Skip to content

Commit

Permalink
Merge pull request #35 from bgd-labs/feat/sonic-deployment
Browse files Browse the repository at this point in the history
feat: add sonic network
  • Loading branch information
sendra authored Feb 11, 2025
2 parents 7f85e10 + 1cc6a38 commit 2427d90
Show file tree
Hide file tree
Showing 14 changed files with 220 additions and 20 deletions.
20 changes: 10 additions & 10 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 1000000000 # 53 gwei
custom_ethereum := --with-gas-price 2000000000 # 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,23 +164,23 @@ deploy-full:

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

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

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

## Deploy LayerZero bridge adapters on all networks
deploy-lz-bridge-adapters-test:
$(call deploy_fn,adapters/DeployLZ,celo)
$(call deploy_fn,adapters/DeployLZ,sonic)

## Deploy HyperLane bridge adapters on all networks
deploy-hl-bridge-adapters-test:
$(call deploy_fn,adapters/DeployHL,celo)
$(call deploy_fn,adapters/DeployHL,sonic)

## Deploy SameChain adapters on ethereum
deploy-same-chain-adapters-test:
Expand Down Expand Up @@ -222,11 +222,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,mantle)
$(call deploy_fn,ccc/Set_CCR_Receivers_Adapters,sonic)

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


## Deploy and configure all contracts
Expand Down Expand Up @@ -269,7 +269,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,mantle)
$(call deploy_fn,access_control/network_scripts/GranularGuardianNetworkDeploys,sonic)

deploy-ccc-revision-and-update:
$(call deploy_fn,CCC/UpdateCCC,ethereum)
Expand All @@ -292,5 +292,5 @@ deploy-celo-path-payload:
update-owners-and-guardians:
$(call deploy_fn,helpers/Update_Ownership,zksync)

update-celo-permissions:
$(call deploy_fn,helpers/UpdateCCCPermissions,celo)
update-sonic-permissions:
$(call deploy_fn,helpers/UpdateCCCPermissions,sonic)
4 changes: 2 additions & 2 deletions deployments/ethereum.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"arbAdapter": "0x88d6D01e08d3e64513b15fD46528dBbA7d755883",
"baseAdapter": "0xa5948b0ac79f72966dFFC5C13E44f6dfDD3D58A0",
"ccipAdapter": "0x58489B249BfBCF5ef4B30bdE2792086e83122B6f",
"ccipAdapter": "0xe3a0d9754aD3452D687cf580Ba3674c2D7D2f7AE",
"chainId": 1,
"clEmergencyOracle": "0x0000000000000000000000000000000000000000",
"create3Factory": "0xcc3C54B95f3f1867A43009B80ed4DD930E3cE2F7",
Expand All @@ -14,7 +14,7 @@
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1",
"lineaAdapter": "0x8097555ffDa4176C93FEf92dF473b9763e467686",
"lzAdapter": "0x8410d9BD353b420ebA8C48ff1B0518426C280FCC",
"lzAdapter": "0x8FD7D8dd557817966181F584f2abB53549B4ABbe",
"mantleAdapter": "0xb66FA987fa7975Cac3d12B629c9c44e459e50990",
"metisAdapter": "0x6B3Dc800E7c813Db3fe8D0F30fDCaE636935dC14",
"mockDestination": "0x19198689FfBE82207F023248dca175a84c52eCE1",
Expand Down
31 changes: 31 additions & 0 deletions deployments/sonic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"arbAdapter": "0x0000000000000000000000000000000000000000",
"baseAdapter": "0x0000000000000000000000000000000000000000",
"ccipAdapter": "0x1905fCdDa41241C0871A5eC3f9dcC3E8d247261D",
"chainId": 146,
"clEmergencyOracle": "0xECB564e91f620fBFb59d0C4A41d7f10aDb0D1934",
"create3Factory": "0x0000000000000000000000000000000000000000",
"crossChainController": "0x58e003a3C6f2Aeed6a2a6Bc77B504566523cb15c",
"crossChainControllerImpl": "0xD34709B95740d0eB6c49Bd735f48281Dd5dc8B0e",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"executor": "0x7b62461a3570c6AC8a9f8330421576e417B71EE7",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x10078c1D8E46dd1ed5D8df2C42d5ABb969b11566",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x1098F187F5f444Bc1c77cD9beE99e8d460347F5F",
"lineaAdapter": "0x0000000000000000000000000000000000000000",
"lzAdapter": "0x7B8FaC105A7a85f02C3f31559d2ee7313BDC5d7f",
"mantleAdapter": "0x0000000000000000000000000000000000000000",
"metisAdapter": "0x0000000000000000000000000000000000000000",
"mockDestination": "0x0000000000000000000000000000000000000000",
"opAdapter": "0x0000000000000000000000000000000000000000",
"owner": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"polAdapter": "0x0000000000000000000000000000000000000000",
"proxyAdminCCC": "0x04aCbFA78c5F97a97995847AF2D6eaBD697552D4",
"proxyFactory": "0xEB0682d148e874553008730f0686ea89db7DA412",
"sameChainAdapter": "0x0000000000000000000000000000000000000000",
"scrollAdapter": "0x0000000000000000000000000000000000000000",
"wormholeAdapter": "0x0000000000000000000000000000000000000000",
"zkevmAdapter": "0x0000000000000000000000000000000000000000",
"zksyncAdapter": "0x0000000000000000000000000000000000000000"
}
4 changes: 4 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ zksync="${RPC_ZK_SYNC}"
zksync-testnet="${RPC_ZK_SYNC_TESTNET}"
linea="${RPC_LINEA}"
linea-testnet="${RPC_LINEA_SEPOLIA}"
sonic="${RPC_SONIC}"
sonic-testnet="${RPC_SONIC_TESTNET}"
mantle="${RPC_MANTLE}"
mantle-testnet="${RPC_MANTLE_TESTNET}"

Expand Down Expand Up @@ -92,6 +94,8 @@ zksync={key="${ETHERSCAN_API_KEY_ZK_SYNC}", chain=324}
zksync-testnet={key="${ETHERSCAN_API_KEY_ZK_SYNC}", chain=300, url='https://api-sepolia-era.zksync.network/api'}
linea={key="${ETHERSCAN_API_KEY_LINEA}", chain=59144 }
linea-testnet={key="${ETHERSCAN_API_KEY_LINEA}",chain=59141}
sonic={key="${ETHERSCAN_API_KEY_SONIC}", chain=146, url='https://api.sonicscan.org/api'}
sonic-testnet={key="${ETHERSCAN_API_KEY_SONIC}", chain=57054, url='https://api-testnet.sonicscan.org/api'}
mantle={key="${ETHERSCAN_API_KEY_MANTLE}", chain=5000, url='https://api.mantlescan.xyz/api'}
mantle-testnet={key="${ETHERSCAN_API_KEY_MANTLE}", chain=5003, url='https://explorer.testnet.mantle.xyz/api'}

Expand Down
16 changes: 15 additions & 1 deletion scripts/InitialDeployments.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,26 @@ contract Celo is BaseInitialDeployment {
}
}

contract Sonic is BaseInitialDeployment {
function TRANSPARENT_PROXY_FACTORY() internal pure override returns (address) {
return 0xEB0682d148e874553008730f0686ea89db7DA412;
}

function EXECUTOR() internal pure override returns (address) {
return 0x7b62461a3570c6AC8a9f8330421576e417B71EE7;
}

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

contract Mantle is BaseInitialDeployment {
function TRANSPARENT_PROXY_FACTORY() internal pure override returns (address) {
return 0xEB0682d148e874553008730f0686ea89db7DA412;
}

function EXECUTOR() internal view override returns (address) {
function EXECUTOR() internal pure override returns (address) {
return 0x9390B1735def18560c509E2d0bc090E9d6BA257a; // executor lvl1
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,24 @@ contract Celo is DeployGranularGuardian {
}
}

contract Sonic is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return 0x7b62461a3570c6AC8a9f8330421576e417B71EE7; //GovernanceV3Sonic.EXECUTOR_LVL_1;
}

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

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

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

contract Mantle is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return 0x70884634D0098782592111A2A6B8d223be31CB7b; //GovernanceV3Mantle.EXECUTOR_LVL_1;
Expand Down
23 changes: 23 additions & 0 deletions scripts/adapters/DeployCCIPAdapter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,29 @@ contract Celo is DeployCCIPAdapter {
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;
}
}

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

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

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

function REMOTE_CCC_BY_NETWORK() internal view override returns (RemoteCCC[] memory) {
RemoteCCC[] memory remoteCCCByNetwork = new RemoteCCC[](1);
remoteCCCByNetwork[0].chainId = ChainIds.ETHEREUM;
Expand Down
20 changes: 20 additions & 0 deletions scripts/adapters/DeployHL.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,23 @@ contract Celo_testnet is DeployHLAdapter {
return remoteCCCByNetwork;
}
}


contract Sonic is DeployHLAdapter {
function HL_MAIL_BOX() internal pure override returns (address) {
return 0x3a464f746D23Ab22155710f44dB16dcA53e0775E;
}

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

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;
}
}
19 changes: 19 additions & 0 deletions scripts/adapters/DeployLZ.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,22 @@ contract Celo_testnet is DeployLZAdapter {
return true;
}
}

contract Sonic is DeployLZAdapter {
function LZ_ENDPOINT() internal pure override returns (address) {
return 0x6F475642a6e85809B1c36Fa62763669b1b48DD5B;
}

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

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;
}
}
10 changes: 10 additions & 0 deletions scripts/ccc/DeployCCC.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ contract Linea is BaseCCCNetworkDeployment {
}
}

