Summary
Strengthen how StreamContract stores data, defines keys, emits events, and surfaces errors so that off chain indexers and clients can reliably interpret stream state.
Scope
- Introduce a DataKey enum or similar pattern for:
- Global stream id counter.
- Individual stream records.
- Replace ad hoc storage keys with a single convention.
- Ensure all public methods use the same storage helpers.
- Extend StreamError to cover:
- Missing stream.
- Inactive stream.
- Unauthorized sender or recipient.
- Ensure events are emitted for create, top up, withdraw, and cancel with all relevant fields.
Acceptance Criteria
- No duplicate helper functions like get_stream or top_up_stream.
- All storage access goes through a centralized key strategy.
- Tests assert on error variants for invalid operations.
- Events can be filtered by stream id and event type in indexers.
Summary
Strengthen how StreamContract stores data, defines keys, emits events, and surfaces errors so that off chain indexers and clients can reliably interpret stream state.
Scope
Acceptance Criteria