Files
smom-dbis-138/contracts/ccip/IRouterClient.sol

90 lines
2.8 KiB
Solidity
Raw Normal View History

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/**
* @title Chainlink CCIP Router Client Interface
* @notice Interface for Chainlink CCIP Router Client
* @dev This interface is based on Chainlink CCIP Router Client specification
*/
interface IRouterClient {
/// @notice Represents the router's fee token
enum TokenAmountType {
Fiat,
Native
}
/// @notice Represents a token amount and its type
struct TokenAmount {
address token;
uint256 amount;
TokenAmountType amountType;
}
/// @notice Represents a CCIP message
struct EVM2AnyMessage {
bytes receiver;
bytes data;
TokenAmount[] tokenAmounts;
address feeToken;
bytes extraArgs;
}
/// @notice Represents a CCIP message with source chain information
struct Any2EVMMessage {
bytes32 messageId;
uint64 sourceChainSelector;
bytes sender;
bytes data;
TokenAmount[] tokenAmounts;
}
/// @notice Emitted when a message is sent
event MessageSent(
bytes32 indexed messageId,
uint64 indexed destinationChainSelector,
address indexed sender,
bytes receiver,
bytes data,
TokenAmount[] tokenAmounts,
address feeToken,
bytes extraArgs
);
/// @notice Emitted when a message is received
event MessageReceived(
bytes32 indexed messageId,
uint64 indexed sourceChainSelector,
address indexed sender,
bytes data,
TokenAmount[] tokenAmounts
);
/// @notice Sends a message to a destination chain
/// @param destinationChainSelector The chain selector of the destination chain
/// @param message The message to send
/// @return messageId The ID of the sent message
/// @return fees The fees required for the message
/// @dev If feeToken is zero address, fees are paid in native token (ETH) via msg.value
function ccipSend(
uint64 destinationChainSelector,
EVM2AnyMessage memory message
) external payable returns (bytes32 messageId, uint256 fees);
/// @notice Gets the fee for sending a message
/// @param destinationChainSelector The chain selector of the destination chain
/// @param message The message to send
/// @return fee The fee required for the message
function getFee(
uint64 destinationChainSelector,
EVM2AnyMessage memory message
) external view returns (uint256 fee);
/// @notice Gets the supported tokens for a destination chain
/// @param destinationChainSelector The chain selector of the destination chain
/// @return tokens The list of supported tokens
function getSupportedTokens(
uint64 destinationChainSelector
) external view returns (address[] memory tokens);
}