CCIP v1.5.1 TokenAdminRegistry Contract API Reference
The TokenAdminRegistry
contract manages which tokens can be transferred through CCIP and who can configure them. Key features:
- Token developers can register their tokens without needing permission from CCIP
- Each token has an administrator who controls its CCIP settings
- Administrators can enable or disable their tokens for CCIP transfers
- The contract is not upgradeable to ensure data persistence
error OnlyRegistryModuleOrOwner(address sender)
Thrown when someone tries to perform an action restricted to registry modules or the owner.
Parameter | Type | Description |
---|
sender | address | Address that attempted the restricted action |
error OnlyAdministrator(address sender, address token)
Thrown when someone tries to perform an action restricted to the token's administrator.
Parameter | Type | Description |
---|
sender | address | Address that attempted the restricted action |
token | address | Token address that was being configured |
error OnlyPendingAdministrator(address sender, address token)
Thrown when someone other than the pending administrator tries to accept the administrator role.
Parameter | Type | Description |
---|
sender | address | Address that attempted to accept the role |
token | address | Token address involved |
error AlreadyRegistered(address token)
Thrown when trying to register a token that already has an administrator.
Parameter | Type | Description |
---|
token | address | Token address that was already registered |
error ZeroAddress()
Thrown when trying to set a critical address to zero (except for specific allowed cases).
error InvalidTokenPoolToken(address token)
Thrown when trying to set a pool that doesn't support the specified token.
Parameter | Type | Description |
---|
token | address | Token address that the pool doesn't support |
event PoolSet(
address indexed token,
address indexed previousPool,
address indexed newPool
)
Emitted when a token's pool address is changed. This indicates a change in how the token is handled in CCIP.
Parameter | Type | Description |
---|
token | address | Token address whose pool was changed |
previousPool | address | Old pool address (can be address(0)) |
newPool | address | New pool address (can be address(0) to disable CCIP for the token) |
event AdministratorTransferRequested(
address indexed token,
address indexed currentAdmin,
address indexed newAdmin
)
Emitted when the first step of an administrator transfer is initiated.
Parameter | Type | Description |
---|
token | address | Token address whose administrator is being changed |
currentAdmin | address | Current administrator address (can be address(0) for new registrations) |
newAdmin | address | Proposed new administrator address |
event AdministratorTransferred(
address indexed token,
address indexed newAdmin
)
Emitted when an administrator transfer is completed (after the new administrator accepts the role).
Parameter | Type | Description |
---|
token | address | Token address whose administrator changed |
newAdmin | address | Address of the new administrator |
event RegistryModuleAdded(address module)
Emitted when a new registry module is added to the system.
Parameter | Type | Description |
---|
module | address | Address of the newly added registry module |
event RegistryModuleRemoved(address indexed module)
Emitted when a registry module is removed from the system.
Parameter | Type | Description |
---|
module | address | Address of the removed registry module |
struct TokenConfig {
address administrator;
address pendingAdministrator;
address tokenPool;
}
Configuration data for each token:
Field | Type | Description |
---|
administrator | address | Current administrator who can manage the token's CCIP settings |
pendingAdministrator | address | Address nominated to become the new administrator (part of 2-step transfer) |
tokenPool | address | Pool contract that handles the token's cross-chain transfers. If set to address(0), the token is disabled for CCIP |
function getPools(
address[] calldata tokens
) external view returns (address[] memory)
Gets the pool addresses for multiple tokens at once.
Name | Type | Description |
---|
tokens | address[] | Array of token addresses to query |
Type | Description |
---|
address[] | Array of pool addresses. Will be address(0) for tokens without pools |
function getPool(
address token
) external view returns (address)
Gets the pool address for a single token.
Name | Type | Description |
---|
token | address | Token address to query |
Type | Description |
---|
address | Pool address for the token, or address(0) if not configured |
function getTokenConfig(
address token
) external view returns (TokenConfig memory)
Gets the complete configuration for a token.
Name | Type | Description |
---|
token | address | Token address to query |
Type | Description |
---|
TokenConfig | Complete token configuration including administrator, pending administrator, and pool |
function getAllConfiguredTokens(
uint64 startIndex,
uint64 maxCount
) external view returns (address[] memory tokens)
Gets a list of all configured tokens, with pagination support to handle large lists.
Name | Type | Description |
---|
startIndex | uint64 | Position to start reading from (0 for beginning) |
maxCount | uint64 | Maximum number of tokens to return. Use type(uint64).max for all remaining tokens |
Type | Description |
---|
address[] | Array of token addresses |
function setPool(
address localToken,
address pool
) external onlyTokenAdmin(localToken)
Sets or changes the pool for a token. Only callable by the token's administrator.
Name | Type | Description |
---|
localToken | address | Token to configure |
pool | address | New pool address, or address(0) to disable |
function transferAdminRole(
address localToken,
address newAdmin
) external onlyTokenAdmin(localToken)
Initiates the transfer of administrator rights to a new address.
Name | Type | Description |
---|
localToken | address | Token whose administrator is being changed |
newAdmin | address | Proposed new administrator (or address(0) to cancel pending transfer) |
function acceptAdminRole(
address localToken
) external
Completes the transfer of administrator rights. Must be called by the pending administrator.
Name | Type | Description |
---|
localToken | address | Token to accept administrator role for |
function isAdministrator(
address localToken,
address administrator
) external view returns (bool)
Checks if an address is the administrator for a token.
Name | Type | Description |
---|
localToken | address | Token to check |
administrator | address | Address to verify |
Type | Description |
---|
bool | True if the address is the token's administrator |
function proposeAdministrator(
address localToken,
address administrator
) external
Proposes an initial administrator for a token. Can only be called by registry modules or owner.
Name | Type | Description |
---|
localToken | address | Token to set administrator for |
administrator | address | Proposed administrator address |
function isRegistryModule(
address module
) public view returns (bool)
Checks if an address is an authorized registry module.
Name | Type | Description |
---|
module | address | Address to check |
Type | Description |
---|
bool | True if the address is an authorized registry module |
function addRegistryModule(
address module
) external onlyOwner
Adds a new registry module. Only callable by owner.
Name | Type | Description |
---|
module | address | Address of module to add |
function removeRegistryModule(
address module
) external onlyOwner
Removes a registry module. Only callable by owner.
Name | Type | Description |
---|
module | address | Address of module to remove |
string public constant override typeAndVersion = "TokenAdminRegistry 1.5.0"
Returns the type and version of the contract.
Type | Description |
---|
string | The string "TokenAdminRegistry 1.5.0" |