@@ -15,6 +15,9 @@ We also define the following WebAssembly data types:
1515- ` i32ptr ` : same as ` i32 ` in WebAssembly, but treated as a pointer to a WebAssembly memory offset
1616- ` i64 ` : same as ` i64 ` in WebAssembly
1717
18+ # Tables
19+ A table named 'callbacks' must be exported if any callbacks are used
20+
1821# API
1922
2023## useGas
@@ -82,10 +85,11 @@ Sends a message with arbitrary date to a given address path
8285- ` dataLength ` ** i32** the length of data
8386- ` resultOffset ` ** i32ptr** the memory offset to store the result data at (` bytes ` )
8487- ` resultLength ` ** i32** the maximal length of result data
88+ - ` callBackIndex ` ** i32** an index of the callback function
8589
86- ** Returns **
90+ ** Callback Index **
8791
88- ` result ` ** i32** Returns 1 or 0 depending on if the VM trapped on the message or not
92+ - ` result ` ** i32** 1 or 0 depending on if the VM trapped on the message or not
8993
9094## callDataCopy
9195
@@ -128,10 +132,11 @@ data passed with the message call instruction or transaction.
128132- ` dataLength ` ** i32** the length of data
129133- ` resultOffset ` ** i32ptr** the memory offset to store the result data at (` bytes ` )
130134- ` resultLength ` ** i32** the maximal length of result data
135+ - ` callBackIndex ` ** i32** an index of the callback function
131136
132- ** Returns **
137+ ** Callback Index **
133138
134- ` result ` ** i32** Returns 1 or 0 depending on if the VM trapped on the message or not
139+ - ` result ` ** i32** 1 or 0 depending on if the VM trapped on the message or not
135140
136141## callDelegate
137142
@@ -146,10 +151,10 @@ persisting the current values for sender and value.
146151- ` dataLength ` ** i32** the length of data
147152- ` resultOffset ` ** i32ptr** the memory offset to store the result data at (` bytes ` )
148153- ` resultLength ` ** i32** the maximal length of result data
154+ - ` callBackIndex ` ** i32** an index of the callback function
149155
150- ** Returns**
151-
152- ` result ` ** i32** Returns 1 or 0 depending on if the VM trapped on the message or not
156+ ** Callback Index**
157+ - ` result ` ** i32** Returns 1 or 0 depending on if the VM trapped on the message or not
153158
154159## storageStore
155160
@@ -159,8 +164,9 @@ Store 256-bit a value in memory to persistent storage
159164
160165- ` pathOffest ` ** i32ptr** the memory offset to load the path from (` u256 ` )
161166- ` valueOffset ` ** i32ptr** the memory offset to load the value from (` u256 ` )
167+ - ` callBackIndex ` ** i32** an index of the callback function
162168
163- ** Returns **
169+ ** Callback Signature **
164170
165171* nothing*
166172
@@ -172,8 +178,9 @@ Loads a 256-bit a value to memory from persistent storage
172178
173179- ` pathOffest ` ** i32ptr** the memory offset to load the path from (` u256 ` )
174180- ` resultOffset ` ** i32ptr** the memory offset to store the result at (` u256 ` )
181+ - ` callBackIndex ` ** i32** an index of the callback function
175182
176- ** Returns **
183+ ** Callback Index **
177184
178185* nothing*
179186
@@ -251,10 +258,11 @@ Creates a new contract with a given value.
251258- ` dataOffset ` ** i32ptr** the memory offset to load the code for the new contract from (` bytes ` )
252259- ` length ` ** i32** the data length
253260- ` resultOffset ` ** i32ptr** the memory offset to write the new contract address to (` address ` )
261+ - ` callBackIndex ` ** i32** an index of the callback function
254262
255- ** Returns**
263+ ** Callback Index**
264+ - ` result ` ** i32** 1 or 0 depending on if the VM trapped on the message or not
256265
257- ` result ` ** i32** Returns 1 or 0 depending on if the VM trapped on the message or not
258266
259267## getBlockDifficulty
260268
@@ -278,8 +286,9 @@ Copies the code of an account to memory.
278286- ` resultOffset ` ** i32ptr** the memory offset to load the result into (` bytes ` )
279287- ` codeOffset ` ** i32** the offset within the code
280288- ` length ` ** i32** the length of code to copy
289+ - ` callBackIndex ` ** i32** an index of the callback function
281290
282- ** Returns **
291+ ** Callback Signature **
283292
284293* nothing*
285294
@@ -290,10 +299,11 @@ Get size of an account’s code.
290299** Parameters**
291300
292301- ` addressOffset ` ** i32ptr** the memory offset to load the address from (` address ` )
302+ - ` callBackIndex ` ** i32** an index of the callback function
293303
294- ** Returns **
304+ ** Callback Index **
295305
296- ` extCodeSize ` ** i32**
306+ - ` extCodeSize ` ** i32**
297307
298308## getGasLeft
299309
0 commit comments