Skip to content

Commit

Permalink
feat: deploy LZ testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
reednaa committed Jun 19, 2024
1 parent a15a153 commit 6b3a1a8
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 33 deletions.
2 changes: 1 addition & 1 deletion evm/lib/GeneralisedIncentives
2 changes: 2 additions & 0 deletions evm/script/BaseMultiChainDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ contract MultiChainDeployer is BaseMultiChainDeployer {
wrappedGas[chainKey[Chains.OptimismSepolia]] = "WETH";

wrappedGas[chainKey[Chains.BlastTestnet]] = "WETH";

wrappedGas["seidevnet"] = "WSEI";
}
}

44 changes: 18 additions & 26 deletions evm/script/DeployInterfaces.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -154,68 +154,60 @@ contract DeployInterfaces is MultiChainDeployer {
_deploy(availableBridges);
}

function _connect_cci(string[] memory bridges) forEachInterface(bridges) internal {
Chains[] memory all_chains = new Chains[](chain_list.length + chain_list_legacy.length);
uint256 i = 0;
for (i = 0; i < chain_list.length; ++i) {
all_chains[i] = chain_list[i];
}
for (uint256 j = 0; j < chain_list_legacy.length; ++j) {
all_chains[i+j] = chain_list_legacy[j];
}
function _connect_cci(string[] memory bridges, string[] memory counterpartChains) forEachInterface(bridges) internal {

CatalystChainInterface cci = CatalystChainInterface(abi.decode(config_interfaces.parseRaw(string.concat(".", bridgeVersion, ".", currentChainKey, ".interface")), (address)));

for (i = 0; i < all_chains.length; ++i) {
Chains remoteChain = all_chains[i];
if (keccak256(abi.encodePacked(currentChainKey)) == keccak256(abi.encodePacked(chainKey[remoteChain]))) continue;
for (uint256 i = 0; i < counterpartChains.length; ++i) {
string memory remoteChain = counterpartChains[i];
if (keccak256(abi.encodePacked(currentChainKey)) == keccak256(abi.encodePacked(remoteChain))) continue;
if (
!vm.keyExists(config_interfaces, string.concat(".", bridgeVersion, ".", chainKey[remoteChain]))
!vm.keyExists(config_interfaces, string.concat(".", bridgeVersion, ".", remoteChain))
) continue;

// Check if there exists a remote deployment.
if (
!vm.keyExists(config_interfaces, string.concat(".", bridgeVersion, ".", chainKey[remoteChain]))
!vm.keyExists(config_interfaces, string.concat(".", bridgeVersion, ".", remoteChain))
) {
console2.log(
"no-deployment",
bridgeVersion,
chainKey[remoteChain]
remoteChain
);
continue;
}

// Check if the chain identifier expists.
if (
!vm.keyExists(config_chain, string.concat(".", bridgeVersion, ".", currentChainKey, ".", chainKey[remoteChain]))
!vm.keyExists(config_chain, string.concat(".", bridgeVersion, ".", currentChainKey, ".", remoteChain))
) {
console2.log(
"no-chainidentifier",
currentChainKey,
chainKey[remoteChain]
remoteChain
);
continue;
}

bytes32 chainIdentifier = abi.decode(config_chain.parseRaw(string.concat(".", bridgeVersion, ".", currentChainKey, ".", chainKey[remoteChain])), (bytes32));
bytes32 chainIdentifier = abi.decode(config_chain.parseRaw(string.concat(".", bridgeVersion, ".", currentChainKey, ".", remoteChain)), (bytes32));

// check if a connection has already been set.
if (keccak256(cci.chainIdentifierToDestinationAddress(chainIdentifier)) != KECCACK_OF_NOTHING) {
console2.log(
"skipping",
currentChainKey,
chainKey[remoteChain]
remoteChain
);
continue;
}

address remoteInterface = abi.decode(config_interfaces.parseRaw(string.concat(".", bridgeVersion, ".", chainKey[remoteChain], ".interface")), (address));
address remoteIncentive = abi.decode(config_interfaces.parseRaw(string.concat(".", bridgeVersion, ".", chainKey[remoteChain], ".escrow")), (address));
address remoteInterface = abi.decode(config_interfaces.parseRaw(string.concat(".", bridgeVersion, ".", remoteChain, ".interface")), (address));
address remoteIncentive = abi.decode(config_interfaces.parseRaw(string.concat(".", bridgeVersion, ".", remoteChain, ".escrow")), (address));

console2.log(
"connecting",
currentChainKey,
chainKey[remoteChain]
remoteChain
);

cci.connectNewChain(
Expand All @@ -230,12 +222,12 @@ contract DeployInterfaces is MultiChainDeployer {
}
}

function connectCCIAll(string[] memory bridges) load_config iter_chains(chain_list) broadcast external {
_connect_cci(bridges);
function connectCCI(string[] calldata bridges, string[] calldata chains) load_config iter_chains_string(chains) broadcast external {
_connect_cci(bridges, chains);
}

function connectCCIAllLegacy(string[] memory bridges) load_config iter_chains(chain_list_legacy) broadcast external {
_connect_cci(bridges);
function connectCCI(string[] calldata bridges, string[] calldata localChains, string[] calldata remoteChains) load_config iter_chains_string(localChains) broadcast external {
_connect_cci(bridges, remoteChains);
}
}

2 changes: 1 addition & 1 deletion evm/script/DeployRouter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ contract DeployRouter is MultiChainDeployer {
deployRouter();
}

function deploy() load_config iter_chains(chain_list) broadcast external {
function deploy(string[] calldata chains) load_config iter_chains_string(chains) broadcast external {
_deploy();
}

Expand Down
4 changes: 2 additions & 2 deletions evm/script/DeployVaults.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ contract DeployVaults is MultiChainDeployer {
}
}

function deploy() load_config iter_chains(chain_list) broadcast public {
function deploy(string[] calldata chains) load_config iter_chains_string(chains) broadcast public {
_deploy();
}

function deploy_legacy() load_config iter_chains(chain_list_legacy) broadcast public {
_deploy();
}

function setConnection() load_config iter_chains(chain_list) broadcast public {
function setConnection(string[] calldata chains) load_config iter_chains_string(chains) broadcast public {
_setConnection();
}

Expand Down
4 changes: 2 additions & 2 deletions evm/script/config/config_contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"volatile_template": "0x0000000003b8C9BFeB9351933CFC301Eea92073F"
},
"registry": {
"describer": "0xBa75192eb00d8eE0E8F0861aaF82609b57e9682B",
"describer_registry": "0xeFc15d542Db6DE23fAB7daFc8e38BDd266Ff064d",
"describer": "0x3F578971672d5469D28B39ec2b367CbeBF238a11",
"describer_registry": "0x39AcfC1Edd61Eb08fB96523A3b5419B83A603820",
"lens": "0x7363003E709EE4Ce16c32D2DEE8B7616d91D51d5"
}
}
18 changes: 18 additions & 0 deletions evm/script/config/config_interfaces.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@
"escrow": "0x9524ACA1fF46fAd177160F0a803189Cb552A3780"
}
},
"LayerZero": {
"arbitrumsepolia": {
"interface": "0x971a39ab3fc82a1b5e813946fd8d16Cb363f4907",
"escrow": "0xbA6f62a6539e4Bc11d2A8B1C760b5a1097c6cF6B"
},
"optimismsepolia": {
"interface": "0x971a39ab3fc82a1b5e813946fd8d16Cb363f4907",
"escrow": "0xbA6f62a6539e4Bc11d2A8B1C760b5a1097c6cF6B"
},
"basesepolia": {
"interface": "0x971a39ab3fc82a1b5e813946fd8d16Cb363f4907",
"escrow": "0xbA6f62a6539e4Bc11d2A8B1C760b5a1097c6cF6B"
},
"seidevnet": {
"interface": "0x971a39ab3fc82a1b5e813946fd8d16Cb363f4907",
"escrow": "0xbA6f62a6539e4Bc11d2A8B1C760b5a1097c6cF6B"
}
},
"Polymer": {
"basesepolia": {
"interface": "0x7d2193429C1ae9BA1b36ffb8d5Ee467B4ce0EFC3",
Expand Down
3 changes: 3 additions & 0 deletions evm/script/config/config_tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@
},
"optimism": {
"WETH": "0x4200000000000000000000000000000000000006"
},
"seidevnet": {
"WSEI": "0x027D2E627209f1cebA52ADc8A5aFE9318459b44B"
}
}
25 changes: 25 additions & 0 deletions evm/script/config/config_vaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,30 @@
"WGAS": 500000000000000000
}
}
},
"LayerZeroSepoliaArbitrumSeidevnet": {
"cci_version": "LayerZero",
"arbitrumsepolia": {
"cci": "0x971a39ab3fc82a1b5e813946fd8d16cb363f4907",
"address": "0x06d4b5289b981933e34af10817f352061bad6353",
"weights": [
1
],
"fee": 1000000000000000,
"tokens": {
"WGAS": 500000000000000000
}
},
"seidevnet": {
"cci": "0x971a39ab3fc82a1b5e813946fd8d16cb363f4907",
"address": "0x06d4b5289b981933e34af10817f352061bad6353",
"weights": [
1
],
"fee": 1000000000000000,
"tokens": {
"WGAS": 500000000000000000
}
}
}
}

0 comments on commit 6b3a1a8

Please sign in to comment.