Struct elrond_wasm_node::ArwenApiImpl[][src]

pub struct ArwenApiImpl {}
Expand description

The reference to the API implementation based on Arwen hooks. It continas no data, can be embedded at no cost. Cloning it is a no-op.

Trait Implementations

impl BlockchainApi for ArwenApiImpl[src]

type BalanceType = ArwenBigUint

The type of the token balances. Not named BigUint to avoid name collisions in types that implement multiple API traits. Read more

fn get_sc_address(&self) -> Address[src]

fn get_owner_address(&self) -> Address[src]

fn get_shard_of_address(&self, address: &Address) -> u32[src]

fn is_smart_contract(&self, address: &Address) -> bool[src]

fn get_caller(&self) -> Address[src]

fn get_balance(&self, address: &Address) -> ArwenBigUint[src]

fn get_tx_hash(&self) -> H256[src]

fn get_gas_left(&self) -> u64[src]

fn get_block_timestamp(&self) -> u64[src]

fn get_block_nonce(&self) -> u64[src]

fn get_block_round(&self) -> u64[src]

fn get_block_epoch(&self) -> u64[src]

fn get_block_random_seed(&self) -> Box<[u8; 48]>

Notable traits for Box<F, A>

impl<F, A> Future for Box<F, A> where
    F: Future + Unpin + ?Sized,
    A: Allocator + 'static, 
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    I: Iterator + ?Sized,
    A: Allocator
type Item = <I as Iterator>::Item;
[src]

fn get_prev_block_timestamp(&self) -> u64[src]

fn get_prev_block_nonce(&self) -> u64[src]

fn get_prev_block_round(&self) -> u64[src]

fn get_prev_block_epoch(&self) -> u64[src]

fn get_prev_block_random_seed(&self) -> Box<[u8; 48]>

Notable traits for Box<F, A>

impl<F, A> Future for Box<F, A> where
    F: Future + Unpin + ?Sized,
    A: Allocator + 'static, 
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    I: Iterator + ?Sized,
    A: Allocator
type Item = <I as Iterator>::Item;
[src]

fn get_current_esdt_nft_nonce(&self, address: &Address, token: &[u8]) -> u64[src]

fn get_esdt_balance(
    &self,
    address: &Address,
    token: &[u8],
    nonce: u64
) -> ArwenBigUint
[src]

fn get_esdt_token_data(
    &self,
    address: &Address,
    token: &[u8],
    nonce: u64
) -> EsdtTokenData<ArwenBigUint>
[src]

fn get_sc_balance(&self) -> Self::BalanceType[src]

fn get_cumulated_validator_rewards(&self) -> Self::BalanceType[src]

Retrieves validator rewards, as set by the protocol. TODO: move to the storage API, once BigUint gets refactored Read more

fn get_esdt_local_roles(&self, token_id: &[u8]) -> Vec<EsdtLocalRole, Global>[src]

Retrieves local roles for the token, by reading protected storage.

impl CallValueApi for ArwenApiImpl[src]

type AmountType = ArwenBigUint

The type of the payment arguments. Not named BigUint to avoid name collisions in types that implement multiple API traits. Read more

fn check_not_payable(&self)[src]

fn egld_value(&self) -> ArwenBigUint[src]

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). Read more

fn esdt_value(&self) -> ArwenBigUint[src]

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). Read more

fn token(&self) -> TokenIdentifier[src]

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

fn esdt_token_nonce(&self) -> u64[src]

Returns the nonce of the received ESDT token. Will return 0 in case of EGLD or fungible ESDT transfer. Read more

fn esdt_token_type(&self) -> EsdtTokenType[src]

Returns the ESDT token type. Will return “Fungible” for EGLD. Read more

fn require_egld(&self) -> Self::AmountType[src]

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. Read more

fn require_esdt(&self, token: &[u8]) -> Self::AmountType[src]

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. Read more

fn payment_token_pair(&self) -> (Self::AmountType, TokenIdentifier)[src]

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. Read more

impl Clone for ArwenApiImpl[src]

Should be no-op. The API implementation is zero-sized.

