Skip to content

Implement configurable stream cancellation fee payable to the protocol treasury #288

Description

@Chuks-coderr

Overview

Early cancellation of streams by senders provides no penalty, enabling fee-free capital extraction strategies where senders create and cancel streams speculatively.

Problem

Without a cancellation fee, senders can abuse the protocol's escrow function with no cost, effectively using it as a free temporary holding mechanism for tokens.

Proposed Solution

  • Add an admin-configurable cancellation_fee_basis_points: u32 parameter
  • On cancel_stream, deduct a percentage of the sender's unstreamed refund and transfer it to the protocol treasury
  • No fee applied when the stream has already passed its end_time (natural expiry is free)
  • Emit the fee amount in the CancelledStream event

Acceptance Criteria

  • Admin can set cancellation_fee_basis_points
  • cancel_stream deducts the fee from the sender's refund and credits the treasury
  • No fee deducted when current_time >= end_time
  • CancelledStream event includes cancellation_fee field
  • Unit tests cover: fee deducted on early cancel, no fee on natural expiry, fee correctly calculated

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity: highComplex feature, refactor, or new integrationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions