diff --git a/.gitignore b/.gitignore index 432d98e..5eb3428 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ broadcast/ Makefile abi.json .vscode/ +zkout/ +foundryup-zksync diff --git a/.gitmodules b/.gitmodules index 7b363c2..280a332 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,4 +9,7 @@ [submodule "lib/murky"] path = lib/murky url = https://github.com/dmfxyz/murky - branch = main \ No newline at end of file + branch = main +[submodule "lib/era-contracts"] + path = lib/era-contracts + url = https://github.com/matter-labs/era-contracts diff --git a/Makefile b/Makefile index 1a63813..76ccba4 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ simulate-deploy: # For live deployment, add --broadcast --verify --delay 30 --etherscan-api-key ${ETHERSCAN_API_KEY} - forge script -vvv script/Deploy.s.sol --sig "run()" --rpc-url ${RPC_URL} --private-key ${PK} --broadcast --verify --delay 30 --etherscan-api-key ${ETHERSCAN_API_KEY} + forge script -vvv script/Deploy.s.sol --sig "run()" --rpc-url ${RPC_URL} --private-key ${PK} verify: - forge verify-contract 0x00000000000000447e69651d841bD8D104Bed493 src/DelegateRegistry.sol:DelegateRegistry --chain 81457 --etherscan-api-key ${ETHERSCAN_API_KEY} --retries 5 --delay 30 --watch + forge verify-contract 0x0000000059A24EB229eED07Ac44229DB56C5d797 src/DelegateRegistry.sol:DelegateRegistry --chain 11124 --etherscan-api-key ${ETHERSCAN_API_KEY} --retries 5 --delay 30 --watch --zksync + # forge verify-contract 0x0000000059A24EB229eED07Ac44229DB56C5d797 src/DelegateRegistry.sol:DelegateRegistry --retries 5 --delay 30 --watch --zksync --verifier-url https://api-sepolia.abscan.org/api --etherscan-api-key IEYKU3EEM5XCD76N7Y7HF9HG7M9ARZ2H4A cast-deploy-singlesig: cast send --rpc-url ${RPC_URL} --private-key ${PK} 0x0000000000ffe8b47b3e2130213b802212439497 0x64e03087000000000000000000000000000000000000000016c7768a8c7a2824b846321d00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000bf0608060405234801561001057600080fd5b50604051610bd0380380610bd083398101604081905261002f9161007d565b600080546001600160a01b0319166001600160a01b03831690811782556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506100ad565b60006020828403121561008f57600080fd5b81516001600160a01b03811681146100a657600080fd5b9392505050565b610b14806100bc6000396000f3fe6080604052600436106100915760003560e01c8063b61d27f611610063578063e30c39781161004b578063e30c397814610214578063f23a6e6114610241578063f2fde38b1461028757005b8063b61d27f6146101ac578063bc197c81146101cc57005b806301ffc9a71461009a578063150b7a02146100cf57806379ba5097146101455780638da5cb5b1461015a57005b3661009857005b005b3480156100a657600080fd5b506100ba6100b5366004610703565b6102a7565b60405190151581526020015b60405180910390f35b3480156100db57600080fd5b506101146100ea3660046107be565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016100c6565b34801561015157600080fd5b5061009861038c565b34801561016657600080fd5b506000546101879073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100c6565b3480156101b857600080fd5b506100ba6101c736600461085c565b6104cb565b3480156101d857600080fd5b506101146101e736600461098a565b7fbc197c810000000000000000000000000000000000000000000000000000000098975050505050505050565b34801561022057600080fd5b506001546101879073ffffffffffffffffffffffffffffffffffffffff1681565b34801561024d57600080fd5b5061011461025c366004610a45565b7ff23a6e61000000000000000000000000000000000000000000000000000000009695505050505050565b34801561029357600080fd5b506100986102a2366004610abd565b6105e6565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316148061033a57507f150b7a02000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061038657507f4e2312e0000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610438576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e6572000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6001546000805460405173ffffffffffffffffffffffffffffffffffffffff93841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600154600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610573576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6f776e6572000000000000000000000000000000000000000000000000000000606482015260840161042f565b8373ffffffffffffffffffffffffffffffffffffffff1683836040516105999190610ad8565b60006040518083038185875af1925050503d80600081146105d6576040519150601f19603f3d011682016040523d82523d6000602084013e6105db565b606091505b509095945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461068d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6f776e6572000000000000000000000000000000000000000000000000000000606482015260840161042f565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227009190a350565b60006020828403121561071557600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461074557600080fd5b9392505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461077057600080fd5b919050565b60008083601f84011261078757600080fd5b50813567ffffffffffffffff81111561079f57600080fd5b6020830191508360208285010111156107b757600080fd5b9250929050565b6000806000806000608086880312156107d657600080fd5b6107df8661074c565b94506107ed6020870161074c565b935060408601359250606086013567ffffffffffffffff81111561081057600080fd5b61081c88828901610775565b969995985093965092949392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060006060848603121561087157600080fd5b61087a8461074c565b925060208401359150604084013567ffffffffffffffff8082111561089e57600080fd5b818601915086601f8301126108b257600080fd5b8135818111156108c4576108c461082d565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561090a5761090a61082d565b8160405282815289602084870101111561092357600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60008083601f84011261095757600080fd5b50813567ffffffffffffffff81111561096f57600080fd5b6020830191508360208260051b85010111156107b757600080fd5b60008060008060008060008060a0898b0312156109a657600080fd5b6109af8961074c565b97506109bd60208a0161074c565b9650604089013567ffffffffffffffff808211156109da57600080fd5b6109e68c838d01610945565b909850965060608b01359150808211156109ff57600080fd5b610a0b8c838d01610945565b909650945060808b0135915080821115610a2457600080fd5b50610a318b828c01610775565b999c989b5096995094979396929594505050565b60008060008060008060a08789031215610a5e57600080fd5b610a678761074c565b9550610a756020880161074c565b94506040870135935060608701359250608087013567ffffffffffffffff811115610a9f57600080fd5b610aab89828a01610775565b979a9699509497509295939492505050565b600060208284031215610acf57600080fd5b6107458261074c565b6000825160005b81811015610af95760208186018101518583015201610adf565b50600092019182525091905056fea164736f6c6343000815000a0000000000000000000000006ed7d526b020780f694f3c10dfb25e1b134d321500000000000000000000000000000000 diff --git a/README.md b/README.md index 8e47bde..3ea82e6 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Frontend website interface at [delegate.xyz](https://delegate.xyz). Full docs at |Mainnet Chain|Address| |---|---| |Ethereum|[0x00000000000000447e69651d841bd8d104bed493](https://etherscan.io/address/0x00000000000000447e69651d841bd8d104bed493)| +|Animechain|[0x00000000000000447e69651d841bd8d104bed493](https://explorer.anime.xyz/address/0x00000000000000447e69651d841bD8D104Bed493)| |Apechain|[0x00000000000000447e69651d841bd8d104bed493](https://apescan.io/address/0x00000000000000447e69651d841bd8d104bed493)| |Arbitrum|[0x00000000000000447e69651d841bd8d104bed493](https://arbiscan.io/address/0x00000000000000447e69651d841bd8d104bed493)| |Arbitrum (Nova)|[0x00000000000000447e69651d841bd8d104bed493](https://nova.arbiscan.io/address/0x00000000000000447e69651d841bd8d104bed493)| @@ -21,13 +22,14 @@ Frontend website interface at [delegate.xyz](https://delegate.xyz). Full docs at |Fantom|[0x00000000000000447e69651d841bd8d104bed493](https://ftmscan.com/address/0x00000000000000447e69651d841bd8d104bed493)| |Gnosis|[0x00000000000000447e69651d841bd8d104bed493](https://gnosisscan.io/address/0x00000000000000447e69651d841bd8d104bed493)| |Hychain|[0x00000000000000447e69651d841bd8d104bed493](https://explorer.hychain.com/address/0x00000000000000447e69651d841bd8d104bed493)| -|Optimism|[0x00000000000000447e69651d841bd8d104bed493](https://optimistic.etherscan.io/address/0x00000000000000447e69651d841bd8d104bed493)| -|Polygon|[0x00000000000000447e69651d841bd8d104bed493](https://polygonscan.com/address/0x00000000000000447e69651d841bd8d104bed493)| -|Polygon zkEVM|[0x00000000000000447e69651d841bd8d104bed493](https://zkevm.polygonscan.com/address/0x00000000000000447e69651d841bd8d104bed493)| |Linea|[0x00000000000000447e69651d841bd8d104bed493](https://lineascan.build/address/0x00000000000000447e69651d841bd8d104bed493)| |Mantle|[0x00000000000000447e69651d841bd8d104bed493](https://explorer.mantle.xyz/address/0x00000000000000447e69651d841bd8d104bed493)| |Moonbeam|[0x00000000000000447e69651d841bd8d104bed493](https://moonscan.io/address/0x00000000000000447e69651d841bd8d104bed493)| |Moonriver|[0x00000000000000447e69651d841bd8d104bed493](https://moonriver.moonscan.io/address/0x00000000000000447e69651d841bd8d104bed493)| +|Optimism|[0x00000000000000447e69651d841bd8d104bed493](https://optimistic.etherscan.io/address/0x00000000000000447e69651d841bd8d104bed493)| +|Polygon|[0x00000000000000447e69651d841bd8d104bed493](https://polygonscan.com/address/0x00000000000000447e69651d841bd8d104bed493)| +|Polygon zkEVM|[0x00000000000000447e69651d841bd8d104bed493](https://zkevm.polygonscan.com/address/0x00000000000000447e69651d841bd8d104bed493)| +|Plume|[0x00000000000000447e69651d841bd8d104bed493](https://phoenix-explorer.plumenetwork.xyz/address/0x00000000000000447e69651d841bD8D104Bed493)| |Ronin|[0x00000000000000447e69651d841bd8d104bed493](https://app.roninchain.com/address/0x00000000000000447e69651d841bd8d104bed493)| |Sanko|[0x00000000000000447e69651d841bd8d104bed493](https://explorer.sanko.xyz/address/0x00000000000000447e69651d841bd8d104bed493)| |Scroll|[0x00000000000000447e69651d841bd8d104bed493](https://scrollscan.com/address/0x00000000000000447e69651d841bd8d104bed493)| @@ -38,12 +40,22 @@ Frontend website interface at [delegate.xyz](https://delegate.xyz). Full docs at |ZetaChain|[0x00000000000000447e69651d841bd8d104bed493](https://mainnet.explorer.zetachain.app/address/0x00000000000000447e69651d841bd8d104bed493)| |Zora|[0x00000000000000447e69651d841bd8d104bed493](https://explorer.zora.energy/address/0x00000000000000447e69651d841bd8d104bed493)| +|ZKSync Chain|Address| +|---|---| +|Abstract (Sepolia)|[0x0000000059A24EB229eED07Ac44229DB56C5d797](https://sepolia.abscan.org/address/0x0000000059A24EB229eED07Ac44229DB56C5d797)| +|ZKsync Era|[0x0000000059A24EB229eED07Ac44229DB56C5d797](https://holesky.etherscan.io/address/0x00000000000000447e69651d841bd8d104bed493)| +|Treasure|[0x0000000059A24EB229eED07Ac44229DB56C5d797](https://sepolia.basescan.org/address/0x00000000000000447e69651d841bd8d104bed493)| |Testnet Chain|Address| |---|---| |Ethereum (Sepolia)|[0x00000000000000447e69651d841bd8d104bed493](https://sepolia.etherscan.io/address/0x00000000000000447e69651d841bd8d104bed493)| |Ethereum (Holesky)|[0x00000000000000447e69651d841bd8d104bed493](https://holesky.etherscan.io/address/0x00000000000000447e69651d841bd8d104bed493)| +|Abstract (Sepolia)|[0x00000000000000447e69651d841bd8d104bed493](https://sepolia.abscan.org/address/0x00000000000000447e69651d841bd8d104bed493)| |Base (Sepolia)|[0x00000000000000447e69651d841bd8d104bed493](https://sepolia.basescan.org/address/0x00000000000000447e69651d841bd8d104bed493)| +|Berachain bArtio|[0x00000000000000447e69651d841bd8d104bed493](https://bartio.beratrail.io/address/0x00000000000000447e69651d841bD8D104Bed493)| +|Monad|[0x00000000000000447e69651d841bd8d104bed493](https://testnet.monadexplorer.com/address/0x00000000000000447e69651d841bD8D104Bed493)| +|Ronin (Saigon)|[0x00000000000000447e69651d841bd8d104bed493](https://saigon-app.roninchain.com/address/0x00000000000000447e69651d841bd8d104bed493)| + If you'd like to get the DelegateRegistry on another EVM chain, anyone in the community can deploy to the same address! Simply run the script in [Deploy.s.sol](script/Deploy.s.sol) with the specified salt. The CREATE2 factory must be deployed at `0x0000000000FFe8B47B3e2130213B802212439497`, but this factory exists on 19 separate chains so shouldn't be an issue. If you've run a community deployment, open a PR adding the link to the above table. diff --git a/foundry.toml b/foundry.toml index b126fb9..a0a7405 100644 --- a/foundry.toml +++ b/foundry.toml @@ -3,6 +3,11 @@ src = 'src' out = 'out' libs = ['lib'] +# zksync specific +fallback_oz = true +is_system = false # Note: NonceHolder and the ContractDeployer system contracts can only be called with a special isSystem flag as true +mode = "3" + auto_detect_remappings = false # remappings = [] diff --git a/gasbenchmark200 b/gasbenchmark200 deleted file mode 100644 index cacb1a7..0000000 --- a/gasbenchmark200 +++ /dev/null @@ -1,11 +0,0 @@ -| src/DelegationRegistry.sol:DelegationRegistry contract | | | | | | -|--------------------------------------------------------|-----------------|--------|--------|--------|---------| -| Deployment Cost | Deployment Size | | | | | -| 1247295 | 6262 | | | | | -| Function Name | min | avg | median | max | # calls | -| checkDelegateForAll | 7588 | 7588 | 7588 | 7588 | 2 | -| checkDelegateForContract | 4786 | 7786 | 7786 | 10786 | 2 | -| checkDelegateForToken | 8186 | 11186 | 11186 | 14186 | 2 | -| delegateForAll | 190137 | 190137 | 190137 | 190137 | 1 | -| delegateForContract | 210458 | 210458 | 210458 | 210458 | 1 | -| delegateForToken | 230841 | 230841 | 230841 | 230841 | 1 | \ No newline at end of file diff --git a/gasreport200 b/gasreport200 deleted file mode 100644 index 79e0e0e..0000000 --- a/gasreport200 +++ /dev/null @@ -1,20 +0,0 @@ -| src/DelegationRegistry.sol:DelegationRegistry contract | | | | | | -|--------------------------------------------------------|-----------------|--------|--------|--------|---------| -| Deployment Cost | Deployment Size | | | | | -| 1247295 | 6262 | | | | | -| Function Name | min | avg | median | max | # calls | -| checkDelegateForAll | 1588 | 2338 | 1588 | 3588 | 8 | -| checkDelegateForContract | 1706 | 3417 | 4786 | 4786 | 9 | -| checkDelegateForToken | 1978 | 4594 | 5645 | 8186 | 10 | -| delegateForAll | 5216 | 150923 | 167237 | 190137 | 20 | -| delegateForContract | 5553 | 139465 | 162658 | 210458 | 19 | -| delegateForToken | 5940 | 157903 | 183041 | 230841 | 20 | -| getContractLevelDelegations | 3221 | 7964 | 8211 | 10534 | 6 | -| getDelegatesForAll | 3273 | 5350 | 5026 | 7730 | 6 | -| getDelegatesForContract | 1353 | 5728 | 6649 | 8260 | 4 | -| getDelegatesForToken | 1377 | 6140 | 7140 | 8906 | 4 | -| getDelegationsByDelegate | 9526 | 13364 | 13917 | 18051 | 8 | -| getTokenLevelDelegations | 3200 | 9378 | 10121 | 11861 | 6 | -| revokeAllDelegates | 21478 | 21478 | 21478 | 21478 | 4 | -| revokeDelegate | 22131 | 22131 | 22131 | 22131 | 4 | -| revokeSelf | 22133 | 22133 | 22133 | 22133 | 1 | \ No newline at end of file diff --git a/lib/era-contracts b/lib/era-contracts new file mode 160000 index 0000000..3288adb --- /dev/null +++ b/lib/era-contracts @@ -0,0 +1 @@ +Subproject commit 3288adb0aee6c1c3022f6c817f95234764e0d611 diff --git a/remappings.txt b/remappings.txt index 16e2a3c..52a2ea2 100644 --- a/remappings.txt +++ b/remappings.txt @@ -1,4 +1,5 @@ ds-test/=lib/forge-std/lib/ds-test/src/ forge-std/=lib/forge-std/src/ murky/=lib/murky/src/ -openzeppelin/=lib/openzeppelin-contracts/contracts/ \ No newline at end of file +openzeppelin/=lib/openzeppelin-contracts/contracts/ +era-contracts=lib/era-contracts/ \ No newline at end of file diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol index ece1dfd..614c95a 100644 --- a/script/Deploy.s.sol +++ b/script/Deploy.s.sol @@ -6,17 +6,33 @@ import {console2} from "forge-std/console2.sol"; import {DelegateRegistry} from "../src/DelegateRegistry.sol"; import {Singlesig} from "../src/singlesig/Singlesig.sol"; +import {Create2Factory} from "era-contracts/system-contracts/contracts/Create2Factory.sol"; +import {ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT, CREATE2_PREFIX} from "era-contracts/system-contracts/contracts/Constants.sol"; + interface ImmutableCreate2Factory { function safeCreate2(bytes32 salt, bytes calldata initCode) external payable returns (address deploymentAddress); function findCreate2Address(bytes32 salt, bytes calldata initCode) external view returns (address deploymentAddress); function findCreate2AddressViaHash(bytes32 salt, bytes32 initCodeHash) external view returns (address deploymentAddress); } +interface ZksyncCreate2Factory { + function create2(bytes32 salt, bytes32 bytecodeHash, bytes calldata constructorInput) external payable returns (address deploymentAddress); + function getNewAddressCreate2(address _sender, bytes32 _bytecodeHash, bytes32 _salt, bytes calldata _input) external view returns (address newAddress); +} + contract Deploy is Script { + address immutable firstOwner = 0x6Ed7D526b020780f694f3c10Dfb25E1b134D3215; + + Create2Factory immutable zksyncCreateFactory = Create2Factory(0x0000000000000000000000000000000000010000); + ZksyncCreate2Factory immutable zksyncContractDeployer = ZksyncCreate2Factory(0x0000000000000000000000000000000000008006); + ImmutableCreate2Factory immutable factory = ImmutableCreate2Factory(0x0000000000FFe8B47B3e2130213B802212439497); bytes initCode = type(DelegateRegistry).creationCode; - // bytes32 salt = 0x0000000000000000000000000000000000000000fbe49ecfc3decb1164228b89; - bytes32 salt = 0x00000000000000000000000000000000000000002bbc593dd77cb93fbb932d5f; + // bytes32 singlesigSalt = 0x0000000000000000000000000000000000000000fbe49ecfc3decb1164228b89; + // bytes32 registrySalt = 0x00000000000000000000000000000000000000002bbc593dd77cb93fbb932d5f; + + bytes32 zkSinglesigSalt = 0x000000000000000000000000000000000000000091430a7ea982667861000090; + bytes32 zkRegistrySalt = 0x000000000000000000000000000000000000000077151a04325c7971a80c00a0; // bytes initCode = abi.encodePacked(type(Singlesig).creationCode, abi.encode(address(0x6Ed7D526b020780f694f3c10Dfb25E1b134D3215))); // bytes32 salt = 0x000000000000000000000000000000000000000016c7768a8c7a2824b846321d; @@ -24,13 +40,49 @@ contract Deploy is Script { function run() external { vm.startBroadcast(); - // address singlesigAddress = factory.safeCreate2(salt, initCode); - // Singlesig singlesig = Singlesig(payable(singlesigAddress)); - // console2.log(address(singlesig)); + // Singlesig predeploySinglesig = new Singlesig{salt: zkSinglesigSalt}(firstOwner); + // bytes32 singlesigZKBytecodeHash = ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.getRawCodeHash(address(predeploySinglesig)); + // bytes32 constructorHash = keccak256(abi.encode(firstOwner)); + // console2.log(address(predeploySinglesig)); + // console2.logBytes(abi.encode(firstOwner)); + // console2.logBytes32(singlesigZKBytecodeHash); + // console2.logBytes32(constructorHash); + // bytes memory preimage = bytes.concat(CREATE2_PREFIX, bytes32(uint256(uint160(address(zksyncCreateFactory)))), zkSinglesigSalt, singlesigZKBytecodeHash, constructorHash); + // console2.logBytes(preimage); + + // -------- + + // DelegateRegistry existing = DelegateRegistry(0x6b176c958fb89Ddca0fc8214150DA4c4D0a32fbe); + // bytes32[] memory hashes = existing.getOutgoingDelegationHashes(0x86362a4C99d900D72d787Ef1BddA38Fd318aa5E9); + // console2.logBytes32(hashes[0]); - address registryAddress = factory.safeCreate2(salt, initCode); - DelegateRegistry registry = DelegateRegistry(registryAddress); - console2.log(address(registry)); + DelegateRegistry saltDeploy = new DelegateRegistry{salt: zkRegistrySalt}(); + console2.logBytes32(keccak256("")); + console2.log(address(saltDeploy)); + + // DelegateRegistry predeploy = new DelegateRegistry(); + + // bytes32 bytecodeHash = keccak256(initCode); + bytes32 zkBytecodeHash = ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.getRawCodeHash(address(saltDeploy)); + + // console2.logBytes32(bytecodeHash); + console2.logBytes32(zkBytecodeHash); + console2.log(msg.sender); + console2.logBytes32(zkRegistrySalt); + bytes memory preimage = bytes.concat(CREATE2_PREFIX, bytes32(uint256(uint160(address(zksyncCreateFactory)))), zkRegistrySalt, zkBytecodeHash, keccak256("")); + console2.logBytes(preimage); + address localRegistryAddress = address( + uint160(uint256(keccak256(bytes.concat(CREATE2_PREFIX, bytes32(uint256(uint160(address(zksyncCreateFactory)))), zkRegistrySalt, zkBytecodeHash, keccak256(""))))) + ); + console2.log(localRegistryAddress); + address registryAddress = zksyncContractDeployer.getNewAddressCreate2(address(zksyncCreateFactory), zkBytecodeHash, zkRegistrySalt, ""); + console2.log(registryAddress); + + // zksyncCreateFactory.create2(registrySalt, zkBytecodeHash, ""); + + // address registryAddress = factory.safeCreate2(registrySalt, initCode); + // DelegateRegistry registry = DelegateRegistry(registryAddress); + // console2.log(address(registry)); // address registryAddress = factory.safeCreate2(salt, initCode); // DelegateRegistry registry = DelegateRegistry(registryAddress); diff --git a/src/DelegateRegistry.sol b/src/DelegateRegistry.sol index 7d3b595..6987c04 100644 --- a/src/DelegateRegistry.sol +++ b/src/DelegateRegistry.sol @@ -151,7 +151,7 @@ contract DelegateRegistry is IDelegateRegistry { function sweep() external { assembly ("memory-safe") { // This hardcoded address is a CREATE2 factory counterfactual smart contract wallet that will always accept native token transfers - let result := call(gas(), 0x000000dE1E80ea5a234FB5488fee2584251BC7e8, selfbalance(), 0, 0, 0, 0) + let result := call(gas(), 0x000000aA2a733BB7bB003b0339859907d5D87320, selfbalance(), 0, 0, 0, 0) } }