ICCIPCrossChainBridge
Functions
getFeeSVM
Gets the fee for sending OHM to the specified destination SVM chain
This can be used to send to an address on any chain supported by CCIP
function getFeeSVM(uint64 dstChainSelector_, bytes32 to_, uint256 amount_) external view returns (uint256 fee_);
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
to_ | bytes32 | The destination address |
amount_ | uint256 | The amount of OHM to send |
Returns
Name | Type | Description |
---|---|---|
fee_ | uint256 | The fee for sending OHM to the specified destination chain |
getFeeEVM
Gets the fee for sending OHM to the specified destination EVM chain
This can be used to send to an address on any EVM chain supported by CCIP
function getFeeEVM(uint64 dstChainSelector_, address to_, uint256 amount_) external view returns (uint256 fee_);
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
to_ | address | The destination address |
amount_ | uint256 | The amount of OHM to send |
Returns
Name | Type | Description |
---|---|---|
fee_ | uint256 | The fee for sending OHM to the specified destination EVM chain |
sendToSVM
Sends OHM to the specified destination SVM chain
This can be used to send to an address on any chain supported by CCIP
function sendToSVM(uint64 dstChainSelector_, bytes32 to_, uint256 amount_)
external
payable
returns (bytes32 messageId);
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
to_ | bytes32 | The destination address |
amount_ | uint256 | The amount of OHM to send |
Returns
Name | Type | Description |
---|---|---|
messageId | bytes32 | The message ID of the sent message |
sendToEVM
Sends OHM to the specified destination EVM chain
This can be used to send to an address on any EVM chain supported by CCIP
function sendToEVM(uint64 dstChainSelector_, address to_, uint256 amount_)
external
payable
returns (bytes32 messageId);
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
to_ | address | The destination address |
amount_ | uint256 | The amount of OHM to send |
Returns
Name | Type | Description |
---|---|---|
messageId | bytes32 | The message ID of the sent message |
getFailedMessage
Gets the failed message for the specified message ID
function getFailedMessage(bytes32 messageId_) external view returns (ICCIPClient.Any2EVMMessage memory);
Parameters
Name | Type | Description |
---|---|---|
messageId_ | bytes32 | The message ID |
Returns
Name | Type | Description |
---|---|---|
<none> | ICCIPClient.Any2EVMMessage | message_ The failed message |
retryFailedMessage
Retries a failed message
function retryFailedMessage(bytes32 messageId_) external;
Parameters
Name | Type | Description |
---|---|---|
messageId_ | bytes32 | The message ID |
withdraw
Allows the owner to withdraw the native token from the contract
This is needed as senders may provide more native token than needed to cover fees
function withdraw(address recipient_) external;
Parameters
Name | Type | Description |
---|---|---|
recipient_ | address | The recipient of the native token |
setTrustedRemoteEVM
Sets the trusted remote for the specified destination EVM chain
This is needed to send/receive messages to/from the specified destination EVM chain
function setTrustedRemoteEVM(uint64 dstChainSelector_, address to_) external;
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
to_ | address | The destination address |
unsetTrustedRemoteEVM
Unsets the trusted remote for the specified destination EVM chain
This is needed to stop sending/receiving messages to/from the specified destination EVM chain
function unsetTrustedRemoteEVM(uint64 dstChainSelector_) external;
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
getTrustedRemoteEVM
Gets the trusted remote for the specified destination EVM chain
function getTrustedRemoteEVM(uint64 dstChainSelector_) external view returns (TrustedRemoteEVM memory);
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
Returns
Name | Type | Description |
---|---|---|
<none> | TrustedRemoteEVM | to_ The destination address |
setTrustedRemoteSVM
Sets the trusted remote for the specified destination SVM chain
This is needed to send/receive messages to/from the specified destination SVM chain
function setTrustedRemoteSVM(uint64 dstChainSelector_, bytes32 to_) external;
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
to_ | bytes32 | The destination address |
unsetTrustedRemoteSVM
Unsets the trusted remote for the specified destination SVM chain
This is needed to stop sending/receiving messages to/from the specified destination SVM chain
function unsetTrustedRemoteSVM(uint64 dstChainSelector_) external;
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
getTrustedRemoteSVM
Gets the trusted remote for the specified destination SVM chain
function getTrustedRemoteSVM(uint64 dstChainSelector_) external view returns (TrustedRemoteSVM memory);
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
Returns
Name | Type | Description |
---|---|---|
<none> | TrustedRemoteSVM | to_ The destination address |
setGasLimit
Sets the gas limit for the specified destination chain
function setGasLimit(uint64 dstChainSelector_, uint32 gasLimit_) external;
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
gasLimit_ | uint32 | The gas limit |
getGasLimit
Gets the gas limit for the specified destination chain
function getGasLimit(uint64 dstChainSelector_) external view returns (uint32);
Parameters
Name | Type | Description |
---|---|---|
dstChainSelector_ | uint64 | The destination chain selector |
Returns
Name | Type | Description |
---|---|---|
<none> | uint32 | gasLimit_ The gas limit, or 0 if not set |
getCCIPRouter
Gets the CCIP router address
function getCCIPRouter() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | ccipRouter_ The CCIP router address |
Events
Bridged
event Bridged(bytes32 messageId, uint64 destinationChainSelector, address indexed sender, uint256 amount, uint256 fees);
Received
event Received(bytes32 messageId, uint64 sourceChainSelector, address indexed sender, uint256 amount);
Withdrawn
event Withdrawn(address indexed recipient, uint256 amount);
TrustedRemoteEVMSet
event TrustedRemoteEVMSet(uint64 indexed dstChainSelector, address indexed to);
TrustedRemoteEVMUnset
event TrustedRemoteEVMUnset(uint64 indexed dstChainSelector);
TrustedRemoteSVMSet
event TrustedRemoteSVMSet(uint64 indexed dstChainSelector, bytes32 indexed to);
TrustedRemoteSVMUnset
event TrustedRemoteSVMUnset(uint64 indexed dstChainSelector);
GasLimitSet
event GasLimitSet(uint64 indexed dstChainSelector, uint32 gasLimit);
MessageFailed
event MessageFailed(bytes32 messageId);
RetryMessageSuccess
event RetryMessageSuccess(bytes32 messageId);
Errors
Bridge_InvalidAddress
error Bridge_InvalidAddress(string param);
Bridge_ZeroAmount
error Bridge_ZeroAmount();
Bridge_InsufficientAmount
error Bridge_InsufficientAmount(uint256 expected, uint256 actual);
Bridge_InsufficientNativeToken
error Bridge_InsufficientNativeToken(uint256 expected, uint256 actual);
Bridge_TransferFailed
error Bridge_TransferFailed(address caller, address recipient, uint256 amount);
Bridge_DestinationNotTrusted
error Bridge_DestinationNotTrusted();
Bridge_SourceNotTrusted
error Bridge_SourceNotTrusted();
Bridge_InvalidCaller
error Bridge_InvalidCaller();
Bridge_FailedMessageNotFound
error Bridge_FailedMessageNotFound(bytes32 messageId);
Bridge_InvalidPayloadTokensLength
error Bridge_InvalidPayloadTokensLength();
Bridge_InvalidPayloadToken
error Bridge_InvalidPayloadToken();
Bridge_TrustedRemoteNotSet
error Bridge_TrustedRemoteNotSet();
Structs
TrustedRemoteEVM
struct TrustedRemoteEVM {
address remoteAddress;
bool isSet;
}
TrustedRemoteSVM
struct TrustedRemoteSVM {
bytes32 remoteAddress;
bool isSet;
}