Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce an Async based interface #48

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions eth_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ We also define the following WebAssembly data types:
- `i32ptr`: same as `i32` in WebAssembly, but treated as a pointer to a WebAssembly memory offset
- `i64`: same as `i64` in WebAssembly

# Tables
A table named 'callback' must be exported if any callbacks are used. All callbacks functions have a parameter of a single `i32` which will contain the error code of the orginal operation. If there where no errors then the return value will be 0 other wise it will be 1.

# API

## useGas
Expand Down Expand Up @@ -51,6 +54,7 @@ offset.

- `addressOffset` **i32ptr** the memory offset to load the address from (`address`)
- `resultOffset` **i32ptr** the memory offset to load the balance into (`u128`)
- `callBackIndex` **i32** an index of the callback function

**Returns**

Expand Down Expand Up @@ -82,10 +86,11 @@ Sends a message with arbitrary date to a given address path
- `dataLength` **i32** the length of data
- `resultOffset` **i32ptr** the memory offset to store the result data at (`bytes`)
- `resultLength` **i32** the maximal length of result data
- `callBackIndex` **i32** an index of the callback function

**Returns**

`result` **i32** Returns 1 or 0 depending on if the VM trapped on the message or not
*nothing*

## callDataCopy

Expand Down Expand Up @@ -128,10 +133,11 @@ data passed with the message call instruction or transaction.
- `dataLength` **i32** the length of data
- `resultOffset` **i32ptr** the memory offset to store the result data at (`bytes`)
- `resultLength` **i32** the maximal length of result data
- `callBackIndex` **i32** an index of the callback function

**Returns**

`result` **i32** Returns 1 or 0 depending on if the VM trapped on the message or not
*nothing*

## callDelegate

Expand All @@ -146,10 +152,11 @@ persisting the current values for sender and value.
- `dataLength` **i32** the length of data
- `resultOffset` **i32ptr** the memory offset to store the result data at (`bytes`)
- `resultLength` **i32** the maximal length of result data
- `callBackIndex` **i32** an index of the callback function

**Returns**

`result` **i32** Returns 1 or 0 depending on if the VM trapped on the message or not
*nothing*

## storageStore

Expand All @@ -159,6 +166,7 @@ Store 256-bit a value in memory to persistent storage

- `pathOffest` **i32ptr** the memory offset to load the path from (`u256`)
- `valueOffset` **i32ptr** the memory offset to load the value from (`u256`)
- `callBackIndex` **i32** an index of the callback function

**Returns**

Expand All @@ -172,6 +180,7 @@ Loads a 256-bit a value to memory from persistent storage

- `pathOffest` **i32ptr** the memory offset to load the path from (`u256`)
- `resultOffset` **i32ptr** the memory offset to store the result at (`u256`)
- `callBackIndex` **i32** an index of the callback function

**Returns**

Expand Down Expand Up @@ -223,11 +232,12 @@ Gets the size of code running in current environment.

**Parameters**

*none*
- `resultOffset` **i32ptr** the memory offset to load the result into (`i32`)
- `callBackIndex` **i32** an index of the callback function

**Returns**

`codeSize` **i32**
*nothing*

## getBlockCoinbase

Expand All @@ -251,10 +261,11 @@ Creates a new contract with a given value.
- `dataOffset` **i32ptr** the memory offset to load the code for the new contract from (`bytes`)
- `length` **i32** the data length
- `resultOffset` **i32ptr** the memory offset to write the new contract address to (`address`)
- `callBackIndex` **i32** an index of the callback function

**Returns**

`result` **i32** Returns 1 or 0 depending on if the VM trapped on the message or not
*nothing*

## getBlockDifficulty

Expand All @@ -278,6 +289,7 @@ Copies the code of an account to memory.
- `resultOffset` **i32ptr** the memory offset to load the result into (`bytes`)
- `codeOffset` **i32** the offset within the code
- `length` **i32** the length of code to copy
- `callBackIndex` **i32** an index of the callback function

**Returns**

Expand All @@ -290,10 +302,12 @@ Get size of an account’s code.
**Parameters**

- `addressOffset` **i32ptr** the memory offset to load the address from (`address`)
- `resultOffset` **i32ptr** the memory offset to load the result into (`i32`)
- `callBackIndex` **i32** an index of the callback function

**Returns**

`extCodeSize` **i32**
*nothing*

## getGasLeft

Expand Down