Handling proxy contracts with implementation abi missing proxy abi
There is a proxy contract (https://etherscan.io/address/0x34460c0eb5074c29a9f6fe13b8e7e23a0d08af01) with implementation (https://etherscan.io/address/0x934ef5836e78d93125317034f5cf855a97b13f43). I'd like to use proxy contract methods in a type-safe way (in this case getTarget and getMaster). I would like to also use implementation methods in the same way. At this point, eth-sdk fetches only implementation abi, so I had to add missing proxy methods on my own.
This could be achieved if noFollowProxies could be defined for every contract separately instead of once for the whole config - I could then define two contracts (one with proxy abi and the other one with implementation abi). The other solution would be to allow abi merging - not sure how this would work precisely though.
What is your take on this?
Two thoughts:
- "global" settings like
noFollowProxiesis not enough. Instead of specifying raw addresses in config, it should be possible to specify small config objects.
Instead of:
export default defineConfig({
contracts: {
mainnet: {
dai: '0x6b175474e89094c44da98b954eedeac495271d0f',
},
},
})
This should be supported as well:
export default defineConfig({
contracts: {
mainnet: {
dai: {
address: '0x6b175474e89094c44da98b954eedeac495271d0f',
proxyHandling: "do-not-follow-proxy"
// this could be a place for many other things like for example providing implementation address manually
},
},
},
})
- noFollowProxies needs to be replaced with a more granular setting. Some ideas:
- follow proxies (default)
- do not follow proxies
- merge proxy with implementation (this is what you need).
Merging proxies should be generally easy because TypeChain and Ethers will use full method signatures if there is a conflict. (but I guess two methods with exactly the same signatures will have to be filtered out...).
There's any update on this? Seems having a more granular setting a reasonable solution