Trait dharitri_wasm::api::CallValueApi
source · 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§
fn check_not_payable(&self)
sourcefn moax_value(&self) -> BigUint<Self>
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).
sourcefn dct_value(&self) -> BigUint<Self>
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).
sourcefn token(&self) -> TokenIdentifier<Self>
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
.
sourcefn dct_token_nonce(&self) -> u64
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.
sourcefn dct_token_type(&self) -> DctTokenType
fn dct_token_type(&self) -> DctTokenType
Returns the DCT token type. Will return “Fungible” for MOAX.
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§
sourcefn require_moax(&self) -> BigUint<Self>
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.
sourcefn require_dct(&self, token: &[u8]) -> BigUint<Self>
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.
sourcefn payment_token_pair(&self) -> (BigUint<Self>, TokenIdentifier<Self>)
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.