> For the complete documentation index, see [llms.txt](https://docs.fira.money/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fira.money/developers/token-contracts/fw-tokens.md).

# FW Tokens

{% hint style="info" %}
**Source:** `src/fira_bonding/StandardizedYield/FWBase.sol`, `src/fira_bonding/StandardizedYield/implementations/USDCFW.sol`
{% endhint %}

## FWBase

Abstract base that all FW tokens inherit. Extends `FiraERC20Permit`, `TokenHelper`, `BoringOwnableUpgradeable`, and `Pausable`.

### Deposit flow

1. Validate input token via `isValidTokenIn`
2. Transfer tokens in via `_transferIn`
3. Call `_deposit(tokenIn, amount)` — abstract, implemented by derived contracts
4. Mint FW shares to receiver
5. Check `minSharesOut` slippage guard

### Redeem flow

1. Validate output token via `isValidTokenOut`
2. Burn FW shares (or from `address(this)` if `burnFromInternalBalance`)
3. Call `_redeem(receiver, tokenOut, shares)` — abstract
4. Check `minTokenOut` slippage guard

### Pause controls

Three independent mechanisms: `depositsPaused`, `redemptionsPaused`, and global `pause()` (blocks all transfers).

## USDCFW

The production FW implementation. Wraps USDC and earns yield by deploying a portion into an ERC-4626 vault.

### State

* `yieldToken` — USDC address (immutable)
* `vault` — ERC-4626 vault (immutable)
* `idleAssets` / `vaultShares` — Tracked explicitly to prevent donation-based manipulation

### Exchange rate

```
exchangeRate = totalUnderlying / totalSupply
```

Where `totalUnderlying = idleAssets + vault.convertToAssets(vaultShares)`.

### Deposit

USDC deposits are added to `idleAssets`. Vault share deposits are converted to equivalent USDC. First deposit mints 1:1. The market is seeded on deployment to prevent ERC-4626 inflation attacks.

### Redeem

Draws from idle USDC first, then from the vault if needed, minimizing gas costs.

### Rehypothecation

`triggerRehypothecation()` (permissionless) and `forceRehypothecation()` (owner-only) rebalance between idle and vault based on the RehypothecationModule parameters.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.fira.money/developers/token-contracts/fw-tokens.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
