SpieldSpield
Developers

Events

The on-chain events Spield's v2 contracts emit, with topics and fields, and how to read them for dashboards and indexers.

Spield's contracts emit Soroban contract events. An indexer can rebuild a series' full activity from them. They are also what the app's activity feed reads.

How events are shaped

  • topic[0] is the event name in snake_case. SrDeposit is published as sr_deposit, MintPy as mint_py.
  • Fields marked as topics in the tables below follow topic[0] in order (usually the acting address).
  • The remaining fields are the event data, a map keyed by field name.
  • Router and one SR event use a fixed two-segment prefix instead: ["router", "<name>", user] and ["sr", "deposit_cap"].
  • Amounts are i128 base units (7 decimals). Rates are 12-decimal fixed point.

Events are per series: each series' contracts emit their own. Filter by the contract addresses of the series you care about.

SR

Event (topic[0])TopicsData
sr_depositfrom, receiverunderlying_in, shares_out, rate
sr_redeemfrom, receivershares_in, underlying_out
transferfrom, toamount
rate_clampednonelive, high_water. The live rate came back below the high-water mark. Rare, worth alerting on.
["sr", "deposit_cap"]nonecap

Yield (PT and YT engine)

EventTopicsData
initializedsr, ptexpiry, yield_fee_bps, index
mint_pyfrom, receiversr_in, py_out, index
redeem_pyfrom, receiverpy_in, sr_out, index
interest_paidusernet_to_user, fee_to_treasury, index
yt_transferfrom, toamount
yt_burnfromamount
expiry_stampednoneindex. The index was pinned at expiry. After this YT accrues nothing.
surplus_sweptnonesr_amount
yield_fee_setnonebps

SR Market

Fee events carry both halves of the split, so protocol revenue and LP earnings can be rebuilt from the log alone.

EventTopicsData
initializedyield_contract, ptsr, expiry, scalar_root, ln_fee_root, ln_implied_rate
add_liquiditylppt_in, sr_in, shares_minted
remove_liquiditylpshares_burned, pt_out, sr_out
swaptraderpt_in (bool: true is PT to SR), amount_in, amount_out, fee_sr, fee_to_treasury
yt_tradeuseris_buy, yt_amount, sr_amount, fee_sr, fee_to_treasury
fee_root_setnoneln_fee_root
treasury_share_setnonebps

fee_sr - fee_to_treasury is what stayed with LPs.

Fixed-Rate Vault

EventTopicsData
initializedyield_contract, ptsr, maturity, rate_bps
seededfromusdc_in, py_minted
depositeduserreceipt_id, principal, payout, rate_bps
redeemedownerreceipt_id, paid
redeemed_partialownerreceipt_id, collected, still_owed. The receipt stays open.
harvestednonesr_claimed, py_minted
swepttopt_amount
surplus_swepttosr_amount, yt_amount, usdc_amount
rate_setnonerate_bps
loss_recognizednonefactor. A lower venue value was observed. Open receipts are scaled by this factor when redeemed.

Router

Each router event records the end-to-end trade the user asked for (USDC in, PT or YT out), not the SR hop in the middle. The SR and market events for that hop are emitted too.

TopicsData
["router", "buy_pt", user]usdc_in, sr_mid, pt_out
["router", "buy_yt", user]usdc_spent, yt_out, usdc_refund, sr_refund
["router", "sell_pt", user]pt_in, sr_mid, usdc_out
["router", "sell_yt", user]yt_in, sr_mid, usdc_out
["router", "redeem", user]py_in, sr_mid, usdc_out, after_expiry
["router", "claim", user]sr_net, sr_fee, usdc_out

Governance events (every contract)

Contracts with admin rotation and upgrades emit the same governance events, so you can monitor admin changes and upgrades:

admin_proposed, admin_changed, admin_transfer_cancelled, upgrade_scheduled (wasm_hash, eta), upgrade_cancelled, upgraded (wasm_hash), timelock_changed (secs).

A scheduled upgrade is public for the whole timelock delay. Watching upgrade_scheduled gives you advance notice.

USTRY series

The USTRY Series contract emits only a few events of its own. Per-action history lives on the token contracts, so index those too.

ContractEventTopicsData
USTRY Seriesfinalizednonehigh_water, factor, boundary
USTRY Seriespaused_setnonepaused
USTRY Seriescap_setnonecap (receipt cap)
USTRY Seriessplit_cap_setnonecap (split cap)
Claim tokensmintseries, ownerthe amount
Claim tokensburnownerthe amount
Claim tokenstransferfrom, tothe amount (or a map with amount and to_muxed_id)
Claim tokensapprovefrom, spender(amount, expiration_ledger)
USTRY Marketinitializedseries, ptyt, asset, expiry, scalar_root, ln_fee_root, ln_implied_rate
USTRY Marketadd_liquiditylppt_in, asset_in, shares_minted
USTRY Marketremove_liquiditylpshares_burned, pt_out, asset_out, haircut
USTRY Marketswaptraderpt_in, amount_in, amount_out, fee_asset, fee_to_treasury
USTRY Marketyt_tradeuseris_buy, yt_amount, asset_amount, fee_asset, fee_to_treasury
USTRY Marketfee_root_set, treasury_share_setnoneln_fee_root, bps
USTRY Marketfee_params_schedulednoneln_fee_root, treasury_fee_share_bps, eta
USTRY Marketfee_params_cancellednonenone
USTRY Marketskimmedtopt, asset, yt

haircut on a remove_liquidity event is true when a clawback left the pool with less than its recorded reserves and LPs were paid pro rata.

Reading events

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

const server = new rpc.Server('https://soroban-testnet.stellar.org');

const latest = (await server.getLatestLedger()).sequence;
const res = await server.getEvents({
  startLedger: latest - 5000,
  filters: [{ type: 'contract', contractIds: [YIELD_ID, MARKET_ID, VAULT_ID] }],
  limit: 200,
});

for (const ev of res.events) {
  const topics = ev.topic.map((t) => scValToNative(t));   // ['mint_py', 'G...from', 'G...receiver']
  const data = scValToNative(ev.value);                    // { sr_in, py_out, index } with bigint values
  console.log(ev.ledger, ev.contractId, topics[0], data);
}

RPC keeps a short history

Soroban RPC retains only a rolling window of recent ledgers (typically about a week), so getEvents cannot rebuild a series from scratch. For full history, index from the series' deployment ledger into your own store as you go, or use an indexer that retains contract events. Stellar Expert also exposes full contract history for a quick look.

Because the series are short-lived and each has its own contracts, a simple pattern is one subscription per series: start from its deployment ledger and stop following it a while after maturity.

On this page