Immutability and upgradeability
Extending a vault
How a live Truss vault grows, from new sub-accounts and assets to new modules and call shapes, and the fixed limits that bound it.
A vault launches with the sub-accounts, assets and modules it needs on day one. It can take on more later without a new vault, up to limits fixed at deployment. Every addition waits the CRITICAL tier, so holders see it before it lands.
Key points
- New sub-accounts, assets, modules and call shapes can be added after launch.
- Each addition waits the CRITICAL tier, and raising its limits from zero waits HIGH.
- The limits on how many sub-accounts and assets a vault may hold cannot be raised.
- A new kind of venue needs its own module and a policy of the same type.
Adding a sub-account
- Deploy an expansion kit. Its constructor creates and initializes the new sub-account in one transaction: a tracked one with its swap module, swap policy and lend module, or an attested one with its call verifier and NAV provider. The kit holds no funds and no role.
- The VaultAdmin maps the sub-account's functions to their roles, and grants its execute and return roles to itself, the vault managers and the traders it names.
- It binds each module with its policy, and sets the sub-account's allocation policy.
- It lists the sub-account with
addSubAccount. The vault accepts only a sub-account that answers to its access manager and uses its NAV oracle. A tracked one must also use its price oracle and asset registry. - It registers the sub-account's assets, then raises its cap and push limit. Both start at zero, so nothing can be sent to it until then.
The shipped expansion script runs these steps with the vault's factory's implementations. It runs only on a vault without timelocks. With timelocks on, each delayed step is scheduled first.
Adding an asset
A tracked sub-account can take a new asset in three steps:
- Bind its price adapter with
setOracleAdapterForAsset(CRITICAL), if it has none. - Register it on the sub-account with
registerAsset(CRITICAL). The registry checks a fresh price first. - Raise its swap or lend rate limits (HIGH). Each starts at zero and refuses every buy until raised.
The VaultAdmin can schedule every step for the same moment and send them, with the first buy, as one batch. An attested sub-account values its holdings by attestation, so it registers no assets. It reaches a new asset through new call shapes.
Adding modules, call shapes and NAV providers
A tracked sub-account takes a new module with addModule(module, policy) (CRITICAL). The module must be owned by
the sub-account, and the policy must be of the module's type. A new kind of venue or action is a new module
family, with its own module and its own policy. Binding a module does not review its code: the CRITICAL tier is
the gate.
An attested sub-account takes new call shapes with allowCallShape (CRITICAL), for example a new bridge route or
custodian action. It can move to a new NAV provider with setNavProvider (CRITICAL), as long as the provider
values this account.
Limits on growth
These are fixed at deployment and cannot be raised:
- the most sub-accounts the vault may list at once;
- the most assets each sub-account may value, and the most across all of them;
- the most requests one settlement may fill;
- the ceilings on the deposit cap and on each sub-account's cap.
A removed sub-account frees its place. The roles table is fixed per environment, and a new contract type's own restricted functions have no rows in it today. Past these limits, a new vault is needed.
Where to read more
| Page | What it covers |
|---|---|
| Contracts that can be swapped | What can be replaced after launch |
| Add a sub-account | The steps, as a guide |
| Onboard an asset | Adding an asset and buying it |
| Tracked sub-accounts | Modules, policies and valuation |
| Attested sub-accounts | Call shapes and attested NAV |