> For the complete documentation index, see [llms.txt](https://docs.t-rex.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.t-rex.network/reference/token-suite/trexregistry.md).

# TREXRegistry

`TREXRegistry` is the eligibility gate of an asset. It resolves an address to an ONCHAINID, holds the claim topics the asset requires and the Claim Issuers it trusts, and answers `isVerified`. One contract carries what ERC-3643 splits into an identity registry, a claim topics registry and a trusted issuers registry. The concept is in [Eligibility and compliance: the two gates](/the-primary-register/eligibility-and-compliance-the-two-gates.md).

### At a glance

|                 |                                                                                                                                                                         |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Source**      | `contracts/registry/implementation/TREXRegistry.sol`, on the standard bases `ERC3643IdentityRegistry`, `ERC3643ClaimTopicsRegistry` and `ERC3643TrustedIssuersRegistry` |
| **Interfaces**  | `ITREXRegistry`, `IERC3643IdentityRegistry`, `IERC3643ClaimTopicsRegistry`, `IERC3643TrustedIssuersRegistry`                                                            |
| **Deployed as** | A beacon proxy per asset. The implementation is built with the address of the `IdentityFactory`, which never changes                                                    |
| **Depends on**  | An `IdentityRegistryStorage` for the registrations, the `IdentityFactory` for the global links and the identity types                                                   |
| **Limits**      | 15 required topics by default and 15 per identity type, 50 trusted issuers, 15 topics per trusted issuer                                                                |

### Eligibility reads

| View                                     | Returns                                                                                                                                                                          |
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `isVerified(_userAddress)`               | Whether an address of the reference chain can receive the asset. The token calls it for the recipient of every transfer and mint                                                 |
| `isWalletVerified(wallet)`               | The same check for a wallet given as `bytes`, on any chain. Used for a recipient on a satellite and for a spender                                                                |
| `identity(_userAddress)`                 | The ONCHAINID an address resolves to: its registration for this asset when there is one, its global link otherwise. A revoked link still resolves, so a position keeps its owner |
| `resolveIdentity(wallet)`                | The same for a wallet given as `bytes`. A satellite wallet resolves through the global link only                                                                                 |
| `contains(_userAddress)`                 | Whether the address resolves to an identity                                                                                                                                      |
| `isLocallyRegistered(userAddress)`       | Whether the address has a registration for this asset                                                                                                                            |
| `identityFactory()`, `identityStorage()` | The factory and the storage this registry reads                                                                                                                                  |
| `issuersRegistry()`, `topicsRegistry()`  | The registry itself                                                                                                                                                              |

`isVerified` decides in this order:

1. Eligibility checks are disabled: true for every address.
2. The address resolves to no identity, or its link is revoked: false.
3. The required topics are the ones set for the type of the identity when there are any, the default topics otherwise. With no required topic: true.
4. For each required topic, the identity holds a claim from at least one Claim Issuer trusted for that topic, and that issuer answers `isClaimValid` with true. Otherwise false.

### Registrations

| Function                                                                                                                | Access  | Reverts with                                                                                                        |
| ----------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------- |
| `registerIdentity(_userAddress, _identity, _country)`, `batchRegisterIdentity(_userAddresses, _identities, _countries)` | `AGENT` | `ZeroAddress`, `AddressAlreadyStored`, `ArrayLengthMismatch`. Emits `IdentityRegistered`. The country is not stored |
| `updateIdentity(_userAddress, _identity)`                                                                               | `AGENT` | `ZeroAddress`, `AddressNotYetStored`. Emits `IdentityUpdated`                                                       |
| `deleteIdentity(_userAddress)`                                                                                          | `AGENT` | `ZeroAddress`, `AddressNotYetStored`. Emits `IdentityRemoved`                                                       |

A registration is needed only for an address that has no global link, or to name another identity than the global link for this asset. Guides: [06](/guides/agents/06.-register-an-investor-for-an-asset.md), [17](/guides/agents/17.-update-an-investors-registration.md), [18](/guides/agents/18.-remove-an-investors-registration.md).

### Required claim topics

| Function                                                          | Access       | Reverts with                                                                                                                 |
| ----------------------------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| `addClaimTopic(_claimTopic)`                                      | `OWNER`      | `ClaimTopicAlreadyExists`, `MaxClaimTopicsReached`. Emits `ClaimTopicAdded`                                                  |
| `removeClaimTopic(_claimTopic)`                                   | `OWNER`      | Nothing: removing an absent topic changes nothing. Emits `ClaimTopicRemoved`                                                 |
| `addClaimTopicForIdentityType(identityType, claimTopic)`          | `OWNER`      | `InvalidIdentityType` for type 0, `ClaimTopicAlreadyExists`, `MaxClaimTopicsReached`. Emits `ClaimTopicAddedForIdentityType` |
| `removeClaimTopicForIdentityType(identityType, claimTopic)`       | `OWNER`      | `InvalidIdentityType`. Emits `ClaimTopicRemovedForIdentityType`                                                              |
| `getClaimTopics()`, `getClaimTopicsForIdentityType(identityType)` | Anyone, read |                                                                                                                              |

Guide: [03 Configure required claim topics](/guides/issuer/03.-configure-required-claim-topics.md).

### Trusted Claim Issuers

| Function                                                                                                                               | Access       | Reverts with                                                                                                                                                    |
| -------------------------------------------------------------------------------------------------------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `addTrustedIssuer(_trustedIssuer, _claimTopics)`                                                                                       | `OWNER`      | `ZeroAddress`, `TrustedIssuerAlreadyExists`, `TrustedClaimTopicsCannotBeEmpty`, `MaxClaimTopicsReached`, `MaxTrustedIssuersReached`. Emits `TrustedIssuerAdded` |
| `removeTrustedIssuer(_trustedIssuer)`                                                                                                  | `OWNER`      | `ZeroAddress`, `NotATrustedIssuer`. Emits `TrustedIssuerRemoved`                                                                                                |
| `updateIssuerClaimTopics(_trustedIssuer, _claimTopics)`                                                                                | `OWNER`      | `ZeroAddress`, `NotATrustedIssuer`, `ClaimTopicsCannotBeEmpty`, `MaxClaimTopicsReached`. Emits `ClaimTopicsUpdated`                                             |
| `getTrustedIssuers()`, `getTrustedIssuersForClaimTopic(claimTopic)`, `isTrustedIssuer(_issuer)`, `hasClaimTopic(_issuer, _claimTopic)` | Anyone, read |                                                                                                                                                                 |
| `getTrustedIssuerClaimTopics(_trustedIssuer)`                                                                                          | Anyone, read | Never reverts: an unknown issuer gives an empty array                                                                                                           |

Guides: [04](/guides/issuer/04.-add-a-trusted-claim-issuer.md), [20](/guides/issuer/20.-remove-a-trusted-claim-issuer.md).

### Settings

| Function                                                                                   | Access                                  | Reverts with                                                                                                                                                                                                                                                 |
| ------------------------------------------------------------------------------------------ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `disableEligibilityChecks()`                                                               | `OWNER`                                 | `EligibilityChecksDisabledAlready`. Emits `EligibilityChecksDisabled`                                                                                                                                                                                        |
| `enableEligibilityChecks()`                                                                | `OWNER`                                 | `EligibilityChecksEnabledAlready`. Emits `EligibilityChecksEnabled`                                                                                                                                                                                          |
| `setIdentityRegistryStorage(_identityRegistryStorage)`                                     | `OWNER`                                 | `AuthorityMismatch` unless the storage answers to the same access manager, `InvalidIdentityRegistryStorage` unless it supports the storage interface, `RegistryNotBoundToStorage` unless the storage already lists this registry. Emits `IdentityStorageSet` |
| `init(identityStorageAddress, accessManagerAddress, initialTopics, issuers, issuerClaims)` | Initializer, called once by the factory | `ZeroAddress`, `InvalidClaimPattern` when the two issuer arrays differ in length, and the errors of the topic and issuer functions                                                                                                                           |

> **With checks disabled, every address is eligible.** `disableEligibilityChecks` turns the first gate off for the whole asset. The compliance rules still apply.

### Functions kept for the standard

| Function                                                                | Behavior                                                                      |
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| `setClaimTopicsRegistry(address)`, `setTrustedIssuersRegistry(address)` | Revert with `Deprecated`: the registry is its own topics and issuers registry |
| `updateCountry(address, uint16)`                                        | Reverts with `Deprecated`: no country is stored                               |
| `investorCountry(address)`                                              | Returns 0                                                                     |

### Events

| Event                                                                                                                                                                                        | Emitted when                                                      |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| `IdentityRegistered(address indexed _investorAddress, IIdentity indexed _identity)`, `IdentityRemoved` (same arguments)                                                                      | An address is registered for this asset, its registration deleted |
| `IdentityUpdated(IIdentity indexed _oldIdentity, IIdentity indexed _newIdentity)`                                                                                                            | A registration names another identity                             |
| `ClaimTopicAdded(uint256 indexed _claimTopic)`, `ClaimTopicRemoved` (same argument)                                                                                                          | A default required topic is added, removed                        |
| `ClaimTopicAddedForIdentityType(uint256 indexed identityType, uint256 indexed claimTopic)`, `ClaimTopicRemovedForIdentityType` (same arguments)                                              | The same, for one type of identity                                |
| `TrustedIssuerAdded(address indexed _trustedIssuer, uint256[] _claimTopics)`, `ClaimTopicsUpdated` (same arguments)                                                                          | A Claim Issuer is trusted for topics, its topics replaced         |
| `TrustedIssuerRemoved(address indexed _trustedIssuer)`                                                                                                                                       | It is no longer trusted                                           |
| `EligibilityChecksDisabled()`, `EligibilityChecksEnabled()`                                                                                                                                  | Checks switched off, on. The second also at deployment            |
| `IdentityStorageSet(address indexed _identityStorage)`, `ClaimTopicsRegistrySet(address indexed _claimTopicsRegistry)`, `TrustedIssuersRegistrySet(address indexed _trustedIssuersRegistry)` | Deployment, and a change of storage for the first                 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.t-rex.network/reference/token-suite/trexregistry.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
