rust-web3 icon indicating copy to clipboard operation
rust-web3 copied to clipboard

Upgrade from `ethabi` to `alloy-json-abi`

Open acemasterjb opened this issue 1 year ago • 0 comments

As per the ethabi repo:

This project is not actively maintained. Consider these alternatives:

  • https://github.com/nlordell/solabi-rs
  • https://github.com/alloy-rs/core

alloy-rs is also now utilized by foundry-compilers.

So if alloy-rs is utilized in rust-web3 as well it could allow for something like:

let all_contracts_compiled: VersionedContracts = self.contract_interfaces;
let dai_abi: &JsonAbi = all_contracts_compiled
    .find_first("ERC20")
    .unwrap()
    .abi
    .unwrap();

let dai_address = Address::from_str("6b175474e89094c44da98b954eedeac495271d0f").unwrap();
let dai_contract = Contract::new(self.client.eth(), dai_address, erc20_abi);

to be easily implemented. Assuming that self.client is a Web3<Transport>.

acemasterjb avatar Nov 18 '23 15:11 acemasterjb