graphprotocol / graph-tooling

Monorepo for various tools used by subgraph developers.
https://thegraph.com/docs
Apache License 2.0
386 stars 208 forks source link

[Feature] Support for Proxy Contracts #1739

Open schmidsi opened 1 week ago

schmidsi commented 1 week ago

Currently, when running graph init and trying to scaffold a subgraph indexing a proxy contract, the CLI is not aware of the implementation contract. This is a big caveat for new devs since often, the first contract they want to index is indeed a proxy.

I think this is solvable at the CLI level: Detect if a contract is a proxy contract and if so, present an option to look at the current implementation contract and get the ABI from it to scaffold out the subgraph entities.

Read more about the Proxy Upgrade Pattern

schmidsi commented 1 week ago
graph init
✔ Protocol · ethereum
✔ Product for which to initialize · subgraph-studio
✔ Subgraph slug · test-graph-arb
✔ Directory to create the subgraph in · test-graph-arb
✔ Ethereum network · arbitrum-one
✔ Contract address · 0xec9A7fb6CbC2E41926127929c2dcE6e9c5D33Bec
✔ Fetching ABI from Etherscan
✔ Fetching Start Block
✔ Proxy contract detected. Do you want to load information from implementation at: 
      0x9B81c7C5A21E65b849FD487540B0A82d3b97b2c7?  · true
✔ Start Block · 173715445

---