# CCIP v1.6.1 RegistryModuleOwnerCustom Contract API Reference
Source: https://docs.chain.link/ccip/api-reference/evm/v1.6.1/registry-module-owner-custom


<Aside type="note" title="Integrate Chainlink CCIP v1.6.1 into your project">
  <Tabs sharedStore="ccip-v1-6-1-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.6.1
      ```
    </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.6.1
      ```
    </Fragment>

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

      ```shell
      forge install smartcontractkit/chainlink-ccip@bbab0601244ce58e2ffac0dbc178a80aab1fa4a3
      ```
    </Fragment>
  </Tabs>
</Aside>

## RegistryModuleOwnerCustom

A contract that facilitates token administrator registration through various ownership patterns.

[Git Source](https://github.com/smartcontractkit/chainlink-ccip/tree/contracts-ccip-v1.6.1/chains/evm/contracts/tokenAdminRegistry/RegistryModuleOwnerCustom.sol)

**Inherits:**

- [ITypeAndVersion](/ccip/api-reference/evm/v1.6.1/i-type-and-version)

> \*\*NOTE\*\*
>
>
>
> This contract provides multiple methods for registering token administrators:
>
> - Supports registration via [`getCCIPAdmin`](#registeradminviagetccipadmin) method
> - Supports registration via [`owner`](#registeradminviaowner) method
> - Supports registration via OpenZeppelin's [`AccessControl`](#registeraccesscontroldefaultadmin)
> - Enforces self-registration security pattern
> - Integrates with [`TokenAdminRegistry`](/ccip/api-reference/evm/v1.6.1/token-admin-registry) for administrator management

## Events

### AdministratorRegistered

```solidity
event AdministratorRegistered(address indexed token, address indexed administrator);
```

> \*\*NOTE\*\*
>
>
>
> Emitted when a new administrator is successfully registered for a token through any of the registration methods
> ([`registerAccessControlDefaultAdmin`](#registeraccesscontroldefaultadmin),
> [`registerAdminViaGetCCIPAdmin`](#registeradminviagetccipadmin), or
> [`registerAdminViaOwner`](#registeradminviaowner)).

**Parameters**

| Name            | Type      | Indexed | Description                          |
| --------------- | --------- | ------- | ------------------------------------ |
| `token`         | `address` | Yes     | The token contract address           |
| `administrator` | `address` | Yes     | The registered administrator address |

## Errors

### AddressZero

```solidity
error AddressZero();
```

> \*\*NOTE\*\*
>
>
>
> Thrown when attempting to initialize with a zero address for the
> [`TokenAdminRegistry`](/ccip/api-reference/evm/v1.6.1/token-admin-registry).

### CanOnlySelfRegister

```solidity
error CanOnlySelfRegister(address admin, address token);
```

> \*\*NOTE\*\*
>
>
>
> Thrown when an address attempts to register an administrator other than itself through any of the registration
> methods.

**Parameters**

| Name    | Type      | Description                        |
| ------- | --------- | ---------------------------------- |
| `admin` | `address` | The expected administrator address |
| `token` | `address` | The token contract address         |

### RequiredRoleNotFound

```solidity
error RequiredRoleNotFound(address msgSender, bytes32 role, address token);
```

> \*\*NOTE\*\*
>
>
>
> Thrown when the caller lacks the required role for administrator registration in
> [`registerAccessControlDefaultAdmin`](#registeraccesscontroldefaultadmin).

**Parameters**

| Name        | Type      | Description                  |
| ----------- | --------- | ---------------------------- |
| `msgSender` | `address` | The caller's address         |
| `role`      | `bytes32` | The required role identifier |
| `token`     | `address` | The token contract address   |

## State Variables

### i\_tokenAdminRegistry

```solidity
ITokenAdminRegistry internal immutable i_tokenAdminRegistry;
```

> \*\*NOTE\*\*
>
>
>
> Immutable reference to the [`TokenAdminRegistry`](/ccip/api-reference/evm/v1.6.1/token-admin-registry) contract that
> manages administrator registrations.

### typeAndVersion

```solidity
string public constant override typeAndVersion = "RegistryModuleOwnerCustom 1.6.1";
```

<Aside>Contract identifier that specifies the implementation version.</Aside>

## Functions

### constructor

```solidity
constructor(address tokenAdminRegistry);
```

> \*\*NOTE\*\*
>
>
>
> Initializes the contract with a reference to the [`TokenAdminRegistry`](/ccip/api-reference/evm/v1.6.1/token-admin-registry):
>
> - Validates the tokenAdminRegistry address is not zero (reverts with [`AddressZero`](#addresszero))
> - Sets up the immutable registry reference

**Parameters**

| Name                 | Type      | Description                                    |
| -------------------- | --------- | ---------------------------------------------- |
| `tokenAdminRegistry` | `address` | The address of the TokenAdminRegistry contract |

### registerAccessControlDefaultAdmin

Registers a token administrator using OpenZeppelin's AccessControl DEFAULT\_ADMIN\_ROLE.

```solidity
function registerAccessControlDefaultAdmin(address token) external;
```

> \*\*NOTE\*\*
>
>
>
> Validates and registers an administrator using AccessControl:
>
> - Verifies caller has DEFAULT\_ADMIN\_ROLE (reverts with [`RequiredRoleNotFound`](#requiredrolenotfound))
> - Only allows self-registration (reverts with [`CanOnlySelfRegister`](#canonlyselfregister))
> - Emits [`AdministratorRegistered`](#administratorregistered) event on success

**Parameters**

| Name    | Type      | Description                              |
| ------- | --------- | ---------------------------------------- |
| `token` | `address` | The token contract to register admin for |

### registerAdminViaGetCCIPAdmin

Registers a token administrator using the `getCCIPAdmin` method.

```solidity
function registerAdminViaGetCCIPAdmin(address token) external;
```

> \*\*NOTE\*\*
>
>
>
> Validates and registers an administrator using getCCIPAdmin:
>
> - Calls token's getCCIPAdmin method
> - Only allows self-registration (reverts with [`CanOnlySelfRegister`](#canonlyselfregister))
> - Emits [`AdministratorRegistered`](#administratorregistered) event on success

**Parameters**

| Name    | Type      | Description                              |
| ------- | --------- | ---------------------------------------- |
| `token` | `address` | The token contract to register admin for |

### registerAdminViaOwner

Registers a token administrator using the `owner` method.

```solidity
function registerAdminViaOwner(address token) external;
```

> \*\*NOTE\*\*
>
>
>
> Validates and registers an administrator using owner pattern:
>
> - Calls token's owner method
> - Only allows self-registration (reverts with [`CanOnlySelfRegister`](#canonlyselfregister))
> - Emits [`AdministratorRegistered`](#administratorregistered) event on success

**Parameters**

| Name    | Type      | Description                              |
| ------- | --------- | ---------------------------------------- |
| `token` | `address` | The token contract to register admin for |

### \_registerAdmin

Internal function to handle administrator registration.

```solidity
function _registerAdmin(address token, address admin) internal;
```

> \*\*NOTE\*\*
>
>
>
> Core registration logic:
>
> - Validates caller is the admin (reverts with [`CanOnlySelfRegister`](#canonlyselfregister))
> - Proposes administrator to registry
> - Emits [`AdministratorRegistered`](#administratorregistered) event

**Parameters**

| Name    | Type      | Description                                |
| ------- | --------- | ------------------------------------------ |
| `token` | `address` | The token contract to register admin for   |
| `admin` | `address` | The administrator address being registered |