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
| Event | Emitted when | Carries |
|---|---|---|
mint | A deposit mints PT + YT | owner, position id, amount, entry rate |
claim | Yield is claimed | owner, position id, amount paid, current rate |
redeem_pt | PT is redeemed at maturity | owner, position id, amount |
combine | PT + YT recombined to USDC | owner, position id, amount |
transfer | A position changes owner | from, to, position id |
paused | Inflows paused/unpaused | new state |
Vault events
| Event | Emitted when | Carries |
|---|---|---|
deposit | A fixed-rate deposit | user, receipt id, principal, payout, rate |
redeem | A receipt is redeemed | owner, receipt id, amount paid |
seed | Coupon capacity added | from, amount |
harvest | Retained yield reinvested | yield claimed, PT added |
rate_set | Quoted rate changed | new rate |
Market events
| Event | Emitted when | Carries |
|---|---|---|
add_liquidity | Liquidity added | lp, pt in, usdc in, shares minted |
remove_liquidity | Liquidity removed | lp, shares, pt out, usdc out |
swap | A trade executes | trader, direction, amount in, amount out |
fee_set | Swap fee changed | new 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/claimevents, plus the livecurrent_rate, reconstruct a cumulative-yield curve. - Market price history → reconstruct executed prices from
swapevents (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.