Erc20ProviderExt

Trait Erc20ProviderExt 

Source
pub trait Erc20ProviderExt<N>: Sized + Provider<N>
where N: Network,
{ // Provided methods fn retrieve_token<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<Token, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn get_token<'a, 'async_trait, Id, S>( &'a self, id: Id, store: &'a mut S, ) -> Pin<Box<dyn Future<Output = Result<&'a Token, Error>> + Send + 'async_trait>> where 'a: 'async_trait, S: TokenStore<'a> + Send + 'async_trait, Id: Into<TokenId> + Send + 'async_trait, Self: Sync + 'async_trait { ... } fn balance_of<'life0, 'async_trait>( &'life0 self, token: Address, address: Address, ) -> Pin<Box<dyn Future<Output = Result<BigDecimal, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } }
Expand description

Extends Alloy Provider trait with ERC-20 related features.

Provided Methods§

Source

fn retrieve_token<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<Token, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Retrieves a token by querying its ERC-20 contract.

Source

fn get_token<'a, 'async_trait, Id, S>( &'a self, id: Id, store: &'a mut S, ) -> Pin<Box<dyn Future<Output = Result<&'a Token, Error>> + Send + 'async_trait>>
where 'a: 'async_trait, S: TokenStore<'a> + Send + 'async_trait, Id: Into<TokenId> + Send + 'async_trait, Self: Sync + 'async_trait,

Returns a token from the given store if present, otherwise retrieves it from its ERC-20 contract and update the store.

Source

fn balance_of<'life0, 'async_trait>( &'life0 self, token: Address, address: Address, ) -> Pin<Box<dyn Future<Output = Result<BigDecimal, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Retrieves the given address balance from the given token contract.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<P, N> Erc20ProviderExt<N> for P
where P: Provider<N>, N: Network,