Automatically follow proxies
krzkaczor opened this issue · 0 comments
krzkaczor commented
eth-sdk
should detect that it's reading ABI of a proxy and should query implementation ABI. Finally, both should be merged. Example contract: 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B
.
Steps:
- After receiving ABI for a given address we should inspect it and detect is it a proxy. I think good enough heuristics include:
a) check forimplementation
or_implementation
getters
b) reading particular storage slotStorage slot 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc (obtained as bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)).
More info: https://docs.openzeppelin.com/upgrades-plugins/1.x/proxies and https://eips.ethereum.org/EIPS/eip-1967 - If proxy was detected,
eth-sdk
should query implementation for ABI and then either merge both ABIs or just use implementation proxy. (I think it might be better just to use implementation).
To implement this properly we need to have web3 node connection setup in eth-sdk. I think it's fine for now just to hardcode dummy infura key and allow user to input custom one in config (similarly to etherscan key).