#![no_std]
pub type Address = &'static [u8; 20];
pub type Amount = &'static [u8; 16];
pub type Data = &'static [u8; 32];
pub type Hash = Data;
#[repr(C)]
pub enum CallResult {
Success = 0,
Failure = 1,
Revert = 2,
}
extern "C" {
pub fn ethereum_useGas(amount: i64);
pub fn ethereum_getAddress(address_ptr: *mut Address);
pub fn ethereum_getExternalBalance(address_ptr: *const Address, ether_amount_ptr: *mut Amount);
pub fn ethereum_getBlockHash(number: i64, hash_ptr: *mut Hash);
pub fn ethereum_call(
gas_limit: i64,
address_ptr: *const Address,
ether_amount_ptr: *const Amount,
data_ptr: *const u8,
data_length: i32,
) -> CallResult;
pub fn ethereum_callDataCopy(result_ptr: *mut u8, input_offset: *mut u8, input_length: i32);
pub fn ethereum_getCallDataSize() -> i32;
pub fn ethereum_callCode(
gas_limit: i64,
address_ptr: *const Address,
ether_amount_ptr: *const Amount,
data_ptr: *const u8,
data_length: i32,
) -> CallResult;
pub fn ethereum_callDelegate(
gas_limit: i64,
address_ptr: *const Address,
data_ptr: *const u8,
data_length: i32,
) -> CallResult;
pub fn ethereum_callStatic(
gas_limit: i64,
address_ptr: *const Address,
data_ptr: *const u8,
data_length: i32,
) -> CallResult;
pub fn ethereum_storeData(path_ptr: *const Data, data_ptr: *const Data);
pub fn ethereum_loadData(path_ptr: *const Data, data_ptr: *mut Data);
pub fn ethereum_getCaller(address_ptr: *mut Address);
pub fn ethereum_getCallValue(amount_ptr: *mut Amount);
pub fn ethereum_codeCopy(code_ptr: *mut u8, code_offset: i32, length: i32);
pub fn ethereum_getCodeSize() -> i32;
pub fn ethereum_getBlockCoinbase(address_ptr: *mut Address);
pub fn ethereum_create(
address_ptr: *mut Address,
amount_ptr: *mut Amount,
code_ptr: *const u8,
code_length: i32,
) -> CallResult;
pub fn ethereum_getBlockDifficulty(difficulty_ptr: *mut Data);
pub fn ethereum_externalCodecodeCopy(
address_ptr: *const Address,
result_ptr: *mut u8,
code_offset: i32,
length: i32,
);
pub fn ethereum_getExternalCodeSize(address_ptr: *const Address) -> i32;
pub fn ethereum_getGasLeft() -> i64;
pub fn ethereum_getBlockGasLimit() -> i64;
pub fn ethereum_getTxGasPrice(ether_amount_ptr: *mut Amount);
pub fn ethereum_log(
data_ptr: *const u8,
data_length: i32,
number_of_topics: i32,
topic_0_ptr: *const Data,
topic_1_ptr: *const Data,
topic_2_ptr: *const Data,
topic_3_ptr: *const Data,
);
pub fn ethereum_getBlockNumber() -> i64;
pub fn ethereum_getTxOrigin(address_ptr: *mut Address);
pub fn ethereum_finish(data_ptr: *const u8, data_length: i32);
pub fn ethereum_getReturnDataSize() -> i32;
pub fn ethereum_returnDataCopy(result_ptr: *mut u8, data_offset: i32, data_length: i32);
pub fn ethereum_selfDestruct(address_ptr: *const Address);
pub fn ethereum_getBlockTimestamp() -> i64;
}