XSC-0003: Streaming Payments
XSC-0003 defines recurring time-based token transfers on top of the fungible token contract.
Canonical Functions
The current canonical token exposes:
python
@export
def create_stream(receiver: str, rate: float, begins: str, closes: str):
...
@export
def create_stream_from_permit(
sender: str,
receiver: str,
rate: float,
begins: str,
closes: str,
deadline: str,
signature: str,
):
...
@export
def balance_stream(stream_id: str):
...
@export
def change_close_time(stream_id: str, new_close_time: str):
...
@export
def finalize_stream(stream_id: str):
...Convenience helpers also exist in the canonical contract:
close_balance_finalizebalance_finalizeforfeit_stream
Stream Model
The canonical state tracks:
- sender
- receiver
- start time
- close time
- rate
- amount already claimed
- lifecycle status
Streams are identified by a deterministic stream_id.
Accrual is lazy. Nothing runs in the background between blocks. The owed amount is computed when balance_stream or related helpers execute in a later block using the current contract now.
Event Expectations
The canonical implementation emits:
StreamCreatedStreamBalanceStreamCloseChangeStreamForfeitStreamFinalized
These events are indexed into CometBFT and surfaced through the optional dashboard/WebSocket layer.