fn clone(&self) -> Self[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl ContractBase for ArwenApiImpl[src]

type BigUint = ArwenBigUint

type BigInt = ArwenBigInt

type Storage = Self

Abstracts the lower-level storage functionality.

type CallValue = Self

Abstracts the call value handling at the beginning of a function call.

type SendApi = Self

Abstracts the sending of EGLD & ESDT transactions, as well as async calls.

type BlockchainApi = Self

type CryptoApi = Self

type LogApi = Self

type ErrorApi = Self

fn get_storage_raw(&self) -> Self::Storage[src]

Gateway into the lower-level storage functionality. Storage related annotations make use of this. Using it directly is not recommended. Read more

fn call_value(&self) -> Self::CallValue[src]

Gateway into the call value retrieval functionality. The payment annotations should normally be the ones to handle this, but the developer is also given direct access to the API. Read more

fn send(&self) -> Self::SendApi[src]

Gateway to the functionality related to sending transactions from the current contract.

fn blockchain(&self) -> Self::BlockchainApi[src]

Gateway blockchain info related to the current transaction and to accounts.

fn crypto(&self) -> Self::CryptoApi[src]

Stateless crypto functions provided by the Arwen VM.

fn log_api_raw(&self) -> Self::LogApi[src]

Gateway into the lower-level event log functionality. Gets called in auto-generated Using it directly is not recommended. TODO: consider moving to ContractPrivateApi. Read more

fn error_api(&self) -> Self::ErrorApi[src]

Currently for some auto-generated code involving callbacks. Please avoid using it directly. TODO: find a way to hide this API. Read more

fn proxy<P>(&self, address: Address) -> P where
    P: ProxyObjApi<SendApi = Self::SendApi>, 
[src]

impl CryptoApi for ArwenApiImpl[src]

fn sha256(&self, data: &[u8]) -> H256[src]

fn keccak256(&self, data: &[u8]) -> H256[src]

fn verify_bls(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool[src]

fn verify_ed25519(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool[src]

fn verify_secp256k1(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool[src]

Note: the signature is minimum 2 bytes in length, the second byte encodes the length of the remaining signature bytes. Read more

impl EndpointArgumentApi for ArwenApiImpl[src]

Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.

fn get_num_arguments(&self) -> i32[src]

fn get_argument_len(&self, arg_index: i32) -> usize[src]

fn copy_argument_to_slice(&self, arg_index: i32, slice: &mut [u8])[src]

fn get_argument_vec_u8(&self, arg_index: i32) -> Vec<u8>[src]

fn get_argument_boxed_bytes(&self, arg_index: i32) -> BoxedBytes[src]

fn get_argument_big_uint_raw(&self, arg_id: i32) -> i32[src]

fn get_argument_big_int_raw(&self, arg_id: i32) -> i32[src]

fn get_argument_u64(&self, arg_id: i32) -> u64[src]

fn get_argument_i64(&self, arg_id: i32) -> i64[src]

fn check_num_arguments(&self, expected: i32)[src]

impl EndpointFinishApi for ArwenApiImpl[src]

Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.

fn finish_slice_u8(&self, slice: &[u8])[src]

fn finish_big_int_raw(&self, handle: i32)[src]

fn finish_big_uint_raw(&self, handle: i32)[src]

fn finish_u64(&self, value: u64)[src]

fn finish_i64(&self, value: i64)[src]

impl ErrorApi for ArwenApiImpl[src]

fn signal_error(&self, message: &[u8]) -> ![src]

impl LogApi for ArwenApiImpl[src]

Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.

fn write_event_log(&self, topics_buffer: &ArgBuffer, data: &[u8])[src]

Saves an event log.

fn write_legacy_log(&self, topics: &[[u8; 32]], data: &[u8])[src]

The legacy Arwen hook for saving event logs. It does the same, but only accepts 32-byte topics. Only kept for backwards compatibility. Read more

impl SendApi for ArwenApiImpl[src]

type AmountType = ArwenBigUint

The type of the payment arguments. Not named BigUint to avoid name collisions in types that implement multiple API traits. Read more

type ProxyBigInt = ArwenBigInt

Not used by SendApi, but forwarded to the proxy traits.

type ProxyStorage = Self

Not used by SendApi, but forwarded to the proxy traits.

fn get_sc_address(&self) -> Address[src]

Required for ESDTNFTTransfer. Same as the implementation from BlockchainApi. Read more

fn direct_egld(&self, to: &Address, amount: &ArwenBigUint, data: &[u8])[src]

Sends EGLD to a given address, directly. Used especially for sending EGLD to regular accounts. Read more

fn direct_egld_execute(
    &self,
    to: &Address,
    amount: &ArwenBigUint,
    gas_limit: u64,
    function: &[u8],
    arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]

Sends EGLD to an address (optionally) and executes like an async call, but without callback.

fn direct_esdt_execute(
    &self,
    to: &Address,
    token: &[u8],
    amount: &ArwenBigUint,
    gas_limit: u64,
    function: &[u8],
    arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]

Sends ESDT to an address and executes like an async call, but without callback.

fn direct_esdt_nft_execute(
    &self,
    to: &Address,
    token: &[u8],
    nonce: u64,
    amount: &ArwenBigUint,
    gas_limit: u64,
    function: &[u8],
    arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]

Sends ESDT NFT to an address and executes like an async call, but without callback.

fn async_call_raw(&self, to: &Address, amount: &ArwenBigUint, data: &[u8]) -> ![src]

Sends an asynchronous call to another contract. Calling this method immediately terminates tx execution. Using it directly is generally discouraged. Read more

fn deploy_contract(
    &self,
    gas: u64,
    amount: &ArwenBigUint,
    code: &BoxedBytes,
    code_metadata: CodeMetadata,
    arg_buffer: &ArgBuffer
) -> Address
[src]

Deploys a new contract in the same shard. Unlike async_call_raw, the deployment is synchronous and tx execution continues afterwards. Also unlike async_call_raw, it uses an argument buffer to pass arguments Read more

fn execute_on_dest_context_raw(
    &self,
    gas: u64,
    address: &Address,
    amount: &ArwenBigUint,
    function: &[u8],
    arg_buffer: &ArgBuffer
) -> Vec<BoxedBytes>
[src]

Same shard, in-line execution of another contract.

fn execute_on_dest_context_raw_custom_result_range<F>(
    &self,
    gas: u64,
    address: &Address,
    amount: &ArwenBigUint,
    function: &[u8],
    arg_buffer: &ArgBuffer,
    range_closure: F
) -> Vec<BoxedBytes> where
    F: FnOnce(usize, usize) -> (usize, usize), 
[src]

Same shard, in-line execution of another contract. Allows the contract to specify which result range to extract as sync call result. This is a workaround to handle nested sync calls. Please do not use this method unless there is absolutely no other option. Will be eliminated after some future Arwen hook redesign. range_closure takes the number of results before, the number of results after, and is expected to return the start index (inclusive) and end index (exclusive). Read more

fn execute_on_dest_context_by_caller_raw(
    &self,
    gas: u64,
    address: &Address,
    amount: &ArwenBigUint,
    function: &[u8],
    arg_buffer: &ArgBuffer
) -> Vec<BoxedBytes>
[src]

fn execute_on_same_context_raw(
    &self,
    gas: u64,
    address: &Address,
    amount: &ArwenBigUint,
    function: &[u8],
    arg_buffer: &ArgBuffer
)
[src]

fn storage_store_tx_hash_key(&self, data: &[u8])[src]

Used to store data between async call and callback.

fn storage_load_tx_hash_key(&self) -> BoxedBytes[src]

Used to store data between async call and callback.

fn call_local_esdt_built_in_function(
    &self,
    gas: u64,
    function: &[u8],
    arg_buffer: &ArgBuffer
)
[src]

Allows synchronously calling a local function by name. Execution is resumed afterwards. You should never have to call this function directly. Use the other specific methods instead. Read more

fn direct_esdt_via_transf_exec(
    &self,
    to: &Address,
    token: &[u8],
    amount: &Self::AmountType,
    data: &[u8]
) -> Result<(), &'static [u8]>
[src]

Sends an ESDT token to a given address, directly. Used especially for sending ESDT to regular accounts. Read more

fn direct(
    &self,
    to: &Address,
    token: &TokenIdentifier,
    amount: &Self::AmountType,
    data: &[u8]
)
[src]

Sends either EGLD or an ESDT token to the target address, depending on what token identifier was specified. Read more

fn transfer_tokens(
    &self,
    token: &TokenIdentifier,
    nonce: u64,
    amount: &Self::AmountType,
    to: &Address
)
[src]

Sends ESDT tokens to the target address. Handles any type of ESDT. Note: this does not work with EGLD, use only with ESDT. Read more

fn direct_esdt_via_async_call(
    &self,
    to: &Address,
    esdt_token_name: &[u8],
    amount: &Self::AmountType,
    data: &[u8]
) -> !
[src]

Performs a simple ESDT transfer, but via async call. This is the preferred way to send ESDT. Read more

fn direct_via_async_call(
    &self,
    to: &Address,
    token: &TokenIdentifier,
    amount: &Self::AmountType,
    data: &[u8]
)
[src]

Sends either EGLD or an ESDT token to the target address, depending on what token identifier was specified. In case of ESDT it performs an async call. Read more

fn async_call(&self, async_call: AsyncCall<Self>) -> ![src]

Sends an asynchronous call to another contract, with either EGLD or ESDT value. The token argument decides which one it will be. Calling this method immediately terminates tx execution. Read more

fn esdt_local_mint(&self, gas: u64, token: &[u8], amount: &Self::AmountType)[src]

Allows synchronous minting of ESDT tokens. Execution is resumed afterwards.

fn esdt_local_burn(&self, gas: u64, token: &[u8], amount: &Self::AmountType)[src]

Allows synchronous burning of ESDT tokens. Execution is resumed afterwards.

fn esdt_nft_create<T>(
    &self,
    gas: u64,
    token: &[u8],
    amount: &Self::AmountType,
    name: &BoxedBytes,
    royalties: &Self::AmountType,
    hash: &BoxedBytes,
    attributes: &T,
    uris: &[BoxedBytes]
) where
    T: TopEncode, 
[src]

Creates a new NFT token of a certain type (determined by token_identifier).
attributes can be any serializable custom struct.
This is a built-in function, so the smart contract execution is resumed after. Read more

fn esdt_nft_add_quantity(
    &self,
    gas: u64,
    token: &[u8],
    nonce: u64,
    amount: &Self::AmountType
)
[src]

Adds quantity for an Non-Fungible Token. (which makes it a Semi-Fungible Token by definition)
This is a built-in function, so the smart contract execution is resumed after. Read more

fn esdt_nft_burn(
    &self,
    gas: u64,
    token: &[u8],
    nonce: u64,
    amount: &Self::AmountType
)
[src]

The reverse operation of esdt_nft_add_quantity, this locally decreases This is a built-in function, so the smart contract execution is resumed after. Read more

fn burn_tokens(
    &self,
    token: &TokenIdentifier,
    nonce: u64,
    amount: &Self::AmountType,
    gas: u64
)
[src]

Burns ESDT tokens. Handles any type of ESDT. Note: this does not work with EGLD, use only with ESDT. Read more

fn direct_esdt_nft_via_async_call(
    &self,
    from: &Address,
    to: &Address,
    token: &[u8],
    nonce: u64,
    amount: &Self::AmountType,
    data: &[u8]
)
[src]

Performs a simple ESDT NFT transfer, but via async call. This is the preferred way to send ESDT. Note: call is done to the SC itself, so from should be the SCs own address Read more

fn direct_esdt_nft_via_transfer_exec(
    &self,
    to: &Address,
    token: &[u8],
    nonce: u64,
    amount: &Self::AmountType,
    data: &[u8]
) -> Result<(), &'static [u8]>
[src]

Sends an ESDT NFT to a given address, directly. Used especially for sending ESDT to regular accounts. Read more

impl StorageReadApi for ArwenApiImpl[src]

fn storage_load_len(&self, key: &[u8]) -> usize[src]

fn storage_load_vec_u8(&self, key: &[u8]) -> Vec<u8>[src]

fn storage_load_boxed_bytes(&self, key: &[u8]) -> BoxedBytes[src]

fn storage_load_big_uint_raw(&self, key: &[u8]) -> i32[src]

fn storage_load_u64(&self, key: &[u8]) -> u64[src]

fn storage_load_i64(&self, key: &[u8]) -> i64[src]

impl StorageWriteApi for ArwenApiImpl[src]

fn storage_store_slice_u8(&self, key: &[u8], value: &[u8])[src]

fn storage_store_big_uint_raw(&self, key: &[u8], handle: i32)[src]

fn storage_store_u64(&self, key: &[u8], value: u64)[src]

fn storage_store_i64(&self, key: &[u8], value: i64)[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.