Function ethers_providers::spoof::storage
source · pub fn storage(adr: H160, key: H256, val: H256) -> State
Expand description
Returns a state override set with a single element setting the storage at the given address and key.
§Examples
ⓘ
let geth = Geth::new().spawn();
let provider = Provider::<Http>::try_from(geth.endpoint()).unwrap();
let adr: Address = "0x6fC21092DA55B392b045eD78F4732bff3C580e2c".parse()?;
let key = H256::from_low_u64_be(1);
let val = H256::from_low_u64_be(17);
let tx = TransactionRequest::default().to(adr).into();
// override the storage slot `key` at `adr`
let state = spoof::storage(adr, key, val);
provider.call_raw(&tx).state(&state).await?;