feat: claim_drip read-only view - #1352
Merged
greatest0fallt1me merged 1 commit intoJul 30, 2026
Merged
Conversation
Contributor
|
Closes #716 |
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.
closes #716
Description
Read-only view returning unsettled accrual (vested minus released) per stream.
This PR implements the
claim_dripentrypoint — a convenience alias forwithdrawable— alongside focused unit tests and documentation.Changes
Smart Contract (
contracts/contracts/streampay-stream/src/lib.rs)The
claim_dripentrypoint already existed atlib.rs:1639as a read-only view that returns the unsettled accrual for a givenstream_id. This PR adds a dedicated#[cfg(test)] mod claim_drip_testwith four focused tests:claim_drip_returns_zero_before_start_time— verifies 0 before accrual beginsclaim_drip_returns_half_at_midpoint— verifies linear accrual at 50%claim_drip_decreases_after_withdrawal— verifies drip decreases by withdrawn amountclaim_drip_nonexistent_stream_returns_not_found— verifiesError::NotFoundfor missing streamAll tests follow the existing
cancel_stream_testpattern (setup(),addresses(),token_and_client()).Documentation
contracts/contracts/streampay-stream/README.md: Addedclaim_dripto the entrypoints table (non-mutating, no auth required, alias forwithdrawable).docs/contract-smoke-tests.md: Added happy-path and error-path smoke test entries forclaim_drip.The inline doc comment on
claim_drip(already present) was reviewed and is accurate.Testing
cargo test --lib claim_drip(requires Visual Studio C++ toolchain)cargo clippyAll 4 new tests exercise both happy-path and error-path:
claim_drip_returns_zero_before_start_timeclaim_drip_returns_half_at_midpointclaim_drip_decreases_after_withdrawalclaim_drip_nonexistent_stream_returns_not_foundSecurity
This is a read-only view — it never mutates state, never requires auth, and is unaffected by the global pause flag. No security impact.
Checklist
Related
claim_dripview to read accrued-but-unsettled (v4 patch) #716feature/claim-drip-view