Skip to content

Commit 61d2097

Browse files
committed
calldata contract code
1 parent 337b0f9 commit 61d2097

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

contracts/script/deploy/AllAtomic.s.sol

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,48 @@ contract AtomicDeployer {
9898
genesisStateRoot = _genesisStateRoot;
9999
}
100100

101-
function deploy(bytes32 salt) external onlyOwner returns (address, address, address, address) {
101+
function deploy(
102+
bytes32 salt,
103+
bytes calldata iproveCode,
104+
bytes calldata governorCode
105+
) external onlyOwner returns (address, address, address, address) {
102106
address STAKING;
103107
{
104-
STAKING = address(
105-
SuccinctStaking(payable(address(new ERC1967Proxy{salt: salt}(stakingImpl, ""))))
106-
);
108+
STAKING = address(new ERC1967Proxy{salt: salt}(stakingImpl, ""));
107109
}
108110

109111
address I_PROVE;
110112
{
111-
I_PROVE = address(new IntermediateSuccinct{salt: salt}(prove, STAKING));
113+
// I_PROVE = address(new IntermediateSuccinct{salt: salt}(prove, STAKING));
114+
bytes memory args = abi.encode(prove, STAKING);
115+
bytes memory initCode = abi.encodePacked(iproveCode, args);
116+
117+
assembly {
118+
I_PROVE := create2(0, add(initCode, 0x20), mload(initCode), salt)
119+
if iszero(extcodesize(I_PROVE)) {
120+
revert(0, 0)
121+
}
122+
}
112123
}
113124

114125
address GOVERNOR;
115126
{
116-
GOVERNOR = address(
117-
new SuccinctGovernor{salt: salt}(
118-
I_PROVE, votingDelay, votingPeriod, proposalThreshold, quorumFraction
119-
)
127+
// GOVERNOR = address(
128+
// new SuccinctGovernor{salt: salt}(
129+
// I_PROVE, votingDelay, votingPeriod, proposalThreshold, quorumFraction
130+
// )
131+
// );
132+
bytes memory args = abi.encode(
133+
I_PROVE, votingDelay, votingPeriod, proposalThreshold, quorumFraction
120134
);
135+
bytes memory initCode = abi.encodePacked(governorCode, args);
136+
137+
assembly {
138+
GOVERNOR := create2(0, add(initCode, 0x20), mload(initCode), salt)
139+
if iszero(extcodesize(GOVERNOR)) {
140+
revert(0, 0)
141+
}
142+
}
121143
}
122144

123145
address VAPP;
@@ -140,9 +162,7 @@ contract AtomicDeployer {
140162
)
141163
);
142164
}
143-
VAPP = address(
144-
SuccinctVApp(payable(address(new ERC1967Proxy{salt: salt}(vappImpl, vappInitData))))
145-
);
165+
VAPP = address(new ERC1967Proxy{salt: salt}(vappImpl, vappInitData));
146166
}
147167

148168
SuccinctStaking(STAKING).initialize(
@@ -217,7 +237,7 @@ contract AllAtomicScript is BaseScript, FixtureLoader {
217237
);
218238
}
219239
(address STAKING, address VAPP, address I_PROVE, address GOVERNOR) =
220-
deployer.deploy(salt);
240+
deployer.deploy(salt, type(IntermediateSuccinct).creationCode, type(SuccinctGovernor).creationCode);
221241
writeAddress("STAKING", STAKING);
222242
writeAddress("VAPP", VAPP);
223243
writeAddress("I_PROVE", I_PROVE);

0 commit comments

Comments
 (0)