CCIP v1.6.0 FeeQuoter API Reference
FeeQuoter
The FeeQuoter contract stores gas and token prices in USD, manages chain-specific fee calculations, and provides fee estimation for cross-chain messages.
Errors
TokenNotSupported
error TokenNotSupported(address token);
Parameters
| Name | Type | Description |
|---|---|---|
token | address | The unsupported token address |
FeeTokenNotSupported
error FeeTokenNotSupported(address token);
Parameters
| Name | Type | Description |
|---|---|---|
token | address | The unsupported fee token address |
StaleGasPrice
error StaleGasPrice(uint64 destChainSelector, uint256 threshold, uint256 timePassed);
Parameters
| Name | Type | Description |
|---|---|---|
destChainSelector | uint64 | The destination chain selector |
threshold | uint256 | The staleness threshold in seconds |
timePassed | uint256 | The time passed since last update in seconds |
MessageGasLimitTooHigh
error MessageGasLimitTooHigh();
MessageComputeUnitLimitTooHigh
error MessageComputeUnitLimitTooHigh();
DestinationChainNotEnabled
error DestinationChainNotEnabled(uint64 destChainSelector);
Parameters
| Name | Type | Description |
|---|---|---|
destChainSelector | uint64 | The disabled destination chain selector |
ExtraArgOutOfOrderExecutionMustBeTrue
error ExtraArgOutOfOrderExecutionMustBeTrue();
InvalidExtraArgsTag
error InvalidExtraArgsTag();
InvalidExtraArgsData
error InvalidExtraArgsData();
MessageTooLarge
error MessageTooLarge(uint256 maxSize, uint256 actualSize);
Parameters
| Name | Type | Description |
|---|---|---|
maxSize | uint256 | Maximum allowed message size |
actualSize | uint256 | Actual message size that was too large |
UnsupportedNumberOfTokens
error UnsupportedNumberOfTokens(uint256 numberOfTokens, uint256 maxNumberOfTokensPerMsg);
Parameters
| Name | Type | Description |
|---|---|---|
numberOfTokens | uint256 | Number of tokens in the message |
maxNumberOfTokensPerMsg | uint256 | Maximum allowed number of tokens per message |
MessageFeeTooHigh
error MessageFeeTooHigh(uint256 msgFeeJuels, uint256 maxFeeJuelsPerMsg);
Parameters
| Name | Type | Description |
|---|---|---|
msgFeeJuels | uint256 | Calculated message fee in Juels |
maxFeeJuelsPerMsg | uint256 | Maximum allowed fee in Juels per message |
InvalidTokenReceiver
error InvalidTokenReceiver();
TooManySVMExtraArgsAccounts
error TooManySVMExtraArgsAccounts(uint256 numAccounts, uint256 maxAccounts);
Parameters
| Name | Type | Description |
|---|---|---|
numAccounts | uint256 | Number of accounts provided |
maxAccounts | uint256 | Maximum allowed number of accounts |
InvalidSVMExtraArgsWritableBitmap
error InvalidSVMExtraArgsWritableBitmap(uint64 accountIsWritableBitmap, uint256 numAccounts);
Parameters
| Name | Type | Description |
|---|---|---|
accountIsWritableBitmap | uint64 | The provided writable bitmap |
numAccounts | uint256 | Number of accounts in the extra args |
TooManySuiExtraArgsReceiverObjectIds
error TooManySuiExtraArgsReceiverObjectIds(uint256 numReceiverObjectIds, uint256 maxReceiverObjectIds);
Parameters
| Name | Type | Description |
|---|---|---|
numReceiverObjectIds | uint256 | Number of receiver object IDs provided |
maxReceiverObjectIds | uint256 | Maximum allowed number of receiver object IDs |
InvalidChainFamilySelector
error InvalidChainFamilySelector(bytes4 chainFamilySelector);
Parameters
| Name | Type | Description |
|---|---|---|
chainFamilySelector | bytes4 | The invalid chain family selector |
Structs
TokenTransferFeeConfig
Structure defining the fee configuration for token transfers.
struct TokenTransferFeeConfig {
uint32 minFeeUSDCents;
uint32 maxFeeUSDCents;
uint16 deciBps;
uint32 destGasOverhead;
uint32 destBytesOverhead;
bool isEnabled;
}
Properties
| Name | Type | Description |
|---|---|---|
minFeeUSDCents | uint32 | Minimum fee to charge per token transfer, multiples of 0.01 USD |
maxFeeUSDCents | uint32 | Maximum fee to charge per token transfer, multiples of 0.01 USD |
deciBps | uint16 | Basis points charged on token transfers, multiples of 0.1bps, or 1e-5 |
destGasOverhead | uint32 | Gas charged to execute the token transfer on the destination chain |
destBytesOverhead | uint32 | Data availability bytes returned from source pool, must be >= Pool.CCIP_LOCK_OR_BURN_V1_RET_BYTES |
isEnabled | bool | Whether this token has custom transfer fees |
DestChainConfig
Structure containing all configuration for a destination chain.
struct DestChainConfig {
bool isEnabled;
uint16 maxNumberOfTokensPerMsg;
uint32 maxDataBytes;
uint32 maxPerMsgGasLimit;
uint32 destGasOverhead;
uint8 destGasPerPayloadByteBase;
uint8 destGasPerPayloadByteHigh;
uint16 destGasPerPayloadByteThreshold;
uint32 destDataAvailabilityOverheadGas;
uint16 destGasPerDataAvailabilityByte;
uint16 destDataAvailabilityMultiplierBps;
bytes4 chainFamilySelector;
bool enforceOutOfOrder;
uint16 defaultTokenFeeUSDCents;
uint32 defaultTokenDestGasOverhead;
uint32 defaultTxGasLimit;
uint64 gasMultiplierWeiPerEth;
uint32 gasPriceStalenessThreshold;
uint32 networkFeeUSDCents;
}
Properties
| Name | Type | Description |
|---|---|---|
isEnabled | bool | Whether this destination chain is enabled |
maxNumberOfTokensPerMsg | uint16 | Maximum number of distinct ERC20 tokens transferred per message |
maxDataBytes | uint32 | Maximum data payload size in bytes |
maxPerMsgGasLimit | uint32 | Maximum gas limit for messages targeting EVMs |
destGasOverhead | uint32 | Gas charged on top of the gasLimit to cover destination chain costs |
destGasPerPayloadByteBase | uint8 | Default dest-chain gas charged per byte of data payload |
destGasPerPayloadByteHigh | uint8 | High dest-chain gas charged per byte of data payload (for EIP-7623) |
destGasPerPayloadByteThreshold | uint16 | The value at which billing switches from base to high rate |
destDataAvailabilityOverheadGas | uint32 | Data availability gas charged for overhead costs (e.g., OCR) |
destGasPerDataAvailabilityByte | uint16 | Gas units charged per byte of message data requiring availability |
destDataAvailabilityMultiplierBps | uint16 | Multiplier for data availability gas, multiples of bps (0.0001) |
chainFamilySelector | bytes4 | Selector identifying the destination chain's family (see Internal library) |
enforceOutOfOrder | bool | Whether to enforce allowOutOfOrderExecution extraArg to be true |
defaultTokenFeeUSDCents | uint16 | Default token fee charged per token transfer |
defaultTokenDestGasOverhead | uint32 | Default gas charged to execute a token transfer on the destination chain |
defaultTxGasLimit | uint32 | Default gas limit for a tx |
gasMultiplierWeiPerEth | uint64 | Multiplier for gas costs, 1e18 based (e.g., 11e17 = 10% extra cost) |
gasPriceStalenessThreshold | uint32 | Time in seconds a gas price can be stale before invalid (0 means disabled) |
networkFeeUSDCents | uint32 | Flat network fee to charge for messages, multiples of 0.01 USD |
StaticConfig
Structure containing the static configuration of the FeeQuoter contract.
struct StaticConfig {
uint96 maxFeeJuelsPerMsg;
address linkToken;
uint32 tokenPriceStalenessThreshold;
}
Properties
| Name | Type | Description |
|---|---|---|
maxFeeJuelsPerMsg | uint96 | Maximum fee that can be charged for a message |
linkToken | address | LINK token address |
tokenPriceStalenessThreshold | uint32 | Time in seconds a token price can be stale before invalid |
State Variables
FEE_BASE_DECIMALS
uint256 public constant FEE_BASE_DECIMALS = 36;
typeAndVersion
string public constant typeAndVersion = "FeeQuoter 1.6.0";
Functions
convertTokenAmount
Converts a token amount from the token's decimals to a fee-denominated amount.
function convertTokenAmount(
address fromToken,
uint256 fromTokenAmount,
address toToken
) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
fromToken | address | The token to convert from |
fromTokenAmount | uint256 | The amount of fromToken to convert |
toToken | address | The token to convert to |
Returns
| Type | Description |
|---|---|
uint256 | The equivalent amount in toToken |
getFeeTokens
Returns the list of tokens that can be used to pay fees.
function getFeeTokens() external view returns (address[] memory);
Returns
| Type | Description |
|---|---|
address[] | Array of fee token addresses |
getValidatedFee
Calculates and validates the fee for a CCIP message.
function getValidatedFee(
uint64 destChainSelector,
Client.EVM2AnyMessage calldata message
) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
destChainSelector | uint64 | The destination chain selector |
message | Client.EVM2AnyMessage | The CCIP message to calculate fee for |
Returns
| Type | Description |
|---|---|
uint256 | The total fee in the smallest unit of the fee token |
getTokenTransferFeeConfig
Returns the token transfer fee configuration for a specific token and destination chain.
function getTokenTransferFeeConfig(
uint64 destChainSelector,
address token
) external view returns (TokenTransferFeeConfig memory);
Parameters
| Name | Type | Description |
|---|---|---|
destChainSelector | uint64 | The destination chain selector |
token | address | The token address |
Returns
| Type | Description |
|---|---|
TokenTransferFeeConfig | The token transfer fee configuration |
getDestChainConfig
Returns the destination chain configuration for a given chain selector.
function getDestChainConfig(
uint64 destChainSelector
) external view returns (DestChainConfig memory);
Parameters
| Name | Type | Description |
|---|---|---|
destChainSelector | uint64 | The destination chain selector |
Returns
| Type | Description |
|---|---|
DestChainConfig | The destination chain configuration |
getStaticConfig
Returns the static configuration of the FeeQuoter contract.
function getStaticConfig() external view returns (StaticConfig memory);
Returns
| Type | Description |
|---|---|
StaticConfig | The static configuration |