IInputBox

Git Source

Provides data availability of inputs for applications.

Each application has its own append-only list of inputs.

Off-chain, inputs can be retrieved via events.

On-chain, only the input hashes are stored.

See LibInput for more details on how such hashes are computed.

Functions

addInput

Send an input to an application.

MUST fire an InputAdded event.

function addInput(address appContract, bytes calldata payload)
    external
    returns (bytes32);

Parameters

NameTypeDescription
appContractaddressThe application contract address
payloadbytesThe input payload

Returns

NameTypeDescription
<none>bytes32The hash of the input blob

getNumberOfInputs

Get the number of inputs sent to an application.

function getNumberOfInputs(address appContract) external view returns (uint256);

Parameters

NameTypeDescription
appContractaddressThe application contract address

getInputHash

Get the hash of an input in an application's input box.

The provided index must be valid.

function getInputHash(address appContract, uint256 index)
    external
    view
    returns (bytes32);

Parameters

NameTypeDescription
appContractaddressThe application contract address
indexuint256The input index

getDeploymentBlockNumber

Get number of block in which contract was deployed

function getDeploymentBlockNumber() external view returns (uint256);

Events

InputAdded

MUST trigger when an input is added.

event InputAdded(address indexed appContract, uint256 indexed index, bytes input);

Parameters

NameTypeDescription
appContractaddressThe application contract address
indexuint256The input index
inputbytesThe input blob

Errors

InputTooLarge

Input is too large.

error InputTooLarge(address appContract, uint256 inputLength, uint256 maxInputLength);

Parameters

NameTypeDescription
appContractaddressThe application contract address
inputLengthuint256The input length
maxInputLengthuint256The maximum input length