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
- Fork the repo and create a branch
git checkout -b feature/contract-events
- 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())
- 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
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
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
env.events().publish(...)withsymbol_short!topics for:created,started,withdrawn,paused,resumed,cancelled,settled.symbol_short!constraint) and document the event schema for indexers.Suggested Execution
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 viaenv.events().all())cd contracts && cargo test -p streampay-stream eventsExample commit message
Acceptance Criteria
symbol_short!and payloads carry id/amount/timestampcargo testasserts events withenv.events().all()Guidelines
.rsfiles undercontracts/contracts/streampay-stream/src/; tests viacargo test; NatSpec-style///docs; minimum 95% test coverage; document the event schema for indexers