Skip to main content

Grainlify Contracts — Event Schema & Indexer Guide

Overview

All events across bounty-escrow, program-escrow, and grainlify-core follow the EVENT_VERSION_V2 envelope. Every event payload carries a version: u32 = 2 field so indexers can detect schema changes without decoding the full XDR body.

Topic Layout

topics[0] — category Symbol (always present, e.g. "f_lock", "fee")
topics[1] — bounty_id: u64 (present where applicable)
data — typed event struct (always carries version: u32)

All topic strings use symbol_short! and are ≤ 9 bytes — enforced at compile time by the Soroban SDK.

Full Event Inventory

bounty-escrow

Topic[0]Topic[1]StructSince
initBountyEscrowInitializedV2
f_lockbounty_idFundsLockedV2
f_relbounty_idFundsReleasedV2
f_refbounty_idFundsRefundedV2
pubbounty_idEscrowPublishedV2
archivebounty_idEscrowArchivedV2
orc_cfgOracleConfigUpdatedV2
feeFeeCollectedV2
fee_cfgFeeConfigUpdatedV2
fee_rtebounty_idFeeRoutingUpdatedV2
fee_rtbounty_idFeeRoutedV2
b_lockBatchFundsLockedV2
b_relBatchFundsReleasedV2
approvalbounty_idApprovalAddedV2
prng_selbounty_idDeterministicSelectionDerivedV2
f_lkanonbounty_idFundsLockedAnonV2
deprecDeprecationStateChangedV2
maintMaintenanceModeChangedV2
pf_modeParticipantFilterModeChangedV2
riskbounty_idRiskFlagsUpdatedV2
ticket_iticket_idTicketIssuedV2
ticket_cticket_idTicketClaimedV2
pauseoperationPauseStateChangedV2
em_wtdEmergencyWithdrawEventV2
cap_newcapability_idCapabilityIssuedV2
cap_usecapability_idCapabilityUsedV2
cap_revcapability_idCapabilityRevokedV2
tmlk_cfgTimelockConfiguredV2
act_propAdminActionProposedV2
act_execAdminActionExecutedV2
act_cnclAdminActionCancelledV2

program-escrow

Topic[0]StructSince
PrgInitProgramInitializedEventV2
FndsLockFundsLockedEventV2
BatLckBatchFundsLockedV2
BatRelBatchFundsReleasedV2
BatchPayBatchPayoutEventV2
PayoutPayoutEventV2
RelSchedReleaseScheduledEventV2
SchRelScheduleReleasedEventV2
DspOpenDisputeOpenedEventV2
DspRslvDisputeResolvedEventV2
PauseStPauseStateChangedV2
em_wtdEmergencyWithdrawEventV2

grainlify-core

Topic[0]Topic[1]Notes
metricopOperationMetric
metricperfPerformanceMetric
initgovGovernance initialized
upgradewasmUpgradeEvent
ROModeChgReadOnlyModeEvent
cfg_snapcreateSnapshot created
cfg_snaprestoreSnapshot restored
migrationMigrationEvent

Unknown Version Handling (for indexers)

When version > 2 is encountered:

  1. Do not hard-fail — emit a warning and skip payload decoding
  2. Preserve raw XDR bytes for reprocessing after decoder update
  3. Never discard topic data — topics are stable across versions

Security Invariants

  • Events are emitted after all state mutations (CEI ordering)
  • No PII, KYC data, or private keys appear in any event payload
  • All symbol_short! strings are ≤ 9 bytes (compile-time enforced)

Running Tests

cargo test -p bounty-escrow
cargo test -p program-escrow
cargo test -p grainlify-core