pub struct LazyToken<P, N> {
pub instance: Erc20ContractInstance<P, N>,
/* private fields */
}Expand description
A token with an embedded contract instance that lazily query the blockchain.
Fields§
§instance: Erc20ContractInstance<P, N>The underlying ERC20 contract instance. Exposed publicly to allow
direct access for write operations like transfer, approve, etc.
Implementations§
Source§impl<P, N> LazyToken<P, N>
impl<P, N> LazyToken<P, N>
Sourcepub async fn total_supply(&self) -> Result<Uint<256, 4>, Error>
pub async fn total_supply(&self) -> Result<Uint<256, 4>, Error>
Returns the amount of tokens in existence.
Sourcepub async fn balance_of(&self, account: Address) -> Result<Uint<256, 4>, Error>
pub async fn balance_of(&self, account: Address) -> Result<Uint<256, 4>, Error>
Returns the value of tokens owned by account.
Sourcepub async fn allowance(
&self,
owner: Address,
spender: Address,
) -> Result<Uint<256, 4>, Error>
pub async fn allowance( &self, owner: Address, spender: Address, ) -> Result<Uint<256, 4>, Error>
Returns the remaining number of tokens that spender will be
allowed to spend on behalf of owner.
Sourcepub async fn get_balance(
&self,
amount: Uint<256, 4>,
) -> Result<BigDecimal, Error>
pub async fn get_balance( &self, amount: Uint<256, 4>, ) -> Result<BigDecimal, Error>
Gets the token balance as a BigDecimal
Trait Implementations§
Auto Trait Implementations§
impl<P, N> !Freeze for LazyToken<P, N>
impl<P, N> RefUnwindSafe for LazyToken<P, N>where
P: RefUnwindSafe,
N: RefUnwindSafe,
impl<P, N> Send for LazyToken<P, N>
impl<P, N> Sync for LazyToken<P, N>
impl<P, N> Unpin for LazyToken<P, N>
impl<P, N> UnwindSafe for LazyToken<P, N>where
P: UnwindSafe,
N: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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