Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: redeploy celo contracts #32

Merged
merged 6 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "lib/aave-delivery-infrastructure"]
path = lib/aave-delivery-infrastructure
url = https://github.com/bgd-labs/aave-delivery-infrastructure
branch = feat/deploy-celo
[submodule "lib/aave-helpers"]
path = lib/aave-helpers
url = https://github.com/bgd-labs/aave-helpers
17 changes: 10 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BASE_KEY = --private-key ${PRIVATE_KEY}



custom_ethereum := --with-gas-price 20000000000 # 53 gwei
custom_ethereum := --with-gas-price 6000000000 # 53 gwei
#custom_polygon := --with-gas-price 190000000000 # 560 gwei
#custom_avalanche := --with-gas-price 27000000000 # 27 gwei
#custom_metis-testnet := --legacy --verifier-url https://goerli.explorer.metisdevops.link/api/
Expand Down Expand Up @@ -164,15 +164,15 @@ deploy-full:

# Deploy Proxy Factories on all networks
deploy-proxy-factory-test:
$(call deploy_fn,InitialDeployments,linea)
$(call deploy_fn,InitialDeployments,celo)

# Deploy Cross Chain Infra on all networks
deploy-cross-chain-infra-test:
$(call deploy_fn,ccc/DeployCCC,linea)
$(call deploy_fn,ccc/DeployCCC,celo)

## Deploy CCIP bridge adapters on all networks
deploy-ccip-bridge-adapters-test:
$(call deploy_fn,adapters/DeployCCIP,ethereum)
$(call deploy_fn,adapters/DeployCCIPAdapter,ethereum)

## Deploy LayerZero bridge adapters on all networks
deploy-lz-bridge-adapters-test:
Expand Down Expand Up @@ -219,11 +219,11 @@ set-ccf-sender-adapters-test:

# Set the bridge adapters allowed to receive messages
set-ccr-receiver-adapters-test:
$(call deploy_fn,ccc/Set_CCR_Receivers_Adapters,linea)
$(call deploy_fn,ccc/Set_CCR_Receivers_Adapters,celo)

# Sets the required confirmations
set-ccr-confirmations-test:
$(call deploy_fn,ccc/Set_CCR_Confirmations,linea)
$(call deploy_fn,ccc/Set_CCR_Confirmations,celo)


## Deploy and configure all contracts
Expand Down Expand Up @@ -266,7 +266,7 @@ send-message-via-adapter:
$(call deploy_fn,helpers/Send_Message_Via_Adapter,ethereum)

deploy_ccc_granular_guardian:
$(call deploy_fn,access_control/network_scripts/GranularGuardianNetworkDeploys,linea)
$(call deploy_fn,access_control/network_scripts/GranularGuardianNetworkDeploys,celo)

deploy-ccc-revision-and-update:
$(call deploy_fn,CCC/UpdateCCC,ethereum)
Expand All @@ -283,5 +283,8 @@ deploy-zksync-path-payload:
deploy-linea-path-payload:
$(call deploy_fn,payloads/adapters/ethereum/Network_Deployments,ethereum)

deploy-celo-path-payload:
$(call deploy_fn,payloads/adapters/ethereum/Network_Deployments,ethereum)

