FW Tokens
FW token base contracts and the USDCFW implementation that wraps USDC through an ERC-4626 vault for yield generation.
Last updated
FW token base contracts and the USDCFW implementation that wraps USDC through an ERC-4626 vault for yield generation.
Source: src/fira_bonding/StandardizedYield/FWBase.sol, src/fira_bonding/StandardizedYield/implementations/USDCFW.sol
Abstract base that all FW tokens inherit. Extends FiraERC20Permit, TokenHelper, BoringOwnableUpgradeable, and Pausable.
Validate input token via isValidTokenIn
Transfer tokens in via _transferIn
Call _deposit(tokenIn, amount) — abstract, implemented by derived contracts
Mint FW shares to receiver
Check minSharesOut slippage guard
Validate output token via isValidTokenOut
Burn FW shares (or from address(this) if burnFromInternalBalance)
Call _redeem(receiver, tokenOut, shares) — abstract
Check minTokenOut slippage guard
Three independent mechanisms: depositsPaused, redemptionsPaused, and global pause() (blocks all transfers).
The production FW implementation. Wraps USDC and earns yield by deploying a portion into an ERC-4626 vault.
yieldToken — USDC address (immutable)
vault — ERC-4626 vault (immutable)
idleAssets / vaultShares — Tracked explicitly to prevent donation-based manipulation
Where totalUnderlying = idleAssets + vault.convertToAssets(vaultShares).
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.
Draws from idle USDC first, then from the vault if needed, minimizing gas costs.
triggerRehypothecation() (permissionless) and forceRehypothecation() (owner-only) rebalance between idle and vault based on the RehypothecationModule parameters.
Last updated
exchangeRate = totalUnderlying / totalSupply