@@ -13,36 +13,8 @@ import {ERC1967Proxy} from
1313import {SP1VerifierGateway} from "../../lib/sp1-contracts/contracts/src/SP1VerifierGateway.sol " ;
1414import {SP1Verifier} from "../../lib/sp1-contracts/contracts/src/v5.0.0/SP1VerifierGroth16.sol " ;
1515
16- struct AtomicDeployerParams {
17- // Staking proxy param
18- address stakingImpl;
19-
20- // IntermediateSuccinct param
21- address prove;
22-
23- // Governor params
24- uint48 votingDelay;
25- uint32 votingPeriod;
26- uint256 proposalThreshold;
27- uint256 quorumFraction;
28-
29- address vappImpl;
30- address owner;
31- address auctioneer;
32- address verifier;
33- uint256 minDepositAmount;
34- bytes32 vkey;
35- bytes32 genesisStateRoot;
36- address dispenser;
37- uint256 minStakeAmount;
38- uint256 maxUnstakeRequests;
39- uint256 unstakePeriod;
40- uint256 slashCancellationPeriod;
41- bytes32 salt;
42- }
43-
4416contract AtomicDeployer {
45- // Staking proxy param
17+ // Staking proxy param
4618 address public stakingImpl;
4719
4820 // IntermediateSuccinct param
@@ -141,9 +113,11 @@ contract AtomicDeployer {
141113
142114 address GOVERNOR;
143115 {
144- GOVERNOR = address (new SuccinctGovernor {salt: salt}(
145- I_PROVE, votingDelay, votingPeriod, proposalThreshold, quorumFraction
146- ));
116+ GOVERNOR = address (
117+ new SuccinctGovernor {salt: salt}(
118+ I_PROVE, votingDelay, votingPeriod, proposalThreshold, quorumFraction
119+ )
120+ );
147121 }
148122
149123 address VAPP;
@@ -152,19 +126,19 @@ contract AtomicDeployer {
152126 bytes memory vappInitData;
153127 {
154128 vappInitData = abi.encodeCall (
155- SuccinctVApp.initialize,
156- (
157- owner,
158- prove,
159- I_PROVE,
160- auctioneer,
161- STAKING,
162- verifier,
163- minDepositAmount,
164- vkey,
165- genesisStateRoot
166- )
167- );
129+ SuccinctVApp.initialize,
130+ (
131+ owner,
132+ prove,
133+ I_PROVE,
134+ auctioneer,
135+ STAKING,
136+ verifier,
137+ minDepositAmount,
138+ vkey,
139+ genesisStateRoot
140+ )
141+ );
168142 }
169143 VAPP = address (
170144 SuccinctVApp (payable (address (new ERC1967Proxy {salt: salt}(vappImpl, vappInitData))))
@@ -198,10 +172,11 @@ contract AllAtomicScript is BaseScript, FixtureLoader {
198172 address STAKING_IMPL = address (new SuccinctStaking {salt: salt}());
199173
200174 // Deploy contracts
201- address PROVE = address (new Succinct {salt: salt}(OWNER));
202- (address VERIFIER , address VAPP_IMPL ) =
203- _deployVAppImpl (salt, OWNER);
175+ address PROVE = readAddress ("PROVE " );
176+ address VERIFIER = readAddress ("VERIFIER " );
204177
178+ address VAPP_IMPL = address (new SuccinctVApp {salt: salt}());
179+
205180 {
206181 AtomicDeployer deployer = new AtomicDeployer ();
207182 {
@@ -223,12 +198,7 @@ contract AllAtomicScript is BaseScript, FixtureLoader {
223198 uint256 MIN_DEPOSIT_AMOUNT = readUint256 ("MIN_DEPOSIT_AMOUNT " );
224199 bytes32 VKEY = readBytes32 ("VKEY " );
225200 deployer.setParams2 (
226- VAPP_IMPL,
227- OWNER,
228- AUCTIONEER,
229- VERIFIER,
230- MIN_DEPOSIT_AMOUNT,
231- VKEY
201+ VAPP_IMPL, OWNER, AUCTIONEER, VERIFIER, MIN_DEPOSIT_AMOUNT, VKEY
232202 );
233203 }
234204 {
@@ -247,7 +217,8 @@ contract AllAtomicScript is BaseScript, FixtureLoader {
247217 GENESIS_STATE_ROOT
248218 );
249219 }
250- (address STAKING , address VAPP , address I_PROVE , address GOVERNOR ) = deployer.deploy (salt);
220+ (address STAKING , address VAPP , address I_PROVE , address GOVERNOR ) =
221+ deployer.deploy (salt);
251222 writeAddress ("STAKING " , STAKING);
252223 writeAddress ("VAPP " , VAPP);
253224 writeAddress ("I_PROVE " , I_PROVE);
@@ -260,77 +231,4 @@ contract AllAtomicScript is BaseScript, FixtureLoader {
260231 writeAddress ("VAPP_IMPL " , VAPP_IMPL);
261232 writeAddress ("PROVE " , PROVE);
262233 }
263-
264- /// @dev This is a stack-too-deep workaround.
265- function _deployGovernor (bytes32 salt , address I_PROVE ) internal returns (address ) {
266- uint48 VOTING_DELAY = readUint48 ("VOTING_DELAY " );
267- uint32 VOTING_PERIOD = readUint32 ("VOTING_PERIOD " );
268- uint256 PROPOSAL_THRESHOLD = readUint256 ("PROPOSAL_THRESHOLD " );
269- uint256 QUORUM_FRACTION = readUint256 ("QUORUM_FRACTION " );
270-
271- return address (
272- new SuccinctGovernor {salt: salt}(
273- I_PROVE, VOTING_DELAY, VOTING_PERIOD, PROPOSAL_THRESHOLD, QUORUM_FRACTION
274- )
275- );
276- }
277-
278- /// @dev This is a stack-too-deep workaround.
279- function _deployVAppImpl (
280- bytes32 salt ,
281- address OWNER
282- ) internal returns (address , address ) {
283- // Read config
284- address VERIFIER = readAddress ("VERIFIER " );
285-
286- // If the verifier is not provided, deploy the SP1VerifierGateway and add v5.0.0 Groth16 SP1Verifier to it
287- if (VERIFIER == address (0 )) {
288- VERIFIER = address (new SP1VerifierGateway {salt: salt}(OWNER));
289- address groth16 = address (new SP1Verifier {salt: salt}());
290- SP1VerifierGateway (VERIFIER).addRoute (groth16);
291- }
292-
293- // Deploy contract
294- address VAPP_IMPL = address (new SuccinctVApp {salt: salt}());
295-
296- return (VERIFIER, VAPP_IMPL);
297- }
298-
299- /// @dev Deploys the staking contract as a proxy but does not initialize it.
300- function _deployStakingAsProxy (bytes32 salt ) internal returns (address , address ) {
301- address STAKING_IMPL = address (new SuccinctStaking {salt: salt}());
302- address STAKING = address (
303- SuccinctStaking (payable (address (new ERC1967Proxy {salt: salt}(STAKING_IMPL, "" ))))
304- );
305- return (STAKING, STAKING_IMPL);
306- }
307-
308- /// @dev This is a stack-too-deep workaround.
309- function _initializeStaking (
310- address OWNER ,
311- address STAKING ,
312- address GOVERNOR ,
313- address VAPP ,
314- address PROVE ,
315- address I_PROVE
316- ) internal {
317- address DISPENSER = readAddress ("DISPENSER " );
318- uint256 MIN_STAKE_AMOUNT = readUint256 ("MIN_STAKE_AMOUNT " );
319- uint256 MAX_UNSTAKE_REQUESTS = readUint256 ("MAX_UNSTAKE_REQUESTS " );
320- uint256 UNSTAKE_PERIOD = readUint256 ("UNSTAKE_PERIOD " );
321- uint256 SLASH_CANCELLATION_PERIOD = readUint256 ("SLASH_CANCELLATION_PERIOD " );
322-
323- SuccinctStaking (STAKING).initialize (
324- OWNER,
325- GOVERNOR,
326- VAPP,
327- PROVE,
328- I_PROVE,
329- DISPENSER,
330- MIN_STAKE_AMOUNT,
331- MAX_UNSTAKE_REQUESTS,
332- UNSTAKE_PERIOD,
333- SLASH_CANCELLATION_PERIOD
334- );
335- }
336234}
0 commit comments