pub trait CallValueApi: ManagedTypeApi + ErrorApi + Sized {
Show 15 methods // Required methods fn check_not_payable(&self); fn moax_value(&self) -> BigUint<Self>; fn dct_value(&self) -> BigUint<Self>; fn token(&self) -> TokenIdentifier<Self>; fn dct_token_nonce(&self) -> u64; fn dct_token_type(&self) -> DctTokenType; fn dct_num_transfers(&self) -> usize; fn dct_value_by_index(&self, index: usize) -> BigUint<Self>; fn token_by_index(&self, index: usize) -> TokenIdentifier<Self>; fn dct_token_nonce_by_index(&self, index: usize) -> u64; fn dct_token_type_by_index(&self, index: usize) -> DctTokenType; // Provided methods fn require_moax(&self) -> BigUint<Self> { ... } fn require_dct(&self, token: &[u8]) -> BigUint<Self> { ... } fn payment_token_pair(&self) -> (BigUint<Self>, TokenIdentifier<Self>) { ... } fn get_all_dct_transfers(&self) -> ManagedVec<Self, DctTokenPayment<Self>> { ... }
}

Required Methods§

source

fn check_not_payable(&self)

source

fn moax_value(&self) -> BigUint<Self>

Retrieves the MOAX call value from the VM. Will return 0 in case of an DCT transfer (cannot have both MOAX and DCT transfer simultaneously).

source

fn dct_value(&self) -> BigUint<Self>

Retrieves the DCT call value from the VM. Will return 0 in case of an MOAX transfer (cannot have both MOAX and DCT transfer simultaneously).

source

fn token(&self) -> TokenIdentifier<Self>

Returns the call value token identifier of the current call. The identifier is wrapped in a TokenIdentifier object, to hide underlying logic.

A note on implementation: even though the underlying api returns an empty name for MOAX, but the MOAX TokenIdentifier is serialized as MOAX.

source

fn dct_token_nonce(&self) -> u64

Returns the nonce of the received DCT token. Will return 0 in case of MOAX or fungible DCT transfer.

source

fn dct_token_type(&self) -> DctTokenType

Returns the DCT token type. Will return “Fungible” for MOAX.

source

fn dct_num_transfers(&self) -> usize

source

fn dct_value_by_index(&self, index: usize) -> BigUint<Self>

source

fn token_by_index(&self, index: usize) -> TokenIdentifier<Self>

source

fn dct_token_nonce_by_index(&self, index: usize) -> u64

source

fn dct_token_type_by_index(&self, index: usize) -> DctTokenType

Provided Methods§

source

fn require_moax(&self) -> BigUint<Self>

Will return the MOAX call value, but also fail with an error if DCT is sent. Especially used in the auto-generated call value processing.

source

fn require_dct(&self, token: &[u8]) -> BigUint<Self>

Will return the DCT call value, but also fail with an error if MOAX or the wrong DCT token is sent. Especially used in the auto-generated call value processing.

source

fn payment_token_pair(&self) -> (BigUint<Self>, TokenIdentifier<Self>)

Returns both the call value (either MOAX or DCT) and the token identifier. Especially used in the `#[payable(“*”)] auto-generated snippets. The method might seem redundant, but there is such a hook in Arwen that might be used in this scenario in the future.

source

fn get_all_dct_transfers(&self) -> ManagedVec<Self, DctTokenPayment<Self>>

Object Safety§

This trait is not object safe.

Implementors§