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
programs/uxd/src/state/controller.rs
// ...
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,
}
// ...