pub struct Erc20<P: Provider<Ethereum>> { /* private fields */ }Expand description
The ERC20 contract.
Implementations§
Source§impl<P: Provider<Ethereum>> Erc20<P>
impl<P: Provider<Ethereum>> Erc20<P>
pub fn new(address: Address, provider: P) -> Self
pub async fn balance_of(&self, address: Address) -> Result<U256, Error>
pub async fn allowance( &self, owner: Address, spender: Address, ) -> Result<U256, Error>
pub async fn decimals(&self) -> Result<u8, Error>
pub async fn approve( &self, owner: Address, spender: Address, amount: U256, ) -> Result<PendingTransactionBuilder<Ethereum>, Error>
pub async fn transfer( &self, from: Address, to: Address, amount: U256, ) -> Result<PendingTransactionBuilder<Ethereum>, Error>
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for Erc20<P>where
P: Freeze,
impl<P> RefUnwindSafe for Erc20<P>where
P: RefUnwindSafe,
impl<P> Send for Erc20<P>
impl<P> Sync for Erc20<P>
impl<P> Unpin for Erc20<P>where
P: Unpin,
impl<P> UnwindSafe for Erc20<P>where
P: 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> 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>
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