# Rehypothecation

## Overview

FW tokens hold their underlying assets in two places: **idle reserves** (for instant redemptions) and an **ERC-4626 vault** (for yield generation). The RehypothecationModule defines the parameters that govern this balance.

{% hint style="info" %}
Rehypothecation ensures FW always has enough idle liquidity for redemptions while maximizing yield by deploying the rest into the underlying vault.
{% endhint %}

## How it works

The RehypothecationModule defines three parameters (in basis points):

| Parameter   | Purpose                                                                        |
| ----------- | ------------------------------------------------------------------------------ |
| `phiMin`    | Minimum idle ratio — if idle drops below this, assets are withdrawn from vault |
| `phiMax`    | Maximum idle ratio — if idle exceeds this, excess is deposited into vault      |
| `phiTarget` | Target idle ratio — used by `forceRehypothecation()` to rebalance              |

### Triggering rebalance

* **`triggerRehypothecation()`** — Callable by anyone. Deposits excess to vault if `idleRatio > phiMax`, or withdraws from vault if `idleRatio < phiMin`. No-ops if the ratio is within bounds.
* **`forceRehypothecation()`** — Owner-only. Always rebalances to `phiTarget` regardless of current ratio.

### Example

If `phiMin = 10%`, `phiMax = 30%`, `phiTarget = 20%`:

* FW holds 100 USDC total, 5 USDC idle (5% idle ratio → below `phiMin`)
* Anyone calls `triggerRehypothecation()` → vault withdraws USDC to bring idle up
* After rebalance: \~20 USDC idle, \~80 USDC in vault

## Key features

* **Automatic yield optimization** — Excess idle funds are deployed for yield
* **Redemption guarantees** — Minimum idle ratio ensures users can always redeem
* **Permissionless triggers** — Anyone can call `triggerRehypothecation()` when out of bounds
* **Owner-controlled force rebalance** — Protocol can rebalance to target at any time

## Related contracts

* [`RehypothecationModule.sol`](https://docs.fira.money/developers/protocol-contracts/rehypothecation-module) — Contract details
* [`FWBase.sol`](https://docs.fira.money/developers/token-contracts/fw-tokens) — FW base contract that uses the module


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fira.money/developers/features/rehypothecation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
