Skip to main content

ICCIPCrossChainBridge

Git Source

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

NameTypeDescription
dstChainSelector_uint64The destination chain selector
to_bytes32The destination address
amount_uint256The amount of OHM to send

Returns

NameTypeDescription
fee_uint256The 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

NameTypeDescription
dstChainSelector_uint64The destination chain selector
to_addressThe destination address
amount_uint256The amount of OHM to send

Returns

NameTypeDescription
fee_uint256The 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

NameTypeDescription
dstChainSelector_uint64The destination chain selector
to_bytes32The destination address
amount_uint256The amount of OHM to send

Returns

NameTypeDescription
messageIdbytes32The 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

NameTypeDescription
dstChainSelector_uint64The destination chain selector
to_addressThe destination address
amount_uint256The amount of OHM to send

Returns

NameTypeDescription
messageIdbytes32The 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

NameTypeDescription
messageId_bytes32The message ID

Returns

NameTypeDescription
<none>ICCIPClient.Any2EVMMessagemessage_ The failed message

retryFailedMessage

Retries a failed message

function retryFailedMessage(bytes32 messageId_) external;

Parameters

NameTypeDescription
messageId_bytes32The 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

NameTypeDescription
recipient_addressThe 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

NameTypeDescription
dstChainSelector_uint64The destination chain selector
to_addressThe 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

NameTypeDescription
dstChainSelector_uint64The destination chain selector

getTrustedRemoteEVM

Gets the trusted remote for the specified destination EVM chain

function getTrustedRemoteEVM(uint64 dstChainSelector_) external view returns (TrustedRemoteEVM memory);

Parameters

NameTypeDescription
dstChainSelector_uint64The destination chain selector

Returns

NameTypeDescription
<none>TrustedRemoteEVMto_ 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

NameTypeDescription
dstChainSelector_uint64The destination chain selector
to_bytes32The 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

NameTypeDescription
dstChainSelector_uint64The destination chain selector

getTrustedRemoteSVM

Gets the trusted remote for the specified destination SVM chain

function getTrustedRemoteSVM(uint64 dstChainSelector_) external view returns (TrustedRemoteSVM memory);

Parameters

NameTypeDescription
dstChainSelector_uint64The destination chain selector

Returns

NameTypeDescription
<none>TrustedRemoteSVMto_ The destination address

setGasLimit

Sets the gas limit for the specified destination chain

function setGasLimit(uint64 dstChainSelector_, uint32 gasLimit_) external;

Parameters

NameTypeDescription
dstChainSelector_uint64The destination chain selector
gasLimit_uint32The gas limit

getGasLimit

Gets the gas limit for the specified destination chain

function getGasLimit(uint64 dstChainSelector_) external view returns (uint32);

Parameters

NameTypeDescription
dstChainSelector_uint64The destination chain selector

Returns

NameTypeDescription
<none>uint32gasLimit_ The gas limit, or 0 if not set

getCCIPRouter

Gets the CCIP router address

function getCCIPRouter() external view returns (address);

Returns

NameTypeDescription
<none>addressccipRouter_ 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;
}