-
Notifications
You must be signed in to change notification settings - Fork 215
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
Add support for Sourcify contract information lookup #1899
Add support for Sourcify contract information lookup #1899
Conversation
🦋 Changeset detectedLatest commit: dfd7bde The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
6464dbd
to
e9206b6
Compare
- Contract name, ABI and creation transaction hash (start block) from [Sourcify API](https://docs.sourcify.dev/docs/api/). - Runs before the registry lookup and replaces default values (not interactive) if not provided by the user. This means priority for CLI parameters looks like: user submitted (env/CLI args) > Sourcify API > Default values > Registry fetch
e9206b6
to
c5c9010
Compare
5d4312f
to
19cbd8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Can we add a couple of test cases to https://github.com/graphprotocol/graph-tooling/blob/main/packages/cli/src/command-helpers/contracts.test.ts
Also, any idea why it can't find source code on Sourcify for this contract on mainnet: 0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB
. It exists on Etherscan. I thought it's supposed to import it from etherscan?
25fd23e
to
7aa683f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
added some retry logic to etherscan tests to handle rate-limited endpoints
Etherscan requires an API key for ABI lookup and other operations.
Sourcify (https://sourcify.dev/) is an open-source decentralized alternative.
Features
This means priority for CLI parameters looks like:
user submitted (env/CLI args) > Sourcify API > Default values > Registry fetch
Closes #1001.
Details
The
getFromSourcify
method returns all the information related to contracts that are normally fetch from registry URLs:It internally makes the RPC call for the
startBlock
using the creation transaction hash.