update-owners-and-guardians:
$(call deploy_fn,helpers/Update_Ownership,zksync)
14 changes: 7 additions & 7 deletions deployments/celo.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"arbAdapter": "0x0000000000000000000000000000000000000000",
"baseAdapter": "0x0000000000000000000000000000000000000000",
"ccipAdapter": "0x0000000000000000000000000000000000000000",
"ccipAdapter": "0x3d534E8964e7aAcfc702751cc9A2BB6A9fe7d928",
"chainId": 42220,
"clEmergencyOracle": "0x91b21900E91CD302EBeD05E45D8f270ddAED944d",
"create3Factory": "0x0000000000000000000000000000000000000000",
"crossChainController": "0x4A5f4b29C0407E5Feb323305e121f563c7bC4d79",
"crossChainControllerImpl": "0xf41193E25408F652AF878c47E4401A01B5E4B682",
"crossChainController": "0x50F4dAA86F3c747ce15C3C38bD0383200B61d6Dd",
"crossChainControllerImpl": "0xB0f963f93bb14C9c7c9061939107989c726E144d",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0xbE815420A63A413BB8D508d8022C0FF150Ea7C39",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"hlAdapter": "0xa5cc218513305221201f196760E9e64e9D49d98A",
"lineaAdapter": "0x0000000000000000000000000000000000000000",
"lzAdapter": "0xAE93BEa44dcbE52B625169588574d31e36fb3A67",
Expand All @@ -19,11 +19,11 @@
"opAdapter": "0x0000000000000000000000000000000000000000",
"owner": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"polAdapter": "0x0000000000000000000000000000000000000000",
"proxyAdmin": "0x01d678F1bbE148C96e7501F1Ac41661904F84F61",
"proxyFactory": "0xb172a90A7C238969CE9B27cc19D13b60A91e7F00",
"proxyAdmin": "0x54BDcc37c4143f944A3EE51C892a6cBDF305E7a0",
"proxyFactory": "0xAe13e4DA0952f0B8fE04E21df53716fCF799a923",
"sameChainAdapter": "0x0000000000000000000000000000000000000000",
"scrollAdapter": "0x0000000000000000000000000000000000000000",
"wormholeAdapter": "0x3F006299eC88985c18E6e885EeA29A49eC579882",
"zkevmAdapter": "0x0000000000000000000000000000000000000000",
"zksyncAdapter": "0x0000000000000000000000000000000000000000"
}
}
2 changes: 1 addition & 1 deletion deployments/ethereum.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"arbAdapter": "0x88d6D01e08d3e64513b15fD46528dBbA7d755883",
"baseAdapter": "0xa5948b0ac79f72966dFFC5C13E44f6dfDD3D58A0",
"ccipAdapter": "0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29",
"ccipAdapter": "0x58489B249BfBCF5ef4B30bdE2792086e83122B6f",
"chainId": 1,
"clEmergencyOracle": "0x0000000000000000000000000000000000000000",
"create3Factory": "0xcc3C54B95f3f1867A43009B80ed4DD930E3cE2F7",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Raw diff

```json
{
"forwarderAdaptersByChain": {
"42220": {
"from": "",
"to": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": "0xa5cc218513305221201f196760E9e64e9D49d98A",
"0x58489B249BfBCF5ef4B30bdE2792086e83122B6f": "0x3d534E8964e7aAcfc702751cc9A2BB6A9fe7d928",
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": "0xAE93BEa44dcbE52B625169588574d31e36fb3A67"
}
}
}
}
```
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fs_permissions = [{ access = "read-write", path = "./"}]
metadata="none"
solc = "0.8.20"
ffi = true

evm_version = 'paris'

[profile.zksync.zksync]
fallback_oz = true
Expand Down
2 changes: 1 addition & 1 deletion lib/aave-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,21 @@ contract Linea is DeployGranularGuardian {
return ChainIds.LINEA;
}
}

contract Celo is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return 0x1dF462e2712496373A347f8ad10802a5E95f053D; //GovernanceV3Linea.EXECUTOR_LVL_1;
sendra marked this conversation as resolved.
Show resolved Hide resolved
}

function RETRY_GUARDIAN() internal pure override returns (address) {
return 0xfD3a6E65e470a7D7D730FFD5D36a9354E8F9F4Ea; // bgd guardian
}

function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) {
return 0x056E4C4E80D1D14a637ccbD0412CDAAEc5B51F4E; // dao governance guardian
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.CELO;
}
}
23 changes: 23 additions & 0 deletions scripts/adapters/DeployCCIPAdapter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,26 @@ contract Binance_testnet is DeployCCIPAdapter {
return remoteCCCByNetwork;
}
}

