Skip to content
perpsplexity
BOTCHATSECURITY
Built onAFTERMATH
Events | Perpsplexity Docs

Introduction

OverviewFees

Products

Perp meme poolsLaunchSwapLeveraged tokens

Integrate

AddressesRouters and aggregatorsEventsError codes

Reference

Public APISecurityAudits

More

FAQ
Integrate

Events

The events to index for trades, launches, bonds, dividends, fees and upkeep, per contract.

Every amount in an event is in raw units: USDC has 6 decimals, launched coins 6, leveraged tokens 9. Event types always use a package's original id (its types and events id), even after upgrades.

ContractEvent type prefix
Pools, upgradeable package0x97fea95545c04dc73f8174c6195013b100a26e3fa978e7cf8b100a51dfaf8354::composite_pool::
Pools, immutable package0xaedb8c9a905a778e831aeb4928f660210a7a645925348a7c4ec1cb4a6a3fd16e::composite_pool::
Leveraged tokens0x294e0968e465d9e2e560b825c603a40d34a7ee72e5a9157ff796519d44f7df4a::token::

Pools#

Trades#

EventFieldsNotes
Swappool, position, buyer, buy, input, output, fee, meme_reserve, quote_nav, hot_only, timestamp_msOne per trade. position is the receipt bought or sold. input and output are in the coin paid and the coin received. fee is in USDC. buyer is the trader on both sides.
Depositedpool, position, owner, amount, timestamp_msLoose coins put into a receipt.
Withdrawnpool, position, owner, amount, burned, timestamp_msA receipt turned back into coins.
ExposureCappedpool, timestamp_ms, to_engine, to_cashA buy split at the position's size limit: the part that opened exposure and the part that joined the cash.

Pool life#

EventFields
Preparedpool, engine, engine_vault, engine_sleeve, engine_account, pool_sleeve, reserve, reserve_account, creator
Createdpool, meme_reserve, quote_nav, lp_supply, timestamp_ms
CurveMovedpool, virtual_quote, basis, bond_target, depth, meme_reserve, timestamp_ms
Bondedpool, real, virtual_quote, burned, meme_reserve, quote_nav, timestamp_ms
LifecycleChangedpool, state, timestamp_ms (the states are on Perp meme pools)
Cancelledpool
LiquidityChangedpool, meme_reserve, quote_nav, lp_supply

Holders and fees#

EventFields
EpochFundedpool, timestamp_ms, amount, rollover: a day's dividends shared out
Reinvestedpool, timestamp_ms, amount, added_nav: the treasury's reinvested share put into the position
CreatorPaidpool, creator, amount
TreasuryFundedpool, donor, amount
platform_fees::Accrued, platform_fees::Collectedthe platform's share, as it accrues and when it is collected

Upkeep#

EventFields
BasketRebalancedpool, nav_before, nav_after, synth_before, synth_after
MarginDefendedpool, timestamp_ms, amount, treasury_left: margin added from the treasury
MarginAddedpool, donor, timestamp_ms, to_margin, to_treasury
RedeemGapCoveredpool, timestamp_ms, gap, free_before, moved, hot_left
Healtha full sample: NAV, cash, position value, lending, margin shortfall, targets and venue flags

Spot pools in the same packages emit the matching pool:: events (PoolCreated, Swap, Bonded, Deposited, Withdrawn, CurveMoved, EpochFunded, StateChanged).

Leveraged tokens#

EventFields
token::Createdtoken, coin_type, vault, account, market, long, target_bps, min_bps, max_bps, max_notional, base_oracle, collateral_oracle
token::Mintedtoken, buyer, deposit, fee, referrer, tokens, nav, supply, price, oracle
token::Redeemedtoken, seller, tokens, payout, fee, referrer, nav, supply, price, oracle
token::Rebalancedtoken, increase, size, leverage_before, leverage_after, nav, oracle
token::FeesAccrued, token::FeesCollectedstreaming fee minted and sold
token::StateChangedtoken, state

price is raw USDC per whole token (1e9 raw units). See Leveraged tokens.

Start checkpoints#

ContractFirst checkpoint
Pools, immutable package323206901
Pools, upgradeable package323461480

Reading events#

TypeScript
import { SuiGrpcClient } from "@mysten/sui/grpc";

// A transaction's events, decoded:
const client = new SuiGrpcClient({ network: "mainnet", baseUrl: "https://fullnode.mainnet.sui.io:443" });
const r: any = await client.core.getTransaction({ digest, include: { events: true } });
const swaps = r.Transaction.events.filter((e: any) => e.eventType.endsWith("::composite_pool::Swap")).map((e: any) => e.json);

To follow a type over time, query Sui's GraphQL events(filter: { type: "<prefix>Swap" }) or run your own indexer from the start checkpoint.

PreviousRouters and aggregatorsNext Error codes

On this page

PoolsTradesPool lifeHolders and feesUpkeepLeveraged tokensStart checkpointsReading events