Skip to content
Open
18 changes: 11 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ BASE_KEY = --private-key ${PRIVATE_KEY}


custom_ethereum := --with-gas-price 45000000000 # 53 gwei
custom_ethereum-testnet := --with-gas-price 130000000000 --legacy
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/
custom_metis := --verifier-url https://api.routescan.io/v2/network/mainnet/evm/1088/etherscan
custom_scroll-testnet := --legacy --with-gas-price 1000000000 # 1 gwei
custom_scroll-testnet := --legacy # 1 gwei

# params:
# 1 - path/file_name
Expand Down Expand Up @@ -203,17 +204,20 @@ deploy-metis-adapters-test:
deploy-base-adapters-test:
$(call deploy_fn,Adapters/DeployCBaseAdapter,ethereum)

deploy-axelar-adapters-test:
$(call deploy_fn,Adapters/DeployAxelarAdapter,ethereum scroll)

## Set sender bridge dapters. Only eth pol avax are needed as other networks will only receive
set-ccf-sender-adapters-test:
$(call deploy_fn,CCC/Set_CCF_Sender_Adapters,avalanche)
$(call deploy_fn,CCC/Set_CCF_Sender_Adapters,ethereum)

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

# Sets the required confirmations
set-ccr-confirmations-test:
$(call deploy_fn,CCC/Set_CCR_Confirmations,ethereum)
$(call deploy_fn,CCC/Set_CCR_Confirmations,scroll)

# Funds CCC
fund-crosschain-test:
Expand All @@ -238,13 +242,13 @@ deploy-full-test:
# ----------------------------------------------------------------------------------------------------------------------
# ----------------------------------------- HELPER SCRIPTS ---------------------------------------------------------
remove-bridge-adapters:
$(call deploy_fn,helpers/RemoveBridgeAdapters,celo)
$(call deploy_fn,helpers/RemoveBridgeAdapters,ethereum)

send-direct-message:
$(call deploy_fn,helpers/Send_Direct_CCMessage,avalanche)
$(call deploy_fn,helpers/Send_Direct_CCMessage,ethereum)

deploy_mock_destination:
$(call deploy_fn,helpers/Deploy_Mock_destination,ethereum)
$(call deploy_fn,helpers/Deploy_Mock_destination,scroll)

