CCIP v2.0.0 FeeTokenHandler API Reference

FeeTokenHandler provides utilities for transferring accumulated ERC20 fee balances from CCIP contracts to a designated fee aggregator.

It handles safe token withdrawals but does not enforce access control.

Calling contracts must ensure only authorized parties can trigger withdrawals.

This library provides reusable helper functions and is not deployed as a standalone application-facing contract.

Usage Boundary

You do not call this library directly.

  • Contracts use this helper to sweep accumulated fees to a configured aggregator.
  • The calling contract must enforce access control on withdrawal functions.
  • You are responsible for ensuring the fee aggregator address is correctly configured.

Contract

libraries/FeeTokenHandler.sol

Import

import {FeeTokenHandler} from "chainlink-ccip/libraries/FeeTokenHandler.sol";

Functions

_withdrawFeeTokens

function _withdrawFeeTokens(address[] calldata feeTokens, address feeAggregator) internal

Transfers the full balances of specified fee tokens to the configured fee aggregator.

ParameterTypeDescription
feeTokensaddress[] calldataList of ERC20 tokens to withdraw.
feeAggregatoraddressDestination address for withdrawn fees.

Errors

  • error ZeroAddressNotAllowed()

For a cross-contract error index, see Errors.

Notes

  • All token balances for the specified tokens are transferred to the fee aggregator.
  • Reverts if feeAggregator is the zero address.
  • All transfers are atomic; if any transfer fails, no tokens are withdrawn.
  • Transfers will revert if any token transfer fails.
  • Assumes tokens conform to standard ERC20 transfer behavior.
  • Contracts should ensure that feeTokens only includes tokens with non-zero balances to avoid unnecessary calls.
  • The fee aggregator is a trusted address that receives all withdrawn funds.
  • Gas cost scales linearly with the number of tokens provided.

Usage context

Used by:

Used to sweep accumulated fee balances to a configured aggregator.

Security model

  • This library does not enforce access control.
  • Calling contracts must restrict who can trigger withdrawals.
  • Funds are transferred to a single configured aggregator address.
  • Incorrect configuration may result in loss or misdirection of funds.

Get the latest Chainlink content straight to your inbox.