foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.34k stars 1.77k forks source link

feat: support blockscout in `cast etherscan-source` #4776

Open sakulstra opened 1 year ago

sakulstra commented 1 year ago

Component

Cast

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

What version of Foundry are you on?

forge 0.2.0 (f7a535d 2023-04-03T00:04:12.007857053Z)

What command(s) is the bug in?

cast etherscan-source

Operating System

Linux

Describe the bug

As i understand https://github.com/gakonst/ethers-rs/blob/master/ethers-etherscan/src/contract.rs#L378 does a simple get call to a "etherscan like api".

Blockscout seems to follow that exact api: image

So i think the command should probably be agnostic e.g. cast source and support a --api-url parameter or source the api from toml (not sure how reasonable this is as technically it's not etherscan?

[etherscan]
metis = { key="any", chainId=1088, url='https://andromeda-explorer.metis.io/api/' }
zerosnacks commented 3 weeks ago

For future reference: cast etherscan-source should be generalized to cast source and support alternative block explorers