Streaming Payments
The maintained streaming-payment implementation is the standalone con_stream_payments package in xian-contracts, not the canonical currency contract.
What The Package Does
con_stream_payments creates time-based escrowed streams against an external token contract.
Each stream:
- escrows the full budget up front
- lets value accrue over time
- lets the sender or receiver claim the accrued portion
- lets the sender shorten the stream and recover the unvested refund
- lets the receiver forfeit the unvested part of the stream
- supports permit-style creation flows
- exposes
claimable_amount(...)andstream_info(...)read helpers for clients
Token Dependency
The streamed token contract must expose:
transfer(amount, to)transfer_from(amount, to, main_account)
con_stream_payments validates that interface before using the token.
Core Flow
- deploy
con_stream_payments - approve the stream-payments contract on the token contract when escrow funding requires
transfer_from - create the stream with start time, close time, receiver, and rate
- call
balance_stream(...)as time passes - finalize, shorten, or forfeit the stream as needed
Encode begins, closes, permit deadlines, and close-time updates as YYYY-MM-DD HH:MM:SS.
Important Behavior
- accrual is lazy; nothing runs between blocks
- the contract uses block time (
now) when computing accrued value - event names are:
StreamCreatedStreamBalancedStreamCloseChangedStreamForfeitedStreamFinalized
- duplicate schedules from the same sender are separated by a sender nonce in the stream id
Caveats
change_close_time(...)supports shortening or immediate close, not arbitrary extension in placecreate_stream_from_permit(...)authorizes the stream parameters, but the token-side approval needed for escrow funding has to exist