Event identity
Decode topics and data as Soroban ScVals. Preserve contract ID, ledger/cursor, transaction hash, and event identity. Deduplicate by event identity, not only transaction hash: one transaction can emit several manager, pool, token, and protocol events.Manager events
Decode the structs in
AccountManagerContract/src/types.rs; topic and struct names are not interchangeable. A liquidation or settle event does not mean the account was closed.
Lending events
Pool amounts are WAD; token-contract events use native token units.
withdraw_event.asset_amount records actual underlying payout, which may be less than requested due to partial redemption. Do not count manager and pool events as two independent borrows or repayments.
Source and history handling
Use Mercury server proxies when configured and protocol-specific RPC history readers for fallback. Pagination and retention can leave incomplete histories. Treat missing history as unknown, not a zero balance or zero cost basis. Reconcile indexed state with current contract reads, and keep fixture-based stress analytics separate from ledger events.Source reference
Protocol_V1_Soroban_testnet/contracts/AccountManagerContract/src/types.rsProtocol_V1_Soroban_testnet/contracts/AccountManagerContract/src/account_manager.rsProtocol_V1_Soroban_testnet/contracts/lending-pool/src/events.rsmercury-stellar-backend/lib/mercury-client.ts

