IApplicationFactory
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
| Name | Type | Description |
|---|---|---|
consensus | IConsensus | The initial consensus contract |
appOwner | address | The initial application owner |
templateHash | bytes32 | The initial machine state hash |
Returns
| Name | Type | Description |
|---|---|---|
<none> | Application | The 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
| Name | Type | Description |
|---|---|---|
consensus | IConsensus | The initial consensus contract |
appOwner | address | The initial application owner |
templateHash | bytes32 | The initial machine state hash |
salt | bytes32 | The salt used to deterministically generate the application contract address |
Returns
| Name | Type | Description |
|---|---|---|
<none> | Application | The 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
| Name | Type | Description |
|---|---|---|
consensus | IConsensus | The initial consensus contract |
appOwner | address | The initial application owner |
templateHash | bytes32 | The initial machine state hash |
salt | bytes32 | The salt used to deterministically generate the application contract address |
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The 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
| Name | Type | Description |
|---|---|---|
consensus | IConsensus | The initial consensus contract |
appOwner | address | The initial application owner |
templateHash | bytes32 | The initial machine state hash |
appContract | Application | The application contract |