Trait elrond_wasm::api::CallValueApi [−][src]
pub trait CallValueApi: ErrorApi + Sized { type AmountType: BigUintApi + 'static; fn check_not_payable(&self); fn egld_value(&self) -> Self::AmountType; fn esdt_value(&self) -> Self::AmountType; fn token(&self) -> TokenIdentifier; fn esdt_token_nonce(&self) -> u64; fn esdt_token_type(&self) -> EsdtTokenType; fn require_egld(&self) -> Self::AmountType { ... } fn require_esdt(&self, token: &[u8]) -> Self::AmountType { ... } fn payment_token_pair(&self) -> (Self::AmountType, TokenIdentifier) { ... } }
Associated Types
type AmountType: BigUintApi + 'static
[src]
Expand description
The type of the payment arguments.
Not named BigUint
to avoid name collisions in types that implement multiple API traits.
Required methods
fn check_not_payable(&self)
[src]
fn egld_value(&self) -> Self::AmountType
[src]
Expand description
Retrieves the EGLD call value from the VM. Will return 0 in case of an ESDT transfer (cannot have both EGLD and ESDT transfer simultaneously).
fn esdt_value(&self) -> Self::AmountType
[src]
Expand description
Retrieves the ESDT call value from the VM. Will return 0 in case of an EGLD transfer (cannot have both EGLD and ESDT transfer simultaneously).
fn token(&self) -> TokenIdentifier
[src]
Expand description
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 EGLD,
but the EGLD TokenIdentifier is serialized as EGLD
.
fn esdt_token_nonce(&self) -> u64
[src]
Expand description
Returns the nonce of the received ESDT token. Will return 0 in case of EGLD or fungible ESDT transfer.
fn esdt_token_type(&self) -> EsdtTokenType
[src]
Expand description
Returns the ESDT token type. Will return “Fungible” for EGLD.
Provided methods
fn require_egld(&self) -> Self::AmountType
[src]
Expand description
Will return the EGLD call value, but also fail with an error if ESDT is sent. Especially used in the auto-generated call value processing.
fn require_esdt(&self, token: &[u8]) -> Self::AmountType
[src]
Expand description
Will return the ESDT call value, but also fail with an error if EGLD or the wrong ESDT token is sent. Especially used in the auto-generated call value processing.
fn payment_token_pair(&self) -> (Self::AmountType, TokenIdentifier)
[src]
Expand description
Returns both the call value (either EGLD or ESDT) 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.