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

How to read a public variable of a contract?

Open hzqd opened this issue 3 years ago • 1 comments

I code:

web3::contract::Contract::from_json(...).call(...).await?;

The problem is the call method returns a H256, how should I read the data of contract variables and functions execution results?

hzqd avatar Feb 23 '22 09:02 hzqd

You don't need to use call but query instead:

https://github.com/AmbireTech/adex-validator-stack-rust/blob/f4fb43b3c6c8765be7a7c68345379b72ad8cea01/adapter/src/ethereum/client.rs#L253-L265

elpiel avatar Aug 10 '22 12:08 elpiel