Minting and redeeming
Both directions happen in one Elysium transaction against the Issuer, at a price fixed by a signed quote: mints pay the ask, redemptions receive the bid. This page gives the exact arithmetic, every check in the order the contract runs it, and what happens on Hyperliquid afterwards.
The two functions
Everything goes through the Issuer on Elysium. Prices are 18-decimal USDC per whole token, USDC amounts have 6 decimals and tokens 18. Both functions are nonReentrant and either complete in full or revert with nothing changed.
function mint(
uint32 perpIndex, // the market, e.g. 10003 for pGOLD
uint256 usdcIn, // USDC paid, 6 decimals, fee included
uint256 minTokensOut, // revert if fewer tokens would come out
address recipient, // who receives the tokens
bytes calldata priceData // abi.encode(Quote, bytes[] signatures)
) external returns (uint256 tokensOut);
function redeem(
uint32 perpIndex,
uint256 tokensIn, // tokens burnt from the caller, 18 decimals
uint256 minUsdcOut, // revert if less USDC would be paid or owed
address recipient, // who receives the USDC
bytes calldata priceData // ignored once a market is settled
) external returns (uint256 usdcOut);priceData is a quote and its signatures, fetched from Ported's price service just before you sign. Its format and what makes it valid are in Prices and quotes; the endpoint is in the Quote API.
Approval
Minting pulls USDC from your wallet with transferFrom, so the Issuer needs an allowance of at least usdcIn first. The site asks for an approval of exactly the amount you mint, then fetches a fresh quote and sends the mint straight after.
Redeeming needs no approval. The Issuer is the only address allowed to burn pTokens, and it burns tokensIn directly from the caller's balance. A redeem for more than you hold reverts.
Minting, step by step
The checks run in this order. The first one that fails reverts the whole transaction with the error shown.
- 1Minting is openGlobal mints are not paused (
MintsArePaused), the market exists (UnknownMarket), it is enabled and not wound down (MintDisabled). The amount and recipient are not zero. - 2Hourly mint limit
usdcInis added to the market's hourly bucket and must fit under its limit (FlowCapExceeded). - 3Global mint budget
usdcInmust fit in the budget shared by all markets, and is spent from it (MintBudgetExceeded). - 4The quoteThe price source checks the quote is for this token, fresh and properly signed. The Issuer then checks
bid ≤ ask, that the market has a reference price, and that both the bid and the ask sit inside the price band (PriceOutOfBand). - 5Tokens outThe fee and the tokens are computed (below). Zero tokens reverts with
ZeroAmount; fewer thanminTokensOutreverts withSlippage. - 6Size limitSupply after the mint, valued at the higher of the ask and the price anchor before this trade, must stay under the market's debt limit (
DebtCapExceeded). - 7SettlementUSDC moves from you to the Issuer, the fee is booked, the tokens are minted to
recipient, andMintedis emitted with the amounts and the ask.
All divisions round down, so rounding always favours the backing, never the minter. Limits and fees are covered in detail in Fees and limits.
Redeeming, step by step
- 1Redemptions are openRedemptions are not paused (
RedeemsArePaused), the market exists, the amount and recipient are not zero. - 2The priceOn a live market, the quote is checked as for a mint, except that only the bid must be inside the band: a quote can be redeem-only, with an ask far above any band. On a wound-down market the settlement price is used and
priceDatais ignored. - 3USDC outThe gross, the fee and the net are computed (below). Zero reverts; less than
minUsdcOutreverts withSlippage. - 4Hourly redeem limitThe net
usdcOutis added to the market's hourly redeem bucket (FlowCapExceeded). This limit is set by the owner only: the risk manager, which adjusts the mint limits, cannot touch it. - 5BurnYour tokens are burnt, the fee is booked and
Redeemedis emitted with the amounts and the bid. - 6Pay or queueIf the Issuer's free USDC covers the gross amount, the net is sent to
recipientat once. Otherwise the redemption becomes a claim at this price,RedeemQueuedis emitted, and it is paid in order as USDC arrives.
The gross is compared rather than the net because the fee is booked as reserved the moment the redemption happens: the Issuer must hold it as well. How the queue works is on Redemption queue.
Slippage protection
A quote fixes the price, but between the moment you see an amount and the moment your transaction lands the site may fetch a newer quote. minTokensOut and minUsdcOut are your guarantee: the contract reverts rather than fill you below them.
- The site computes the amount from the fresh quote it is about to send and passes exactly that amount as the minimum. The transaction then fills at that amount or not at all.
- If the fresh quote would give noticeably less than the amount on screen, the site stops, shows the new amount and asks you to confirm again.
- A quote expires within seconds. If your wallet takes longer, the transaction reverts with
QuoteTooOldand nothing moves.
Contracts calling the Issuer directly should set the minimum from the quote they pass, never zero.
The hedge that follows
The Issuer does not touch Hyperliquid. Ported's operator watches Minted and Redeemed, nets them per market and, shortly after, sends the matching order through the market's CoreAccount on HyperEVM: a buy of the same exposure after mints, a reduce-only sell after redemptions.
- Margin
- Mints are hedged from USDC already on Hyperliquid, not from the USDC you paid, which stays on Elysium. A global mint budget, kept in line with the margin ready for new hedges, stops minting before it runs out.
- Bounds
- Each order is checked on-chain against the mark price, a leverage cap and an hourly size limit. The operator cannot open more than the account's value supports.
- The gap
- For those seconds Ported, not you, carries the price risk. The spread and the hourly limits bound it.
The full set of bounds is in Custody and hedging.
A worked example
Illustrative numbers for pGOLD with gold near $3,670, a quote with a bid of $3,668 and an ask of $3,672, and the live fees of 10 bps on each side.
| Step | Formula | Result |
|---|---|---|
| You pay | usdcIn | 1,000.000000 USDC |
| Mint fee | 1,000 × 10 / 10,000 | 1.000000 USDC |
| Tokens out | 999 × 1e30 / 3,672e18 | 0.272058823529411764 pGOLD |
| Later, redeem all | tokensIn | 0.272058823529411764 pGOLD |
| Gross | 0.27205… × 3,668 | 997.911764 USDC |
| Redeem fee | 997.911764 × 10 / 10,000 | 0.997911 USDC |
| You receive | gross − fee | 996.913853 USDC |
In practice the price moves between the two trades, and funding changes the token's units while you hold it. The round trip above is what it costs to go in and out at an unchanged market.
After a market closes
When a market is wound down, mints stop for good and redeem prices every token at the settlement price, without a quote. The fee, the hourly redeem limit and the queue still apply. See Market lifecycle.
Minting and redeeming through a pool
Once Elysium reads Hyperliquid's prices natively, minting and redeeming also run as a swap: a Uniswap v4 pool between USDC and each pToken, whose hook calls the Issuer instead of trading against a curve. Buying the token in that pool mints it at the ask; selling it redeems it at the bid. The pool needs no liquidity providers, and every wallet, router or aggregator that speaks v4 can reach pTokens without this site.
- Same Issuer, same rules: the price band, the fees, the per-market limits and the global mint budget apply to a swap exactly as to a direct call.
- The price comes from the chain itself, so a swap carries no signed quote.
- A swap settles in one transaction, so the pool redeems only what the Issuer can pay at once. Larger redemptions keep using
redeemand the queue. - A swap that a limit would refuse reverts in simulation, so routers simply route around it.
What to listen for
- Minted
perpIndex,payer,recipient(indexed),usdcIn,fee,tokensOut,ask.- Redeemed
perpIndex,holder,recipient(indexed),tokensIn,fee,usdcOut,bid. Emitted for paid and queued redemptions alike.- RedeemQueued
- Only when the redemption was queued:
claimId,perpIndex,recipient,amount.
Every event and error is listed in Events and errors.