foundry
foundry copied to clipboard
Add support for OKLink verification
Component
Other (please describe)
Describe the feature you would like
Polygon endorses polygonscan.com for their mainnet and https://www.oklink.com/amoy for their Amoy testnet as the block explorers. It would be great if they were supported by cast verify-contract and other tools like cast src.
There are so many block explorers, do they share the APIs? If yes then maybe generic support could be added where foundry commands would accept the URL of the explorer? It would be great because nowadays there are dozens of L2s and alt chains, and each of them has at least 1 scanner plus a scanner for their testnet.
Additional context
No response
Polygon is already supported, OKLink is not yet supported, see https://github.com/foundry-rs/foundry/pull/7586
@CodeSandwich You can already use OKLink for Amoy testnet by passing --verifier-url 'https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/AMOY_TESTNET'
Ohh, thank you and sorry for the noise, I somehow missed the --verifier-url parameter!
For my own reference the default etherscan-like explorers' URLs are here: https://github.com/alloy-rs/chains/blob/351451bd14386ddfd6b43c6fff72fcf5820a0aef/src/named.rs#L767. Now it contains all Polygon flavors, including Amoy with OKLink. It's fairly difficult information to find, it could be useful to have it somehow documented in Foundry itself, but I'm not sure how. Maybe a new cast command that would list all the known chains, their names, IDs and default explorers? I think that it may be also helpful for the users to document that setting --verifier etherscan only selects the verifier API flavor, which does affect the default URL, but does not necessarily set it to etherscan.io.
I'm fine with closing this issue, but I see that it's linked to the PR now, so I'll close it manually only in case the PR is rejected as unneeded.