Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling proxy contracts with implementation abi missing proxy abi #109

Open
sin6pi7 opened this issue Jul 5, 2022 · 2 comments
Open

Handling proxy contracts with implementation abi missing proxy abi #109

sin6pi7 opened this issue Jul 5, 2022 · 2 comments

Comments

@sin6pi7
Copy link

sin6pi7 commented Jul 5, 2022

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?

@krzkaczor
Copy link
Member

Two thoughts:

  1. "global" settings like noFollowProxies is 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
      },
    },
  },
})
  1. 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...).

@milonite
Copy link

There's any update on this?
Seems having a more granular setting a reasonable solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants