@@ -6,179 +6,12 @@ import {SuccinctStaking} from "../../src/SuccinctStaking.sol";
66import {SuccinctVApp} from "../../src/SuccinctVApp.sol " ;
77import {IntermediateSuccinct} from "../../src/tokens/IntermediateSuccinct.sol " ;
88import {SuccinctGovernor} from "../../src/SuccinctGovernor.sol " ;
9- import {Succinct} from "../../src/tokens/Succinct.sol " ;
10- import {FixtureLoader} from "../../test/utils/FixtureLoader.sol " ;
9+ import {AtomicDeployer} from "../utils/AtomicDeployer.sol " ;
1110import {ERC1967Proxy } from
1211 "../../lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol " ;
13- import {SP1VerifierGateway} from "../../lib/sp1-contracts/contracts/src/SP1VerifierGateway.sol " ;
14- import {SP1Verifier} from "../../lib/sp1-contracts/contracts/src/v5.0.0/SP1VerifierGroth16.sol " ;
15-
16- contract AtomicDeployer {
17- // Staking proxy param
18- address public stakingImpl;
19-
20- // IntermediateSuccinct param
21- address public prove;
22-
23- // Governor params
24- uint48 public votingDelay;
25- uint32 public votingPeriod;
26- uint256 public proposalThreshold;
27- uint256 public quorumFraction;
28-
29- address public vappImpl;
30- address public owner;
31- address public auctioneer;
32- address public verifier;
33- uint256 public minDepositAmount;
34- bytes32 public vkey;
35- address public dispenser;
36- uint256 public minStakeAmount;
37- uint256 public maxUnstakeRequests;
38- uint256 public unstakePeriod;
39- uint256 public slashCancellationPeriod;
40- bytes32 public genesisStateRoot;
41-
42- address public deployerOwner;
43-
44- constructor () {
45- deployerOwner = msg .sender ;
46- }
47-
48- modifier onlyOwner () {
49- require (msg .sender == deployerOwner);
50- _;
51- }
52-
53- function setParams1 (
54- address _stakingImpl ,
55- address _prove ,
56- uint48 _votingDelay ,
57- uint32 _votingPeriod ,
58- uint256 _proposalThreshold ,
59- uint256 _quorumFraction
60- ) external onlyOwner {
61- stakingImpl = _stakingImpl;
62- prove = _prove;
63- votingDelay = _votingDelay;
64- votingPeriod = _votingPeriod;
65- proposalThreshold = _proposalThreshold;
66- quorumFraction = _quorumFraction;
67- }
68-
69- function setParams2 (
70- address _vappImpl ,
71- address _owner ,
72- address _auctioneer ,
73- address _verifier ,
74- uint256 _minDepositAmount ,
75- bytes32 _vkey
76- ) external onlyOwner {
77- vappImpl = _vappImpl;
78- owner = _owner;
79- auctioneer = _auctioneer;
80- verifier = _verifier;
81- minDepositAmount = _minDepositAmount;
82- vkey = _vkey;
83- }
84-
85- function setParams3 (
86- address _dispenser ,
87- uint256 _minStakeAmount ,
88- uint256 _maxUnstakeRequests ,
89- uint256 _unstakePeriod ,
90- uint256 _slashCancellationPeriod ,
91- bytes32 _genesisStateRoot
92- ) external onlyOwner {
93- dispenser = _dispenser;
94- minStakeAmount = _minStakeAmount;
95- maxUnstakeRequests = _maxUnstakeRequests;
96- unstakePeriod = _unstakePeriod;
97- slashCancellationPeriod = _slashCancellationPeriod;
98- genesisStateRoot = _genesisStateRoot;
99- }
100-
101- function deploy (bytes32 salt , bytes calldata iproveCode , bytes calldata governorCode )
102- external
103- onlyOwner
104- returns (address , address , address , address )
105- {
106- address STAKING;
107- {
108- STAKING = address (new ERC1967Proxy {salt: salt}(stakingImpl, "" ));
109- }
110-
111- address I_PROVE;
112- {
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)) { revert (0 , 0 ) }
120- }
121- }
122-
123- address GOVERNOR;
124- {
125- // GOVERNOR = address(
126- // new SuccinctGovernor{salt: salt}(
127- // I_PROVE, votingDelay, votingPeriod, proposalThreshold, quorumFraction
128- // )
129- // );
130- bytes memory args =
131- abi.encode (I_PROVE, votingDelay, votingPeriod, proposalThreshold, quorumFraction);
132- bytes memory initCode = abi.encodePacked (governorCode, args);
133-
134- assembly {
135- GOVERNOR := create2 (0 , add (initCode, 0x20 ), mload (initCode), salt)
136- if iszero (extcodesize (GOVERNOR)) { revert (0 , 0 ) }
137- }
138- }
139-
140- address VAPP;
141- {
142- // Encode the initialize function call data
143- bytes memory vappInitData;
144- {
145- vappInitData = abi.encodeCall (
146- SuccinctVApp.initialize,
147- (
148- owner,
149- prove,
150- I_PROVE,
151- auctioneer,
152- STAKING,
153- verifier,
154- minDepositAmount,
155- vkey,
156- genesisStateRoot
157- )
158- );
159- }
160- VAPP = address (new ERC1967Proxy {salt: salt}(vappImpl, vappInitData));
161- }
162-
163- SuccinctStaking (STAKING).initialize (
164- owner,
165- GOVERNOR,
166- VAPP,
167- prove,
168- I_PROVE,
169- dispenser,
170- minStakeAmount,
171- maxUnstakeRequests,
172- unstakePeriod,
173- slashCancellationPeriod
174- );
175-
176- return (STAKING, VAPP, I_PROVE, GOVERNOR);
177- }
178- }
17912
18013// Deploy all contracts.
181- contract AllAtomicScript is BaseScript , FixtureLoader {
14+ contract AllAtomicScript is BaseScript {
18215 function run () external broadcaster {
18316 // Read config
18417 bytes32 salt = readBytes32 ("CREATE2_SALT " );
0 commit comments