pub struct Introspector {
pub contract_address: Address,
/* private fields */
}
Expand description
The Introspector
struct is used to introspect a contract’s storage and determine which
standards it adheres to.
Fields§
§contract_address: Address
The contract address to introspect.
Implementations§
Source§impl Introspector
impl Introspector
Sourcepub fn try_new(contract_address: Address, rpc_url: impl Into<String>) -> Self
pub fn try_new(contract_address: Address, rpc_url: impl Into<String>) -> Self
Creates a new Introspector
instance with the given contract_address
and provider
.
Sourcepub async fn run(&self) -> Result<IntrospectResult>
pub async fn run(&self) -> Result<IntrospectResult>
Run an introspection on the contract and return the results.
Performs the following calls, returning the base slot for each:
- balanceOf(address)
- allowance(address, address)
- getApproved(address)
- isApprovedForAll(address, address)
- balanceOf(address, uint256)
Sourcepub async fn get_balance_slot(&self) -> Result<U256>
pub async fn get_balance_slot(&self) -> Result<U256>
Get the balance slot of the contract by tracing a call to balanceOf(address)
.
Sourcepub async fn get_allowance_slot(&self) -> Result<U256>
pub async fn get_allowance_slot(&self) -> Result<U256>
Get the allowance slot of the contract by tracing a call to allowance(address, address)
.
Sourcepub async fn get_token_approvals_slot(&self) -> Result<U256>
pub async fn get_token_approvals_slot(&self) -> Result<U256>
Get the token approvals slot of the contract by tracing a call to getApproved(address)
.
Sourcepub async fn get_operator_approvals_slot(&self) -> Result<U256>
pub async fn get_operator_approvals_slot(&self) -> Result<U256>
Get the operator approvals slot of the contract by tracing a call to
isApprovedForAll(address, address)
.
Sourcepub async fn get_erc_1155_balance_slot(&self) -> Result<U256>
pub async fn get_erc_1155_balance_slot(&self) -> Result<U256>
Get the erc1155 balance slot of the contract by tracing a call to balanceOf(address, uint256)
.
Trait Implementations§
Source§impl Clone for Introspector
impl Clone for Introspector
Source§fn clone(&self) -> Introspector
fn clone(&self) -> Introspector
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for Introspector
impl RefUnwindSafe for Introspector
impl Send for Introspector
impl Sync for Introspector
impl Unpin for Introspector
impl UnwindSafe for Introspector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more