forked from bgd-labs/aave-delivery-infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWormholeAdapter.sol
56 lines (52 loc) · 1.68 KB
/
WormholeAdapter.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
55
56
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.8;
import {TestNetChainIds} from './TestNetChainIds.sol';
import {WormholeAdapter} from '../../src/contracts/adapters/wormhole/WormholeAdapter.sol';
import {BaseAdapter, IBaseAdapter} from '../../src/contracts/adapters/BaseAdapter.sol';
/**
* @title WormholeAdapterTestnet
* @author BGD Labs
*/
contract WormholeAdapterTestnet is WormholeAdapter {
/**
* @param crossChainController address of the cross chain controller that will use this bridge adapter
* @param wormholeRelayer wormhole entry point address
* @param refundAddress address that will receive left over gas
* @param trustedRemotes list of remote configurations to set as trusted
*/
constructor(
address crossChainController,
address wormholeRelayer,
address refundAddress,
uint256 providerGasLimit,
TrustedRemotesConfig[] memory trustedRemotes
)
WormholeAdapter(
crossChainController,
wormholeRelayer,
refundAddress,
providerGasLimit,
trustedRemotes
)
{}
/// @inheritdoc IBaseAdapter
function nativeToInfraChainId(uint256 nativeChainId) public pure override returns (uint256) {
if (nativeChainId == 10002) {
return TestNetChainIds.ETHEREUM_SEPOLIA;
} else if (nativeChainId == 14) {
return TestNetChainIds.CELO_ALFAJORES;
} else {
return 0;
}
}
/// @inheritdoc IBaseAdapter
function infraToNativeChainId(uint256 infraChainId) public pure override returns (uint256) {
if (infraChainId == TestNetChainIds.ETHEREUM_SEPOLIA) {
return 10002;
} else if (infraChainId == TestNetChainIds.CELO_ALFAJORES) {
return 14;
} else {
return 0;
}
}
}