-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathITokenBridge.sol
More file actions
72 lines (60 loc) · 3.19 KB
/
ITokenBridge.sol
File metadata and controls
72 lines (60 loc) · 3.19 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
import {PoolId} from "../../core/types/PoolId.sol";
import {ShareClassId} from "../../core/types/ShareClassId.sol";
import {ITrustedContractUpdate} from "../../core/utils/interfaces/IContractUpdate.sol";
interface ITokenBridge is ITrustedContractUpdate {
event File(bytes32 indexed what, address data);
event File(bytes32 indexed what, uint256 evmChainId, uint16 centrifugeId);
event UpdateGasLimits(
PoolId indexed poolId, ShareClassId indexed scId, uint128 extraGasLimit, uint128 remoteExtraGasLimit
);
error FileUnrecognizedParam();
error InvalidChainId();
error InvalidRelayer();
error InvalidToken();
error UnknownTrustedCall();
error ShareTokenDoesNotExist();
error FailedToTransferToRelayer();
enum TrustedCall {
SetGasLimits
}
struct GasLimits {
uint128 extraGasLimit;
uint128 remoteExtraGasLimit;
}
//----------------------------------------------------------------------------------------------
// Administration
//----------------------------------------------------------------------------------------------
/// @notice Configure contract parameters
/// @param what The parameter name to configure
/// @param data The address value to set
function file(bytes32 what, address data) external;
/// @notice Configure chain ID mapping
/// @param what Must be "centrifugeId"
/// @param evmChainId The EVM chain ID
/// @param centrifugeId The corresponding Centrifuge chain ID
function file(bytes32 what, uint256 evmChainId, uint16 centrifugeId) external;
//----------------------------------------------------------------------------------------------
// Bridging
//----------------------------------------------------------------------------------------------
/// @notice Send a token from chain A to chain B after approving this contract with the token
/// @dev This function transfers tokens from the caller and initiates a cross-chain transfer
/// @dev These methods match the expected interface from Glacis Airlift for cross-chain token transfers
/// @param token The address of the token sending across chains
/// @param amount The amount of the token to send across chains
/// @param receiver The target address that should receive the funds on the destination chain
/// @param destinationChainId The Ethereum chain ID of the destination chain
/// @param refundAddress The address that should receive any funds if the cross-chain gas value is too high
/// @return sendResponse The response from the token's handler function (not standardized)
function send(address token, uint256 amount, bytes32 receiver, uint256 destinationChainId, address refundAddress)
external
payable
returns (bytes memory);
//----------------------------------------------------------------------------------------------
// View methods
//----------------------------------------------------------------------------------------------
/// @notice Returns the relayer address
/// @return The relayer address
function relayer() external view returns (address);
}