|
| 1 | +// SPDX-License-Identifier: AGPL-3.0-only |
| 2 | +pragma solidity ^0.8.4; |
| 3 | + |
| 4 | +/** |
| 5 | + * @title CreateX Factory Interface Definition |
| 6 | + * @author pcaversaccio (https://web.archive.org/web/20230921103111/https://pcaversaccio.com/) |
| 7 | + * @custom:coauthor Matt Solomon (https://web.archive.org/web/20230921103335/https://mattsolomon.dev/) |
| 8 | + */ |
| 9 | +interface ICreateX { |
| 10 | + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 11 | + /* TYPES */ |
| 12 | + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 13 | + |
| 14 | + struct Values { |
| 15 | + uint256 constructorAmount; |
| 16 | + uint256 initCallAmount; |
| 17 | + } |
| 18 | + |
| 19 | + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 20 | + /* EVENTS */ |
| 21 | + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 22 | + |
| 23 | + event ContractCreation(address indexed newContract, bytes32 indexed salt); |
| 24 | + event ContractCreation(address indexed newContract); |
| 25 | + event Create3ProxyContractCreation( |
| 26 | + address indexed newContract, |
| 27 | + bytes32 indexed salt |
| 28 | + ); |
| 29 | + |
| 30 | + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 31 | + /* CUSTOM ERRORS */ |
| 32 | + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 33 | + |
| 34 | + error FailedContractCreation(address emitter); |
| 35 | + error FailedContractInitialisation(address emitter, bytes revertData); |
| 36 | + error InvalidSalt(address emitter); |
| 37 | + error InvalidNonceValue(address emitter); |
| 38 | + error FailedEtherTransfer(address emitter, bytes revertData); |
| 39 | + |
| 40 | + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 41 | + /* CREATE */ |
| 42 | + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 43 | + |
| 44 | + function deployCreate(bytes memory initCode) |
| 45 | + external |
| 46 | + payable |
| 47 | + returns (address newContract); |
| 48 | + |
| 49 | + function deployCreateAndInit( |
| 50 | + bytes memory initCode, |
| 51 | + bytes memory data, |
| 52 | + Values memory values, |
| 53 | + address refundAddress |
| 54 | + ) external payable returns (address newContract); |
| 55 | + |
| 56 | + function deployCreateAndInit( |
| 57 | + bytes memory initCode, |
| 58 | + bytes memory data, |
| 59 | + Values memory values |
| 60 | + ) external payable returns (address newContract); |
| 61 | + |
| 62 | + function deployCreateClone(address implementation, bytes memory data) |
| 63 | + external |
| 64 | + payable |
| 65 | + returns (address proxy); |
| 66 | + |
| 67 | + function computeCreateAddress(address deployer, uint256 nonce) |
| 68 | + external |
| 69 | + view |
| 70 | + returns (address computedAddress); |
| 71 | + |
| 72 | + function computeCreateAddress(uint256 nonce) |
| 73 | + external |
| 74 | + view |
| 75 | + returns (address computedAddress); |
| 76 | + |
| 77 | + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 78 | + /* CREATE2 */ |
| 79 | + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 80 | + |
| 81 | + function deployCreate2(bytes32 salt, bytes memory initCode) |
| 82 | + external |
| 83 | + payable |
| 84 | + returns (address newContract); |
| 85 | + |
| 86 | + function deployCreate2(bytes memory initCode) |
| 87 | + external |
| 88 | + payable |
| 89 | + returns (address newContract); |
| 90 | + |
| 91 | + function deployCreate2AndInit( |
| 92 | + bytes32 salt, |
| 93 | + bytes memory initCode, |
| 94 | + bytes memory data, |
| 95 | + Values memory values, |
| 96 | + address refundAddress |
| 97 | + ) external payable returns (address newContract); |
| 98 | + |
| 99 | + function deployCreate2AndInit( |
| 100 | + bytes32 salt, |
| 101 | + bytes memory initCode, |
| 102 | + bytes memory data, |
| 103 | + Values memory values |
| 104 | + ) external payable returns (address newContract); |
| 105 | + |
| 106 | + function deployCreate2AndInit( |
| 107 | + bytes memory initCode, |
| 108 | + bytes memory data, |
| 109 | + Values memory values, |
| 110 | + address refundAddress |
| 111 | + ) external payable returns (address newContract); |
| 112 | + |
| 113 | + function deployCreate2AndInit( |
| 114 | + bytes memory initCode, |
| 115 | + bytes memory data, |
| 116 | + Values memory values |
| 117 | + ) external payable returns (address newContract); |
| 118 | + |
| 119 | + function deployCreate2Clone( |
| 120 | + bytes32 salt, |
| 121 | + address implementation, |
| 122 | + bytes memory data |
| 123 | + ) external payable returns (address proxy); |
| 124 | + |
| 125 | + function deployCreate2Clone(address implementation, bytes memory data) |
| 126 | + external |
| 127 | + payable |
| 128 | + returns (address proxy); |
| 129 | + |
| 130 | + function computeCreate2Address( |
| 131 | + bytes32 salt, |
| 132 | + bytes32 initCodeHash, |
| 133 | + address deployer |
| 134 | + ) external pure returns (address computedAddress); |
| 135 | + |
| 136 | + function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) |
| 137 | + external |
| 138 | + view |
| 139 | + returns (address computedAddress); |
| 140 | + |
| 141 | + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 142 | + /* CREATE3 */ |
| 143 | + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 144 | + |
| 145 | + function deployCreate3(bytes32 salt, bytes memory initCode) |
| 146 | + external |
| 147 | + payable |
| 148 | + returns (address newContract); |
| 149 | + |
| 150 | + function deployCreate3(bytes memory initCode) |
| 151 | + external |
| 152 | + payable |
| 153 | + returns (address newContract); |
| 154 | + |
| 155 | + function deployCreate3AndInit( |
| 156 | + bytes32 salt, |
| 157 | + bytes memory initCode, |
| 158 | + bytes memory data, |
| 159 | + Values memory values, |
| 160 | + address refundAddress |
| 161 | + ) external payable returns (address newContract); |
| 162 | + |
| 163 | + function deployCreate3AndInit( |
| 164 | + bytes32 salt, |
| 165 | + bytes memory initCode, |
| 166 | + bytes memory data, |
| 167 | + Values memory values |
| 168 | + ) external payable returns (address newContract); |
| 169 | + |
| 170 | + function deployCreate3AndInit( |
| 171 | + bytes memory initCode, |
| 172 | + bytes memory data, |
| 173 | + Values memory values, |
| 174 | + address refundAddress |
| 175 | + ) external payable returns (address newContract); |
| 176 | + |
| 177 | + function deployCreate3AndInit( |
| 178 | + bytes memory initCode, |
| 179 | + bytes memory data, |
| 180 | + Values memory values |
| 181 | + ) external payable returns (address newContract); |
| 182 | + |
| 183 | + function computeCreate3Address(bytes32 salt, address deployer) |
| 184 | + external |
| 185 | + pure |
| 186 | + returns (address computedAddress); |
| 187 | + |
| 188 | + function computeCreate3Address(bytes32 salt) |
| 189 | + external |
| 190 | + view |
| 191 | + returns (address computedAddress); |
| 192 | +} |
0 commit comments