CCIP v1.5.0 TokenAdminRegistry Contract API Reference

The TokenAdminRegistry contract stores the token pool configuration for all cross-chain tokens. It operates on a self-serve basis, where tokens can be registered without intervention from the CCIP owner.

This contract is not considered upgradable, as it is a customer-facing contract that will store significant amounts of data.

Errors

OnlyRegistryModuleOrOwner

error OnlyRegistryModuleOrOwner(address sender)

OnlyAdministrator

error OnlyAdministrator(address sender, address token)

OnlyPendingAdministrator

error OnlyPendingAdministrator(address sender, address token)

AlreadyRegistered

error AlreadyRegistered(address token)

ZeroAddress

error ZeroAddress()

InvalidTokenPoolToken

error InvalidTokenPoolToken(address token)

Events

PoolSet

event PoolSet(address token, address previousPool, address newPool)

AdministratorTransferRequested

event AdministratorTransferRequested(address token, address currentAdmin, address newAdmin)

AdministratorTransferred

event AdministratorTransferred(address token, address newAdmin)

RegistryModuleAdded

event RegistryModuleAdded(address module)

RegistryModuleRemoved

event RegistryModuleRemoved(address module)

Structs

TokenConfig

struct TokenConfig {
  address administrator;
  address pendingAdministrator;
  address tokenPool;
}
NameTypeDescription
administratoraddressCurrent administrator of the token.
pendingAdministratoraddressPending administrator for transfer.
tokenPooladdressToken pool associated with the token.

Constants

typeAndVersion

string typeAndVersion

The version of the TokenAdminRegistry contract.

Mappings

s_tokenConfig

mapping(address => struct TokenAdminRegistry.TokenConfig) s_tokenConfig

Stores the configuration for each token.

s_tokens

struct EnumerableSet.AddressSet s_tokens

List of all tokens that have been configured.

s_registryModules

struct EnumerableSet.AddressSet s_registryModules

List of all registry modules allowed to interact with the contract.

Functions

getPools

function getPools(address[] tokens) external view returns (address[])

Returns the pools for the given tokens.

Will return address(0) for tokens that do not have an associated pool.

Parameters

NameTypeDescription
tokensaddress[]Array of token addresses to query.

Return Values

NameTypeDescription
[0]address[]Array of pool addresses for each token.

getPool

function getPool(address token) external view returns (address)

Returns the pool for the given token.

Parameters

NameTypeDescription
tokenaddressThe token to get the pool for.

Return Values

NameTypeDescription
[0]addressPool address for the token.

getTokenConfig

function getTokenConfig(address token) external view returns (struct TokenAdminRegistry.TokenConfig)

Returns the configuration for a token.

Parameters

NameTypeDescription
tokenaddressThe token to get the configuration for.

Return Values

NameTypeDescription
[0]struct TokenAdminRegistry.TokenConfigConfiguration for the token.

getAllConfiguredTokens

function getAllConfiguredTokens(uint64 startIndex, uint64 maxCount) external view returns (address[] tokens)

Returns a list of tokens that are configured in the TokenAdminRegistry.

The function is paginated to avoid RPC timeouts.

Parameters

NameTypeDescription
startIndexuint64Starting index in the list (use 0 to start from the beginning).
maxCountuint64Maximum number of tokens to retrieve (use type(uint64).max to retrieve all tokens in large lists).

Return Values

NameTypeDescription
tokensaddress[]Array of addresses of configured tokens.

setPool

function setPool(address localToken, address pool) external

Sets the pool for a token. Setting the pool to address(0) will delist the token from CCIP.

Parameters

NameTypeDescription
localTokenaddressThe token to associate with the pool.
pooladdressThe pool to associate with the token.

transferAdminRole

function transferAdminRole(address localToken, address newAdmin) external

Transfers the administrator role for a token. The new admin must call acceptAdminRole to finalize the transfer.

Parameters

NameTypeDescription
localTokenaddressThe token to transfer the admin role for.
newAdminaddressThe new administrator's address.

acceptAdminRole

function acceptAdminRole(address localToken) external

Accepts the administrator role for a token.

Only the pending administrator can call this function.

Parameters

NameTypeDescription
localTokenaddressThe token for which the admin role is being accepted.

isAdministrator

function isAdministrator(address localToken, address administrator) external view returns (bool)

Returns whether an address is the administrator of the given token.

Parameters

NameTypeDescription
localTokenaddressThe token to check the administrator for.
administratoraddressThe administrator address to check.

Return Values

NameTypeDescription
[0]boolTrue if the address is an administrator.

proposeAdministrator

function proposeAdministrator(address localToken, address administrator) external

Proposes a new administrator for the token.

Can only be called by a registry module.

Parameters

NameTypeDescription
localTokenaddressThe token to propose a new admin for.
administratoraddressThe new administrator address.

isRegistryModule

function isRegistryModule(address module) public view returns (bool)

Returns whether an address is a valid registry module.

Parameters

NameTypeDescription
moduleaddressThe module address to check.

Return Values

NameTypeDescription
[0]boolTrue if the address is a registry module.

addRegistryModule

function addRegistryModule(address module) external

Adds a new registry module to the list of allowed modules.

Parameters

NameTypeDescription
moduleaddressThe address of the module to add.

removeRegistryModule

function removeRegistryModule(address module) external

Removes a registry module from the list of allowed modules.

Parameters

NameTypeDescription
moduleaddressThe address of the module to remove.

onlyTokenAdmin

modifier onlyTokenAdmin(address token)

Modifier that checks if an address is the administrator of the given token.

Get the latest Chainlink content straight to your inbox.