> 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/treximplementationauthority.md).

# TREXImplementationAuthority

`TREXImplementationAuthority` holds the beacons that every shared suite of a network points at, and the archive of the versions published for them. Moving the beacons to a new version upgrades every shared suite at once. The concept is in [Upgradeability: beacons and versions](/governance-and-infrastructure/upgradeability-beacons-and-versions.md) and the operation in [27 Upgrade a suite](/guides/issuer/27.-upgrade-a-suite.md).

### At a glance

|                 |                                                                                                                                                 |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **Source**      | `contracts/proxy/beacon/TREXImplementationAuthority.sol`                                                                                        |
| **Interface**   | `ITREXImplementationAuthority`                                                                                                                  |
| **Deployed as** | One contract per network, not upgradeable. Its constructor publishes a first version and deploys the five beacons, whose addresses never change |
| **Role**        | The platform role `VERSION_MANAGER`                                                                                                             |

### Versions

A `Version` is a `uint24` that packs a major, a minor and a patch number of 8 bits each (`VersionLib.pack(major, minor, patch)`), so versions compare as numbers.

| Function                            | Access            | Reverts with                                                                                                                                                          |
| ----------------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `publish(version, impls)`           | `VERSION_MANAGER` | `EmptyImplementations` when an implementation address is zero, `VersionAlreadyPublished`. Archives the version without moving the beacons. Emits `VersionPublished`   |
| `upgrade(version)`                  | `VERSION_MANAGER` | `UnknownVersion`, `VersionNotNewer` unless the version is above the current one. Points the five beacons at the implementations of the version. Emits `SuiteUpgraded` |
| `publishAndUpgrade(version, impls)` | `VERSION_MANAGER` | The errors of both. Does both in one transaction                                                                                                                      |
| `currentVersion()`                  | Anyone, read      | The version the beacons point at                                                                                                                                      |
| `implementations()`                 | Anyone, read      | The implementations of the current version                                                                                                                            |
| `implementationsFor(version)`       | Anyone, read      | The implementations of a published version. Reverts with `UnknownVersion`                                                                                             |
| `beacons()`                         | Anyone, read      | The five beacons                                                                                                                                                      |

A published version cannot be replaced, and the beacons only move forward: there is no downgrade function.

### The two structs

`SuiteImplementations` and `SuiteBeacons` each hold five addresses, in this order.

| `SuiteImplementations`        | `SuiteBeacons`        | Contract                  |
| ----------------------------- | --------------------- | ------------------------- |
| `tokenImplementation`         | `tokenBeacon`         | `Token`                   |
| `trexRegistryImplementation`  | `trexRegistryBeacon`  | `TREXRegistry`            |
| `irsImplementation`           | `irsBeacon`           | `IdentityRegistryStorage` |
| `mcImplementation`            | `mcBeacon`            | `ModularCompliance`       |
| `accessManagerImplementation` | `accessManagerBeacon` | `TREXAccessManager`       |

### What an upgrade reaches

| Suite                                   | Effect of `upgrade`                                                                                |
| --------------------------------------- | -------------------------------------------------------------------------------------------------- |
| Deployed with `deployTREXSuite`         | Its five proxies read the shared beacons: it runs the new implementations from that transaction on |
| Deployed with `deployTREXSuiteIsolated` | None. Its beacons are its own, owned by its access manager, and the Issuer moves them              |

> **Trust statement.** The holder of `VERSION_MANAGER` can change the code of every shared suite of the network in one transaction. An Issuer that does not accept this deploys an isolated suite and governs its own beacons.

### Events

| Event                                                                                                  | Emitted when                         |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------ |
| `VersionPublished(Version version, ITREXImplementationAuthority.SuiteImplementations implementations)` | A version is archived                |
| `SuiteUpgraded(Version version, ITREXImplementationAuthority.SuiteImplementations implementations)`    | The shared beacons move to a version |
| `BeaconsDeployed(ITREXImplementationAuthority.SuiteBeacons beacons)`                                   | Once, at construction                |


---

# 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/treximplementationauthority.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.
