[][src]Trait elrond_wasm::ContractHookApi

pub trait ContractHookApi<BigInt> {
    fn get_owner(&self) -> Address;
fn get_caller(&self) -> Address;
fn storage_store(&self, key: &StorageKey, value: &Vec<u8>);
fn storage_load(&self, key: &StorageKey) -> Vec<u8>;
fn storage_store_bytes32(&self, key: &StorageKey, value: &[u8; 32]);
fn storage_load_bytes32(&self, key: &StorageKey) -> [u8; 32];
fn storage_store_big_int(&self, key: &StorageKey, value: &BigInt);
fn storage_load_big_int(&self, key: &StorageKey) -> BigInt;
fn get_call_value_big_int(&self) -> BigInt;
fn send_tx(&self, to: &Address, amount: &BigInt, message: &str);
fn get_gas_left(&self) -> i64;
fn sha256(&self, data: &Vec<u8>) -> [u8; 32];
fn keccak256(&self, data: &Vec<u8>) -> [u8; 32]; }

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 storage_store(&self, key: &StorageKey, value: &Vec<u8>)

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

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

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

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

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

fn get_call_value_big_int(&self) -> BigInt

fn send_tx(&self, to: &Address, amount: &BigInt, message: &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...

Implementors

Loading content...