Skip to content

Add top-up / extend functions to lengthen or refund an active stream #31

Description

@Omoboi-dev

Today the only way to add funds to or lengthen a stream is to cancel and recreate it. Add first-class support.

What to do

  • top_up(stream_id, amount) — sender deposits additional tokens into an active stream, recalculating rate_per_sec (or extending end_time, document which).
  • extend(stream_id, new_end_time) — push out the end time, lowering the effective rate over the remaining deposit.

Requirements

  • Sender-authed; only valid on Active streams.
  • Must preserve already-earned/claimed amounts — a top-up or extend may never reduce what the recipient has already accrued.
  • Checked integer math only (no overflow, no truncation that strands funds — see the dust handling in get_claimable).
  • Emit events for the new state.

Acceptance criteria

  • Unit tests covering claimable correctness immediately before and after top-up/extend.
  • Tests that pre-top-up earnings are unchanged.
  • cargo test passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions