For the complete documentation index, see llms.txt. This page is also available as Markdown.

Integration Guide

This guide shows developers how to integrate with Knox Protocol: depositing, querying positions, and withdrawing.

Quick Start

1

Find a Pool

Pools are deployed via SpectrumFactory. Query deployment events or maintain an off-chain index.

// Listen for pool deployments
event PoolDeployed(
    address indexed accountant,
    address indexed seniorVault,
    address indexed juniorVault,
    address allocator,
    address underlyingMarket
);
2

Check Pool Parameters

ISpectrumAccountant accountant = ISpectrumAccountant(accountantAddress);

// Core parameters
uint128 seniorAPY = accountant.rSenior(); // e.g., 500 = 5%
uint128 maxSpectrumAPY = accountant.rMaxSpectrum(); // e.g., 2000 = 20%
uint128 gridStep = accountant.spectrumGridStep(); // e.g., 50 = 0.5%
uint128 period = accountant.dPeriod(); // seconds
uint256 maturity = accountant.tStart() + period;

// Capacity
uint256 seniorCap = accountant.seniorCapacity();
uint256 maxTotal = accountant.cMaxTotalDeposits();

// Fee
uint128 protocolFee = accountant.cProtocolFee(); // e.g., 500 = 5%
3

Choose Your Tranche

Decision Tree:

Want guaranteed returns? → Senior

Want a specific cap with downside protection? → Spectrum (choose APY on grid)

Want maximum upside? → Junior

Depositing

The KnoxRouter provides the cleanest UX:

Senior Deposit

// Standard ERC20 approval
IERC20(asset).approve(address(router), amount);
router.depositSeniorSpectrum(accountant, amount, receiver);

// OR with Permit2 (no approval needed)
router.depositSeniorSpectrumPermit2(
    accountant,
    amount,
    receiver,
    permit2Signature
);

Spectrum Deposit

Junior Deposit

Via Accountant (Direct)

Via Vault (ERC4626)

Only for existing vaults (cannot create new spectrum vaults):

Querying Positions

Tranche Shares

Current Tranche Values

User Share Value

Pool State

Underlying Asset Value

Withdrawing

After Settlement

Once the pool is in SETTLED state:

Note: The last redeemer of a tranche gets the entire remaining balance (not a calculated proportion) to prevent dust.

Before Settlement

Withdrawals are blocked. However, tranche tokens are ERC-20s and can be:

  • Transferred to another address

  • Sold on secondary markets

  • Used as collateral

Monitoring Settlement

Check Redemption Progress

Trigger Redemption (Permissionless)

Advanced: Reading Waterfall Results

Per-Tranche Payouts

Protocol Fee Collected

Common Patterns

Deposit & Track Pattern

Auto-Withdraw Pattern

Error Handling

Common Errors

Frontend Integration Example

React Hook

Key Takeaways

  • Use the router for deposits — cleaner UX, handles approvals

  • Permit2 variants eliminate approval transactions

  • Tranche tokens are ERC-20s — transferable before settlement

  • Withdrawals only after SETTLED — monitor pool state

  • Permissionless redemption — anyone can trigger after maturity

  • Async markets may have cooldown periods — check maxPendingExitUnlockAt()

  • Last redeemer gets dust — no rounding issues