> For the complete documentation index, see [llms.txt](https://docs.uxd.fi/uxdprogram-solana/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uxd.fi/uxdprogram-solana/on-chain-accounts/controller.md).

# Controller

The controller is the root on chain account of the UXDProgram stack

### Characteristics

* Owns the `redeemable` (a.k.a. r-token, a.k.a UXD in our case) `mint authority`
* Holds the identity of the `Authority`, the sole pub-key able to call permissionned instructions
* Contain all top level accounting metrics of the protocol (for Solana)
* Keep reference on Authorised `Depositories`

### Layout

{% code title="programs/uxd/src/state/controller.rs" %}

```rust
// ...

pub const MAX_REGISTERED_MANGO_DEPOSITORIES: usize = 8;

pub const CONTROLLER_SPACE: usize =
    8 + 1 + 1 + 1 + 32 + 32 + 1 + (32 * MAX_REGISTERED_MANGO_DEPOSITORIES) + 1 + 16 + 8 + 16 + 512;

#[account(zero_copy)]
#[repr(packed)]
pub struct Controller {
    pub bump: u8,
    pub redeemable_mint_bump: u8,
    // Version used
    pub version: u8,
    // The account with authority over the UXD stack
    pub authority: Pubkey,
    pub redeemable_mint: Pubkey,
    pub redeemable_mint_decimals: u8,
    //
    // The Mango Depositories registered with this Controller
    pub registered_mango_depositories: [Pubkey; MAX_REGISTERED_MANGO_DEPOSITORIES],
    pub registered_mango_depositories_count: u8,
    //
    // Progressive roll out and safety ----------
    //
    // The total amount of UXD that can be in circulation, variable
    //  in redeemable Redeemable Native Amount (careful, usually Mint express this in full token, UI amount, u64)
    pub redeemable_global_supply_cap: u128,
    //
    // The max amount of Redeemable affected by Mint and Redeem operations on `MangoDepository` instances, variable
    //  in redeemable Redeemable Native Amount
    pub mango_depositories_redeemable_soft_cap: u64,
    //
    // Accounting -------------------------------
    //
    // The actual circulating supply of Redeemable
    // This should always be equal to the sum of all Depositories' `redeemable_amount_under_management`
    //  in redeemable Redeemable Native Amount
    pub redeemable_circulating_supply: u128,
}

// ...
```

{% endcode %}

<div align="center"><img src="https://1243349683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRKF3VF7d5MowqV2AiuSx%2Fuploads%2FnMsJ2JwLwHpcL2Rf8fx2%2FScreenshot%202022-05-25%20at%2010.11.10%20AM.png?alt=media&amp;token=36a885ea-ebc9-411d-be8c-eb9c36cbdcc8" alt="The controller account on mainnet for UXD, visualized through the backoffice interface"></div>
