-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
180 additions
and
51 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//! Assembly FFI. | ||
#[link(wasm_import_module = "zinkc")] | ||
#[allow(improper_ctypes)] | ||
extern "C" { | ||
/// Push a 8-bit signed integer to the stack. | ||
pub fn push_i8(val: i8); | ||
|
||
/// Push a 8-bit unsigned integer to the stack. | ||
pub fn push_u8(val: u8); | ||
|
||
/// Push a 16-bit signed integer to the stack. | ||
pub fn push_i16(val: i16); | ||
|
||
/// Push a 16-bit unsigned integer to the stack. | ||
pub fn push_u16(val: u16); | ||
|
||
/// Push a 32-bit signed integer to the stack. | ||
pub fn push_i32(val: i32); | ||
|
||
/// Push a 32-bit unsigned integer to the stack. | ||
pub fn push_u32(val: u32); | ||
|
||
/// Push a 64-bit signed integer to the stack. | ||
pub fn push_i64(val: i64); | ||
|
||
/// Push a 64-bit unsigned integer to the stack. | ||
pub fn push_u64(val: u64); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
//! EVM FFI | ||
#[link(wasm_import_module = "evm")] | ||
#[allow(improper_ctypes)] | ||
extern "C" { | ||
/// Push 1 byte to the stack. | ||
pub fn push0(); | ||
|
||
/// Push 1 byte to the stack. | ||
pub fn push1(val: u8); | ||
|
||
/// Push 2 bytes to the stack. | ||
pub fn push2(val: u8); | ||
|
||
/// Push 3 bytes to the stack. | ||
pub fn push3(val: u8); | ||
|
||
/// Push 4 bytes to the stack. | ||
pub fn push4(val: u8); | ||
|
||
/// Push 5 bytes to the stack. | ||
pub fn push5(val: u8); | ||
|
||
/// Push 6 bytes to the stack. | ||
pub fn push6(val: u8); | ||
|
||
/// Push 7 bytes to the stack. | ||
pub fn push7(val: u8); | ||
|
||
/// Push 8 bytes to the stack. | ||
pub fn push8(val: u8); | ||
|
||
/// Push 9 bytes to the stack. | ||
pub fn push9(val: u8); | ||
|
||
/// Push 10 bytes to the stack. | ||
pub fn push10(val: u8); | ||
|
||
/// Push 11 bytes to the stack. | ||
pub fn push11(val: u8); | ||
|
||
/// Push 12 bytes to the stack. | ||
pub fn push12(val: u8); | ||
|
||
/// Push 13 bytes to the stack. | ||
pub fn push13(val: u8); | ||
|
||
/// Push 14 bytes to the stack. | ||
pub fn push14(val: u8); | ||
|
||
/// Push 15 bytes to the stack. | ||
pub fn push15(val: u8); | ||
|
||
/// Push 16 bytes to the stack. | ||
pub fn push16(val: u8); | ||
|
||
/// Push 17 bytes to the stack. | ||
pub fn push17(val: u8); | ||
|
||
/// Push 18 bytes to the stack. | ||
pub fn push18(val: u8); | ||
|
||
/// Push 19 bytes to the stack. | ||
pub fn push19(val: u8); | ||
|
||
/// Push 20 bytes to the stack. | ||
pub fn push20(val: u8); | ||
|
||
/// Push 21 bytes to the stack. | ||
pub fn push21(val: u8); | ||
|
||
/// Push 22 bytes to the stack. | ||
pub fn push22(val: u8); | ||
|
||
/// Push 23 bytes to the stack. | ||
pub fn push23(val: u8); | ||
|
||
/// Push 24 bytes to the stack. | ||
pub fn push24(val: u8); | ||
|
||
/// Push 25 bytes to the stack. | ||
pub fn push25(val: u8); | ||
|
||
/// Push 26 bytes to the stack. | ||
pub fn push26(val: u8); | ||
|
||
/// Push 27 bytes to the stack. | ||
pub fn push27(val: u8); | ||
|
||
/// Push 28 bytes to the stack. | ||
pub fn push28(val: u8); | ||
|
||
/// Push 29 bytes to the stack. | ||
pub fn push29(val: u8); | ||
|
||
/// Push 30 bytes to the stack. | ||
pub fn push30(val: u8); | ||
|
||
/// Push 31 bytes to the stack. | ||
pub fn push31(val: u8); | ||
|
||
/// Push 32 bytes to the stack. | ||
pub fn push32(val: u8); | ||
|
||
/// Store a value in the storage | ||
pub fn sstore(value: i32, key: i32); | ||
|
||
/// Load a value from the storage | ||
pub fn sload(key: i32) -> i32; | ||
|
||
/// Append log record with no topics | ||
pub fn log0(name: &'static [u8]); | ||
|
||
/// Append log record with one topics | ||
pub fn log1(name: &'static [u8], topic1: &'static [u8]); | ||
|
||
/// Append log record with two topics | ||
pub fn log2(name: &'static [u8], topic1: &'static [u8], topic2: &'static [u8]); | ||
|
||
/// Append log record with three topics | ||
pub fn log3( | ||
name: &'static [u8], | ||
topic1: &'static [u8], | ||
topic2: &'static [u8], | ||
topic3: &'static [u8], | ||
); | ||
|
||
/// Append log record with four topics | ||
pub fn log4( | ||
name: &'static [u8], | ||
topic1: &'static [u8], | ||
topic2: &'static [u8], | ||
topic3: &'static [u8], | ||
topic4: &'static [u8], | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//! Zink FFI. | ||
pub mod asm; | ||
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); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//! Zink storage mapping implementation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters