pub trait TempoStateAccess<M = ()> {
type Error: Display;
// Required methods
fn basic(&mut self, address: Address) -> Result<AccountInfo, Self::Error>;
fn sload(
&mut self,
address: Address,
key: Uint<256, 4>,
) -> Result<Uint<256, 4>, Self::Error>;
// Provided methods
fn with_read_only_storage_ctx<R>(
&mut self,
spec: TempoHardfork,
f: impl FnOnce() -> R,
) -> R
where Self: Sized { ... }
fn get_fee_token(
&mut self,
tx: impl TempoTx,
fee_payer: Address,
spec: TempoHardfork,
) -> Result<Address, TempoPrecompileError>
where Self: Sized { ... }
fn is_tip20_usd(
&mut self,
spec: TempoHardfork,
fee_token: Address,
) -> Result<bool, TempoPrecompileError>
where Self: Sized { ... }
fn is_valid_fee_token(
&mut self,
spec: TempoHardfork,
fee_token: Address,
) -> Result<bool, TempoPrecompileError>
where Self: Sized { ... }
fn is_fee_token_paused(
&mut self,
spec: TempoHardfork,
fee_token: Address,
) -> Result<bool, TempoPrecompileError>
where Self: Sized { ... }
fn can_fee_payer_transfer(
&mut self,
fee_token: Address,
fee_payer: Address,
spec: TempoHardfork,
) -> Result<bool, TempoPrecompileError>
where Self: Sized { ... }
fn get_token_balance(
&mut self,
token: Address,
account: Address,
spec: TempoHardfork,
) -> Result<Uint<256, 4>, TempoPrecompileError>
where Self: Sized { ... }
}Expand description
Helper trait to perform Tempo-specific operations on top of different state providers.
We provide blanket implementations for revm database, journal and reth state provider.
The generic marker is used as a workaround to avoid conflicting implementations.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn with_read_only_storage_ctx<R>(
&mut self,
spec: TempoHardfork,
f: impl FnOnce() -> R,
) -> Rwhere
Self: Sized,
fn with_read_only_storage_ctx<R>(
&mut self,
spec: TempoHardfork,
f: impl FnOnce() -> R,
) -> Rwhere
Self: Sized,
Returns a read-only storage provider for the given spec.
Sourcefn get_fee_token(
&mut self,
tx: impl TempoTx,
fee_payer: Address,
spec: TempoHardfork,
) -> Result<Address, TempoPrecompileError>where
Self: Sized,
fn get_fee_token(
&mut self,
tx: impl TempoTx,
fee_payer: Address,
spec: TempoHardfork,
) -> Result<Address, TempoPrecompileError>where
Self: Sized,
Resolves user-level or transaction-level fee token preference.
Sourcefn is_tip20_usd(
&mut self,
spec: TempoHardfork,
fee_token: Address,
) -> Result<bool, TempoPrecompileError>where
Self: Sized,
fn is_tip20_usd(
&mut self,
spec: TempoHardfork,
fee_token: Address,
) -> Result<bool, TempoPrecompileError>where
Self: Sized,
Checks if the given TIP20 token has USD currency.
IMPORTANT: Caller must ensure fee_token has a valid TIP20 prefix.
Sourcefn is_valid_fee_token(
&mut self,
spec: TempoHardfork,
fee_token: Address,
) -> Result<bool, TempoPrecompileError>where
Self: Sized,
fn is_valid_fee_token(
&mut self,
spec: TempoHardfork,
fee_token: Address,
) -> Result<bool, TempoPrecompileError>where
Self: Sized,
Checks if the given token can be used as a fee token.
Sourcefn is_fee_token_paused(
&mut self,
spec: TempoHardfork,
fee_token: Address,
) -> Result<bool, TempoPrecompileError>where
Self: Sized,
fn is_fee_token_paused(
&mut self,
spec: TempoHardfork,
fee_token: Address,
) -> Result<bool, TempoPrecompileError>where
Self: Sized,
Checks if a fee token is paused.
Sourcefn can_fee_payer_transfer(
&mut self,
fee_token: Address,
fee_payer: Address,
spec: TempoHardfork,
) -> Result<bool, TempoPrecompileError>where
Self: Sized,
fn can_fee_payer_transfer(
&mut self,
fee_token: Address,
fee_payer: Address,
spec: TempoHardfork,
) -> Result<bool, TempoPrecompileError>where
Self: Sized,
Checks if the fee payer can transfer the fee token to the fee manager.
Sourcefn get_token_balance(
&mut self,
token: Address,
account: Address,
spec: TempoHardfork,
) -> Result<Uint<256, 4>, TempoPrecompileError>where
Self: Sized,
fn get_token_balance(
&mut self,
token: Address,
account: Address,
spec: TempoHardfork,
) -> Result<Uint<256, 4>, TempoPrecompileError>where
Self: Sized,
Returns the balance of the given token for the given account.
IMPORTANT: the caller must ensure token is a valid TIP20Token address.