set-approved-ccf-senders:
$(call deploy_fn,helpers/Set_Approved_Senders,ethereum)
Expand Down
5 changes: 4 additions & 1 deletion deployments/cc/testnet/scroll_sepolia.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"arbAdapter": "0x0000000000000000000000000000000000000000",
"axelarAdapter": "0x3003206c02a0EC2e556D5dAC9E87c8C9CACA6e5b",
"baseAdapter": "0x0000000000000000000000000000000000000000",
"ccipAdapter": "0x0000000000000000000000000000000000000000",
"chainId": 534351,
Expand All @@ -9,17 +10,19 @@
"crossChainControllerImpl": "0x4E097ce514bD5623E6dafE14118a6211d8226832",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"guardian": "0x6D603081563784dB3f83ef1F65Cc389D94365Ac9",
"hlAdapter": "0x0000000000000000000000000000000000000000",
"lzAdapter": "0x0000000000000000000000000000000000000000",
"metisAdapter": "0x0000000000000000000000000000000000000000",
"mockDestination": "0xF718d61c51EB65164e160A850b98E9038Fa873a5",
"mockDestination": "0xF1a818CE6b4F49452388099e6E671E42F1767AB6",
"opAdapter": "0x0000000000000000000000000000000000000000",
"owner": "0x6D603081563784dB3f83ef1F65Cc389D94365Ac9",
"polAdapter": "0x0000000000000000000000000000000000000000",
"proxyAdmin": "0xA89e270a2e49268CD2fEa2949c2Abf86bE26Cc29",
"proxyFactory": "0x72F460dA1f429391D2228369dB653E1441780810",
"sameChainAdapter": "0x0000000000000000000000000000000000000000",
"scrollAdapter": "0x9E96A989425d69Bec6DdA993Eadc8229D2AB1cef",
"wormholeAdapter": "0x0000000000000000000000000000000000000000",
"zkevmAdapter": "0x0000000000000000000000000000000000000000"
}
4 changes: 3 additions & 1 deletion deployments/cc/testnet/sep.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"arbAdapter": "0x0000000000000000000000000000000000000000",
"axelarAdapter": "0xf1E85fC9b66Aa0C74Fd86775860Cf7F9aF22fcb9",
"baseAdapter": "0x0000000000000000000000000000000000000000",
"ccipAdapter": "0x81Cb82983c973797FCADfC7b3F13ca15E03e7E98",
"chainId": 11155111,
Expand All @@ -9,6 +10,7 @@
"crossChainControllerImpl": "0x51Ca5ADc684f2C23deC1F8f762668D7a0Fd601fd",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"guardian": "0x6D603081563784dB3f83ef1F65Cc389D94365Ac9",
"hlAdapter": "0x158d2Ab713BD05a2a32F7a0776bA4F1c93d2937f",
"lzAdapter": "0xd52F3438F755f46E35f4741B9443b1F0A5bA7eB1",
Expand All @@ -23,4 +25,4 @@
"scrollAdapter": "0xba62183cc12d68ca9Cf9a8b2ed64107fAd1F1d2f",
"wormholeAdapter": "0x42D8D601cB91df86367229d04D8cf3556464c5c7",
"zkevmAdapter": "0x0000000000000000000000000000000000000000"
}
}
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ gnosis-testnet="${RPC_GNOSIS_TESTNET}"
zkevm="${RPC_ZKEVM}"
zkevm-testnet="${RPC_ZKEVM_TESTNET}"
scroll="${RPC_SCROLL}"
scroll-testnet="${RPC_SCROLL_TESTNET}"
scroll-testnet="${RPC_SCROLL_SEPOLIA}"
celo="${RPC_CELO}"
celo-testnet="${RPC_CELO_ALFAJORES}"

Expand Down
58 changes: 58 additions & 0 deletions scripts/Adapters/DeployAxelarAdapter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import {AxelarAdapter, IAxelarAdapter, IBaseAdapter} from '../../src/contracts/adapters/axelar/AxelarAdapter.sol';
import {AxelarAdapterTestnet} from '../contract_extensions/AxelarAdapter.sol';
import './BaseAdapterScript.sol';

library AxelarAdapterDeploymentHelper {
struct AxelarAdapterArgs {
BaseAdapterArgs baseArgs;
address axelarGateway;
address axelarGasService;
}

function getAdapterCode(
AxelarAdapterArgs memory axelarArgs
) internal pure returns (bytes memory) {
bytes memory creationCode = axelarArgs.baseArgs.isTestnet
? type(AxelarAdapterTestnet).creationCode
: type(AxelarAdapter).creationCode;

return
abi.encodePacked(
creationCode,
abi.encode(
IBaseAdapter.BaseAdapterArgs({
crossChainController: axelarArgs.baseArgs.crossChainController,
providerGasLimit: axelarArgs.baseArgs.providerGasLimit,
trustedRemotes: axelarArgs.baseArgs.trustedRemotes
}),
axelarArgs.axelarGateway,
axelarArgs.axelarGasService
)
);
}
}

abstract contract BaseDeployAxelarAdapter is BaseAdapterScript {
function AXELAR_GATEWAY() public view virtual returns (address);

function AXELAR_GAS_SERVICE() public view virtual returns (address);

function _getAdapterByteCode(
BaseAdapterArgs memory baseArgs
) internal view override returns (bytes memory) {
require(AXELAR_GATEWAY() != address(0), 'Invalid Axelar Gateway');
require(AXELAR_GAS_SERVICE() != address(0), 'Invalid Axelar Gas Service');

return
AxelarAdapterDeploymentHelper.getAdapterCode(
AxelarAdapterDeploymentHelper.AxelarAdapterArgs({
baseArgs: baseArgs,
axelarGateway: AXELAR_GATEWAY(),
axelarGasService: AXELAR_GAS_SERVICE()
})
);
}
}
79 changes: 79 additions & 0 deletions scripts/contract_extensions/AxelarAdapter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.8;

