# Contracts that can be swapped

> Which contracts bound to a Truss vault can be swapped for different or new ones after launch, at which tier, and under what conditions.

Source: https://docs.trusslabs.io/vaults/immutability/swappable

A vault is built from parts that plug in. Several of them can be replaced by a different or newer contract
without touching the vault, as long as the new one meets the slot's checks. Each swap waits its tier, so holders
see it coming.

> **Key points**
>
> - Binding a new contract waits the CRITICAL tier, and changing the fee recipient waits HIGH.
> - Removing or narrowing is usually immediate.
> - A replacement must name the same vault and answer to the same access manager.
> - The vault itself, its oracles, its asset registry and its instant redemption policy cannot be swapped.

## What can be swapped

| Part | Swap in with | Remove or narrow with | Conditions |
|---|---|---|---|
| Deposit, holder and withdrawal policies | `setDepositPolicy`, `setHolderPolicy`, `setWithdrawalPolicy` (CRITICAL) | The same setter with zero (CRITICAL) | Removing the deposit policy, or replacing it with one that does not cap, removes the deposit cap |
| A sub-account's allocation policy | `setSubAccountAllocationPolicy` (CRITICAL) | The same setter with zero (CRITICAL) | With none, pushes into the sub-account have no cap or rate limit |
| A module and its policy | `addModule(module, policy)` (CRITICAL) | `removeModule` (Immediate) | The module is owned by the sub-account, and the policy is of its type. Removal needs every asset but USDC at zero |
| An asset's price adapter | `setOracleAdapterForAsset` (CRITICAL) | `removeOracleAdapterForAsset` (Immediate) | The new adapter must price one whole unit first. USDC's can be replaced but not removed |
| An attested sub-account's NAV provider | `setNavProvider` (CRITICAL) | — | The provider must value this account and answer a read |
| The instant path's default source | `setDefaultSource` (CRITICAL) | `clearDefaultSource` (Immediate) | An active tracked sub-account, its ERC-4626 lend module and a USDC venue it values |
| A sub-account | `addSubAccount` (CRITICAL) | `initiateSubAccountRemoval`, then `finalizeSubAccountRemoval` (Immediate) | Finalizing needs a tracked account to hold no positions, and an attested one to answer `canRemove()` |
| An attested sub-account's call shapes | `allowCallShape` (CRITICAL) | `revokeCallShape` (Immediate) | — |
| An operator key | A new multicall and a grant | Revoking its roles (Immediate) | See [Operator multicalls](https://docs.trusslabs.io/vaults/roles/owned-multicall.md) |
| The fee recipient | `setFeeRecipient` (HIGH) | — | Fees accrued so far are turned into shares for the old recipient first |

A module's tolerance ceiling is fixed in its policy. A different ceiling means a new policy, bound by removing the
module and adding it back with the new one.

## What a replacement must meet

- A policy or sub-account must name this vault, which `vault()` reads.
- It must answer to this vault's access manager. The vault checks this when it binds it.
- A sub-account must also use the vault's NAV oracle, and a tracked one the vault's price oracle and asset
  registry. It counts toward the vault's most sub-accounts.
- It must implement the slot's interface.

A custom contract's own restricted functions have no rows in the roles table today.

## What cannot be swapped

- The vault, its underlying and its deposit silo.
- The NAV oracle, the price oracle and the asset registry.
- The instant redemption policy, though its default source can change.
- A tracked sub-account's price oracle and registry, and an attested one's call verifier.
- The sub-account a module serves.

Changing any of these means a new vault, or for a sub-account's bindings, a new sub-account.

## Where to read more

| Page | What it covers |
|---|---|
| [What is immutable](https://docs.trusslabs.io/vaults/immutability/immutable.md) | Every setting fixed for good |
| [Extending a vault](https://docs.trusslabs.io/vaults/immutability/extending.md) | Adding sub-accounts, assets, modules and call shapes |
| [Who can call what](https://docs.trusslabs.io/vaults/roles/function-permissions.md) | The tier and holders of every function |
| [Bind a policy](https://docs.trusslabs.io/vaults/guides/bind-a-policy.md) | The steps to bind or replace a policy |
