Application

Git Source

Inherits: IApplication, Ownable, ERC721Holder, ERC1155Holder, ReentrancyGuard

State Variables

_templateHash

The initial machine state hash.

See the getTemplateHash function.

bytes32 internal immutable _templateHash;

_executed

Keeps track of which outputs have been executed.

See the wasOutputExecuted function.

BitMaps.BitMap internal _executed;

_consensus

The current consensus contract.

See the getConsensus and migrateToConsensus functions.

IConsensus internal _consensus;

Functions

constructor

Creates an Application contract.

constructor(IConsensus consensus, address initialOwner, bytes32 templateHash) Ownable(initialOwner);

Parameters

NameTypeDescription
consensusIConsensusThe initial consensus contract
initialOwneraddressThe initial application owner
templateHashbytes32The initial machine state hash

receive

Accept Ether transfers.

If you wish to transfer Ether to an application while informing the backend of it, then please do so through the Ether portal contract.

receive() external payable;

executeOutput

function executeOutput(bytes calldata output, OutputValidityProof calldata proof) external override nonReentrant;

migrateToConsensus

function migrateToConsensus(IConsensus newConsensus) external override onlyOwner;

wasOutputExecuted

function wasOutputExecuted(uint256 outputIndex) external view override returns (bool);

validateOutput

function validateOutput(bytes calldata output, OutputValidityProof calldata proof) public view override;

validateOutputHash

function validateOutputHash(bytes32 outputHash, OutputValidityProof calldata proof) public view override;

getTemplateHash

function getTemplateHash() external view override returns (bytes32);

getConsensus

function getConsensus() external view override returns (IConsensus);

_wasClaimAccepted

Check if an output Merkle root hash was ever accepted by the current consensus.

function _wasClaimAccepted(bytes32 claim) internal view returns (bool);

Parameters

NameTypeDescription
claimbytes32The output Merkle root hash

_executeVoucher

Executes a voucher

function _executeVoucher(bytes calldata arguments) internal;

Parameters

NameTypeDescription
argumentsbytesABI-encoded arguments

_executeDelegateCallVoucher

Executes a delegatecall voucher

function _executeDelegateCallVoucher(bytes calldata arguments) internal;

Parameters

NameTypeDescription
argumentsbytesABI-encoded arguments