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.
| Contract | Event type prefix |
|---|
| Pools, upgradeable package | 0x97fea95545c04dc73f8174c6195013b100a26e3fa978e7cf8b100a51dfaf8354::composite_pool:: |
| Pools, immutable package | 0xaedb8c9a905a778e831aeb4928f660210a7a645925348a7c4ec1cb4a6a3fd16e::composite_pool:: |
| Leveraged tokens | 0x294e0968e465d9e2e560b825c603a40d34a7ee72e5a9157ff796519d44f7df4a::token:: |
Pools#
Trades#
| Event | Fields | Notes |
|---|
Swap | pool, position, buyer, buy, input, output, fee, meme_reserve, quote_nav, hot_only, timestamp_ms | One 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. |
Deposited | pool, position, owner, amount, timestamp_ms | Loose coins put into a receipt. |
Withdrawn | pool, position, owner, amount, burned, timestamp_ms | A receipt turned back into coins. |
ExposureCapped | pool, timestamp_ms, to_engine, to_cash | A buy split at the position's size limit: the part that opened exposure and the part that joined the cash. |
Pool life#
| Event | Fields |
|---|
Prepared | pool, engine, engine_vault, engine_sleeve, engine_account, pool_sleeve, reserve, reserve_account, creator |
Created | pool, meme_reserve, quote_nav, lp_supply, timestamp_ms |
CurveMoved | pool, virtual_quote, basis, bond_target, depth, meme_reserve, timestamp_ms |
Bonded | pool, real, virtual_quote, burned, meme_reserve, quote_nav, timestamp_ms |
LifecycleChanged | pool, state, timestamp_ms (the states are on Perp meme pools) |
Cancelled | pool |
LiquidityChanged | pool, meme_reserve, quote_nav, lp_supply |
Holders and fees#
| Event | Fields |
|---|
EpochFunded | pool, timestamp_ms, amount, rollover: a day's dividends shared out |
Reinvested | pool, timestamp_ms, amount, added_nav: the treasury's reinvested share put into the position |
CreatorPaid | pool, creator, amount |
TreasuryFunded | pool, donor, amount |
platform_fees::Accrued, platform_fees::Collected | the platform's share, as it accrues and when it is collected |
Upkeep#
| Event | Fields |
|---|
BasketRebalanced | pool, nav_before, nav_after, synth_before, synth_after |
MarginDefended | pool, timestamp_ms, amount, treasury_left: margin added from the treasury |
MarginAdded | pool, donor, timestamp_ms, to_margin, to_treasury |
RedeemGapCovered | pool, timestamp_ms, gap, free_before, moved, hot_left |
Health | a 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#
| Event | Fields |
|---|
token::Created | token, coin_type, vault, account, market, long, target_bps, min_bps, max_bps, max_notional, base_oracle, collateral_oracle |
token::Minted | token, buyer, deposit, fee, referrer, tokens, nav, supply, price, oracle |
token::Redeemed | token, seller, tokens, payout, fee, referrer, nav, supply, price, oracle |
token::Rebalanced | token, increase, size, leverage_before, leverage_after, nav, oracle |
token::FeesAccrued, token::FeesCollected | streaming fee minted and sold |
token::StateChanged | token, state |
price is raw USDC per whole token (1e9 raw units). See Leveraged tokens.
Start checkpoints#
| Contract | First checkpoint |
|---|
| Pools, immutable package | 323206901 |
| Pools, upgradeable package | 323461480 |
Reading events#
import { SuiGrpcClient } from "@mysten/sui/grpc";
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.