pub trait BlockchainApiImpl: ManagedTypeApiImpl {
Show 36 methods
// Required methods
fn get_caller_legacy(&self) -> Address;
fn get_sc_address_legacy(&self) -> Address;
fn load_owner_address_managed(&self, dest: Self::ManagedBufferHandle);
fn get_shard_of_address_legacy(&self, address: &Address) -> u32;
fn is_smart_contract_legacy(&self, address: &Address) -> bool;
fn load_balance_legacy(&self, dest: Self::BigIntHandle, address: &Address);
fn load_state_root_hash_managed(&self, dest: Self::ManagedBufferHandle);
fn get_tx_hash_legacy(&self) -> H256;
fn get_gas_left(&self) -> u64;
fn get_block_timestamp(&self) -> u64;
fn get_block_nonce(&self) -> u64;
fn get_block_round(&self) -> u64;
fn get_block_epoch(&self) -> u64;
fn load_block_random_seed_managed(&self, dest: Self::ManagedBufferHandle);
fn get_prev_block_timestamp(&self) -> u64;
fn get_prev_block_nonce(&self) -> u64;
fn get_prev_block_round(&self) -> u64;
fn get_prev_block_epoch(&self) -> u64;
fn get_prev_block_random_seed_legacy(&self) -> Box<[u8; 48]>;
fn get_current_esdt_nft_nonce(
&self,
address_handle: Self::ManagedBufferHandle,
token_id_handle: Self::ManagedBufferHandle,
) -> u64;
fn load_esdt_balance(
&self,
address_handle: Self::ManagedBufferHandle,
token_id_handle: Self::ManagedBufferHandle,
nonce: u64,
dest: Self::BigIntHandle,
);
fn managed_get_esdt_token_data(
&self,
address_handle: RawHandle,
token_id_handle: RawHandle,
nonce: u64,
value_handle: RawHandle,
properties_handle: RawHandle,
hash_handle: RawHandle,
name_handle: RawHandle,
attributes_handle: RawHandle,
creator_handle: RawHandle,
royalties_handle: RawHandle,
uris_handle: RawHandle,
);
fn managed_get_back_transfers(
&self,
esdt_transfer_value_handle: RawHandle,
call_value_handle: RawHandle,
);
fn check_esdt_frozen(
&self,
address_handle: Self::ManagedBufferHandle,
token_id_handle: Self::ManagedBufferHandle,
nonce: u64,
) -> bool;
fn check_esdt_paused(
&self,
token_id_handle: Self::ManagedBufferHandle,
) -> bool;
fn check_esdt_limited_transfer(
&self,
token_id_handle: Self::ManagedBufferHandle,
) -> bool;
fn load_esdt_local_roles(
&self,
token_id_handle: Self::ManagedBufferHandle,
) -> EsdtLocalRoleFlags;
fn managed_get_code_metadata(
&self,
address_handle: Self::ManagedBufferHandle,
response_handle: Self::ManagedBufferHandle,
);
fn managed_is_builtin_function(
&self,
function_name_handle: Self::ManagedBufferHandle,
) -> bool;
// Provided methods
fn load_caller_managed(&self, dest: Self::ManagedBufferHandle) { ... }
fn load_sc_address_managed(&self, dest: Self::ManagedBufferHandle) { ... }
fn get_shard_of_address(
&self,
address_handle: Self::ManagedBufferHandle,
) -> u32 { ... }
fn is_smart_contract(
&self,
address_handle: Self::ManagedBufferHandle,
) -> bool { ... }
fn load_balance(
&self,
dest: Self::BigIntHandle,
address_handle: Self::ManagedBufferHandle,
) { ... }
fn load_tx_hash_managed(&self, dest: Self::ManagedBufferHandle) { ... }
fn load_prev_block_random_seed_managed(
&self,
dest: Self::ManagedBufferHandle,
) { ... }
}
Expand description
Interface to be used by the actual smart contract code.
Note: contracts and the api are not mutable. They simply pass on/retrieve data to/from the protocol. When mocking the blockchain state, we use the Rc/RefCell pattern to isolate mock state mutability from the contract interface.
Required Methods§
fn get_caller_legacy(&self) -> Address
fn get_sc_address_legacy(&self) -> Address
fn load_owner_address_managed(&self, dest: Self::ManagedBufferHandle)
fn get_shard_of_address_legacy(&self, address: &Address) -> u32
fn is_smart_contract_legacy(&self, address: &Address) -> bool
fn load_balance_legacy(&self, dest: Self::BigIntHandle, address: &Address)
fn load_state_root_hash_managed(&self, dest: Self::ManagedBufferHandle)
fn get_tx_hash_legacy(&self) -> H256
fn get_gas_left(&self) -> u64
fn get_block_timestamp(&self) -> u64
fn get_block_nonce(&self) -> u64
fn get_block_round(&self) -> u64
fn get_block_epoch(&self) -> u64
fn load_block_random_seed_managed(&self, dest: Self::ManagedBufferHandle)
fn get_prev_block_timestamp(&self) -> u64
fn get_prev_block_nonce(&self) -> u64
fn get_prev_block_round(&self) -> u64
fn get_prev_block_epoch(&self) -> u64
fn get_prev_block_random_seed_legacy(&self) -> Box<[u8; 48]>
fn get_current_esdt_nft_nonce( &self, address_handle: Self::ManagedBufferHandle, token_id_handle: Self::ManagedBufferHandle, ) -> u64
fn load_esdt_balance( &self, address_handle: Self::ManagedBufferHandle, token_id_handle: Self::ManagedBufferHandle, nonce: u64, dest: Self::BigIntHandle, )
fn managed_get_esdt_token_data( &self, address_handle: RawHandle, token_id_handle: RawHandle, nonce: u64, value_handle: RawHandle, properties_handle: RawHandle, hash_handle: RawHandle, name_handle: RawHandle, attributes_handle: RawHandle, creator_handle: RawHandle, royalties_handle: RawHandle, uris_handle: RawHandle, )
fn managed_get_back_transfers( &self, esdt_transfer_value_handle: RawHandle, call_value_handle: RawHandle, )
fn check_esdt_frozen( &self, address_handle: Self::ManagedBufferHandle, token_id_handle: Self::ManagedBufferHandle, nonce: u64, ) -> bool
fn check_esdt_paused(&self, token_id_handle: Self::ManagedBufferHandle) -> bool
fn check_esdt_limited_transfer( &self, token_id_handle: Self::ManagedBufferHandle, ) -> bool
fn load_esdt_local_roles( &self, token_id_handle: Self::ManagedBufferHandle, ) -> EsdtLocalRoleFlags
fn managed_get_code_metadata( &self, address_handle: Self::ManagedBufferHandle, response_handle: Self::ManagedBufferHandle, )
fn managed_is_builtin_function( &self, function_name_handle: Self::ManagedBufferHandle, ) -> bool
Provided Methods§
fn load_caller_managed(&self, dest: Self::ManagedBufferHandle)
fn load_sc_address_managed(&self, dest: Self::ManagedBufferHandle)
fn get_shard_of_address(&self, address_handle: Self::ManagedBufferHandle) -> u32
fn is_smart_contract(&self, address_handle: Self::ManagedBufferHandle) -> bool
fn load_balance( &self, dest: Self::BigIntHandle, address_handle: Self::ManagedBufferHandle, )
fn load_tx_hash_managed(&self, dest: Self::ManagedBufferHandle)
fn load_prev_block_random_seed_managed(&self, dest: Self::ManagedBufferHandle)
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.