contract Sonic is BaseCCCNetworkDeployment {
function CL_EMERGENCY_ORACLE() internal pure override returns (address) {
return 0xECB564e91f620fBFb59d0C4A41d7f10aDb0D1934;
}

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

contract Mantle is BaseCCCNetworkDeployment {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.MANTLE;
Expand Down
23 changes: 21 additions & 2 deletions scripts/ccc/Set_CCF_Sender_Adapters.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct NetworkAddresses {
Addresses zksync;
Addresses linea;
Addresses mantle;
Addresses sonic;
}

abstract contract BaseCCFSenderAdapters is BaseDeployerScript {
Expand All @@ -43,7 +44,7 @@ contract Ethereum is BaseCCFSenderAdapters {
) public view override returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory) {
ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[]
memory bridgeAdaptersToEnable = new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[](
1
29
);

NetworkAddresses memory networkAddresses = NetworkAddresses({
Expand All @@ -60,6 +61,7 @@ contract Ethereum is BaseCCFSenderAdapters {
celo: _getAddresses(ChainIds.CELO),
zksync: _getAddresses(ChainIds.ZKSYNC),
linea: _getAddresses(ChainIds.LINEA),
sonic: _getAddresses(ChainIds.SONIC),
mantle: _getAddresses(ChainIds.MANTLE)
});

Expand Down Expand Up @@ -213,8 +215,25 @@ contract Ethereum is BaseCCFSenderAdapters {
destinationChainId: networkAddresses.linea.chainId
});

// Mantle
// Sonic
bridgeAdaptersToEnable[25] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({
currentChainBridgeAdapter: addresses.ccipAdapter,
destinationBridgeAdapter: networkAddresses.sonic.ccipAdapter,
destinationChainId: networkAddresses.sonic.chainId
});
bridgeAdaptersToEnable[26] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({
currentChainBridgeAdapter: addresses.lzAdapter,
destinationBridgeAdapter: networkAddresses.celo.lzAdapter,
destinationChainId: networkAddresses.celo.chainId
});
bridgeAdaptersToEnable[27] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({
currentChainBridgeAdapter: addresses.hlAdapter,
destinationBridgeAdapter: networkAddresses.celo.hlAdapter,
destinationChainId: networkAddresses.celo.chainId
});

// Mantle
bridgeAdaptersToEnable[28] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({
currentChainBridgeAdapter: addresses.mantleAdapter,
destinationBridgeAdapter: networkAddresses.mantle.mantleAdapter,
destinationChainId: networkAddresses.mantle.chainId
Expand Down
18 changes: 18 additions & 0 deletions scripts/ccc/Set_CCR_Confirmations.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,24 @@ contract Mantle is BaseSetCCRConfirmations {
}
}

contract Sonic is BaseSetCCRConfirmations {
function TRANSACTION_NETWORK() internal pure virtual override returns (uint256) {
return ChainIds.SONIC;
}

function getConfirmationsByChainIds()
public
virtual
override
returns (ConfirmationsByChain[] memory)
{
ConfirmationsByChain[] memory chainIds = new ConfirmationsByChain[](1);
chainIds[0] = ConfirmationsByChain({chainId: ChainIds.ETHEREUM, confirmations: 2});

return chainIds;
}
}

contract Ethereum_testnet is Ethereum {
function TRANSACTION_NETWORK() internal pure virtual override returns (uint256) {
return TestNetChainIds.ETHEREUM_SEPOLIA;
Expand Down
24 changes: 24 additions & 0 deletions scripts/ccc/Set_CCR_Receivers_Adapters.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,30 @@ contract Mantle is BaseSetCCRAdapters {
}
}

contract Sonic is BaseSetCCRAdapters {
function TRANSACTION_NETWORK() internal pure virtual override returns (uint256) {
return ChainIds.SONIC;
}

function getChainIds() public pure virtual override returns (uint256[] memory) {
uint256[] memory chainIds = new uint256[](1);
chainIds[0] = ChainIds.ETHEREUM;

return chainIds;
}

function getReceiverBridgeAdaptersToAllow(
Addresses memory addresses
) public pure override returns (address[] memory) {
address[] memory receiverBridgeAdaptersToAllow = new address[](3);
receiverBridgeAdaptersToAllow[0] = addresses.lzAdapter;
receiverBridgeAdaptersToAllow[1] = addresses.hlAdapter;
receiverBridgeAdaptersToAllow[2] = addresses.ccipAdapter;

return receiverBridgeAdaptersToAllow;
}
}

contract Ethereum_testnet is Ethereum {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return TestNetChainIds.ETHEREUM_SEPOLIA;
Expand Down
Loading

0 comments on commit 2427d90

Please sign in to comment.