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

feat(forge): allow --verifier custom option #9311

Merged
merged 4 commits into from
Nov 14, 2024

Conversation

grandizzy
Copy link
Collaborator

@grandizzy grandizzy commented Nov 13, 2024

Motivation

Closes #9220
Closes #8254
Closes #7466 (no need to pass chain param as it will be retrieved from provider / --rpc-url)
Closes #8100
image

  • allows custom verifiers to be defined as --verifier custom. adds --verifier-api-key for custom verifier keys
Verifier options:
      --verifier <VERIFIER>
          The contract verification provider to use
          
          [default: etherscan]

          Possible values:
          - etherscan
          - sourcify
          - blockscout
          - oklink
          - custom:     Custom verification provider, compatible with Etherscan API

      --verifier-api-key <VERIFIER_API_KEY>
          The verifier API KEY, if using a custom provider
          
          [env: VERIFIER_API_KEY=]

      --verifier-url <VERIFIER_URL>
          The verifier URL, if using a custom provider
          
          [env: VERIFIER_URL=]
  • could be passed as cli arg, e.g.
forge create \
  --rpc-url http://localhost:8545 \
  --private-key 0x12345.... \
  src/Counter.sol:Counter \
  --verify \
  --verifier custom \
  --verifier-url http://localhost:8888/api \
  --verifier-api-key 1234
forge verify-contract \
  0x59b670e9fA9D0A427751Af201D676719a970857b \
  --rpc-url http://localhost:8545 \
  --verifier custom \
  --verifier-url http://localhost:8888/api \
  --verifier-api-key 1234

or defined and implicitly taken from foundry.toml config, e.g.

[etherscan]
anvil-hardhat = { key = "1234", url = "http://localhost:8888/api" }
forge create \
  --rpc-url http://localhost:8545 \
  --private-key 0x12345.... \
  src/Counter.sol:Counter \
  --verify
forge verify-contract \
  0x59b670e9fA9D0A427751Af201D676719a970857b \
  --rpc-url http://localhost:8545
  • better user feedback for retry error handle, print console warning

image

Solution

@grandizzy grandizzy marked this pull request as ready for review November 13, 2024 13:34
@grandizzy
Copy link
Collaborator Author

I think would be nice to have a --verifier-api-key so custom verifiers args won't need the etherscan keyword at all...

pub verifier_url: Option<String>,

@grandizzy grandizzy merged commit 36cbce7 into foundry-rs:master Nov 14, 2024
21 checks passed
@grandizzy grandizzy deleted the issue-9220 branch November 14, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
2 participants