Docs · For builders
Events to index
indexer/src/chain.ts, grouped by the contract that emits it.Reading them
Start at the block the contracts were deployed in, the startBlock in the deployment file, and read forward with eth_getLogs in ranges your RPC accepts. Filter by the contract addresses on Contract addresses and by topic. Amounts are in wei and tokens have 18 decimals.
Trade and EarnersPaid, the token's Transfers, and the router's Routed. A trade on a graduated token's pool emits the hook's Swap, then, when its fees are paid out, the hook's Burned and the launchpad's EarnersPaid, PoolFeePaid and ProtocolFeeFromPool. Count a trade once, from the venue's event, and use Routed to learn whose trade it was. When the venue saw the router as its trader, the real one is the trader on Routed in the same transaction, even for a limit order or a copy made in a user's name.Launchpad
TokenLaunched
TokenLaunched(address indexed token, address indexed creator, string name, string symbol, string uri, uint256 timestamp, uint256 supply, uint16 feeBps, uint16 holdersBps, uint16 burnBps, bool antiSnipe)A new token and its terms at launch. feeBps is the whole fee a trader without a rank pays: 100 for the base plus the creator's own fee, which FeeLowered can only lower later. holdersBps and burnBps are shares of the own fee. The uri is the metadata link, see the API's /meta route.
Trade
Trade(address indexed token, address indexed trader, bool isBuy, uint256 zroAmount, uint256 tokenAmount, uint256 fee, uint256 toTreasury, uint256 raisedAfter, uint256 soldAfter)A trade on a curve. On a buy, zroAmount includes the fee. On a sale, it is what the seller got, after the fee. toTreasury is the part of fee that went to the treasury after any referral share. raisedAfter and soldAfter give the price after the trade.
EarnersPaid
EarnersPaid(address indexed token, uint256 toCreator, uint256 toHolders, uint256 toBurn, uint256 burned)Where everything but the terminal's cut went. toCreator is the creator's 0.6% base plus their part of the own fee. toBurn is ZRO that bought burned tokens on the curve and sent them to the dead address; on a pool the hook burns that part itself, so toBurn is 0 there.
Graduated
Graduated(address indexed token, uint256 zroToPool, uint256 tokensToPool)The curve filled: 6,000 ZRO and 20% of the supply opened its pool.
PoolFeePaid
PoolFeePaid(address indexed token, uint256 amount)A graduated token's fee from its pool reached the launchpad when distribute ran, and was paid to its holders and creator (with an EarnersPaid just before it). The buyback part was already burned by the hook.
ProtocolFeeFromPool
ProtocolFeeFromPool(address indexed token, uint256 toTreasury)The terminal's 0.4% of pool trades, less any rank discount, which the hook took and handed to the launchpad when distribute ran. toTreasury is what is left after any partner's and referral share, added to the treasury's fees.
MaxWalletSet
MaxWalletSet(address indexed token, uint256 maxWallet, uint256 until)Right after TokenLaunched, for a launch with a max wallet: nobody but the market and Submarine's contracts may hold more than maxWallet, in wei of the token, until the Unix second until.
FeeLowered
FeeLowered(address indexed token, address indexed creator, uint16 feeBps, uint16 devFeeBps)The creator lowered their own fee. feeBps is the whole fee now, the base included, and devFeeBps the part above it. The shares stay as launched.
CreatorFeesClaimed
CreatorFeesClaimed(address indexed creator, uint256 amount)A creator took their fees.
ProtocolFeesCollected
ProtocolFeesCollected(address indexed treasury, uint256 amount)Fees pushed to the treasury.
LaunchFeeUpdated
LaunchFeeUpdated(uint256 launchFee)The owner changed the fee to launch, at most 40 ZRO. The trading fees have no event because they can't change. The indexer doesn't read it.
Tokens
Transfer
Transfer(address indexed from, address indexed to, uint256 value)Standard ERC-20. Balances, holders, the creator's transfers and burns all come from this. The indexer leaves out the zero address, the dead address and Submarine's own contracts when it counts holders.
RewardsAdded
RewardsAdded(uint256 amount)HolderToken only. ZRO added for holders.
RewardsClaimed
RewardsClaimed(address indexed holder, uint256 amount)HolderToken only. A holder took rewards.
ZroInfinityPools
Emitted by the pools contract, the hook of every graduated token's pool, at the pools address in the deployment file. The fields are the same as the constant-product pools these replaced had, so a reader built for those keeps working. Infinity's CLPoolManager also emits events of its own for the same pools, in its own terms.
PoolCreated
PoolCreated(address indexed token, address indexed by, bool graduated)A graduated token's pool opened on Infinity. by is the launchpad and graduated is always true: no other pools open here.
Swap
Swap(address indexed token, address indexed trader, bool isBuy, uint256 zroAmount, uint256 tokenAmount, uint256 reserveZro, uint256 reserveToken)A trade on a pool, emitted for every trade, through Submarine's venue, another router or Infinity directly. On a buy, zroAmount is what went into the pool, the token's fee included; on a sale, what the trader got, after it. That fee includes the terminal's 0.4%, which the hook takes itself: the router adds no fee of its own here. trader is the recipient Submarine's venue names, or whoever called Infinity's pool manager otherwise. The reserves are what the pool's liquidity is worth at the price after the trade, so their ratio is the price.
Burned
Burned(address indexed token, uint256 zro, uint256 tokens)The burn share of a graduated token's fee bought tokens back from its pool and sent them to the dead address, when distribute ran. zro is what it spent.
LiquidityAdded
LiquidityAdded(address indexed token, address indexed provider, uint256 zro, uint256 tokens, uint256 sharesMinted)Once per pool, at graduation: the locked position going in. provider is the dead address, since nobody can take it out, and sharesMinted is the position's liquidity.
FeeLowered
FeeLowered(address indexed token, uint16 earnersBps, uint16 burnBps)A graduated token's fee on its pool went down with its creator's fee. The same name as the launchpad's FeeLowered with other fields, so decode by address.
There is no LiquidityRemoved any more: nothing can be removed from these pools.
Router
Routed
Routed(address indexed token, address indexed trader, address indexed venue, bool isBuy, uint256 zroAmount, uint256 tokenAmount, uint256 fee)A trade through the router: whose trade it was, which venue won, and the router fee, 0 on Submarine's own curve and pools. trader is the user for a limit order or a copy, and on a direct sale it is the seller, not the recipient. On a buy, zroAmount is what the trader spent after any refund. The indexer counts points from this.
Partner
Partner(address indexed token, address indexed trader, address indexed partner, uint8 kind, uint256 amount)A trade through buyPartner or sellPartner paid its partner: kind 1 a call, 2 a builder. amount is 30% of the terminal's cut, from the router fee and from what the curve or pool sent, and 0 when there was no cut, so every partner trade shows. Calls and the builder program are counted from this.
RankUp
RankUp(address indexed trader, uint256 rank, uint256 volume)A wallet's volume through the router passed a mark: 2,000, 10,000, 40,000, 200,000 or 1,000,000 ZRO. rank is 1 to 5, volume the wallet's total after the trade, in wei. The new rank counts from its next trade. The indexer doesn't read it: the site asks the router for volumeOf instead.
VenueQueued
VenueQueued(bytes32 indexed id, address indexed venue, uint16 feeBps, string name, uint256 listableAt)A venue was announced. Watch this one: it can be listed at listableAt, 2 days later.
VenueListed / VenueUpdated / VenueRemoved / VenueQueueCancelled / SetupFinished
VenueListed(uint256 indexed index, address indexed venue, uint16 feeBps, string name) …Changes to the venue list.
StakingSet
StakingSet(address staking)The staking contract that names fee-free wallets, set once. The indexer doesn't read it.
LimitOrders
Placed
Placed(uint256 indexed id, address indexed owner, address indexed token, bool isBuy, uint256 amount, uint256 minOut, uint256 expiry)A new order. amount is ZRO for a buy and tokens for a sale. expiry 0 means none.
Conditions
Conditions(uint256 indexed id, uint8 kind, uint256 trigger, uint16 trailBps, uint32 interval, uint16 slices, uint256 group)What a non-limit order waits for. kind: 0 limit, 1 stop, 2 trailing, 3 on graduation, 4 on dev sale, 5 DCA. group is the first leg's id for a sale group.
Filled
Filled(uint256 indexed id, uint256 zroSide, uint256 tokenSide, address indexed by)A fill or part of one, and who made it.
Closed
Closed(uint256 indexed id, bool expired)Filled in full, cancelled, or closed after expiry.
Peak
Peak(uint256 indexed id, uint256 value)A trailing stop's high moved up.
Credited / Withdrawn
Credited(address indexed owner, uint256 amount) · Withdrawn(address indexed owner, address indexed to, uint256 amount)ZRO a wallet refused, held for it, and later taken out.
Config
Config(uint16 feeBps, uint256 runFee)New fees for orders placed from now on.
CopyVault
Deposited / Withdrawn
Deposited(address indexed follower, uint256 amount) · Withdrawn(address indexed follower, address to, uint256 amount)ZRO in and out. This Withdrawn has the same signature as LimitOrders' but a different indexed field, so decode by address.
Followed / Unfollowed
Followed(address indexed follower, address indexed leader, (uint128 perTrade, uint128 perToken, uint128 perDay, uint16 sizeBps, uint16 slippageBps, uint16 chaseBps, uint16 minSellBps, bool buyOnce, bool copySells, uint32 maxAge) rules)A follow with its rules, or the end of one.
ExitSet
ExitSet(address indexed follower, (uint16 takeProfitBps, uint16 stopLossBps, uint16 slippageBps) exit)Take profit and stop loss.
CopiedBuy / CopiedSell
CopiedBuy(address indexed follower, address indexed leader, address indexed token, uint256 zro, uint256 tokens, address by)A copy ran, and who ran it.
Exited
Exited(address indexed follower, address indexed token, bool takeProfit, uint256 zro, uint256 tokens, address by)A position sold at take profit or stop loss.
Sold / TokensWithdrawn
Sold(address indexed follower, address indexed token, uint256 zro, uint256 tokens) · TokensWithdrawn(address indexed follower, address indexed token, address to, uint256 tokens)The follower sold or took out tokens.
RunnerCredited
RunnerCredited(address indexed runner, uint256 amount)A runner refused its run fee, so it was held for it.
CopyFeePaid
CopyFeePaid(address indexed follower, address indexed token, uint256 amount)A copied buy paid the terminal's copy fee to the treasury.
CopyFeeSet
CopyFeeSet(uint16 feeBps)The owner set the copy fee for follows from now on. Followed doesn't carry the fee, so a follow's fee is the last CopyFeeSet before it.
PausedSet / GuardianSet
PausedSet(bool paused, address by) · GuardianSet(address guardian)Copies paused or resumed, and by whom; a new guardian.
The vault trades through the router in the follower's name, so the Routed of a copy or an exit already names the follower as its trader. LimitOrders does the same for the order's owner.
BuybackVault
Buyback
Buyback(address indexed token, uint256 zroSpent, uint256 tokensBurned)The treasury bought its token and burned it.
StakingFunded
StakingFunded(address indexed staking, uint256 amount)The treasury sent ZRO to the stakers. The staking contract's Funded follows in the same transaction.
BuybackTokenSet / RouterSet / KeeperUpdated / StakingSet
BuybackTokenSet(address token) · RouterSet(address router) · KeeperUpdated(address keeper) · StakingSet(address staking)Setup, and who may run buybacks.
Staking
Staked / Unstaked
Staked(address indexed who, uint256 amount, uint256 staked) · Unstaked(address indexed who, uint256 amount, uint256 staked)A stake went in or out. staked is the wallet's stake after it.
Claimed
Claimed(address indexed who, uint256 amount)A staker took their ZRO. The same signature as Referrals' Claimed, so decode by address.
Funded
Funded(address indexed from, uint256 amount, uint256 ratePerDay, uint256 finish)ZRO added to the rewards, the rate it streams at now, per day, and when the stream ends.
StakeTokenSet / ThresholdSet
StakeTokenSet(address token) · ThresholdSet(uint256 threshold)The token, set once, and the fee-free threshold, in wei of the token.
Referrals
Linked
Linked(address indexed trader, address indexed referrer)A trader linked to a referrer, for good.
Credited
Credited(address indexed trader, address indexed referrer, uint256 toReferrer, uint256 toTrader)A referred trade paid its share: 75% to the referrer and 25% back to the trader.
Claimed
Claimed(address indexed who, uint256 amount)Earnings taken.
Decoding with viem
import { createPublicClient, http, parseAbiItem } from 'viem';
const client = createPublicClient({ transport: http('https://testnet.zero.layerzero.network') });
const trade = parseAbiItem(
'event Trade(address indexed token, address indexed trader, bool isBuy, uint256 zroAmount, uint256 tokenAmount, uint256 fee, uint256 toTreasury, uint256 raisedAfter, uint256 soldAfter)',
);
let from = START_BLOCK; // startBlock from the deployment file
const head = await client.getBlockNumber();
while (from <= head) {
const to = from + 999n > head ? head : from + 999n; // 1,000 blocks per call
const logs = await client.getLogs({ address: LAUNCHPAD, event: trade, fromBlock: from, toBlock: to });
for (const l of logs) console.log(l.args.token, l.args.isBuy, l.args.zroAmount);
from = to + 1n;
}The start block comes with Submarine's deployment on Zero. The RPC above is Zero's testnet, which answers developers LayerZero has let in.
Don't want to run your own? The public API serves the same data already worked out, and its live stream pushes each event as it lands.