defuse_core::engine

Trait StateView

Source
pub trait StateView {
    // Required methods
    fn verifying_contract(&self) -> Cow<'_, AccountIdRef>;
    fn wnear_id(&self) -> Cow<'_, AccountIdRef>;
    fn fee(&self) -> Pips;
    fn fee_collector(&self) -> Cow<'_, AccountIdRef>;
    fn has_public_key(
        &self,
        account_id: &AccountIdRef,
        public_key: &PublicKey,
    ) -> bool;
    fn iter_public_keys(
        &self,
        account_id: &AccountIdRef,
    ) -> impl Iterator<Item = PublicKey> + '_;
    fn is_nonce_used(&self, account_id: &AccountIdRef, nonce: Nonce) -> bool;
    fn balance_of(&self, account_id: &AccountIdRef, token_id: &TokenId) -> u128;

    // Provided method
    fn cached(self) -> CachedState<Self>
       where Self: Sized { ... }
}

Required Methods§

Source

fn verifying_contract(&self) -> Cow<'_, AccountIdRef>

Source

fn wnear_id(&self) -> Cow<'_, AccountIdRef>

Source

fn fee(&self) -> Pips

Source

fn fee_collector(&self) -> Cow<'_, AccountIdRef>

Source

fn has_public_key( &self, account_id: &AccountIdRef, public_key: &PublicKey, ) -> bool

Source

fn iter_public_keys( &self, account_id: &AccountIdRef, ) -> impl Iterator<Item = PublicKey> + '_

Source

fn is_nonce_used(&self, account_id: &AccountIdRef, nonce: Nonce) -> bool

Source

fn balance_of(&self, account_id: &AccountIdRef, token_id: &TokenId) -> u128

Provided Methods§

Source

fn cached(self) -> CachedState<Self>
where Self: Sized,

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.

Implementations on Foreign Types§

Source§

impl<T: StateView + ?Sized> StateView for &T

Source§

fn verifying_contract(&self) -> Cow<'_, AccountIdRef>

Source§

fn wnear_id(&self) -> Cow<'_, AccountIdRef>

Source§

fn fee(&self) -> Pips

Source§

fn fee_collector(&self) -> Cow<'_, AccountIdRef>

Source§

fn has_public_key( &self, account_id: &AccountIdRef, public_key: &PublicKey, ) -> bool

Source§

fn iter_public_keys( &self, account_id: &AccountIdRef, ) -> impl Iterator<Item = PublicKey> + '_

Source§

fn is_nonce_used(&self, account_id: &AccountIdRef, nonce: Nonce) -> bool

Source§

fn balance_of(&self, account_id: &AccountIdRef, token_id: &TokenId) -> u128

Source§

impl<T: StateView + ?Sized> StateView for &mut T

Source§

fn verifying_contract(&self) -> Cow<'_, AccountIdRef>

Source§

fn wnear_id(&self) -> Cow<'_, AccountIdRef>

Source§

fn fee(&self) -> Pips

Source§

fn fee_collector(&self) -> Cow<'_, AccountIdRef>

Source§

fn has_public_key( &self, account_id: &AccountIdRef, public_key: &PublicKey, ) -> bool

Source§

fn iter_public_keys( &self, account_id: &AccountIdRef, ) -> impl Iterator<Item = PublicKey> + '_

Source§

fn is_nonce_used(&self, account_id: &AccountIdRef, nonce: Nonce) -> bool

Source§

fn balance_of(&self, account_id: &AccountIdRef, token_id: &TokenId) -> u128

Source§

impl<T: StateView + ?Sized> StateView for Box<T>

Source§

fn verifying_contract(&self) -> Cow<'_, AccountIdRef>

Source§

fn wnear_id(&self) -> Cow<'_, AccountIdRef>

Source§

fn fee(&self) -> Pips

Source§

fn fee_collector(&self) -> Cow<'_, AccountIdRef>

Source§

fn has_public_key( &self, account_id: &AccountIdRef, public_key: &PublicKey, ) -> bool

Source§

fn iter_public_keys( &self, account_id: &AccountIdRef, ) -> impl Iterator<Item = PublicKey> + '_

Source§

fn is_nonce_used(&self, account_id: &AccountIdRef, nonce: Nonce) -> bool

Source§

fn balance_of(&self, account_id: &AccountIdRef, token_id: &TokenId) -> u128

Implementors§

Source§

impl<S> StateView for Deltas<S>
where S: StateView,

Source§

impl<W> StateView for CachedState<W>
where W: StateView,