-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathIEspressoApplicationFactory.sol
More file actions
48 lines (44 loc) · 2.22 KB
/
Copy pathIEspressoApplicationFactory.sol
File metadata and controls
48 lines (44 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)
pragma solidity ^0.8.8;
import {IApplication} from "./IApplication.sol";
import {IOutputsMerkleRootValidator} from "../consensus/IOutputsMerkleRootValidator.sol";
/// @title Application Factory interface
interface IEspressoApplicationFactory {
/// @notice Deploy a new application deterministically.
/// @param outputsMerkleRootValidator The initial outputs Merkle root validator contract
/// @param appOwner The initial application owner
/// @param templateHash The initial machine state hash
/// @param fromBlock Height of first Espresso block to consider
/// @param namespaceId The Espresso namespace ID
/// @param salt The salt used to deterministically generate the application contract address
/// @return The application
/// @dev On success, MUST emit an `ApplicationCreated` event.
/// @dev Reverts if the application owner address is zero.
function newApplication(
IOutputsMerkleRootValidator outputsMerkleRootValidator,
address appOwner,
bytes32 templateHash,
uint256 fromBlock,
uint32 namespaceId,
bytes32 salt
) external returns (IApplication);
/// @notice Calculate the address of an application contract to be deployed deterministically.
/// @param outputsMerkleRootValidator The initial outputs Merkle root validator contract
/// @param appOwner The initial application owner
/// @param templateHash The initial machine state hash
/// @param fromBlock Height of first Espresso block to consider
/// @param namespaceId The Espresso namespace ID
/// @param salt The salt used to deterministically generate the application contract address
/// @return The deterministic application contract address
/// @dev 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,
uint256 fromBlock,
uint32 namespaceId,
bytes32 salt
) external view returns (address);
}