zink/ffi/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! Zink FFI.

use crate::primitives::U256;

pub mod asm;
pub mod bytes;
pub mod evm;

#[link(wasm_import_module = "zinkc")]
#[allow(improper_ctypes)]
extern "C" {
    /// Emit ABI to host state.
    pub fn emit_abi(ptr: u32, len: u32);

    /// Equal operation for addresses
    pub fn u256_add(this: U256, other: U256) -> U256;

    /// Equal operation for addresses
    pub fn u256_sub(this: U256, other: U256) -> U256;

    /// Less than operation for addresses
    pub fn u256_lt(this: U256, other: U256) -> bool;

    /// Equal operation for addresses
    pub fn u256_max() -> U256;

    /// Addmod operation for addresses
    pub fn u256_addmod(this: U256, other: U256, modulus: U256) -> U256;

    /// Equal operation for addresses
    pub fn u256_mulmod(this: U256, other: U256, modulus: U256) -> U256;

    /// Set up a label for reserving 32 bytes in memory
    pub fn label_reserve_mem_32();

    /// Set up a label for reserving 64 bytes in memory
    pub fn label_reserve_mem_64();
}