IApplicationFactory
Inherits: IVersionGetter, IApplicationFactoryErrors
Title: Application Factory interface
Functions
newApplication
Deploy a new application.
On success, MUST emit an ApplicationCreated event.
Reverts if the application owner address is zero.
function newApplication(
IOutputsMerkleRootValidator outputsMerkleRootValidator,
address appOwner,
bytes32 templateHash,
IInputBox inputBox,
WithdrawalConfig calldata withdrawalConfig
) external returns (IApplication);
Parameters
| Name | Type | Description |
|---|---|---|
outputsMerkleRootValidator | IOutputsMerkleRootValidator | The initial outputs Merkle root validator contract |
appOwner | address | The initial application owner |
templateHash | bytes32 | The initial machine state hash |
inputBox | IInputBox | The input box contract |
withdrawalConfig | WithdrawalConfig | The withdrawal configuration |
Returns
| Name | Type | Description |
|---|---|---|
<none> | IApplication | The application |
newApplication
Deploy a new application deterministically.
On success, MUST emit an ApplicationCreated event.
Reverts if the application owner address is zero.
function newApplication(
IOutputsMerkleRootValidator outputsMerkleRootValidator,
address appOwner,
bytes32 templateHash,
IInputBox inputBox,
WithdrawalConfig calldata withdrawalConfig,
bytes32 salt
) external returns (IApplication);
Parameters
| Name | Type | Description |
|---|---|---|
outputsMerkleRootValidator | IOutputsMerkleRootValidator | The initial outputs Merkle root validator contract |
appOwner | address | The initial application owner |
templateHash | bytes32 | The initial machine state hash |
inputBox | IInputBox | The input box contract |
withdrawalConfig | WithdrawalConfig | The withdrawal configuration |
salt | bytes32 | The salt used to deterministically generate the application contract address |
Returns
| Name | Type | Description |
|---|---|---|
<none> | IApplication | 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(
IOutputsMerkleRootValidator outputsMerkleRootValidator,
address appOwner,
bytes32 templateHash,
IInputBox inputBox,
WithdrawalConfig calldata withdrawalConfig,
bytes32 salt
) external view returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
outputsMerkleRootValidator | IOutputsMerkleRootValidator | The initial outputs Merkle root validator contract |
appOwner | address | The initial application owner |
templateHash | bytes32 | The initial machine state hash |
inputBox | IInputBox | The input box contract |
withdrawalConfig | WithdrawalConfig | The withdrawal configuration |
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(
IOutputsMerkleRootValidator indexed outputsMerkleRootValidator,
address appOwner,
bytes32 templateHash,
IInputBox inputBox,
WithdrawalConfig withdrawalConfig,
IApplication appContract
);
Parameters
| Name | Type | Description |
|---|---|---|
outputsMerkleRootValidator | IOutputsMerkleRootValidator | The initial outputs Merkle root validator contract |
appOwner | address | The initial application owner |
templateHash | bytes32 | The initial machine state hash |
inputBox | IInputBox | The input box contract |
withdrawalConfig | WithdrawalConfig | |
appContract | IApplication | The application contract |