Skip to main content

Mint and redeem

Integrate against the market minter proxy. Quotes are view dry-runs; execution is approve (or permit via zap) then mint* / redeem*. Live minters are Minter_v2.

Quote first. Guard with minOut. Then submit.

Process-flow narrative (illustrative math, not a quote): Minting process flow. Function SoT: Minter.

Direct vs zap

PathWhen
DirectYou already hold wrapped collateral (fxSAVE, wstETH, …). Call the minter.
ZapUser has ETH / stETH / USDC / fxUSD. Use the market’s genesis or minter zap if listed — Zap contracts. Zaps are convenience only.

Prefer wrapped collateral when integrating another protocol (fewer moving parts, no zap upgrade surface). One-click ETH/stETH/USDC paths: Zaps.

Cookbook (direct mint ha)

  1. Resolve addresses from the market page (minter, wrappedCollateralToken, peggedToken).
  2. wrappedCollateral.approve(minter, amount) (or exact allowance).
  3. Quote:
minter.mintPeggedTokenDryRun(wrappedCollateralIn)

Returns incentive ratio, fees, output amounts, price, and rate (see minter page). Abort without sending the tx if the ratio is 1e18 (disallowed at the current CR) or any relevant taken / used / out amount is 0.

  1. Set minPeggedOut from the dry-run output with your slippage buffer.
  2. Execute:
minter.mintPeggedToken(wrappedCollateralIn, receiver, minPeggedOut);

Mint hs with mintLeveragedToken / mintLeveragedTokenDryRun. Redeem with redeemPeggedToken / redeemLeveragedToken and matching dry-runs (minWrappedCollateralOut).

Dry-run fields (how to use them)

Treat dry-run as the quote API. Decode returns by position (shapes differ per function — see Minter dry-runs):

Field familyHow to use
Incentive ratioFee (positive), discount (negative), or disallow (== 1e18). Also abort if taken/out is 0.
Fees / discountsAlready reflected in the out preview; discounts come from the reserve when funded.
Taken / used / outBasis for minOut; near bands, taken may be less than in (partial).
Price / rate18-decimal Harbor units — do not mix with 8-decimal Chainlink.

Re-quote immediately before submission if CR is near a band edge (fees are path-dependent integrals). A normal eth_call and the later mined transaction can land in different blocks — minOut remains the execution guard unless you use a transaction-bundled or on-chain quote.

Approvals and tokens

  • Mint: approve wrapped collateral to the minter.
  • Redeem ha: the minter burns ha from the sender (_BURN_SIGNATURE is immutable per market — Burn1Arg / Burn2Arg / BurnFrom). If redeem reverts on allowance, approve ha to the minter.
  • Redeem hs: same pattern for the leveraged token.

Restricted paths

freeMint* / freeRedeem* require ZERO_FEE_ROLE (stability pool manager / protocol). External protocols should use the public mint* / redeem* functions.