[][src]Trait elrond_wasm::ContractHookApi

pub trait ContractHookApi<BigInt, BigUint> {
    fn get_owner(&self) -> Address;
fn get_caller(&self) -> Address;
fn get_balance(&self, address: &Address) -> BigUint;
fn storage_store(&self, key: &StorageKey, value: &Vec<u8>);
fn storage_load(&self, key: &StorageKey) -> Vec<u8>;
fn storage_load_len(&self, key: &StorageKey) -> usize;
fn storage_store_bytes32(&self, key: &StorageKey, value: &[u8; 32]);
fn storage_load_bytes32(&self, key: &StorageKey) -> [u8; 32];
fn storage_store_big_uint(&self, key: &StorageKey, value: &BigUint);
fn storage_load_big_uint(&self, key: &StorageKey) -> BigUint;
fn storage_store_big_int(&self, key: &StorageKey, value: &BigInt);
fn storage_load_big_int(&self, key: &StorageKey) -> BigInt;
fn storage_store_i64(&self, key: &StorageKey, value: i64);
fn storage_load_i64(&self, key: &StorageKey) -> Option<i64>;
fn get_call_value_big_uint(&self) -> BigUint;
fn send_tx(&self, to: &Address, amount: &BigUint, message: &str);
fn async_call(&self, to: &Address, amount: &BigUint, data: &str);
fn get_gas_left(&self) -> i64;
fn sha256(&self, data: &Vec<u8>) -> [u8; 32];
fn keccak256(&self, data: &Vec<u8>) -> [u8; 32]; fn get_own_balance(&self) -> BigUint { ... } }

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_owner(&self) -> Address

fn get_caller(&self) -> Address

fn get_balance(&self, address: &Address) -> BigUint

fn storage_store(&self, key: &StorageKey, value: &Vec<u8>)

fn storage_load(&self, key: &StorageKey) -> Vec<u8>

fn storage_load_len(&self, key: &StorageKey) -> usize

fn storage_store_bytes32(&self, key: &StorageKey, value: &[u8; 32])

fn storage_load_bytes32(&self, key: &StorageKey) -> [u8; 32]

fn storage_store_big_uint(&self, key: &StorageKey, value: &BigUint)

fn storage_load_big_uint(&self, key: &StorageKey) -> BigUint

fn storage_store_big_int(&self, key: &StorageKey, value: &BigInt)

fn storage_load_big_int(&self, key: &StorageKey) -> BigInt

fn storage_store_i64(&self, key: &StorageKey, value: i64)

fn storage_load_i64(&self, key: &StorageKey) -> Option<i64>

fn get_call_value_big_uint(&self) -> BigUint

fn send_tx(&self, to: &Address, amount: &BigUint, message: &str)

fn async_call(&self, to: &Address, amount: &BigUint, data: &str)

fn get_gas_left(&self) -> i64

fn sha256(&self, data: &Vec<u8>) -> [u8; 32]

fn keccak256(&self, data: &Vec<u8>) -> [u8; 32]

Loading content...

Provided methods

fn get_own_balance(&self) -> BigUint

Loading content...

Implementors

Loading content...