Repository navigation
Conversation
…absCrypt#1463) - Add `top_up_from` entrypoint to allow any authorized funder to extend active stream runway - Emit `StreamRefueledEvent` distinguishing third-party funder contributions from creator top-ups - Enforce donation equity where unvested funds refund to original sender upon stream cancellation - Deduct protocol fees if configured and project updated stream end time - Reject unsupported schedules (e.g., StepTranches) with TopUpUnsupported - Update STREAM_FIELD_COUNT and schema shape checks to 17 fields to account for recent Stream fields - Add comprehensive test suite covering auth, accounting, multi-funder extensions, and refund equity
This branch has not been deployed
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.
feat(stream_contract): implement permissionless third-party top-up & automated balance refuel (#1463)
Closes #1463
Description
Addresses #1463 by implementing permissionless third-party top-up functionality (
top_up_from) onStreamContract.Previously,
top_up_streamstrictly enforcedsender.require_auth(), preventing external sponsors, automated treasury refuel keepers (e.g. Gelato), DAO multisigs, or team leads from extending a payment stream's runway without administrative transfer.Summary of Changes
1. Permissionless Top-Up Entrypoint
top_up_from(env: Env, funder: Address, stream_id: u64, amount: i128) -> Result<(), StreamError>incontracts/stream_contract/src/lib.rs:funder.require_auth()instead of requiring the stream creator's authorization.require_not_protocol_paused).StepTranchesvesting schedules withTopUpUnsupported.stream.deposited_amount.2. Event Emission
StreamRefueledEventincontracts/stream_contract/src/events.rs:("stream_refueled", stream_id).stream_id,funder,amount,new_deposited_amount, andnew_end_time.3. Cancellation Refund Invariant
stream.sender.4. Storage & Schema Alignment
STREAM_FIELD_COUNT = 17instorage.rsto reflect all fields (cliff_time,arbiter,dispute_status,is_allowance_based).Resultwarnings.Testing & Quality Gates
cargo test: 235 passed, 0 failedcargo clippy --all-targets -- -D warnings: Clean (0 warnings)cargo fmt --all -- --check: Cleancargo build --target wasm32-unknown-unknown --release: CleanCloses #1463