contract Celo is DeployCCIPAdapter {
function CCIP_ROUTER() internal pure override returns (address) {
return 0xfB48f15480926A4ADf9116Dca468bDd2EE6C5F62;
}

function LINK_TOKEN() internal pure override returns (address) {
return 0xd07294e6E917e07dfDcee882dd1e2565085C2ae0;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.CELO;
}

function REMOTE_CCC_BY_NETWORK() internal view override returns (RemoteCCC[] memory) {
RemoteCCC[] memory remoteCCCByNetwork = new RemoteCCC[](1);
remoteCCCByNetwork[0].chainId = ChainIds.ETHEREUM;
remoteCCCByNetwork[0].crossChainController = _getAddresses(ChainIds.ETHEREUM)
.crossChainController;

return remoteCCCByNetwork;
}
}
5 changes: 2 additions & 3 deletions scripts/ccc/Set_CCR_Receivers_Adapters.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,10 @@ contract Celo is BaseSetCCRAdapters {
function getReceiverBridgeAdaptersToAllow(
Addresses memory addresses
) public pure override returns (address[] memory) {
address[] memory receiverBridgeAdaptersToAllow = new address[](4);
address[] memory receiverBridgeAdaptersToAllow = new address[](3);
receiverBridgeAdaptersToAllow[0] = addresses.lzAdapter;
receiverBridgeAdaptersToAllow[1] = addresses.hlAdapter;
receiverBridgeAdaptersToAllow[2] = addresses.wormholeAdapter;
receiverBridgeAdaptersToAllow[3] = addresses.ccipAdapter;
receiverBridgeAdaptersToAllow[2] = addresses.ccipAdapter;

return receiverBridgeAdaptersToAllow;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import '../../../BaseDeployerScript.sol';
import '../../../../src/adapter_payloads/Ethereum_Celo_Path_Payload.sol';

abstract contract Ethereum_Activate_Celo_Bridge_Adapter_Payload is BaseDeployerScript {
function _getPayloadByteCode() internal virtual returns (bytes memory);

function PAYLOAD_SALT() internal pure virtual returns (string memory) {
return 'Add Celo path to a.DI';
}

function DESTINATION_CHAIN_ID() internal pure virtual returns (uint256);

function _deployPayload(AddForwarderAdapterArgs memory args) internal returns (address) {
bytes memory payloadCode = abi.encodePacked(_getPayloadByteCode(), abi.encode(args));

return _deployByteCode(payloadCode, PAYLOAD_SALT());
}

function _execute(Addresses memory addresses) internal virtual override {
Addresses memory destinationAddresses = _getAddresses(DESTINATION_CHAIN_ID());

_deployPayload(
AddForwarderAdapterArgs({
crossChainController: addresses.crossChainController,
currentChainHLBridgeAdapter: addresses.hlAdapter,
destinationChainHLBridgeAdapter: destinationAddresses.hlAdapter,
currentChainCCIPBridgeAdapter: addresses.ccipAdapter,
destinationChainCCIPBridgeAdapter: destinationAddresses.ccipAdapter,
currentChainLZBridgeAdapter: addresses.lzAdapter,
destinationChainLZBridgeAdapter: destinationAddresses.lzAdapter,
destinationChainId: DESTINATION_CHAIN_ID()
})
);
}
}
24 changes: 21 additions & 3 deletions scripts/payloads/adapters/ethereum/Network_Deployments.s.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './Ethereum_Activate_Lina_Bridge_Adapter_Payload.s.sol';
import '../../../BaseDeployerScript.sol';
import {Ethereum_Activate_Celo_Bridge_Adapter_Payload} from './Ethereum_Activate_Celo_Bridge_Adapter_Payload.s.sol';
import {Ethereum_Activate_Lina_Bridge_Adapter_Payload} from './Ethereum_Activate_Lina_Bridge_Adapter_Payload.s.sol';
import {Ethereum_Celo_Path_Payload} from '../../../../src/adapter_payloads/Ethereum_Celo_Path_Payload.sol';
import {SimpleAddForwarderAdapter} from '../../../../src/templates/SimpleAddForwarderAdapter.sol';

contract Ethereum is Ethereum_Activate_Lina_Bridge_Adapter_Payload {
contract Ethereum is Ethereum_Activate_Celo_Bridge_Adapter_Payload {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.ETHEREUM;
}

function _getPayloadByteCode() internal pure override returns (bytes memory) {
return type(Ethereum_Celo_Path_Payload).creationCode;
}

function DESTINATION_CHAIN_ID() internal pure override returns (uint256) {
return ChainIds.CELO;
}
}

contract Ethereum_Linea is Ethereum_Activate_Lina_Bridge_Adapter_Payload {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.ETHEREUM;
}
Expand All @@ -15,4 +33,4 @@ contract Ethereum is Ethereum_Activate_Lina_Bridge_Adapter_Payload {
function DESTINATION_CHAIN_ID() internal pure override returns (uint256) {
return ChainIds.LINEA;
}
}
}
72 changes: 72 additions & 0 deletions src/adapter_payloads/Ethereum_Celo_Path_Payload.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import '../templates/BaseAdaptersUpdate.sol';

struct AddForwarderAdapterArgs {
address crossChainController;
address currentChainHLBridgeAdapter;
address destinationChainHLBridgeAdapter;
address currentChainLZBridgeAdapter;
address destinationChainLZBridgeAdapter;
address currentChainCCIPBridgeAdapter;
address destinationChainCCIPBridgeAdapter;
uint256 destinationChainId;
}

/**
* @title Ethereum_Celo_Path_Payload
* @author BGD Labs @bgdlabs
* @dev this payload adds a new bridging path to adi with multiple forwarder adapters
*/
contract Ethereum_Celo_Path_Payload is BaseAdaptersUpdate {
address public immutable CURRENT_CHAIN_HL_BRIDGE_ADAPTER;
address public immutable DESTINATION_CHAIN_HL_BRIDGE_ADAPTER;
address public immutable CURRENT_CHAIN_CCIP_BRIDGE_ADAPTER;
address public immutable DESTINATION_CHAIN_CCIP_BRIDGE_ADAPTER;
address public immutable CURRENT_CHAIN_LZ_BRIDGE_ADAPTER;
address public immutable DESTINATION_CHAIN_LZ_BRIDGE_ADAPTER;
uint256 public immutable DESTINATION_CHAIN_ID;

constructor(
AddForwarderAdapterArgs memory forwarderArgs
) BaseAdaptersUpdate(forwarderArgs.crossChainController) {
CURRENT_CHAIN_HL_BRIDGE_ADAPTER = forwarderArgs.currentChainHLBridgeAdapter;
DESTINATION_CHAIN_HL_BRIDGE_ADAPTER = forwarderArgs.destinationChainHLBridgeAdapter;
CURRENT_CHAIN_CCIP_BRIDGE_ADAPTER = forwarderArgs.currentChainCCIPBridgeAdapter;
DESTINATION_CHAIN_CCIP_BRIDGE_ADAPTER = forwarderArgs.destinationChainCCIPBridgeAdapter;
CURRENT_CHAIN_LZ_BRIDGE_ADAPTER = forwarderArgs.currentChainLZBridgeAdapter;
DESTINATION_CHAIN_LZ_BRIDGE_ADAPTER = forwarderArgs.destinationChainLZBridgeAdapter;
DESTINATION_CHAIN_ID = forwarderArgs.destinationChainId;
}

function getForwarderBridgeAdaptersToEnable()
public
view
override
returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory)
{
ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[]
memory newForwarders = new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[](3);

newForwarders[0] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({
currentChainBridgeAdapter: CURRENT_CHAIN_HL_BRIDGE_ADAPTER,
destinationBridgeAdapter: DESTINATION_CHAIN_HL_BRIDGE_ADAPTER,
destinationChainId: DESTINATION_CHAIN_ID
});

newForwarders[1] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({
currentChainBridgeAdapter: CURRENT_CHAIN_CCIP_BRIDGE_ADAPTER,
destinationBridgeAdapter: DESTINATION_CHAIN_CCIP_BRIDGE_ADAPTER,
destinationChainId: DESTINATION_CHAIN_ID
});

newForwarders[2] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({
currentChainBridgeAdapter: CURRENT_CHAIN_LZ_BRIDGE_ADAPTER,
destinationBridgeAdapter: DESTINATION_CHAIN_LZ_BRIDGE_ADAPTER,
destinationChainId: DESTINATION_CHAIN_ID
});

return newForwarders;
}
}
5 changes: 4 additions & 1 deletion tests/adi/ADITestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ contract ADITestBase is Test {
uint256 chainId
) internal pure returns (uint256[] memory) {
if (chainId == ChainIds.MAINNET) {
uint256[] memory chainIds = new uint256[](11);
uint256[] memory chainIds = new uint256[](12);
chainIds[0] = ChainIds.MAINNET;
chainIds[1] = ChainIds.POLYGON;
chainIds[2] = ChainIds.AVALANCHE;
Expand All @@ -599,6 +599,7 @@ contract ADITestBase is Test {
chainIds[8] = ChainIds.BASE;
chainIds[9] = ChainIds.SCROLL;
chainIds[10] = ChainIds.LINEA;
chainIds[11] = ChainIds.CELO;

return chainIds;
} else if (chainId == ChainIds.POLYGON) {
Expand Down Expand Up @@ -676,6 +677,8 @@ contract ADITestBase is Test {
return GovernanceV3Scroll.CROSS_CHAIN_CONTROLLER;
} else if (chainId == ChainIds.LINEA) {
return 0x0D3f821e9741C8a8Bcac231162320251Db0cdf52;
} else if (chainId == ChainIds.CELO) {
return 0x50F4dAA86F3c747ce15C3C38bD0383200B61d6Dd;
}
revert();
}
Expand Down
Loading
Loading