@@ -6,6 +6,9 @@ import {console2} from "forge-std/console2.sol";
66import {DelegateRegistry} from "../src/DelegateRegistry.sol " ;
77import {Singlesig} from "../src/singlesig/Singlesig.sol " ;
88
9+ import {Create2Factory} from "era-contracts/system-contracts/contracts/Create2Factory.sol " ;
10+ import {ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT} from "era-contracts/system-contracts/contracts/Constants.sol " ;
11+
912interface ImmutableCreate2Factory {
1013 function safeCreate2 (bytes32 salt , bytes calldata initCode ) external payable returns (address deploymentAddress );
1114 function findCreate2Address (bytes32 salt , bytes calldata initCode ) external view returns (address deploymentAddress );
@@ -23,13 +26,14 @@ interface ZksyncCreate2Factory {
2326}
2427
2528contract Deploy is Script {
26- ZksyncCreate2Factory immutable zksyncCreateFactory = ZksyncCreate2Factory (0x0000000000000000000000000000000000010000 );
29+ // ZksyncCreate2Factory immutable zksyncCreateFactory = ZksyncCreate2Factory(0x0000000000000000000000000000000000010000);
30+ Create2Factory immutable zksyncCreateFactory = Create2Factory (0x0000000000000000000000000000000000010000 );
2731 ZksyncCreate2Factory immutable zksyncContractDeployer = ZksyncCreate2Factory (0x0000000000000000000000000000000000008006 );
2832
2933 ImmutableCreate2Factory immutable factory = ImmutableCreate2Factory (0x0000000000FFe8B47B3e2130213B802212439497 );
3034 bytes initCode = type (DelegateRegistry).creationCode;
3135 // bytes32 singlesigSalt = 0x0000000000000000000000000000000000000000fbe49ecfc3decb1164228b89;
32- bytes32 registrySalt = 0x10000000000000000000000000000000000000002bbc593dd77cb93fbb932d5f ;
36+ bytes32 registrySalt = 0x00000000000000000000000000000000000000002bbc593dd77cb93fbb932d5f ;
3337
3438 // bytes initCode = abi.encodePacked(type(Singlesig).creationCode, abi.encode(address(0x6Ed7D526b020780f694f3c10Dfb25E1b134D3215)));
3539 // bytes32 salt = 0x000000000000000000000000000000000000000016c7768a8c7a2824b846321d;
@@ -45,15 +49,23 @@ contract Deploy is Script {
4549 // bytes32[] memory hashes = existing.getOutgoingDelegationHashes(0x86362a4C99d900D72d787Ef1BddA38Fd318aa5E9);
4650 // console2.logBytes32(hashes[0]);
4751
52+ DelegateRegistry saltDeploy = new DelegateRegistry {salt: registrySalt}();
53+ console2.log (address (saltDeploy));
54+
4855 DelegateRegistry predeploy = new DelegateRegistry ();
56+
57+ bytes32 bytecodeHash = keccak256 (initCode);
58+ bytes32 zkBytecodeHash = ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.getRawCodeHash (address (predeploy));
59+
60+ console2.logBytes32 (bytecodeHash);
61+ console2.logBytes32 (zkBytecodeHash);
4962 console2.log (address (predeploy));
5063 console2.log (msg .sender );
51- console2.logBytes32 (keccak256 (initCode));
5264 console2.logBytes32 (registrySalt);
53- address registryAddress = zksyncContractDeployer.getNewAddressCreate2 (address (zksyncCreateFactory), keccak256 (initCode) , registrySalt, "" );
65+ address registryAddress = zksyncContractDeployer.getNewAddressCreate2 (address (zksyncCreateFactory), zkBytecodeHash , registrySalt, "" );
5466 console2.log (registryAddress);
55- bytes memory constructorInput = "" ;
56- zksyncCreateFactory.create2 (registrySalt, keccak256 (initCode), constructorInput );
67+
68+ // zksyncCreateFactory.create2(registrySalt, zkBytecodeHash, "" );
5769
5870 // address registryAddress = factory.safeCreate2(registrySalt, initCode);
5971 // DelegateRegistry registry = DelegateRegistry(registryAddress);
0 commit comments