-
Notifications
You must be signed in to change notification settings - Fork 29
/
IContractDeployer.sol
91 lines (75 loc) · 3.41 KB
/
IContractDeployer.sol
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IContractDeployer {
/// @notice Defines the version of the account abstraction protocol
/// that a contract claims to follow.
/// - `None` means that the account is just a contract and it should never be interacted
/// with as a custom account
/// - `Version1` means that the account follows the first version of the account abstraction protocol
enum AccountAbstractionVersion {
None,
Version1
}
/// @notice Defines the nonce ordering used by the account
/// - `Sequential` means that it is expected that the nonces are monotonic and increment by 1
/// at a time (the same as EOAs).
/// - `Arbitrary` means that the nonces for the accounts can be arbitrary. The operator
/// should serve the transactions from such an account on a first-come-first-serve basis.
/// @dev This ordering is more of a suggestion to the operator on how the AA expects its transactions
/// to be processed and is not considered as a system invariant.
enum AccountNonceOrdering {
Sequential,
Arbitrary
}
struct AccountInfo {
AccountAbstractionVersion supportedAAVersion;
AccountNonceOrdering nonceOrdering;
}
event ContractDeployed(
address indexed deployerAddress,
bytes32 indexed bytecodeHash,
address indexed contractAddress
);
event AccountNonceOrderingUpdated(address indexed accountAddress, AccountNonceOrdering nonceOrdering);
event AccountVersionUpdated(address indexed accountAddress, AccountAbstractionVersion aaVersion);
function getNewAddressCreate2(
address _sender,
bytes32 _bytecodeHash,
bytes32 _salt,
bytes calldata _input
) external view returns (address newAddress);
function getNewAddressCreate(address _sender, uint256 _senderNonce) external pure returns (address newAddress);
function create2(
bytes32 _salt,
bytes32 _bytecodeHash,
bytes calldata _input
) external payable returns (address newAddress);
function create2Account(
bytes32 _salt,
bytes32 _bytecodeHash,
bytes calldata _input,
AccountAbstractionVersion _aaVersion
) external payable returns (address newAddress);
/// @dev While the `_salt` parameter is not used anywhere here,
/// it is still needed for consistency between `create` and
/// `create2` functions (required by the compiler).
function create(
bytes32 _salt,
bytes32 _bytecodeHash,
bytes calldata _input
) external payable returns (address newAddress);
/// @dev While `_salt` is never used here, we leave it here as a parameter
/// for the consistency with the `create` function.
function createAccount(
bytes32 _salt,
bytes32 _bytecodeHash,
bytes calldata _input,
AccountAbstractionVersion _aaVersion
) external payable returns (address newAddress);
/// @notice Returns the information about a certain AA.
function getAccountInfo(address _address) external view returns (AccountInfo memory info);
/// @notice Can be called by an account to update its account version
function updateAccountVersion(AccountAbstractionVersion _version) external;
/// @notice Can be called by an account to update its nonce ordering
function updateNonceOrdering(AccountNonceOrdering _nonceOrdering) external;
}