Skip to content

Standardize Event Specification across Soroban Contracts - #24

Merged
Meshmulla merged 3 commits into
stellar-kracken:mainfrom
jrcity:feature/standardize-events
Jul 30, 2026
Merged

Standardize Event Specification across Soroban Contracts#24
Meshmulla merged 3 commits into
stellar-kracken:mainfrom
jrcity:feature/standardize-events

Conversation

@jrcity

@jrcity jrcity commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

To enable reliable off-chain indexing and integrations across the Swipely ecosystem, I have standardized the event emission specification across all Soroban contracts.

The standardization includes:

  • Establishing a stable 4-topic hierarchy [symbol_short!("Swipely"), Symbol::new(&env, "Module"), Symbol::new(&env, "EventName"), ID] for easy and performant indexing.
  • Introducing strictly versioned struct payloads for all events via the #[contracttype] macro, with version: u32 = 1.
  • Adding lifecycle and status events to missing state changes, especially in complex components like the Governance module (now tracking ProposalCreatedEvent, VoteCastEvent, ProposalStatusChangedEvent, ProposalExecutedEvent, etc).
  • Writing a centralized EVENTS.md cataloging the standards and providing clear guidance on event structure for future feature integrations.

Components Updated

  • soroban/src/alert_system.rs: Migrated raw tuples to structured payload events (RuleRegisteredEvent, RuleUpdatedEvent, RuleStatusChangedEvent, AssetEvaluatedEvent).
  • escrow_contract/src/lib.rs: Eliminated legacy symbol-based tuple payloads in favor of standardized DepositEvent, WithdrawEvent, and FeeUpdatedEvent.
  • soroban/src/operator_rotation.rs: Refactored to emit structured OperatorAddedEvent and OperatorRemovedEvent.
  • soroban/src/governance.rs: Redesigned legacy tuple configurations to ParameterChangedEvent and ConfigUpdatedEvent. Significantly expanded the event hooks across the governance system lifecycle with payload structures for proposal creation, status changes, execution, and vote tracking.

Testing & Verification

  • Confirmed backwards compatibility issues with strict static typing of all payloads. Fixed compiler issues regarding Rust memory borrowing with ownership clones during structured initialization on large modules like governance.
  • Ensured total test coverage natively via cargo test and successfully tested all modules including unit/integration suites.
  • Created soroban/docs/EVENTS.md containing integration logic for developers setting up event_query.rs listeners.

Ready for Review

The Pull Request is fully documented, well-formatted, and completely stable for production deploy. It provides a standardized data lake backbone necessary for any future analytics integrations within the Swipely indexer pipeline.

Closes #3

jrcity added 3 commits July 29, 2026 14:43
- Implemented 4-topic standard hierarchy: [Swipely, Module, Event, ID]
- Migrated legacy tuples to strictly typed #[contracttype] structs with versioning (version: u32 = 1)
- Refactored env.events().publish in alert_system, escrow_contract, operator_rotation, and governance.
- Hooked full proposal lifecycle events in Governance module
- Authored centralized EVENTS.md documentation to catalog events
- Resolved memory ownership violations during struct initialization
- All native unit and integration tests successfully pass
@Meshmulla
Meshmulla merged commit 0707382 into stellar-kracken:main Jul 30, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize structured event emission across all contracts

2 participants