CCIP v2.0.0 TokenPoolFactory API Reference
Summary
TokenPoolFactory deploys new [TokenPool](/ccip/evm/api-reference/v2.0.0/token-pool) contracts and registers them with [TokenAdminRegistry](/ccip/evm/api-reference/v2.0.0/token-admin-registry).
It standardizes pool provisioning and ensures that deployed pools are correctly registered for their corresponding tokens.
Contract
chains/evm/contracts/tokenAdminRegistry/TokenPoolFactory/TokenPoolFactory.sol
Import
import {TokenPoolFactory} from "chainlink-ccip/chains/evm/contracts/tokenAdminRegistry/TokenPoolFactory/TokenPoolFactory.sol";
Inheritance
Ownable2StepMsgSenderITypeAndVersion
typeAndVersion
string public constant override typeAndVersion =
"TokenPoolFactory 1.5.0";
Constructor
constructor(ITokenAdminRegistry tokenAdminRegistry)
Reverts:
error ZeroAddress();
If:
address(tokenAdminRegistry) == address(0)
Initializes:
i_tokenAdminRegistry = tokenAdminRegistry;
Deployment API
createTokenPool
function createTokenPool(
address token,
address administrator,
bytes calldata constructorArgs
) external onlyOwner returns (address pool)
Behavior:
- Validates
token != address(0). - Deploys a new pool contract using the provided
constructorArgs. - Registers the deployed pool with:
i_tokenAdminRegistry.setPool(token, pool);
- Emits:
event TokenPoolDeployed(
address indexed token,
address indexed pool,
address indexed administrator
);
Returns the deployed pool address.
Note: The factory delegates constructor argument encoding responsibility to the caller via constructorArgs.
getRegistry
function getRegistry() external view returns (address)
Returns:
address(i_tokenAdminRegistry);
Events
event TokenPoolDeployed(
address indexed token,
address indexed pool,
address indexed administrator
);
Errors
error ZeroAddress();
No additional custom errors are declared in this contract.
Security model
- Only the contract owner may deploy pools.
- The registry address is immutable.
- Registration occurs immediately after deployment.
- If deployment fails, the transaction reverts atomically.
- The factory itself does not enforce pool-type validation — constructor argument correctness is the caller’s responsibility.