Events and errors
Every event the contracts emit, with its fields and what it means, and every error a user or an integration can run into, with what to do about it. Names and fields are exactly as in the contracts.
Reading events
Amounts in events use the same scales as the calls: USDC in 6 decimals, pTokens in 18, prices in 18-decimal USDC per whole token. Indexed fields can be filtered on by the node, so a wallet can find its own mints by recipient without scanning every log. The Issuer was deployed at Elysium block 13157064; no Ported log on Elysium is older.
import { parseAbiItem } from "viem"
import { ISSUER, publicClient } from "./ported" // see the Integrate page
const FROM_BLOCK = 13157064n // the Issuer's deployment block
const STEP = 50_000n
const minted = parseAbiItem(
"event Minted(uint32 indexed perpIndex, address indexed payer, address indexed recipient, uint256 usdcIn, uint256 fee, uint256 tokensOut, uint256 ask)",
)
// Walk forward in fixed windows: RPCs cap the block range of one eth_getLogs.
const head = await publicClient.getBlockNumber()
for (let from = FROM_BLOCK; from <= head; from += STEP) {
const to = from + STEP - 1n < head ? from + STEP - 1n : head
const logs = await publicClient.getLogs({
address: ISSUER,
event: minted,
args: { perpIndex: 10003 }, // indexed fields filter on the node
fromBlock: from,
toBlock: to,
})
for (const l of logs) console.log(l.blockNumber, l.args.recipient, l.args.tokensOut, l.args.ask)
}Every owned contract also emits OpenZeppelin's OwnershipTransferStarted(previousOwner, newOwner) and OwnershipTransferred(previousOwner, newOwner), and each pToken emits the standard ERC-20 Transfer and Approval. A mint shows as a Transfer from the zero address, a redemption as a Transfer to it.
Issuer: mints and redemptions
| Event | Fields | Meaning |
|---|---|---|
Minted | perpIndex (indexed), payer (indexed), recipient (indexed), usdcIn, fee, tokensOut, ask | A mint. payer paid usdcIn (fee included) and recipient received tokensOut at the quote's ask. |
Redeemed | perpIndex (indexed), holder (indexed), recipient (indexed), tokensIn, fee, usdcOut, bid | A redemption. holder's tokensIn were burnt at bid (or the settlement price); usdcOut is what recipient is paid, now or from the queue. |
RedeemQueued | claimId (indexed), perpIndex (indexed), recipient (indexed), amount | Emitted right after Redeemed when the Issuer could not pay at once. The USDC amount is owed to recipient under claimId. |
ClaimPaid | claimId (indexed), recipient (indexed), amount | A queued claim was paid in full by payClaims. |
ClaimVoided | claimId (indexed), holder (indexed), tokens | The guardian or owner voided an unpaid claim: tokens were minted back to holder, nothing is owed any more. |
Issuer: markets, prices and limits
| Event | Fields | Meaning |
|---|---|---|
MarketCreated | perpIndex (indexed), token, name, symbol | A market was listed and its pToken deployed. Minting stays closed until the market is configured. |
MarketConfigured | perpIndex (indexed), params | The owner set the market's parameters: mintEnabled, fees, band, and the ceilings on debt and hourly flows. |
MarketLimitsSet | perpIndex (indexed), maxDebt, maxMintPerHour | The mint-side limits in force changed (risk manager, or a reconfiguration that lowered them). |
MintBudgetSet | budget, ceiling | The global mint budget or its ceiling changed. Each mint also spends the budget without an event. |
ReferencePriceSet | perpIndex (indexed), price | The band's anchor moved to price: on an accepted trade or pokePrice (at most once a minute), or on a reset by the guardian or owner. |
MarketSettled | perpIndex (indexed), price | The market was wound down: minting is off for good and every token redeems at price, without a quote. |
SettlementAdjusted | perpIndex (indexed), price, maxRedeemPerHour, redeemFeeBps | After a wind-down, the redemption pace or fee changed, or the settlement price was corrected (possible once). |
Issuer: pauses, roles and USDC moves
| Event | Fields | Meaning |
|---|---|---|
MintsPaused | paused | Minting stopped (true) or restarted (false), on every market. |
RedeemsPaused | paused | Redemptions and queue payments stopped or restarted. |
BridgeOutPaused | paused | USDC leaving the Issuer towards HyperEVM stopped or restarted. |
BridgedOut | amount, to | USDC sent to the treasury on HyperEVM through Elysium's canonical bridge. |
BridgedOutRelay | amount, orderId | USDC sent to the treasury on HyperEVM through Relay, under a daily cap. |
RelaySet | depository, dailyCap | The Relay route was turned on, off (zero depository) or re-capped. |
FeesWithdrawn | amount, to | Accrued fees sent to the fee recipient. |
PriceSourceSet | priceSource | The contract that verifies quotes changed. |
OperatorSet | operator | New operator (moves USDC back to HyperEVM). |
GuardianSet | guardian | New guardian (pauses, resets the band, voids claims). |
RiskManagerSet | riskManager | New risk manager (mint-side limits and budget); zero turns the role off. |
ParentTreasurySet | parentTreasury | New destination of USDC sent back to HyperEVM. |
FeeRecipientSet | feeRecipient | New recipient of withdrawn fees. |
AttestedPriceSource
| Event | Fields | Meaning |
|---|---|---|
AttesterSet | attester (indexed), enabled | An address was added to or removed from the signers whose quotes count. |
ThresholdSet | threshold | How many distinct attester signatures a quote needs. |
MaxQuoteAgeSet | age | How many seconds a quote stays valid after its issuedAt (at most 30). |
HyperEVM: CoreAccount, Treasury, factory
Each market's position lives in its own CoreAccount on HyperEVM, which owns a HyperCore account. Its events record what was sent to HyperCore: orders reach Hyperliquid a few seconds after the transaction and are immediate-or-cancel, so whether and at what price an order filled is visible on Hyperliquid, not in these events.
| Contract | Event | Fields | Meaning |
|---|---|---|---|
| CoreAccount | OrderSent | isBuy (indexed), sz, limitPx, cloid | An IOC order was sent: a buy grows the long, a reduce-only sell shrinks it. sz and limitPx are 1e8-scaled; cloid is the client order id on Hyperliquid. |
| CoreAccount | OrderCancelled | cloid | A cancel was sent for that order id. |
| CoreAccount | UsdcDeposited | evmAmount, destinationDex | USDC moved from the contract on HyperEVM into its HyperCore account. |
| CoreAccount | SpotToPerp | usd | USDC moved from HyperCore spot into the market's perp margin. |
| CoreAccount | PerpToSpot | usd | Free margin moved back to HyperCore spot, never past the leverage cap. |
| CoreAccount | SpotToEvm | weiAmount | USDC bridged from HyperCore spot back to the contract on HyperEVM. |
| CoreAccount | HypeToCore | amount | HYPE sent to HyperCore to pay its transfer gas. |
| CoreAccount | Swept | amount | USDC sent from the account to the treasury, its only allowed destination. |
| CoreAccount | ParamsSet | params | New risk bounds: slippage, leverage cap, settle window, hourly increase and decrease limits. |
| CoreAccount | LeverageSetupBegun | agent | Isolated-only markets: an agent was registered to set 1x isolated leverage. |
| CoreAccount | LeverageSetupEnded | replacement | The agent was replaced with a fresh keyless address (also on a retry). |
| CoreAccount | RevocationConfirmed | replacement | The guardian or owner confirmed the agent is gone: trading opens. |
| CoreAccount | OperatorSet, GuardianSet, TreasurySet | address (indexed) | Role and destination changes. |
| Treasury | AccountFunded | perpIndex (indexed), account, amount | USDC sent to a market's CoreAccount. |
| Treasury | BridgedToElysium | amount, fee | USDC sent to the Issuer on Elysium through the canonical bridge; fee is the HYPE paid for the bridge ticket. |
| Treasury | OwnerWithdrawal | token, to, amount | The owner moved an asset out (zero token = HYPE). For migrations and emergencies. |
| Treasury | MoverSet, GuardianSet | address | Role changes. |
| Treasury | ElysiumIssuerSet | issuer, refund | New bridge recipient on Elysium and refund address for bridge fees. |
| Treasury | MaxBridgeFeeSet | maxBridgeFee | New ceiling on the HYPE one bridge transaction may spend. |
| CoreAccount, Treasury | Paused, Unpaused | account | OpenZeppelin's pause events, with the caller. |
| CoreAccountFactory | AccountCreated | perpIndex (indexed), account | A market's CoreAccount was deployed. |
| CoreAccountFactory | DefaultsSet, UsdcDexSet | defaults / dex, allowed | Roles and bounds for new accounts; which Hyperliquid dexs are accepted (USDC-margined only). |
BasisVault
Each basis vault emits these events; the epoch mechanics are on Deposits, redemptions, epochs.
| Event | Fields | Meaning |
|---|---|---|
DepositRequested, DepositCancelled | epoch (indexed), user (indexed), assets | USDC queued for an epoch, or taken back. |
RedeemRequested, RedeemCancelled | epoch (indexed), user (indexed), shares | Shares queued for an epoch's redemption, or taken back. |
EpochSettled | epoch (indexed), navLow, navHigh, sharesMinted, sharesBurned, assetsReleased | An epoch closed: deposits priced at the high NAV, redemptions at the low NAV. |
DepositClaimed | epoch (indexed), user (indexed), shares | Shares from a settled deposit delivered. |
RedeemClaimed | epoch (indexed), user (indexed), assets, sharesReturned | USDC from a settled redemption paid, and any shares not redeemed for lack of cash returned. |
InstantRedeemed | user (indexed), shares, assets | A redemption paid at once from cash, for a higher fee. |
PerformanceFee | assets, shares | Performance fee charged on gains above the high-water mark, as shares to the fee recipient. |
Order, Moved | spot, isBuy, sz, limitPx, cloid / kind, amount | Orders and USDC moves sent to the vault's HyperCore account. |
ParamsSet, RolesSet, Paused, ClosingStarted | … | Configuration, roles, pause, and the start of a permanent wind-down. |
Errors you can hit
The Issuer calls the price source while checking a trade, so the price source's errors come back from mint and redeem unchanged. Include both contracts' errors in the ABI you decode with.
| Error | Raised by | Cause | What to do |
|---|---|---|---|
QuoteTooOld(issuedAt) | Price source | The block's time is past issuedAt + maxQuoteAge. | Fetch a new quote right before sending and retry. |
QuoteFromFuture(issuedAt) | Price source | issuedAt is more than 5 seconds ahead of the block's time. | Retry with a new quote; persistent cases point to a clock problem at the service. |
NotEnoughSignatures(valid, threshold) | Price source | Fewer signatures than threshold(). | Gather co-signatures through /cosign. |
SignersNotSorted() | Price source | Signatures not in strictly increasing signer order, or one signer twice. | Sort by signer address and drop duplicates. |
UnknownSigner(signer) | Price source | A signature recovers to an address that is not a registered attester. | Check the endpoint you used; verify signatures before sending. |
WrongToken(expected, quoted) | Price source | The quote prices another token. | Request the quote for the perp index you are trading. |
InvalidPrices(bid, ask) | Price source | Zero bid, or bid above ask. | Fetch a new quote. |
ECDSAInvalidSignature… | Price source | A malformed signature. | Pass each signature exactly as received, 65 bytes. |
PriceOutOfBand(price, refPrice, allowedBps) | Issuer | The bid (or, on a mint, the ask) is too far from the anchor. | Wait: the band widens every minute. On a large real gap the guardian resets it. |
NoReferencePrice(perpIndex) | Issuer | The market has no anchor yet: trading has not opened. | Wait for the market to open. |
Slippage(out, minOut) | Issuer | The quote gives less than your minimum. | Recompute the minimum from the quote you send, or accept the new price. |
FlowCapExceeded(usedAfter, cap) | Issuer | The trade would take the market's hourly USDC in (or out) past its cap. | Trade a smaller amount, or wait: the counter decays over the hour. Read mintedLastHour / redeemedLastHour. |
MintBudgetExceeded(amount, budget) | Issuer | Larger than the global mint budget. | Mint at most mintBudget(), or wait for it to be topped up. |
DebtCapExceeded(debtAfter, maxDebt) | Issuer | The market's supply would exceed its debt limit. | Mint less; the room is maxDebtNow minus the current debt. |
MintsArePaused() | Issuer | Minting is paused on every market. | Wait for the owner to restart it. Redemptions may still be open. |
RedeemsArePaused() | Issuer | Redemptions (and queue payments) are paused. | Wait for the guardian or owner to reopen them. Your tokens remain transferable. |
MintDisabled(perpIndex) | Issuer | Minting is not enabled on this market, or it is wound down. | Only redeem. |
UnknownMarket(perpIndex) | Issuer | No market with that perp index. | Read perpIndexes. |
ZeroAmount() | Issuer | Zero in, or an amount so small it rounds to zero out. | Trade a larger amount. |
ZeroAddress() | Issuer | Recipient is the zero address. | Pass a recipient. |
InvalidQuote(bid, ask) | Issuer | The price source returned a bid above the ask. | Fetch a new quote. |
InvalidParams() | Issuer | On a queued redemption, an amount beyond the claim's storage range (absurdly large). | Redeem in smaller parts. |
MarketSettledAlready(perpIndex) | Issuer | pokePrice on a wound-down market. | No price is needed: redeem directly. |
ERC20InsufficientBalance | pToken | Redeeming more tokens than you hold. | Redeem at most your balance. |
"ERC20: insufficient allowance" | USDC | The Issuer is not approved for usdcIn. Elysium USDC reverts with strings, not custom errors. | Approve the Issuer first. |
"ERC20: transfer amount exceeds balance" | USDC | Not enough USDC. | Mint a smaller amount. |
Role-gated functions revert with NotOperator, NotGuardian, NotRiskManager or OpenZeppelin's OwnableUnauthorizedAccount when called by anyone else; AboveCeiling, BudgetChanged, ClaimNotOpen and RenounceDisabled come from the same administrative paths. They are listed per role on Roles and powers.
Decoding a revert
Simulate before sending and read the error by name. With viem, walk the error chain to the contract revert:
import { BaseError, ContractFunctionRevertedError } from "viem"
import { ISSUER, issuerAbi, publicClient, walletClient } from "./ported"
try {
await publicClient.simulateContract({
account: walletClient.account,
address: ISSUER,
abi: issuerAbi, // include the Issuer's and the price source's errors
functionName: "mint",
args: [perp, usdcIn, minTokensOut, recipient, priceData],
})
} catch (e) {
const revert = e instanceof BaseError ? e.walk((x) => x instanceof ContractFunctionRevertedError) : null
if (revert instanceof ContractFunctionRevertedError) {
// e.g. "QuoteTooOld" [1795986787n]: fetch a new quote and retry
console.log(revert.data?.errorName, revert.data?.args)
} else {
throw e
}
}