@@ -12,6 +12,21 @@ contract SuccinctStakingScript is BaseScript {
1212 function run () external broadcaster {
1313 // Read config
1414 bytes32 salt = readBytes32 ("CREATE2_SALT " );
15+
16+ // Deploy contract
17+ address STAKING_IMPL = address (new SuccinctStaking {salt: salt}());
18+ address STAKING = address (
19+ SuccinctStaking (payable (address (new ERC1967Proxy {salt: salt}(STAKING_IMPL, "" ))))
20+ );
21+
22+ // Write address
23+ writeAddress (KEY, STAKING);
24+ writeAddress (string .concat (KEY, "_IMPL " ), STAKING_IMPL);
25+ }
26+
27+ /// @dev Only run this once all of the other contracts are deployed. Script must be ran with OWNER's private key.
28+ function initialize () external broadcaster {
29+ address STAKING = readAddress (KEY);
1530 address OWNER = readAddress ("OWNER " );
1631 address GOVERNOR = readAddress ("GOVERNOR " );
1732 address VAPP = readAddress ("VAPP " );
@@ -23,31 +38,17 @@ contract SuccinctStakingScript is BaseScript {
2338 uint256 UNSTAKE_PERIOD = readUint256 ("UNSTAKE_PERIOD " );
2439 uint256 SLASH_CANCELLATION_PERIOD = readUint256 ("SLASH_CANCELLATION_PERIOD " );
2540
26- // Encode the initialize function call data
27- bytes memory initData = abi.encodeCall (
28- SuccinctStaking.initialize,
29- (
30- OWNER,
31- GOVERNOR,
32- VAPP,
33- PROVE,
34- I_PROVE,
35- DISPENSER,
36- MIN_STAKE_AMOUNT,
37- MAX_UNSTAKE_REQUESTS,
38- UNSTAKE_PERIOD,
39- SLASH_CANCELLATION_PERIOD
40- )
41- );
42-
43- // Deploy contract
44- address STAKING_IMPL = address (new SuccinctStaking {salt: salt}());
45- address STAKING = address (
46- SuccinctStaking (payable (address (new ERC1967Proxy {salt: salt}(STAKING_IMPL, initData))))
41+ SuccinctStaking (STAKING).initialize (
42+ OWNER,
43+ GOVERNOR,
44+ VAPP,
45+ PROVE,
46+ I_PROVE,
47+ DISPENSER,
48+ MIN_STAKE_AMOUNT,
49+ MAX_UNSTAKE_REQUESTS,
50+ UNSTAKE_PERIOD,
51+ SLASH_CANCELLATION_PERIOD
4752 );
48-
49- // Write address
50- writeAddress (KEY, STAKING);
51- writeAddress (string .concat (KEY, "_IMPL " ), STAKING_IMPL);
5253 }
5354}
0 commit comments