pub trait CallValueApi<BigUint>: ErrorApi + Sized
where BigUint: BigUintApi + 'static,
{ // Required methods fn check_not_payable(&self); fn moax_value(&self) -> BigUint; fn dct_value(&self) -> BigUint; fn token(&self) -> TokenIdentifier; fn dct_token_nonce(&self) -> u64; fn dct_token_type(&self) -> DctTokenType; // Provided methods fn require_moax(&self) -> BigUint { ... } fn require_dct(&self, token: &[u8]) -> BigUint { ... } fn payment_token_pair(&self) -> (BigUint, TokenIdentifier) { ... } }

Required Methods§

source

fn check_not_payable(&self)

source

fn moax_value(&self) -> BigUint

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

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

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.

Provided Methods§

source

fn require_moax(&self) -> BigUint

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

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, TokenIdentifier)

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.

Object Safety§

This trait is not object safe.

Implementors§