Skip to content

Commit

Permalink
Merge pull request #467 from superform-xyz/v1-staging
Browse files Browse the repository at this point in the history
chore: V1 staging SUP-5701
  • Loading branch information
0xTimepunk authored Feb 13, 2024
2 parents 0e68fae + b0b6874 commit 85d549c
Show file tree
Hide file tree
Showing 19 changed files with 422 additions and 183 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ typechain
cache
artifacts


# Ignore all vscode settings
.vscode/

Expand All @@ -31,4 +30,6 @@ bin/

lcov.info

report/
report/

script/output
59 changes: 35 additions & 24 deletions script/Abstract.Deploy.Single.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ abstract contract AbstractDeploySingle is Script {
/*//////////////////////////////////////////////////////////////
PROTOCOL VARIABLES
//////////////////////////////////////////////////////////////*/
string public SUPER_POSITIONS_NAME;

/// @dev 1 = ERC4626Form, 2 = ERC4626TimelockForm, 3 = KYCDaoForm
uint32[] public FORM_IMPLEMENTATION_IDS = [uint32(1), uint32(2), uint32(3)];
Expand Down Expand Up @@ -307,7 +308,15 @@ abstract contract AbstractDeploySingle is Script {

address public ownerAddress;

address constant EMERGENCY_ADMIN = 0x73009CE7cFFc6C4c5363734d1b429f0b848e0490;
address public PAYMENT_ADMIN;
address public CSR_PROCESSOR;
address public CSR_UPDATER;
address public DST_SWAPPER;
address public CSR_RESCUER;
address public CSR_DISPUTER;
address public SUPERFORM_RECEIVER;

address public EMERGENCY_ADMIN;

address[] public PROTOCOL_ADMINS = [
0xd26b38a64C812403fD3F87717624C80852cD6D61,
Expand Down Expand Up @@ -393,18 +402,18 @@ abstract contract AbstractDeploySingle is Script {
ISuperRBAC.InitialRoleSetup({
admin: ownerAddress,
emergencyAdmin: ownerAddress,
paymentAdmin: 0xD911673eAF0D3e15fe662D58De15511c5509bAbB,
csrProcessor: 0x23c658FE050B4eAeB9401768bF5911D11621629c,
paymentAdmin: PAYMENT_ADMIN,
csrProcessor: CSR_PROCESSOR,
tlProcessor: EMERGENCY_ADMIN,
/// @dev Temporary, as we are not using this processor in this release
brProcessor: EMERGENCY_ADMIN,
/// @dev FIXME who is broadcastProcessor
csrUpdater: 0xaEbb4b9f7e16BEE2a0963569a5E33eE10E478a5f,
csrUpdater: CSR_UPDATER,
srcVaaRelayer: EMERGENCY_ADMIN,
/// @dev FIXME who is srcVaaRelayer
dstSwapper: 0x1666660D2F506e754CB5c8E21BDedC7DdEc6Be1C,
csrRescuer: 0x90ed07A867bDb6a73565D7abBc7434Dd810Fafc5,
csrDisputer: 0x7c9c8C0A9aA5D8a2c2e6C746641117Cc9591296a
dstSwapper: DST_SWAPPER,
csrRescuer: CSR_RESCUER,
csrDisputer: CSR_DISPUTER
})
)
);
Expand Down Expand Up @@ -573,7 +582,7 @@ abstract contract AbstractDeploySingle is Script {
new SuperPositions{ salt: salt }(
"https://ipfs-gateway.superform.xyz/ipns/k51qzi5uqu5dg90fqdo9j63m556wlddeux4mlgyythp30zousgh3huhyzouyq8/JSON/",
vars.superRegistry,
"SuperPositions",
SUPER_POSITIONS_NAME,
"SP"
)
);
Expand Down Expand Up @@ -638,15 +647,15 @@ abstract contract AbstractDeploySingle is Script {
vars.ids[8] = vars.superRegistryC.SUPERFORM_RECEIVER();

vars.newAddresses = new address[](9);
vars.newAddresses[0] = 0xD911673eAF0D3e15fe662D58De15511c5509bAbB;
vars.newAddresses[1] = 0x23c658FE050B4eAeB9401768bF5911D11621629c;
vars.newAddresses[0] = PAYMENT_ADMIN;
vars.newAddresses[1] = CSR_PROCESSOR;
vars.newAddresses[2] = EMERGENCY_ADMIN;
vars.newAddresses[3] = EMERGENCY_ADMIN;
vars.newAddresses[4] = 0xaEbb4b9f7e16BEE2a0963569a5E33eE10E478a5f;
vars.newAddresses[5] = 0x90ed07A867bDb6a73565D7abBc7434Dd810Fafc5;
vars.newAddresses[6] = 0x7c9c8C0A9aA5D8a2c2e6C746641117Cc9591296a;
vars.newAddresses[7] = 0x1666660D2F506e754CB5c8E21BDedC7DdEc6Be1C;
vars.newAddresses[8] = 0x1a6805487322565202848f239C1B5bC32303C2FE;
vars.newAddresses[4] = CSR_UPDATER;
vars.newAddresses[5] = CSR_RESCUER;
vars.newAddresses[6] = CSR_DISPUTER;
vars.newAddresses[7] = DST_SWAPPER;
vars.newAddresses[8] = SUPERFORM_RECEIVER;

vars.chainIdsSetAddresses = new uint64[](9);
vars.chainIdsSetAddresses[0] = vars.chainId;
Expand Down Expand Up @@ -763,7 +772,8 @@ abstract contract AbstractDeploySingle is Script {
uint256 i,
uint256 trueIndex,
Cycle cycle,
uint64[] memory s_superFormChainIds
uint64[] memory s_superFormChainIds,
bool grantProtocolAdmin
)
internal
setEnvDeploy(cycle)
Expand All @@ -778,7 +788,8 @@ abstract contract AbstractDeploySingle is Script {
bytes32 protocolAdminRole = srbac.PROTOCOL_ADMIN_ROLE();
bytes32 emergencyAdminRole = srbac.EMERGENCY_ADMIN_ROLE();

srbac.grantRole(protocolAdminRole, PROTOCOL_ADMINS[trueIndex]);
if (grantProtocolAdmin) srbac.grantRole(protocolAdminRole, PROTOCOL_ADMINS[trueIndex]);

srbac.grantRole(emergencyAdminRole, EMERGENCY_ADMIN);

//srbac.revokeRole(emergencyAdminRole, ownerAddress);
Expand Down Expand Up @@ -981,15 +992,15 @@ abstract contract AbstractDeploySingle is Script {
newAddresses[7] = _readContract(chainNames[vars.dstTrueIndex], vars.dstChainId, "SuperRBAC");
newAddresses[8] = _readContract(chainNames[vars.dstTrueIndex], vars.dstChainId, "PayloadHelper");
newAddresses[9] = _readContract(chainNames[vars.dstTrueIndex], vars.dstChainId, "EmergencyQueue");
newAddresses[10] = 0xD911673eAF0D3e15fe662D58De15511c5509bAbB;
newAddresses[11] = 0x23c658FE050B4eAeB9401768bF5911D11621629c;
newAddresses[12] = 0xaEbb4b9f7e16BEE2a0963569a5E33eE10E478a5f;
newAddresses[10] = PAYMENT_ADMIN;
newAddresses[11] = CSR_PROCESSOR;
newAddresses[12] = CSR_UPDATER;
/// @dev FIXME setting this temporarily to EMERGENCY_ADMIN as we are not using it in this release
newAddresses[13] = EMERGENCY_ADMIN;
newAddresses[14] = 0x90ed07A867bDb6a73565D7abBc7434Dd810Fafc5;
newAddresses[15] = 0x7c9c8C0A9aA5D8a2c2e6C746641117Cc9591296a;
newAddresses[16] = 0x1666660D2F506e754CB5c8E21BDedC7DdEc6Be1C;
newAddresses[17] = 0x1a6805487322565202848f239C1B5bC32303C2FE;
newAddresses[14] = CSR_RESCUER;
newAddresses[15] = CSR_DISPUTER;
newAddresses[16] = DST_SWAPPER;
newAddresses[17] = SUPERFORM_RECEIVER;

uint64[] memory chainIdsSetAddresses = new uint64[](18);
chainIdsSetAddresses[0] = vars.dstChainId;
Expand Down
2 changes: 1 addition & 1 deletion script/Mainnet.Deploy.NewChain.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ contract MainnetDeployNewChain is AbstractDeploySingle {
}
}

_deployStage3(selectedChainIndex, trueIndex, Cycle.Prod, TARGET_DEPLOYMENT_CHAINS);
_deployStage3(selectedChainIndex, trueIndex, Cycle.Prod, TARGET_DEPLOYMENT_CHAINS, true);
}

/// @dev configures stage 2 for previous chains for the newly added chain
Expand Down
14 changes: 13 additions & 1 deletion script/Mainnet.Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ contract MainnetDeploy is AbstractDeploySingle {

/// @notice The main stage 1 script entrypoint
function deployStage1(uint256 selectedChainIndex) external {
PAYMENT_ADMIN = 0xD911673eAF0D3e15fe662D58De15511c5509bAbB;
CSR_PROCESSOR = 0x23c658FE050B4eAeB9401768bF5911D11621629c;
CSR_UPDATER = 0xaEbb4b9f7e16BEE2a0963569a5E33eE10E478a5f;
DST_SWAPPER = 0x1666660D2F506e754CB5c8E21BDedC7DdEc6Be1C;
CSR_RESCUER = 0x90ed07A867bDb6a73565D7abBc7434Dd810Fafc5;
CSR_DISPUTER = 0x7c9c8C0A9aA5D8a2c2e6C746641117Cc9591296a;
SUPERFORM_RECEIVER = 0x1a6805487322565202848f239C1B5bC32303C2FE;
EMERGENCY_ADMIN = 0x73009CE7cFFc6C4c5363734d1b429f0b848e0490;
SUPER_POSITIONS_NAME = "SuperPositions";

_preDeploymentSetup();


uint256 trueIndex;
for (uint256 i = 0; i < chainIds.length; i++) {
if (TARGET_DEPLOYMENT_CHAINS[selectedChainIndex] == chainIds[i]) {
Expand Down Expand Up @@ -54,6 +66,6 @@ contract MainnetDeploy is AbstractDeploySingle {
}
}

_deployStage3(selectedChainIndex, trueIndex, Cycle.Prod, TARGET_DEPLOYMENT_CHAINS);
_deployStage3(selectedChainIndex, trueIndex, Cycle.Prod, TARGET_DEPLOYMENT_CHAINS, true);
}
}
70 changes: 70 additions & 0 deletions script/Mainnet.Staging.Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

import { AbstractDeploySingle } from "./Abstract.Deploy.Single.s.sol";

contract MainnetStagingDeploy is AbstractDeploySingle {
/*//////////////////////////////////////////////////////////////
SELECT CHAIN IDS TO DEPLOY HERE
//////////////////////////////////////////////////////////////*/
uint64[] TARGET_DEPLOYMENT_CHAINS = [BSC, ARBI, OP, BASE];

///@dev ORIGINAL SALT
bytes32 constant salt = "StagingV1_0";

/// @notice The main stage 1 script entrypoint
function deployStage1(uint256 selectedChainIndex) external {
PAYMENT_ADMIN = 0xc5c971e6B9F01dcf06bda896AEA3648eD6e3EFb3;
CSR_PROCESSOR = 0x2759142A9e3cBbcCc1E3d5F76490eEE4007B8943;
CSR_UPDATER = 0xF1c73958118F22Fc3A3947f405DcEBF08a1E68f7;
DST_SWAPPER = 0x3ea519270248BdEE4a939df20049E02290bf9CaF;
CSR_RESCUER = 0xe1A61d90554131314cB30dB55B8AD4F4b6e21C3a;
CSR_DISPUTER = 0xe9F074d003b377A197D336B8a1c86EdaA6cC4dEF;
SUPERFORM_RECEIVER = 0x46F15EDC21f7eed6D1eb01e5Abe993Dc6c6A78BB;
EMERGENCY_ADMIN = 0x6A5DD913fE3CB5193E09D1810a3b9ff1C0f9c0D6;
SUPER_POSITIONS_NAME = "StagingSuperPositions";

_preDeploymentSetup();

uint256 trueIndex;
for (uint256 i = 0; i < chainIds.length; i++) {
if (TARGET_DEPLOYMENT_CHAINS[selectedChainIndex] == chainIds[i]) {
trueIndex = i;

break;
}
}

_deployStage1(selectedChainIndex, trueIndex, Cycle.Prod, TARGET_DEPLOYMENT_CHAINS, salt);
}

/// @dev stage 2 must be called only after stage 1 is complete for all chains!
function deployStage2(uint256 selectedChainIndex) external {
_preDeploymentSetup();

uint256 trueIndex;
for (uint256 i = 0; i < chainIds.length; i++) {
if (TARGET_DEPLOYMENT_CHAINS[selectedChainIndex] == chainIds[i]) {
trueIndex = i;
break;
}
}

_deployStage2(selectedChainIndex, trueIndex, Cycle.Prod, TARGET_DEPLOYMENT_CHAINS, TARGET_DEPLOYMENT_CHAINS);
}

/// @dev stage 3 must be called only after stage 1 is complete for all chains!
function deployStage3(uint256 selectedChainIndex) external {
_preDeploymentSetup();

uint256 trueIndex;
for (uint256 i = 0; i < chainIds.length; i++) {
if (TARGET_DEPLOYMENT_CHAINS[selectedChainIndex] == chainIds[i]) {
trueIndex = i;
break;
}
}

_deployStage3(selectedChainIndex, trueIndex, Cycle.Prod, TARGET_DEPLOYMENT_CHAINS, false);
}
}
2 changes: 1 addition & 1 deletion script/Tenderly.Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ contract TenderlyDeploy is AbstractDeploySingle {
}
}

_deployStage3(selectedChainIndex, trueIndex, Cycle.Dev, TARGET_DEPLOYMENT_CHAINS);
_deployStage3(selectedChainIndex, trueIndex, Cycle.Dev, TARGET_DEPLOYMENT_CHAINS, true);
}
}
22 changes: 0 additions & 22 deletions script/output/1/Ethereum-latest.json

This file was deleted.

22 changes: 0 additions & 22 deletions script/output/10/Optimism-latest.json

This file was deleted.

22 changes: 0 additions & 22 deletions script/output/137/Polygon-latest.json

This file was deleted.

22 changes: 0 additions & 22 deletions script/output/42161/Arbitrum-latest.json

This file was deleted.

22 changes: 0 additions & 22 deletions script/output/43114/Avalanche-latest.json

This file was deleted.

Loading

0 comments on commit 85d549c

Please sign in to comment.