← Protocols
Spectra
01Description

Permissionless interest-rate derivatives protocol (formerly APWine). Splits any ERC-4626 yield-bearing token into a Principal Token (PT) and Yield Token (YT), then lets users trade them on a Curve-style stableswap pool — a Pendle alternative.

02Best for
  • 01yield tokenization (PT / YT split)
  • 02fixed-rate yield via PT discounts
  • 03yield speculation / leverage via YT
  • 04interest-rate swaps for ERC-4626 vaults
  • 05boosting LST / RWA / lending yields
03Install
  • pnpm add viem
  • git clone https://github.com/perspectivefi/spectra-core
04Environment variables
VariableScopeDescription
NEXT_PUBLIC_SPECTRA_FACTORYClientSpectra `PrincipalTokenFactory` address; resolve per-chain from spectra-core deployments.
NEXT_PUBLIC_SPECTRA_ROUTERClientSpectra `Router` address used to encode PT/YT mint, swap, and redeem flows in a single call.
05Prompt snippet
Integrate Spectra for yield trading. A market = a `PrincipalToken` (ERC-5095-style PT, also ERC-4626) wrapping an underlying ERC-4626 IBT (interest-bearing token), plus a paired `YieldToken` (YT) and a Curve stableswap pool of `IBT <> PT`. Mint PT+YT: `PrincipalToken.deposit(assets, receiver)` returns shares (PT); the matching YT is minted to the same receiver. Buy fixed-rate yield: swap IBT -> PT on the pool (PT trades at a discount that compounds to the underlying APY). Speculate: swap IBT -> YT to long yield. Use the `Router` to batch `transferFrom`, `wrapVault`, `addLiquidity`, `swap`, and `redeem` in one tx. At maturity, call `PrincipalToken.redeem(shares, receiver, owner)` to claim 1:1 underlying; YT holders call `YieldToken.claimYield(receiver)` to harvest accrued yield up to expiry.
06Gotchas
  • PT/YT pairs are bound to a fixed `maturity` (expiry) — after expiry, YT becomes worthless and PT redeems 1:1 for underlying. Build expiry warnings into the UI and roll positions before expiry.
  • Spectra inherits the underlying IBT's risk — if the wrapped ERC-4626 vault depegs, gets exploited, or has a bad oracle, PT/YT both reflect that loss; vet the IBT, not just Spectra.
  • Fixed-rate APY for a PT buyer is only realized if held to maturity — exiting early via the pool can yield less (or more) than the implied APY due to swap slippage and IBT price drift.
  • YT yield is claimable but not auto-compounding — holders must call `claimYield`, and unclaimed yield is lost if the YT is transferred to a non-claiming address.
  • The pool uses Curve stableswap math calibrated for PT/IBT — large trades far from the equilibrium ratio incur outsized slippage near expiry as PT approaches par.
  • Permissionless market creation: anyone can deploy a `PrincipalToken` for any IBT, including malicious or low-liquidity ones — whitelist by curator or via the official Spectra app pool list.
  • Solidity rounding favors the protocol on `deposit` / `redeem` — quote off-chain with `previewDeposit` / `previewRedeem` and tolerate ±1 wei in tests.
07Alternatives