zink/ffi/
mod.rs

1//! Zink FFI.
2
3use crate::primitives::U256;
4
5pub mod asm;
6pub mod bytes;
7pub mod evm;
8
9#[link(wasm_import_module = "zinkc")]
10#[allow(improper_ctypes)]
11extern "C" {
12    /// Emit ABI to host state.
13    pub fn emit_abi(ptr: u32, len: u32);
14
15    /// Addition operation for addresses
16    pub fn u256_add(this: U256, other: U256) -> U256;
17
18    /// Subtraction operation for addresses
19    pub fn u256_sub(this: U256, other: U256) -> U256;
20
21    /// Division operation for addresses
22    pub fn u256_div(this: U256, other: U256) -> U256;
23
24    /// Less than operation for addresses
25    pub fn u256_lt(this: U256, other: U256) -> bool;
26
27    /// Returns the maximum U256 value
28    pub fn u256_max() -> U256;
29
30    /// Addmod operation for addresses
31    pub fn u256_addmod(this: U256, other: U256, modulus: U256) -> U256;
32
33    /// Mulmod operation for addresses
34    pub fn u256_mulmod(this: U256, other: U256, modulus: U256) -> U256;
35
36    /// Set up a label for reserving 32 bytes in memory
37    pub fn label_reserve_mem_32();
38
39    /// Set up a label for reserving 64 bytes in memory
40    pub fn label_reserve_mem_64();
41}