pub trait CallValueApi:
ManagedTypeApi
+ ErrorApi
+ Sized {
Show 15 methods
// Required methods
fn check_not_payable(&self);
fn rewa_value(&self) -> BigUint<Self>;
fn dcdt_value(&self) -> BigUint<Self>;
fn token(&self) -> TokenIdentifier<Self>;
fn dcdt_token_nonce(&self) -> u64;
fn dcdt_token_type(&self) -> DcdtTokenType;
fn dcdt_num_transfers(&self) -> usize;
fn dcdt_value_by_index(&self, index: usize) -> BigUint<Self>;
fn token_by_index(&self, index: usize) -> TokenIdentifier<Self>;
fn dcdt_token_nonce_by_index(&self, index: usize) -> u64;
fn dcdt_token_type_by_index(&self, index: usize) -> DcdtTokenType;
// Provided methods
fn require_rewa(&self) -> BigUint<Self> { ... }
fn require_dcdt(&self, token: &[u8]) -> BigUint<Self> { ... }
fn payment_token_pair(&self) -> (BigUint<Self>, TokenIdentifier<Self>) { ... }
fn get_all_dcdt_transfers(&self) -> ManagedVec<Self, DcdtTokenPayment<Self>> { ... }
}Required Methods§
fn check_not_payable(&self)
Sourcefn rewa_value(&self) -> BigUint<Self>
fn rewa_value(&self) -> BigUint<Self>
Retrieves the REWA call value from the VM. Will return 0 in case of an DCDT transfer (cannot have both REWA and DCDT transfer simultaneously).
Sourcefn dcdt_value(&self) -> BigUint<Self>
fn dcdt_value(&self) -> BigUint<Self>
Retrieves the DCDT call value from the VM. Will return 0 in case of an REWA transfer (cannot have both REWA and DCDT 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 REWA,
but the REWA TokenIdentifier is serialized as REWA.
Sourcefn dcdt_token_nonce(&self) -> u64
fn dcdt_token_nonce(&self) -> u64
Returns the nonce of the received DCDT token. Will return 0 in case of REWA or fungible DCDT transfer.
Sourcefn dcdt_token_type(&self) -> DcdtTokenType
fn dcdt_token_type(&self) -> DcdtTokenType
Returns the DCDT token type. Will return “Fungible” for REWA.
fn dcdt_num_transfers(&self) -> usize
fn dcdt_value_by_index(&self, index: usize) -> BigUint<Self>
fn token_by_index(&self, index: usize) -> TokenIdentifier<Self>
fn dcdt_token_nonce_by_index(&self, index: usize) -> u64
fn dcdt_token_type_by_index(&self, index: usize) -> DcdtTokenType
Provided Methods§
Sourcefn require_rewa(&self) -> BigUint<Self>
fn require_rewa(&self) -> BigUint<Self>
Will return the REWA call value, but also fail with an error if DCDT is sent. Especially used in the auto-generated call value processing.
Sourcefn require_dcdt(&self, token: &[u8]) -> BigUint<Self>
fn require_dcdt(&self, token: &[u8]) -> BigUint<Self>
Will return the DCDT call value, but also fail with an error if REWA or the wrong DCDT 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 REWA or DCDT) and the token identifier. Especially used in the `#[payable(“*”)] auto-generated snippets. The method might seem redundant, but there is such a hook in Andes that might be used in this scenario in the future.
fn get_all_dcdt_transfers(&self) -> ManagedVec<Self, DcdtTokenPayment<Self>>
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.