IApplicationFactory

Git Source

Functions

newApplication

Deploy a new application.

On success, MUST emit an ApplicationCreated event.

function newApplication(IConsensus consensus, address appOwner, bytes32 templateHash) external returns (Application);

Parameters

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

Returns

NameTypeDescription
<none>ApplicationThe application

newApplication

Deploy a new application deterministically.

On success, MUST emit an ApplicationCreated event.

function newApplication(IConsensus consensus, address appOwner, bytes32 templateHash, bytes32 salt)
    external
    returns (Application);

Parameters

NameTypeDescription
consensusIConsensusThe initial consensus contract
appOwneraddressThe initial application owner
templateHashbytes32The initial machine state hash
saltbytes32The salt used to deterministically generate the application contract address

Returns

NameTypeDescription
<none>ApplicationThe application

calculateApplicationAddress

Calculate the address of an application contract to be deployed deterministically.

Beware that only the newApplication function with the salt parameter is able to deterministically deploy an application.

function calculateApplicationAddress(IConsensus consensus, address appOwner, bytes32 templateHash, bytes32 salt)
    external
    view
    returns (address);

Parameters

NameTypeDescription
consensusIConsensusThe initial consensus contract
appOwneraddressThe initial application owner
templateHashbytes32The initial machine state hash
saltbytes32The salt used to deterministically generate the application contract address

Returns

NameTypeDescription
<none>addressThe deterministic application contract address

Events

ApplicationCreated

A new application was deployed.

MUST be triggered on a successful call to newApplication.

event ApplicationCreated(IConsensus indexed consensus, address appOwner, bytes32 templateHash, Application appContract);

Parameters

NameTypeDescription
consensusIConsensusThe initial consensus contract
appOwneraddressThe initial application owner
templateHashbytes32The initial machine state hash
appContractApplicationThe application contract