Implemented Soroban stream storage, events, and errors#168
Merged
ogazboiz merged 3 commits intoLabsCrypt:mainfrom Feb 24, 2026
Merged
Conversation
…, and errors - Extract DataKey, Stream, ProtocolConfig into types.rs - Extract StreamError (9 variants) into errors.rs - Extract typed event structs into events.rs (StreamCreatedEvent, StreamToppedUpEvent, TokensWithdrawnEvent, StreamCancelledEvent, FeeCollectedEvent) - Introduce storage.rs as the single centralized storage access layer; all reads/writes go through load_stream, save_stream, load_config, save_config, next_stream_id — no ad-hoc storage calls elsewhere - Fix create_stream: returns Result<u64> guarding InvalidAmount and new InvalidDuration (= 9) error variant - Fix cancel_stream: refunds unspent balance (deposited - withdrawn) back to sender; includes refunded_amount in StreamCancelledEvent - All four public mutating methods emit indexer-filterable events with two-element topic tuple (event_name_symbol, stream_id) - Remove dangling references to is_emergency_mode / EmergencyStopEnabled that prevented compilation - 36 tests: every StreamError variant covered, every event payload asserted, DataKey deterministic serialization verified Closes LabsCrypt#124
Auto-generated by the Soroban test runner — should never be committed. Added **/test_snapshots/ to .gitignore to prevent re-addition.
ogazboiz
reviewed
Feb 24, 2026
Contributor
ogazboiz
left a comment
There was a problem hiding this comment.
hey, thanks for implementing the Soroban stream storage, events, and error handling! this looks like a huge and important milestone.
the CI didn't trigger for your branch, probably because it's slightly out of sync with main. could you run git fetch origin && git rebase origin/main and force push? that will trigger our test runner.
once the tests run and pass, i'll get this merged!
Contributor
Author
|
@ogazboiz you can merge now |
ogazboiz
approved these changes
Feb 24, 2026
Contributor
ogazboiz
left a comment
There was a problem hiding this comment.
looks great, merging this in! thanks for the contribution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #124
Type of Change
This PR strengthens how StreamContract stores data, defines keys, emits events, and surfaces errors so that off-chain indexers and clients can reliably interpret stream state. The implementation follows a clean modular architecture with no redundant code and strict separation of concerns.
Related Issues
Closes #
Changes Made
Testing
Test Coverage
Unit tests added/updated
Integration tests added/updated
Manual testing performed
Additional Notes