Skip to content

Emit contract events for create/withdraw/pause/resume/cancel/settle in streampay-stream #261

@greatest0fallt1me

Description

@greatest0fallt1me

Description

Publish structured Soroban events for every lifecycle transition so the backend's events indexer and transactional outbox (app/api/streams/events, Horizon events indexer) can track on-chain state changes. Events are the contract's public, indexable record of money movement.

Requirements and Context

  • Use env.events().publish(...) with symbol_short! topics for: created, started, withdrawn, paused, resumed, cancelled, settled.
  • Include relevant data per event (stream id, sender/recipient, token, amount, timestamp) in the event payload.
  • Keep topic symbols <= 9 chars (symbol_short! constraint) and document the event schema for indexers.
  • Emit events only after successful state mutation/transfer.
  • Must be secure, tested, and documented.
  • Should be efficient and easy to review.

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b feature/contract-events
  2. Implement changes
    • contracts/contracts/streampay-stream/src/events.rs (typed publish helpers)
    • contracts/contracts/streampay-stream/src/lib.rs (emit on each transition)
    • contracts/contracts/streampay-stream/src/test.rs (assert events via env.events().all())
  3. Test and commit
    • cd contracts && cargo test -p streampay-stream events
    • Cover edge cases (no event emitted on failed/rejected call)
    • Include test output and notes in the PR

Example commit message

feat: emit lifecycle events for streams

Acceptance Criteria

  • Each lifecycle transition emits exactly one well-formed event
  • Event topics use symbol_short! and payloads carry id/amount/timestamp
  • Failed/rejected calls emit no event
  • cargo test asserts events with env.events().all()

Guidelines

  • .rs files under contracts/contracts/streampay-stream/src/; tests via cargo test; NatSpec-style /// docs; minimum 95% test coverage; document the event schema for indexers
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programrustRust implementationsmart-contractSoroban smart-contract worksorobanSoroban SDK / Stellar
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions