SpieldSpield
Developers

Events

The on-chain events Spield emits — enough to reconstruct full protocol state for dashboards, indexers, and analytics.

Every economic state change in Spield emits an event. Together they're enough to reconstruct the full state of the protocol off-chain — for a dashboard, an indexer, an activity feed, or analytics.

Engine events

EventEmitted whenCarries
mintA deposit mints PT + YTowner, position id, amount, entry rate
claimYield is claimedowner, position id, amount paid, current rate
redeem_ptPT is redeemed at maturityowner, position id, amount
combinePT + YT recombined to USDCowner, position id, amount
transferA position changes ownerfrom, to, position id
pausedInflows paused/unpausednew state

Vault events

EventEmitted whenCarries
depositA fixed-rate deposituser, receipt id, principal, payout, rate
redeemA receipt is redeemedowner, receipt id, amount paid
seedCoupon capacity addedfrom, amount
harvestRetained yield reinvestedyield claimed, PT added
rate_setQuoted rate changednew rate

Market events

EventEmitted whenCarries
add_liquidityLiquidity addedlp, pt in, usdc in, shares minted
remove_liquidityLiquidity removedlp, shares, pt out, usdc out
swapA trade executestrader, direction, amount in, amount out
fee_setSwap fee changednew fee

Governance & lifecycle events

Each contract also emits an initialized event and governance events (admin proposal/accept, upgrade schedule/apply/cancel) — useful for monitoring the protocol's administrative state.

Reading events

Use the Soroban RPC getEvents endpoint, filtered by contract id and a starting ledger. Event topics are snake_case (e.g. mint, redeem_pt, add_liquidity).

import { rpc, scValToNative } from '@stellar/stellar-sdk';

const server = new rpc.Server(RPC_URL);

const { events } = await server.getEvents({
  startLedger,
  filters: [
    {
      type: 'contract',
      contractIds: [WRAPPER_ID],
    },
  ],
});

for (const e of events) {
  const topic = scValToNative(e.topic[0]); // e.g. "mint"
  const data = scValToNative(e.value);     // the event payload
  // …index into your store
}

Mind RPC retention windows

Public RPC nodes only retain recent events (a limited ledger window). For full history, index continuously from launch and persist events yourself, or use an indexing service. When backfilling, query in chunks and fall back to smaller startLedger windows if a node returns nothing for a too-old range.

Reconstructing state

A few common derivations:

  • A user's positions → fold mint (creates) + transfer (reassigns) + redeem_pt/combine (drains) events.
  • Realized yield over time → the rate fields on mint/claim events, plus the live current_rate, reconstruct a cumulative-yield curve.
  • Market price history → reconstruct executed prices from swap events (amount_in / amount_out).
  • Protocol activity feed → just stream the events in ledger order.

Everything you need is on-chain

Because every economic change emits an event and every figure is independently readable, you can build a fully self-sufficient dashboard or indexer without any private API. That's the same data the official app uses.

On this page