# CCIP v1.5.0 TokenAdminRegistry Contract API Reference
Source: https://docs.chain.link/ccip/api-reference/evm/v1.5.0/token-admin-registry

> For the complete documentation index, see [llms.txt](/llms.txt).

<Aside type="note" title="Integrate Chainlink CCIP v1.5.0 into your project">
  <Tabs sharedStore="ccip-v1-5-0-package" client:visible>
    <Fragment slot="tab.1">npm</Fragment>
    <Fragment slot="tab.2">yarn</Fragment>
    <Fragment slot="tab.3">foundry</Fragment>

    <Fragment slot="panel.1">
      If you use [NPM](https://www.npmjs.com/), install the [@chainlink/contracts-ccip NPM package](https://www.npmjs.com/package/@chainlink/contracts-ccip):

      ```shell
      npm install @chainlink/contracts-ccip@1.5.0
      ```
    </Fragment>

    <Fragment slot="panel.2">
      If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/contracts-ccip NPM package](https://www.npmjs.com/package/@chainlink/contracts-ccip):

      ```shell
      yarn add @chainlink/contracts-ccip@1.5.0
      ```
    </Fragment>

    <Fragment slot="panel.3">
      If you use [Foundry](https://book.getfoundry.sh/), install the package:

      ```shell
      forge install smartcontractkit/ccip@5c711214167b7e6f05cf6de74bdab9f6e26763b2
      ```
    </Fragment>
  </Tabs>
</Aside>

The [`TokenAdminRegistry`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol) 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

```solidity
error OnlyRegistryModuleOrOwner(address sender)
```

### OnlyAdministrator

```solidity
error OnlyAdministrator(address sender, address token)
```

### OnlyPendingAdministrator

```solidity
error OnlyPendingAdministrator(address sender, address token)
```

### AlreadyRegistered

```solidity
error AlreadyRegistered(address token)
```

### ZeroAddress

```solidity
error ZeroAddress()
```

### InvalidTokenPoolToken

```solidity
error InvalidTokenPoolToken(address token)
```

## Events

### PoolSet

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

### AdministratorTransferRequested

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

### AdministratorTransferred

```solidity
event AdministratorTransferred(address token, address newAdmin)
```

### RegistryModuleAdded

```solidity
event RegistryModuleAdded(address module)
```

### RegistryModuleRemoved

```solidity
event RegistryModuleRemoved(address module)
```

## Structs

### TokenConfig

```solidity
struct TokenConfig {
  address administrator;
  address pendingAdministrator;
  address tokenPool;
}
```

| Name                 | Type    | Description                           |
| -------------------- | ------- | ------------------------------------- |
| administrator        | address | Current administrator of the token.   |
| pendingAdministrator | address | Pending administrator for transfer.   |
| tokenPool            | address | Token pool associated with the token. |

## Constants

### typeAndVersion

```solidity
string typeAndVersion
```

*The version of the TokenAdminRegistry contract.*

## Mappings

### s\_tokenConfig

```solidity
mapping(address => struct TokenAdminRegistry.TokenConfig) s_tokenConfig
```

*Stores the configuration for each token.*

### s\_tokens

```solidity
struct EnumerableSet.AddressSet s_tokens
```

*List of all tokens that have been configured.*

### s\_registryModules

```solidity
struct EnumerableSet.AddressSet s_registryModules
```

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

## Functions

### getPools

```solidity
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

| Name   | Type       | Description                        |
| ------ | ---------- | ---------------------------------- |
| tokens | address\[] | Array of token addresses to query. |

#### Return Values

| Name | Type       | Description                             |
| ---- | ---------- | --------------------------------------- |
| \[0] | address\[] | Array of pool addresses for each token. |

### getPool

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

Returns the pool for the given token.

#### Parameters

| Name  | Type    | Description                    |
| ----- | ------- | ------------------------------ |
| token | address | The token to get the pool for. |

#### Return Values

| Name | Type    | Description                 |
| ---- | ------- | --------------------------- |
| \[0] | address | Pool address for the token. |

### getTokenConfig

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

Returns the configuration for a token.

#### Parameters

| Name  | Type    | Description                             |
| ----- | ------- | --------------------------------------- |
| token | address | The token to get the configuration for. |

#### Return Values

| Name | Type                                  | Description                  |
| ---- | ------------------------------------- | ---------------------------- |
| \[0] | struct TokenAdminRegistry.TokenConfig | Configuration for the token. |

### getAllConfiguredTokens

```solidity
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

| Name       | Type   | Description                                                                                          |
| ---------- | ------ | ---------------------------------------------------------------------------------------------------- |
| startIndex | uint64 | Starting index in the list (use 0 to start from the beginning).                                      |
| maxCount   | uint64 | Maximum number of tokens to retrieve (use `type(uint64).max` to retrieve all tokens in large lists). |

#### Return Values

| Name   | Type       | Description                              |
| ------ | ---------- | ---------------------------------------- |
| tokens | address\[] | Array of addresses of configured tokens. |

### setPool

```solidity
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

| Name       | Type    | Description                           |
| ---------- | ------- | ------------------------------------- |
| localToken | address | The token to associate with the pool. |
| pool       | address | The pool to associate with the token. |

### transferAdminRole

```solidity
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

| Name       | Type    | Description                               |
| ---------- | ------- | ----------------------------------------- |
| localToken | address | The token to transfer the admin role for. |
| newAdmin   | address | The new administrator's address.          |

### acceptAdminRole

```solidity
function acceptAdminRole(address localToken) external
```

Accepts the administrator role for a token.

*Only the pending administrator can call this function.*

#### Parameters

| Name       | Type    | Description                                           |
| ---------- | ------- | ----------------------------------------------------- |
| localToken | address | The token for which the admin role is being accepted. |

### isAdministrator

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

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

#### Parameters

| Name          | Type    | Description                               |
| ------------- | ------- | ----------------------------------------- |
| localToken    | address | The token to check the administrator for. |
| administrator | address | The administrator address to check.       |

#### Return Values

| Name | Type | Description                              |
| ---- | ---- | ---------------------------------------- |
| \[0] | bool | True if the address is an administrator. |

### proposeAdministrator

```solidity
function proposeAdministrator(address localToken, address administrator) external
```

Proposes a new administrator for the token.

*Can only be called by a registry module.*

#### Parameters

| Name          | Type    | Description                           |
| ------------- | ------- | ------------------------------------- |
| localToken    | address | The token to propose a new admin for. |
| administrator | address | The new administrator address.        |

### isRegistryModule

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

Returns whether an address is a valid registry module.

#### Parameters

| Name   | Type    | Description                  |
| ------ | ------- | ---------------------------- |
| module | address | The module address to check. |

#### Return Values

| Name | Type | Description                               |
| ---- | ---- | ----------------------------------------- |
| \[0] | bool | True if the address is a registry module. |

### addRegistryModule

```solidity
function addRegistryModule(address module) external
```

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

#### Parameters

| Name   | Type    | Description                       |
| ------ | ------- | --------------------------------- |
| module | address | The address of the module to add. |

### removeRegistryModule

```solidity
function removeRegistryModule(address module) external
```

Removes a registry module from the list of allowed modules.

#### Parameters

| Name   | Type    | Description                          |
| ------ | ------- | ------------------------------------ |
| module | address | The address of the module to remove. |

### onlyTokenAdmin

```solidity
modifier onlyTokenAdmin(address token)
```

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