tomusdrw / rust-web3

Ethereum JSON-RPC multi-transport client. Rust implementation of web3 library. ENS address: rust-web3.eth
MIT License
1.45k stars 465 forks source link

Error using contract::estimate_gas() on mainnet #637

Open harry-anderson opened 2 years ago

harry-anderson commented 2 years ago

Hi there,

I am trying to estimate the gas of transferring an ERC20 token using the contract method:


        let res = contract
            .estimate_gas(
                "transfer",
                params,
                public_key,
                Options::default(),
            )
            .await;

        println!("{:?}", res);

testing on ropsten via infura

Ok(21596)

testing on mainnet via infura

Err(Api(Rpc(Error { code: ServerError(-32000), message: "invalid opcode: INVALID", data: None })))

only changing the chain between tests. Any ideas what is causing this?

Thanks in advance!