-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathCCIPAdapter.sol
54 lines (50 loc) · 2.1 KB
/
CCIPAdapter.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.8;
import {TestNetChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol';
import {CCIPAdapter} from '../../src/contracts/adapters/ccip/CCIPAdapter.sol';
import {BaseAdapter, IBaseAdapter} from '../../src/contracts/adapters/BaseAdapter.sol';
/**
* @title CCIPAdapterTestnet
* @author BGD Labs
*/
contract CCIPAdapterTestnet is CCIPAdapter {
/**
* @param crossChainController address of the cross chain controller that will use this bridge adapter
* @param ccipRouter ccip entry point address
* @param trustedRemotes list of remote configurations to set as trusted
* @param linkToken address of the LINK token
*/
constructor(
address crossChainController,
address ccipRouter,
uint256 providerGasLimit,
TrustedRemotesConfig[] memory trustedRemotes,
address linkToken
) CCIPAdapter(crossChainController, ccipRouter, providerGasLimit, trustedRemotes, linkToken) {}
/// @inheritdoc IBaseAdapter
function nativeToInfraChainId(uint256 nativeChainId) public pure override returns (uint256) {
if (nativeChainId == uint64(16015286601757825753)) {
return TestNetChainIds.ETHEREUM_SEPOLIA;
} else if (nativeChainId == uint64(14767482510784806043)) {
return TestNetChainIds.AVALANCHE_FUJI;
} else if (nativeChainId == uint64(16281711391670634445)) {
return TestNetChainIds.POLYGON_AMOY;
} else if (nativeChainId == uint64(13264668187771770619)) {
return TestNetChainIds.BNB_TESTNET;
}
return nativeChainId;
}
/// @inheritdoc IBaseAdapter
function infraToNativeChainId(uint256 infraChainId) public pure override returns (uint256) {
if (infraChainId == TestNetChainIds.ETHEREUM_SEPOLIA) {
return uint64(16015286601757825753);
} else if (infraChainId == TestNetChainIds.AVALANCHE_FUJI) {
return uint64(14767482510784806043);
} else if (infraChainId == TestNetChainIds.POLYGON_AMOY) {
return uint64(16281711391670634445);
} else if (infraChainId == TestNetChainIds.BNB_TESTNET) {
return uint64(13264668187771770619);
}
return infraChainId;
}
}