# Withdrawals

> How a redemption request is opened, funded, settled at a fresh NAV by a settler, claimed as USDC, cancelled or transferred, and which contract and caller each step needs.

Source: https://docs.trusslabs.io/vaults/flow-of-funds/withdrawals

A redemption is a request too. The holder's shares wait in escrow inside the vault until a settler fills them from
the vault's idle USDC at the price of that moment, and the holder then claims the USDC. A vault that has turned on
instant withdrawals can also pay at once; see [Instant withdrawals](https://docs.trusslabs.io/vaults/flow-of-funds/instant-withdrawals.md).

> **Key points**
>
> - The owner of the shares, or its operator, opens the request. A settler decides which requests fill, by how much, and when.
> - Settlement pays only from USDC already idle in the vault, at one fresh NAV for the whole batch.
> - Cancelling is free at any age: every share still pending goes back to the controller.
> - A pending request can be transferred to a new controller, which lets a holder sell it before it settles.

| Step | Contract and function | Who must call it | Fresh NAV | Event |
|---|---|---|---|---|
| Request | `TrussVault.requestRedeem(shares, controller, owner)` | The owner or its operator | No | `RedeemRequest` |
| Bring capital back | The sub-account's `returnAssetsToVault(amount)` | A VaultManager, the VaultAdmin, or a Trader the sub-account names | Only on an attested sub-account | `AssetsReturned` |
| Settle | `TrussVault.settleRedeem(requestIds, shares)` | A Settler or VaultManager through its multicall, or the VaultAdmin | Yes | `RequestFilled`, `Settled` |
| Claim | `redeem` or `withdraw` with a controller, or `claimRedeemFor(controller)` | The controller or its operator; anyone for `claimRedeemFor` | No | `Withdraw` |

## 1. Opening a request

`requestRedeem` moves the shares from the owner into escrow inside the vault. The request must be worth at least the
vault's minimum redemption at the last price; while the NAV is stale that check is skipped, so a lapsed feed cannot
keep a holder out of the queue. The vault refuses the request while paused, when a bound withdrawal policy refuses
the controller, and when a bound holder policy refuses a controller other than the owner.

## 2. Bringing capital back

Settlement pays only from accounted idle, the USDC the vault holds and has booked. When idle is short, capital must
come back first. A VaultManager can signal the need with `requestAssetsFromSubAccount`, which
only emits `AssetsRequested`. The return itself is `returnAssetsToVault` on the sub-account, called by a
VaultManager, the VaultAdmin or one of that sub-account's traders. It works while the sub-account is paused. An
attested sub-account returns nothing while its own NAV is stale, because its net worth is then unknown.

## 3. Settling and claiming

A settler calls `settleRedeem` with request ids in ascending order and the shares to fill for each, exit fee
included. The vault turns accrued fees into shares, prices the batch at a fresh NAV, and fills each request:
it burns the shares, sends the exit fee's shares to the fee recipient, and sets the USDC aside for the claim. No
holder or withdrawal policy is asked, so a refused controller cannot hold up a batch.

- A request with less pending than its fill names, or no longer pending, is skipped with `RequestSkipped`.
- The whole batch reverts when a fill would pay more than the idle left (`InsufficientIdle`) or nothing at all
  (`FillPaysNothing`).
- Settlement works while the vault is paused, and reverts while the NAV is stale.

The controller or its operator claims with `redeem` or `withdraw`, in one go or in parts. Anyone may call
`claimRedeemFor(controller)`, which pays the controller everything claimable. A bound withdrawal policy must allow
the controller and the receiver. Deliver claims in a later transaction than the settlement, since a claim that
reverts takes its batch with it.

## Cancelling and transferring

The controller or its operator can cancel with `cancelRedeemRequest(requestId)`. Every pending share goes back to
the controller, at any age, with no fee. A bound holder policy must allow the controller; otherwise the request
stays and still settles.

`transferRedeemRequest(requestId, oldController, newController)` moves the whole pending balance to a new
controller, who must pass the holder and withdrawal policies when bound. See
[Selling a pending request](https://docs.trusslabs.io/vaults/flow-of-funds/selling-a-pending-request.md).

What can delay a redemption: too little idle USDC, slow returns, a settler that does not settle, a stale NAV, and a
withdrawal policy at claim. A pause stops new requests only.

## Where to read more

| Page | What it covers |
|---|---|
| [Instant withdrawals](https://docs.trusslabs.io/vaults/flow-of-funds/instant-withdrawals.md) | Being paid at once, within the vault's limits |
| [Fees in the flow of funds](https://docs.trusslabs.io/vaults/flow-of-funds/fees.md) | The exit fee, and accrued fees at settlement |
| [Vault policies](https://docs.trusslabs.io/vaults/policies/vault-policies.md) | The withdrawal and holder policies |
