zink/ffi/evm.rs
1//! EVM FFI.
2
3use crate::primitives::{Address, Bytes32};
4
5#[link(wasm_import_module = "evm")]
6#[allow(improper_ctypes)]
7extern "C" {
8 /// Push 1 byte to the stack.
9 pub fn push0();
10
11 /// Push 1 byte to the stack.
12 pub fn push1(val: i32);
13
14 /// Push 2 bytes to the stack.
15 pub fn push2(val: i32);
16
17 /// Push 3 bytes to the stack.
18 pub fn push3(val: i32);
19
20 /// Push 4 bytes to the stack.
21 pub fn push4(val: i32);
22
23 /// Push 5 bytes to the stack.
24 pub fn push5(val: i32);
25
26 /// Push 6 bytes to the stack.
27 pub fn push6(val: i32);
28
29 /// Push 7 bytes to the stack.
30 pub fn push7(val: i32);
31
32 /// Push 8 bytes to the stack.
33 pub fn push8(val: i32);
34
35 /// Push 9 bytes to the stack.
36 pub fn push9(val: i32);
37
38 /// Push 10 bytes to the stack.
39 pub fn push10(val: i32);
40
41 /// Push 11 bytes to the stack.
42 pub fn push11(val: i32);
43
44 /// Push 12 bytes to the stack.
45 pub fn push12(val: i32);
46
47 /// Push 13 bytes to the stack.
48 pub fn push13(val: i32);
49
50 /// Push 14 bytes to the stack.
51 pub fn push14(val: i32);
52
53 /// Push 15 bytes to the stack.
54 pub fn push15(val: i32);
55
56 /// Push 16 bytes to the stack.
57 pub fn push16(val: i32);
58
59 /// Push 17 bytes to the stack.
60 pub fn push17(val: i32);
61
62 /// Push 18 bytes to the stack.
63 pub fn push18(val: i32);
64
65 /// Push 19 bytes to the stack.
66 pub fn push19(val: i32);
67
68 /// Push 20 bytes to the stack.
69 pub fn push20(val: i32);
70
71 /// Push 21 bytes to the stack.
72 pub fn push21(val: i32);
73
74 /// Push 22 bytes to the stack.
75 pub fn push22(val: i32);
76
77 /// Push 23 bytes to the stack.
78 pub fn push23(val: i32);
79
80 /// Push 24 bytes to the stack.
81 pub fn push24(val: i32);
82
83 /// Push 25 bytes to the stack.
84 pub fn push25(val: i32);
85
86 /// Push 26 bytes to the stack.
87 pub fn push26(val: i32);
88
89 /// Push 27 bytes to the stack.
90 pub fn push27(val: i32);
91
92 /// Push 28 bytes to the stack.
93 pub fn push28(val: i32);
94
95 /// Push 29 bytes to the stack.
96 pub fn push29(val: i32);
97
98 /// Push 30 bytes to the stack.
99 pub fn push30(val: i32);
100
101 /// Push 31 bytes to the stack.
102 pub fn push31(val: i32);
103
104 /// Push 32 bytes to the stack.
105 pub fn push32();
106
107 /// Store a value in the storage
108 pub fn sstore();
109
110 /// Load a value from the storage
111 pub fn sload();
112
113 /// Store a value in the transient storage
114 pub fn tstore();
115
116 /// Load a value from the transient storage
117 pub fn tload();
118
119 /// Save word to memory
120 pub fn mstore();
121
122 /// Save byte to memory
123 pub fn mstore8();
124
125 /// Load word from memory
126 pub fn mload();
127
128 /// Copy memory to memory
129 pub fn mcopy();
130
131 /// Compute Keccak-256 hash
132 pub fn keccak256();
133
134 /// Get the current message sender
135 pub fn caller() -> Address;
136
137 /// Get the current blob hash at index
138 pub fn blobhash();
139
140 /// Get the current blob base fee
141 pub fn blobbasefee();
142
143 /// Append log record with no topics
144 pub fn log0(name: &'static [u8]);
145
146 /// Append log record with one topic
147 pub fn log1(topic1: Bytes32, name: &'static [u8]);
148
149 /// Append log record with two topics
150 pub fn log2(topic1: Bytes32, topic2: Bytes32, name: &'static [u8]);
151
152 /// Append log record with three topics
153 pub fn log3(topic1: Bytes32, topic2: Bytes32, topic3: Bytes32, name: &'static [u8]);
154
155 /// Append log record with four topics
156 pub fn log4(
157 topic1: Bytes32,
158 topic2: Bytes32,
159 topic3: Bytes32,
160 topic4: Bytes32,
161 name: &'static [u8],
162 );
163}