0

I tried to verify my contract that has been deployed on Polygon Amoy. But all it does is verifies another contract on polygon mainnet.

Submitted contract for verification:
        Response: `OK`
        GUID: `minfutd9rrduuhp4qdj5stehw4d9k5vmcpu1tmnn6azjyexifv`
        URL: https://www.oklink.com/address/0x1935aba6ea495a3dd1d84f8dd6cab96ca005e751

It returns this on the terminal which takes me to a different explorer and on the mainnet chain.

This is how my foundry.toml looks like

[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc_version = "0.8.25"
optimizer = true
optimizer_runs = 200
remappings = [
    "@chainlink/contracts/=lib/chainlink-brownie-contracts/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts",
]
fs_permissions = [{ access = "read", path = "./" }]
[etherscan]
polygon-amoy = { key = "${AMOY_API_KEY}", url = "https://api-amoy.polygonscan.com/api" }

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options

This is how my Makefile looks like

-include .env

.PHONY: deploy

deploy :; @forge script script/DeployDTsla.s.sol --private-key ${PRIVATE_KEY} --rpc-url ${POLYGON_RPC_URL} --broadcast 
verify :; @forge verify-contract ${CONTRACT_ADDRESS} src/dTsla.sol:dTsla --chain polygon-amoy

I would appreciate any help

1 Answer 1

1

The API url of Amoy Polygonscan isn't supported by Foundry yet, as it's currently supporting the OKLink explorer one.

So, in your foundry.toml file, you can use this url:

https://www.oklink.com/api/explorer/v1/contract/verify/async/api/polygonAmoy
[etherscan]
polygon-amoy = { key = "${AMOY_API_KEY}", url = "https://www.oklink.com/api/explorer/v1/contract/verify/async/api/polygonAmoy" }

And, you can see your verified contract at:

https://www.oklink.com/amoy/address/${CONTRACT_ADDRESS}/contract

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.