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

--init-config flag in substreams init #375

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Dirt-Nasty
Copy link
Contributor

@Dirt-Nasty Dirt-Nasty commented Jan 15, 2024

substreams init --init-config

I've added an --init-config flag for use in substreams init.

This allows you to use a local config file rather than the command prompts to spin up a substreams projects.

The config should be in the root directory of wherever you're running the substreams init command from.

{
    "project_name" : "testing_local",
    "protocol" : "Ethereum",
    "chain" : "Mainnet",
    "contracts" : [
        {
            "address" : "0xB4Ac9F231D2469769A0a56eee5559Fd4613ed3fB",
            "short_name" : "loans_interface",
            "start_block" : "10600000",
            "abi_path" : "./abis/LoansInterface.json"
        }
    ]
}

The main use case here is to use local abis for non verified contracts rather than relying on the block explorer.

contracts can be an array to support multiple contracts.
start_block is currently not used as the explorer is able to handle to retrieving the start block without contract verification.
abi_path should point to your local abi file.

All fields should be present in the config.

I've tested this on the following scenarios:

  • Single & Multiple substreams init with the init-config flag
  • Single & Multiple substreams init without the init-config flag
  • Proxy Contracts without the init-config flag

Some things to note:

  • Its probably more preferable to use a yaml than json
  • Rather than a bool flag allow a string to the location of the config file
  • This needs better error handling I'm sure
  • Allow dynamic use where some contracts are available on the explorer and some aren't

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

Successfully merging this pull request may close these issues.

1 participant