Skip to content

Commit

Permalink
chore: adapt launch script, changes to broadcasting and wormholeSrImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTimepunk committed Jan 23, 2024
1 parent 0ee0dfe commit 182a701
Show file tree
Hide file tree
Showing 16 changed files with 226 additions and 232 deletions.
98 changes: 36 additions & 62 deletions script/Abstract.Deploy.Single.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ abstract contract AbstractDeploySingle is Script {
address public constant CANONICAL_PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;
mapping(uint64 chainId => mapping(bytes32 implementation => address at)) public contracts;

string[18] public contractNames = [
string[20] public contractNames = [
"CoreStateRegistry",
//"TimelockStateRegistry",
//"BroadcastRegistry",
"BroadcastRegistry",
"LayerzeroImplementation",
"HyperlaneImplementation",
"WormholeARImplementation",
//"WormholeSRImplementation",
"WormholeSRImplementation",
"LiFiValidator",
"SocketValidator",
//"SocketOneInchValidator",
Expand Down Expand Up @@ -164,9 +164,9 @@ abstract contract AbstractDeploySingle is Script {
/// @notice id 1 is layerzero
/// @notice id 2 is hyperlane
/// @notice id 3 is wormhole AR
/// @notice FIXME 4 is wormhole SR - not added
uint8[] public ambIds = [uint8(1), 2, 3];
bool[] public broadcastAMB = [false, false, false];
/// @notice id 4 is wormhole SR
uint8[] public ambIds = [uint8(1), 2, 3, 4];
bool[] public broadcastAMB = [false, false, false, true];

/*//////////////////////////////////////////////////////////////
AMB VARIABLES
Expand Down Expand Up @@ -398,10 +398,10 @@ abstract contract AbstractDeploySingle is Script {
tlProcessor: EMERGENCY_ADMIN,
/// @dev Temporary, as we are not using this processor in this release
brProcessor: EMERGENCY_ADMIN,
/// @dev Temporary, as we are not using this processor in this release
/// @dev FIXME who is broadcastProcessor
csrUpdater: 0xaEbb4b9f7e16BEE2a0963569a5E33eE10E478a5f,
srcVaaRelayer: EMERGENCY_ADMIN,
/// @dev Temporary, as we are not using this processor in this release
/// @dev FIXME who is srcVaaRelayer
dstSwapper: 0x1666660D2F506e754CB5c8E21BDedC7DdEc6Be1C,
csrRescuer: 0x90ed07A867bDb6a73565D7abBc7434Dd810Fafc5,
csrDisputer: 0x7c9c8C0A9aA5D8a2c2e6C746641117Cc9591296a
Expand Down Expand Up @@ -440,23 +440,22 @@ abstract contract AbstractDeploySingle is Script {
);
*/

/*
/// @dev 3.3 - deploy Broadcast State Registry
vars.broadcastRegistry = address(new BroadcastRegistry{ salt: salt }(vars.superRegistryC));
contracts[vars.chainId][bytes32(bytes("BroadcastRegistry"))] = vars.broadcastRegistry;

vars.superRegistryC.setAddress(vars.superRegistryC.BROADCAST_REGISTRY(), vars.broadcastRegistry, vars.chainId);
*/
/// @dev FIXME not setting this yet so that broadcast reverts
//vars.superRegistryC.setAddress(vars.superRegistryC.BROADCAST_REGISTRY(), vars.broadcastRegistry,
// vars.chainId);

address[] memory registryAddresses = new address[](1);
address[] memory registryAddresses = new address[](2);
registryAddresses[0] = vars.coreStateRegistry;
//registryAddresses[1] = vars.timelockStateRegistry;
//registryAddresses[2] = vars.broadcastRegistry;
registryAddresses[1] = vars.broadcastRegistry;

uint8[] memory registryIds = new uint8[](1);
uint8 brRegistryId = 2;
uint8[] memory registryIds = new uint8[](2);
registryIds[0] = 1;
//registryIds[1] = 2;
//registryIds[2] = 3;
registryIds[1] = brRegistryId;

vars.superRegistryC.setStateRegistryAddress(registryIds, registryAddresses);

Expand Down Expand Up @@ -487,20 +486,19 @@ abstract contract AbstractDeploySingle is Script {
WormholeARImplementation(vars.wormholeImplementation).setWormholeRelayer(wormholeRelayerConfig);
WormholeARImplementation(vars.wormholeImplementation).setRefundChainId(wormhole_chainIds[trueIndex]);

/*
/// @dev 6.5- deploy Wormhole Specialized Relayer Implementation
vars.wormholeSRImplementation = address(new WormholeSRImplementation{ salt: salt }(vars.superRegistryC));
vars.wormholeSRImplementation =
address(new WormholeSRImplementation{ salt: salt }(vars.superRegistryC, brRegistryId));
contracts[vars.chainId][bytes32(bytes("WormholeSRImplementation"))] = vars.wormholeSRImplementation;

WormholeSRImplementation(vars.wormholeSRImplementation).setWormholeCore(wormholeCore[trueIndex]);
/// @dev FIXME who is the wormhole relayer on mainnet?
WormholeSRImplementation(vars.wormholeSRImplementation).setRelayer(ownerAddress);
*/

vars.ambAddresses[0] = vars.lzImplementation;
vars.ambAddresses[1] = vars.hyperlaneImplementation;
vars.ambAddresses[2] = vars.wormholeImplementation;
//vars.ambAddresses[3] = vars.wormholeSRImplementation;
vars.ambAddresses[3] = vars.wormholeSRImplementation;

/// @dev 6- deploy liquidity validators
vars.lifiValidator = address(new LiFiValidator{ salt: salt }(vars.superRegistry));
Expand Down Expand Up @@ -558,7 +556,7 @@ abstract contract AbstractDeploySingle is Script {
/// @dev 9 - Add newly deployed form implementations to Factory, formImplementationId 1
ISuperformFactory(vars.factory).addFormImplementation(vars.erc4626Form, FORM_IMPLEMENTATION_IDS[0], 1);

/// passing 2 cuz timelock state registry id is 2
/// passing 2 because timelock state registry id is 2
//ISuperformFactory(vars.factory).addFormImplementation(vars.erc4626TimelockForm, FORM_IMPLEMENTATION_IDS[1],
// 2);

Expand Down Expand Up @@ -688,7 +686,6 @@ abstract contract AbstractDeploySingle is Script {

PaymentHelper(payable(vars.paymentHelper)).updateRemoteChain(vars.chainId, 11, abi.encode(50_000));

/// @dev FIXME emergencyCost value
PaymentHelper(payable(vars.paymentHelper)).updateRemoteChain(vars.chainId, 12, abi.encode(10_000));

/// @dev 19 deploy vault claimer
Expand Down Expand Up @@ -725,8 +722,7 @@ abstract contract AbstractDeploySingle is Script {
vars.lzImplementation = _readContract(chainNames[trueIndex], vars.chainId, "LayerzeroImplementation");
vars.hyperlaneImplementation = _readContract(chainNames[trueIndex], vars.chainId, "HyperlaneImplementation");
vars.wormholeImplementation = _readContract(chainNames[trueIndex], vars.chainId, "WormholeARImplementation");
//vars.wormholeSRImplementation = _readContract(chainNames[trueIndex], vars.chainId,
// "WormholeSRImplementation");
vars.wormholeSRImplementation = _readContract(chainNames[trueIndex], vars.chainId, "WormholeSRImplementation");
vars.superRegistry = _readContract(chainNames[trueIndex], vars.chainId, "SuperRegistry");
vars.paymentHelper = _readContract(chainNames[trueIndex], vars.chainId, "PaymentHelper");
vars.superRegistryC = SuperRegistry(vars.superRegistry);
Expand Down Expand Up @@ -811,8 +807,7 @@ abstract contract AbstractDeploySingle is Script {
vars.lzImplementation = _readContract(chainNames[trueIndex], vars.chainId, "LayerzeroImplementation");
vars.hyperlaneImplementation = _readContract(chainNames[trueIndex], vars.chainId, "HyperlaneImplementation");
vars.wormholeImplementation = _readContract(chainNames[trueIndex], vars.chainId, "WormholeARImplementation");
//vars.wormholeSRImplementation = _readContract(chainNames[trueIndex], vars.chainId,
// "WormholeSRImplementation");
vars.wormholeSRImplementation = _readContract(chainNames[trueIndex], vars.chainId, "WormholeSRImplementation");
vars.superRegistry = _readContract(chainNames[trueIndex], vars.chainId, "SuperRegistry");
vars.paymentHelper = _readContract(chainNames[trueIndex], vars.chainId, "PaymentHelper");
vars.superRegistryC = SuperRegistry(payable(vars.superRegistry));
Expand Down Expand Up @@ -880,10 +875,10 @@ abstract contract AbstractDeploySingle is Script {
_readContract(chainNames[vars.dstTrueIndex], vars.dstChainId, "HyperlaneImplementation");
vars.dstWormholeARImplementation =
_readContract(chainNames[vars.dstTrueIndex], vars.dstChainId, "WormholeARImplementation");
/*

vars.dstWormholeSRImplementation =
_readContract(chainNames[vars.dstTrueIndex], vars.dstChainId, "WormholeSRImplementation");
*/

LayerzeroImplementation(payable(vars.lzImplementation)).setTrustedRemote(
vars.dstLzChainId, abi.encodePacked(vars.dstLzImplementation, vars.lzImplementation)
);
Expand Down Expand Up @@ -919,7 +914,6 @@ abstract contract AbstractDeploySingle is Script {
vars.dstChainId, vars.dstWormholeChainId
);

/*
WormholeSRImplementation(payable(vars.wormholeSRImplementation)).setChainId(
vars.dstChainId, vars.dstWormholeChainId
);
Expand All @@ -928,19 +922,10 @@ abstract contract AbstractDeploySingle is Script {
vars.dstWormholeChainId, vars.dstWormholeSRImplementation
);

/// @dev FIXME missing attribution of WORMHOLE_VAA_RELAYER_ROLE
*/

SuperRegistry(payable(vars.superRegistry)).setRequiredMessagingQuorum(vars.dstChainId, 1);

vars.superRegistryC.setVaultLimitPerDestination(vars.dstChainId, 5);
/*
updateGasUsed Arb = 1M, others = 200k
ackGasCost[CHAIN_ID], Arb = 500k, others = 150k -- i.e. ackGasCost on 42161 of ackGasCost[42161] = 500k

swapGasUsed Arb = 2M, others = 1M
*/
PaymentHelper(payable(vars.paymentHelper)).addRemoteChain(
vars.dstChainId,
IPaymentHelper.PaymentHelperConfig(
Expand All @@ -962,7 +947,8 @@ abstract contract AbstractDeploySingle is Script {

PaymentHelper(payable(vars.paymentHelper)).updateRegisterAERC20Params(abi.encode(4, abi.encode(0, "")));

bytes32[] memory ids = new bytes32[](19);
/// @dev FIXME not setting BROADCAST_REGISTRY yet, which will result in all broadcast tentatives to fail
bytes32[] memory ids = new bytes32[](18);
ids[0] = vars.superRegistryC.SUPERFORM_ROUTER();
ids[1] = vars.superRegistryC.SUPERFORM_FACTORY();
ids[2] = vars.superRegistryC.PAYMASTER();
Expand All @@ -977,13 +963,12 @@ abstract contract AbstractDeploySingle is Script {
ids[11] = vars.superRegistryC.CORE_REGISTRY_PROCESSOR();
ids[12] = vars.superRegistryC.CORE_REGISTRY_UPDATER();
ids[13] = vars.superRegistryC.BROADCAST_REGISTRY_PROCESSOR();
ids[14] = vars.superRegistryC.TIMELOCK_REGISTRY_PROCESSOR();
ids[15] = vars.superRegistryC.CORE_REGISTRY_RESCUER();
ids[16] = vars.superRegistryC.CORE_REGISTRY_DISPUTER();
ids[17] = vars.superRegistryC.DST_SWAPPER_PROCESSOR();
ids[18] = vars.superRegistryC.SUPERFORM_RECEIVER();
ids[14] = vars.superRegistryC.CORE_REGISTRY_RESCUER();
ids[15] = vars.superRegistryC.CORE_REGISTRY_DISPUTER();
ids[16] = vars.superRegistryC.DST_SWAPPER_PROCESSOR();
ids[17] = vars.superRegistryC.SUPERFORM_RECEIVER();

address[] memory newAddresses = new address[](19);
address[] memory newAddresses = new address[](18);
newAddresses[0] = _readContract(chainNames[vars.dstTrueIndex], vars.dstChainId, "SuperformRouter");
newAddresses[1] = _readContract(chainNames[vars.dstTrueIndex], vars.dstChainId, "SuperformFactory");
newAddresses[2] = _readContract(chainNames[vars.dstTrueIndex], vars.dstChainId, "PayMaster");
Expand All @@ -999,14 +984,12 @@ abstract contract AbstractDeploySingle is Script {
newAddresses[12] = 0xaEbb4b9f7e16BEE2a0963569a5E33eE10E478a5f;
/// @dev FIXME setting this temporarily to EMERGENCY_ADMIN as we are not using it in this release
newAddresses[13] = EMERGENCY_ADMIN;
/// @dev FIXME setting this temporarily to EMERGENCY_ADMIN as we are not using it in this release
newAddresses[14] = EMERGENCY_ADMIN;
newAddresses[15] = 0x90ed07A867bDb6a73565D7abBc7434Dd810Fafc5;
newAddresses[16] = 0x7c9c8C0A9aA5D8a2c2e6C746641117Cc9591296a;
newAddresses[17] = 0x1666660D2F506e754CB5c8E21BDedC7DdEc6Be1C;
newAddresses[18] = 0x1a6805487322565202848f239C1B5bC32303C2FE;
newAddresses[14] = 0x90ed07A867bDb6a73565D7abBc7434Dd810Fafc5;
newAddresses[15] = 0x7c9c8C0A9aA5D8a2c2e6C746641117Cc9591296a;
newAddresses[16] = 0x1666660D2F506e754CB5c8E21BDedC7DdEc6Be1C;
newAddresses[17] = 0x1a6805487322565202848f239C1B5bC32303C2FE;

uint64[] memory chainIdsSetAddresses = new uint64[](19);
uint64[] memory chainIdsSetAddresses = new uint64[](18);
chainIdsSetAddresses[0] = vars.dstChainId;
chainIdsSetAddresses[1] = vars.dstChainId;
chainIdsSetAddresses[2] = vars.dstChainId;
Expand All @@ -1025,7 +1008,6 @@ abstract contract AbstractDeploySingle is Script {
chainIdsSetAddresses[15] = vars.dstChainId;
chainIdsSetAddresses[16] = vars.dstChainId;
chainIdsSetAddresses[17] = vars.dstChainId;
chainIdsSetAddresses[18] = vars.dstChainId;

vars.superRegistryC.batchSetAddress(ids, newAddresses, chainIdsSetAddresses);

Expand All @@ -1036,14 +1018,6 @@ abstract contract AbstractDeploySingle is Script {
vars.dstChainId
);
*/

/*
vars.superRegistryC.setAddress(
vars.superRegistryC.BROADCAST_REGISTRY(),
_readContract(chainNames[vars.dstTrueIndex], vars.dstChainId, "BroadcastRegistry"),
vars.dstChainId
);
*/
}

function _preDeploymentSetup() internal {
Expand Down
2 changes: 1 addition & 1 deletion script/DeployBroadcastAbstract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ abstract contract AbstractDeploySingle is Script {
vars.superRegistryC.setStateRegistryAddress(registryIds, registryAddresses);

/// @dev 6.5- deploy Wormhole Specialized Relayer Implementation
vars.wormholeSRImplementation = address(new WormholeSRImplementation{ salt: salt }(vars.superRegistryC));
vars.wormholeSRImplementation = address(new WormholeSRImplementation{ salt: salt }(vars.superRegistryC, 2));
contracts[vars.chainId][bytes32(bytes("WormholeSRImplementation"))] = vars.wormholeSRImplementation;

WormholeSRImplementation(vars.wormholeSRImplementation).setWormholeCore(wormholeCore[trueIndex]);
Expand Down
4 changes: 2 additions & 2 deletions script/Mainnet.Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ contract MainnetDeploy is AbstractDeploySingle {
/*//////////////////////////////////////////////////////////////
SELECT CHAIN IDS TO DEPLOY HERE
//////////////////////////////////////////////////////////////*/
uint64[] TARGET_DEPLOYMENT_CHAINS = [BSC, AVAX, POLY, ARBI, OP, BASE];
uint64[] TARGET_DEPLOYMENT_CHAINS = [ETH, BSC, AVAX, POLY, ARBI, OP, BASE];

///@dev ORIGINAL SALT
bytes32 constant salt = "SunNeverSetsOnSuperformEmpire";
bytes32 constant salt = "SunNeverSetsOnSuperformRealm";

/// @notice The main stage 1 script entrypoint
function deployStage1(uint256 selectedChainIndex) external {
Expand Down
40 changes: 20 additions & 20 deletions script/output/1/Ethereum-latest.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"BroadcastRegistry": "0xdded3E0fc2472eF3F1f262dbEf5DBedF7Ba11Cd1",
"CoreStateRegistry": "0x0000000000000000000000000000000000000000",
"DstSwapper": "0x0000000000000000000000000000000000000000",
"ERC4626Form": "0x0000000000000000000000000000000000000000",
"EmergencyQueue": "0x0000000000000000000000000000000000000000",
"HyperlaneImplementation": "0x0000000000000000000000000000000000000000",
"LayerzeroImplementation": "0x0000000000000000000000000000000000000000",
"LiFiValidator": "0x0000000000000000000000000000000000000000",
"PayMaster": "0x0000000000000000000000000000000000000000",
"PayloadHelper": "0x0000000000000000000000000000000000000000",
"PaymentHelper": "0x0000000000000000000000000000000000000000",
"SocketValidator": "0x0000000000000000000000000000000000000000",
"SuperPositions": "0x0000000000000000000000000000000000000000",
"SuperRBAC": "0x2e639444763e402F80A9Ec9D03361Be351b9d40c",
"SuperRegistry": "0x38594203fB14f85AF738Ec1bAFe2A82a16BB48Cb",
"SuperformFactory": "0x0000000000000000000000000000000000000000",
"SuperformRouter": "0x0000000000000000000000000000000000000000",
"VaultClaimer": "0x0000000000000000000000000000000000000000",
"WormholeARImplementation": "0x0000000000000000000000000000000000000000",
"WormholeSRImplementation": "0x99A4DB767Bd389Fbef3072a9ec7789F668de3fE3"
"BroadcastRegistry": "0xc9AF8c437610235cA3816B04113C3f29f841A02B",
"CoreStateRegistry": "0x5c44aEacB25768E43C0940344F03CA99e6f6D6A9",
"DstSwapper": "0xC9b7e8060f6A8d1A1428361AB0b617c69AAA4541",
"ERC4626Form": "0x89045a3aDfD23133A4E6e40De3bA2f1BC52b81E2",
"EmergencyQueue": "0x13708D8E55CaeB32ef9f55B2059149632E355Ae1",
"HyperlaneImplementation": "0x11a17B16Ec5bc2dA7EfcE864d518c0A32E540fEd",
"LayerzeroImplementation": "0x838312b954122795E509B3D6B1A95821EE05Ce1a",
"LiFiValidator": "0x01Ac084361D8ca80604E6e1C07f518D2ce0F0662",
"PayMaster": "0xB7ef61C20b530e4416C3722C4e19aefFf83e6d0d",
"PayloadHelper": "0x3e6c5190A1E5040E062E4358Ba19A3c47F177104",
"PaymentHelper": "0xD4eA9a8d03b3eaa79C8661AFb5e8CC22aB8e0296",
"SocketValidator": "0x5973DE3988A1a01FA8bff494A027eBf096Cbed62",
"SuperPositions": "0x0755978C52D83a7a07cfc34ec7a1FFFfb64BBa0a",
"SuperRBAC": "0x2b8d7cB90903d89bD2Ea8682Dee10eBeB9057b1A",
"SuperRegistry": "0x410BDbCc6f788fDb4f127f54842db79789365F2F",
"SuperformFactory": "0x9214E15DD6f7Ac3Ab5daeBa3cd6e9110500aA722",
"SuperformRouter": "0x8b5EF2e67887952a76ED1A7F615040c18EE93DaB",
"VaultClaimer": "0xC4A234A40aC13b02096Dd4aae1b8221541Dc5d5A",
"WormholeARImplementation": "0xC09E1E1C50D8E44dAa2e7D51f5300d43a1741292",
"WormholeSRImplementation": "0x4781767B99A00fEE05018F5cBDB466eFEB9cF7Be"
}
Loading

0 comments on commit 182a701

Please sign in to comment.