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

Forge verify does not parse etherscan section of foundry.toml #4563

Closed
2 tasks done
debych opened this issue Mar 15, 2023 · 5 comments · Fixed by #4574
Closed
2 tasks done

Forge verify does not parse etherscan section of foundry.toml #4563

debych opened this issue Mar 15, 2023 · 5 comments · Fixed by #4574
Labels
T-bug Type: bug

Comments

@debych
Copy link

debych commented Mar 15, 2023

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (df8ab09 2023-03-14T10:00:26.197329Z)

What command(s) is the bug in?

forge verify-contract

Operating System

macOS (Apple Silicon)

Describe the bug

Calling this command

forge verify-contract --chain polygon <address> <name>

Gives

Error: 
ETHERSCAN_API_KEY must be set

after probably this commit. It doesnt work even this way

forge verify-contract --chain polygon --etherscan-api-key <key> <address> <name>

getting the same error

@debych debych added the T-bug Type: bug label Mar 15, 2023
@gakonst gakonst added this to Foundry Mar 15, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Mar 15, 2023
@mattsse
Copy link
Member

mattsse commented Mar 15, 2023

cc @DaniPopes

@debych can you please post your config file.

@debych
Copy link
Author

debych commented Mar 15, 2023

@mattsse

[profile.default]
test = 'test/solidity'
solc_version = '0.8.17'
optimizer = true
optimizer_runs = 10000
sender = '<sender>'
tx_origin = '<tx_origin>'
out = 'out'
fs_permissions = [
  { access = "read", path = "./config/" },
  { access = "read-write", path = "./test/logs/" },
]
ffi = true
libs = ["node_modules", "lib"]

[rpc_endpoints]
polygon = "${ETH_NODE_URI_POLYGON}"

[etherscan]
polygon = { key = "${POLYGON_ETHERSCAN_API_KEY}", url = "https://api.polygonscan.com/api" }

@DaniPopes
Copy link
Member

Is the POLYGON_ETHERSCAN_API_KEY environment variable set? I just ran this:

forge init test
cd test
forge build

printf '\n[etherscan]\npolygon = { key = "${POLYGON_ETHERSCAN_API_KEY}" }' >> foundry.toml

# error: ... not set
unset POLYGON_ETHERSCAN_API_KEY
forge v $(cast address-zero) Counter --chain polygon

# error (after making the request to etherscan): invalid api key
export POLYGON_ETHERSCAN_API_KEY="abcd"
forge v $(cast address-zero) Counter --chain polygon

@debych
Copy link
Author

debych commented Mar 15, 2023

Yes it is set in the .env file like so

POLYGON_ETHERSCAN_API_KEY=<key>

@mattsse
Copy link
Member

mattsse commented Mar 15, 2023

@debych could you please link the repo or prepare a repro for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants