diff --git a/ethers-providers/src/provider.rs b/ethers-providers/src/provider.rs index b21817ae..7f61388c 100644 --- a/ethers-providers/src/provider.rs +++ b/ethers-providers/src/provider.rs @@ -398,7 +398,27 @@ impl Provider

{ .map_err(Into::into)?) } - // TODO: get_storage_at + /// Get the storage of an address for a particular slot location + pub async fn get_storage_at( + &self, + from: impl Into, + location: H256, + block: Option, + ) -> Result { + let from = match from.into() { + NameOrAddress::Name(ens_name) => self.resolve_name(&ens_name).await?, + NameOrAddress::Address(addr) => addr, + }; + + let from = utils::serialize(&from); + let location = utils::serialize(&location); + let block = utils::serialize(&block.unwrap_or(BlockNumber::Latest)); + Ok(self + .0 + .request("eth_getStorageAt", [from, location, block]) + .await + .map_err(Into::into)?) + } /// Returns the deployed code at a given address pub async fn get_code(