Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Add dedicated etherscan client #485

Open
6 of 12 tasks
mattsse opened this issue Oct 3, 2021 · 1 comment
Open
6 of 12 tasks

Add dedicated etherscan client #485

mattsse opened this issue Oct 3, 2021 · 1 comment

Comments

@mattsse
Copy link
Collaborator

mattsse commented Oct 3, 2021

Tracking issue for complete ethers-etherscan client crate

Endpoints

  • accounts
  • contracts
    • get abi
    • get source
    • verify contract (implemented but requires some investigating to make it work)
  • transactions
  • blocks
  • tokens
  • gas tracker
  • stats

Overview https://docs.etherscan.io/api-endpoints/

Initial WIP foundry-rs/foundry#82 #486

with the Query type, etherscan api requests can be easily created like

let mut map = HashMap::new();
map.insert("address", address);
// this will create the `query` object that gets serialized into the final url like:
// https://api.etherscan.io/api?module=contract&action=getabi&address=0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413&apikey=YourApiKeyToken
let query = self.create_query("contract", "getabi", map);
let resp: Response<String> = self.get_json(&query).await?;

Some endpoints will require quite a bit of parameters, for these cases (>3 params) a config struct with Serialize should be created, (check https://github.com/gakonst/ethers-rs/blob/master/ethers-etherscan/src/lib.rs#L201-L229)

/// Arguments for verifying contracts
#[derive(Debug, Clone, Serialize)]
pub struct EndpointParams {
    pub address: Address,
   // --snip--
}

Other todos

  • replace the current ethers internal usage in abigen
  • utility function to compile a contract retrieved from etherscan locally, or scrape the bytecode from the html website
@gakonst
Copy link
Owner

gakonst commented Oct 17, 2021

Transactions were implemented in #512. @brockelmore if you end up looking at dapp create (foundry-rs/foundry#43) you may want to take a look at the verification issue @mattsse mentions above.

meetmangukiya pushed a commit to meetmangukiya/ethers-rs that referenced this issue Mar 21, 2022
* fix: move cargo forge & cast bins to foundry bin

* docs: update install section

* docs: fix stale comment

* refactor: better way to move cargo bin output
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants