Open 0xtempest opened 2 years ago
Contract::from_json()
returns a Result
which doesnt have the method query
as stated by the error.
You are missing a ? or an unwrap
let dai_contract: Contract<Http> = Contract::from_json(
web3.eth(),
dai_address,
include_bytes!("dai.json"),
)?;
I'm running into an issue with trying to query contracts that should already exist on a mainnet-fork version of ganache I'm running.
Using a basic example
`use hex_literal::hex; use web3::{ contract::{Contract, Options}, types::U256, types::H160 };
[tokio::main]
async fn main() -> web3::Result<()> {
method not found in Result<web3::contract::Contract, web3::ethabi::Error>
I'm guessing this is because I didn't actually deploy the dai contract, however, I'm running a version of ganache that is forked from eth mainnet, how would I go about querying the contract without actually having to deploy it locally?
How would I do this just having the contract address and abi