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

less whitespace #65

Closed
wants to merge 1 commit into from
Closed
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
89 changes: 1 addition & 88 deletions eth_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,63 +18,49 @@ We also define the following WebAssembly data types:
# API

## useGas

Subtracts an amount to the gas counter

**Parameters**

- `amount` **i64** the amount to subtract to the gas counter

**Returns**

*nothing*

## getAddress

Gets address of currently executing account and loads it into memory at
the given offset.

**Parameters**

- `resultOffset` **i32ptr** the memory offset to load the address into (`address`)

**Returns**

*nothing*

## getBalance

Gets balance of the given account and loads it into memory at the given
offset.

**Parameters**

- `addressOffset` **i32ptr** the memory offset to load the address from (`address`)
- `resultOffset` **i32ptr** the memory offset to load the balance into (`u128`)

**Returns**

*nothing*

## getBlockHash

Gets the hash of one of the 256 most recent complete blocks.

**Parameters**

- `number` **i64** which block to load
- `resultOffset` **i32ptr** the memory offset to load the hash into (`u256`)

**Returns**

*nothing*

## call

Sends a message with arbitrary date to a given address path

**Parameters**

- `gas` **i64** the gas limit
- `addressOffset` **i32ptr** the memory offset to load the address from (`address`)
- `valueOffset` **i32ptr** the memory offset to load the value from (`u128`)
Expand All @@ -84,43 +70,34 @@ Sends a message with arbitrary date to a given address path
- `resultLength` **i32** the maximal length of result data

**Returns**

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

## callDataCopy

Copies the input data in current environment to memory. This pertains to
the input data passed with the message call instruction or transaction.

**Parameters**

- `resultOffset` **i32ptr** the memory offset to load data into (`bytes`)
- `dataOffset` **i32** the offset in the input data
- `length` **i32** the length of data to copy

**Returns**

*nothing*

## getCallDataSize

Get size of input data in current environment. This pertains to the input
data passed with the message call instruction or transaction.

**Parameters**

*none*

**Returns**

`callDataSize` **i32**

## callCode

Message-call into this account with an alternative account's code.
Message-call into this account with an alternative account's code.

**Parameters**

- `gas` **i64** the gas limit
- `addressOffset` **i32ptr** the memory offset to load the address from (`address`)
- `valueOffset` **i32ptr** the memory offset to load the value from (`u128`)
Expand All @@ -130,16 +107,13 @@ data passed with the message call instruction or transaction.
- `resultLength` **i32** the maximal length of result data

**Returns**

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

## callDelegate

Message-call into this account with an alternative account’s code, but
persisting the current values for sender and value.

**Parameters**

- `gas` **i64** the gas limit
- `addressOffset` **i32ptr** the memory offset to load the address from (`address`)
- `dataOffset` **i32ptr** the memory offset to load data from (`bytes`)
Expand All @@ -148,195 +122,150 @@ persisting the current values for sender and value.
- `resultLength` **i32** the maximal length of result data

**Returns**

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

## storageStore

Store 256-bit a value in memory to persistent storage

**Parameters**

- `pathOffest` **i32ptr** the memory offset to load the path from (`u256`)
- `valueOffset` **i32ptr** the memory offset to load the value from (`u256`)

**Returns**

*nothing*

## storageLoad

Loads a 256-bit a value to memory from persistent storage

**Parameters**

- `pathOffest` **i32ptr** the memory offset to load the path from (`u256`)
- `resultOffset` **i32ptr** the memory offset to store the result at (`u256`)

**Returns**

*nothing*

## getCaller

Gets caller address and loads it into memory at the given offset. This is
the address of the account that is directly responsible for this execution.

**Parameters**

- `resultOffset` **i32ptr** the memory offset to load the address into (`address`)

**Returns**

*nothing*

## getCallValue

Gets the deposited value by the instruction/transaction responsible for
this execution and loads it into memory at the given location.

**Parameters**

- `resultOffset` **i32ptr** the memory offset to load the value into (`u128`)

**Returns**

*nothing*

## codeCopy

Copies the code running in current environment to memory.

**Parameters**

- `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

**Returns**

*nothing*

## getCodeSize

Gets the size of code running in current environment.

**Parameters**

*none*

**Returns**

`codeSize` **i32**

## getBlockCoinbase

Gets the block’s beneficiary address and loads into memory.

**Parameters**

- `resultOffset` **i32ptr** the memory offset to load the coinbase address into (`address`)

**Returns**

*nothing*

## create

Creates a new contract with a given value.

**Parameters**

- `valueOffset` **i32ptr** the memory offset to load the value from (`u128`)
- `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`)

**Returns**

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

## getBlockDifficulty

Get the block’s difficulty.

**Parameters**

- `offset` **i32ptr** the memory offset to load the difficulty into (`u256`)

**Returns**

*nothing*

## externalCodeCopy

Copies the code of an account to memory.

**Parameters**

- `addressOffset` **i32ptr** the memory offset to load the address from (`address`)
- `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

**Returns**

*nothing*

## getExternalCodeSize

Get size of an account’s code.

**Parameters**

- `addressOffset` **i32ptr** the memory offset to load the address from (`address`)

**Returns**

`extCodeSize` **i32**

## getGasLeft

Returns the current gasCounter

**Parameters**

*none*

**Returns**

`gasLeft` **i64**

## getBlockGasLimit

Get the block’s gas limit.

**Parameters**

*none*

**Returns**

`blockGasLimit` **i64**

## getTxGasPrice

Gets price of gas in current environment.

**Parameters**

- `valueOffset` **i32ptr** the memory offset to write the value to (`u128`)

**Returns**

*nothing*

## log

Creates a new log in the current environment

**Parameters**

- `dataOffset` **i32ptr** the memory offset to load data from (`bytes`)
- `length` **i32** the data length
- `numberOfTopics` **i32** the number of topics following (0 to 4)
Expand All @@ -346,52 +275,41 @@ Creates a new log in the current environment
- `topic4` **i32ptr** the memory offset to load topic4 from (`u256`)

**Returns**

*nothing*

## getBlockNumber

Get the block’s number.

**Parameters**

*none*

**Returns**

`blockNumber` **i64**

## getTxOrigin

Gets the execution's origination address and loads it into memory at the
given offset. This is the sender of original transaction; it is never an
account with non-empty associated code.

**Parameters**

- `resultOffset` **i32ptr** the memory offset to load the origin address from (`address`)

**Returns**

*nothing*

## return

Set the returning output data for the execution.

*Note*: multiple invocations will overwrite the previous data.

**Parameters**

- `dataOffset` **i32ptr** the memory offset of the output data (`bytes`)
- `length` **i32** the length of the output data

**Returns**

*nothing*

## selfDestruct

Mark account for later deletion and give the remaining balance to the specified
beneficiary address. This takes effect once the contract execution terminates.

Expand All @@ -400,21 +318,16 @@ beneficiary address. This takes effect once the contract execution terminates.
*Note*: the contract **shall** halt execution after this call.

**Parameters**

- `addressOffset` **i32ptr** the memory offset to load the address from (`address`)

**Returns**

*nothing*

## getBlockTimestamp

Get the block’s timestamp.

**Parameters**

*none*

**Returns**

`blockTimestamp` **i64**