import {TestNetChainIds} from 'aave-helpers/ChainIds.sol';
import {IAxelarAdapter, AxelarAdapter, Strings} from '../../src/contracts/adapters/axelar/AxelarAdapter.sol';

/**
* @title AxelarAdapterTestnet
* @author BGD Labs
*/
contract AxelarAdapterTestnet is AxelarAdapter {
using Strings for string;

/**
* @notice constructor for the Axelar adapter
* @param baseArgs adapter base arguments
* @param gateway address of the axelar gateway endpoint on the current chain where adapter is deployed
* @param gasService address of the axelar gas service endpoint on the current chain where adapter is deployed
*/
constructor(
BaseAdapterArgs memory baseArgs,
address gateway,
address gasService
) AxelarAdapter(baseArgs, gateway, gasService) {}

/// @inheritdoc IAxelarAdapter
function axelarNativeToInfraChainId(
string memory nativeChainId
) public pure override returns (uint256) {
if (nativeChainId.equal('ethereum-sepolia')) {
return TestNetChainIds.ETHEREUM_SEPOLIA;
} else if (nativeChainId.equal('Avalanche')) {
return TestNetChainIds.AVALANCHE_FUJI;
} else if (nativeChainId.equal('arbitrum-sepolia')) {
return TestNetChainIds.ARBITRUM_SEPOLIA;
} else if (nativeChainId.equal('optimism-sepolia')) {
return TestNetChainIds.OPTIMISM_SEPOLIA;
} else if (nativeChainId.equal('base-sepolia')) {
return TestNetChainIds.BASE_SEPOLIA;
} else if (nativeChainId.equal('binance')) {
return TestNetChainIds.BNB_TESTNET;
} else if (nativeChainId.equal('scroll')) {
return TestNetChainIds.SCROLL_SEPOLIA;
} else if (nativeChainId.equal('celo')) {
return TestNetChainIds.CELO_ALFAJORES;
} else if (nativeChainId.equal('Fantom')) {
return TestNetChainIds.FANTOM_TESTNET;
} else {
return 0;
}
}

/// @inheritdoc IAxelarAdapter
function axelarInfraToNativeChainId(
uint256 infraChainId
) public pure override returns (string memory) {
if (infraChainId == TestNetChainIds.ETHEREUM_SEPOLIA) {
return 'ethereum-sepolia';
} else if (infraChainId == TestNetChainIds.AVALANCHE_FUJI) {
return 'Avalanche';
} else if (infraChainId == TestNetChainIds.ARBITRUM_SEPOLIA) {
return 'arbitrum-sepolia';
} else if (infraChainId == TestNetChainIds.OPTIMISM_SEPOLIA) {
return 'optimism-sepolia';
} else if (infraChainId == TestNetChainIds.FANTOM_TESTNET) {
return 'Fantom';
} else if (infraChainId == TestNetChainIds.BASE_SEPOLIA) {
return 'base-sepolia';
} else if (infraChainId == TestNetChainIds.SCROLL_SEPOLIA) {
return 'scroll';
} else if (infraChainId == TestNetChainIds.BNB_TESTNET) {
return 'binance';
} else if (infraChainId == TestNetChainIds.CELO_ALFAJORES) {
return 'celo';
} else {
return '';
}
}
}
12 changes: 12 additions & 0 deletions src/contracts/adapters/IBaseAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ import {IBaseCrossChainController} from '../interfaces/IBaseCrossChainController
* @notice interface containing the event and method used in all bridge adapters
*/
interface IBaseAdapter {
/**
* @notice Adapter constructor base arguments
* @param crossChainController address of the contract that manages cross chain infrastructure
* @param providerGasLimit base gas limit used by the bridge adapter
* @param trustedRemotes array of objects with chain id and origin addresses which will be allowed to send messages to this adapter
*/
struct BaseAdapterArgs {
address crossChainController;
uint256 providerGasLimit;
TrustedRemotesConfig[] trustedRemotes;
}

/**
* @notice emitted when a trusted remote is set
* @param originChainId id of the chain where the trusted remote is from
Expand Down
Loading