> For the complete documentation index, see [llms.txt](https://docs.townsq.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.townsq.xyz/institution-backed-yield-vault-features/yield-vault.md).

# Yield Vault

townSquare Vault is a yield-bearing vault built on ERC4646. You deposit an underlying asset and receive `townSquare` shares. The yield is produced by a trading strategy operated **offchain**, and profit or loss is reported back to the vault periodically. Your shares gain (or lose) value as those reports land; the number of shares you hold does not change.

**Profit arrives gradually, not all at once.** When a profit is reported, it is released into the share price linearly over the *vesting period* rather than instantly. This stops someone from depositing just before a report and capturing yield they were not exposed to. Practically: a reported profit raises your position's value smoothly over the following days.

### Depositing

Standard ERC-4626. Approve the vault, then deposit.

* **There is no deposit fee.** Entering the vault is free; the fee is charged only on exit.
* There is a **minimum deposit size**, expressed in shares (`minSharesInVaultToken`). Very small deposits revert.
* Your assets do not stay in the vault. They are forwarded immediately to the Manager contract, which deploys them to the strategy. This matters for withdrawal — see below.

### Withdrawing

**This is the part that differs from a normal vault.** Withdrawal is a two-step process with a waiting period, and you cannot skip it.

#### Step 1 — request

```bash
requestRedeem(uint256)
```

What happens the moment you call this:

* Your shares are **burned immediately**.
* The asset amount you will receive is **calculated and locked in now**, at the current share price, net of the exit fee.
* A cooldown timer starts.

#### Step 2 — collect, after the cooldown

**Rules that will trip you up**

* **Your amount is fixed at request time.** Once you request, you are no longer exposed to the share price. If a profit is reported during your cooldown you do **not** receive it. If a loss is reported you are **not** affected. Requesting is an exit from the strategy, not a queued sale.
* **One request at a time.** `requestRedeem` reverts if you already have a pending request. You cannot add to it, and there is no cancel function — once requested, you are committed to that amount.
* **You must call `withdraw`/`redeem` yourself.** The vault requires the caller to be the owner of the request. Approving another address does not let it withdraw for you — this intentionally breaks the standard ERC-4626 allowance flow.
* **The amount must match exactly.** `redeem(shares)` requires `shares` to equal your request's stored share count exactly; `withdraw(assets)` requires an exact asset match. Partial collection is not supported. Read your request and pass the stored value back.
* There may be a **cap on the size of a single request** (`maxRedeemCap`). If your position exceeds it, exit across multiple requests, one after another.

**Fees**

You pay **one** fee as a depositor: the **exit fee**, charged when you request a redemption. It is capped at 1% and is deducted from the amount you are quoted.

There is no deposit fee and no ongoing management fee.
