Streamflow is fully composable, supporting integration with various protocols via the Streamflow SDK. At the core of Streamflow is a protocol for programmable payments which acts like a time-lock escrow service for funds.
Streamflow Protocol allows the creation of scheduled Token Transfers from one account to another. This transfer may be done in the form of an actual token transfer on the chain to a Recipient address or as an unlock, meaning that after a certain time, the Recipient may claim tokens manually.
The schedule may be configured to send/unlock these tokens partially with some amount (absolute value) being unlocked every unlock period. The sender may also configure a cliff - a one-time unlock of a certain amount (different from the usual unlock amount configured in the contract) -that will be done as the first unlock.
A protocol is a Program that lives on-chain. To interact with the Streamflow protocol you'll need to make use of pre-defined Methods, which are called within the blockchain transaction.
create
Authority: Anyone
Creates a Contract, usually accepts these parameters
withdrawal_frequency is used only if automatic_withdrawal parameter is set to true
update allows only to enableautomatic_withdrawal (disabling may be tricky because we also need to notify Worker for that, but in theory we can allow disabling AW)
amount_per_period is accepted only if can_update_rate is enabled
Cancel
Authority: configured by cancelable_by_sender and cancelable_by_recipient flags
Cancel a Contract.
all unlocked funds by the time of cancellation are withdrawn (including fees)
all leftover funds are returned to the Sender (including fees)
Pause
Authority: Sender if pausable is enabled
Pause a Contract
when contract is paused, unlock calculation is halted
all already unlocked funds may be withdrawn
Unpause
Authority: Sender if pausable is enabled and contract is in pause state
Unpauses a Contract
continue unlock calculation
Withdraw
Authority: Recipient or Withdrawor if automatic_withdrawal is enabled
Withdraw some amount to Recipient address, usually accepts these parameters
amount:u64
accepts 18446744073709551615 as magical number to withdraw all unlocked funds
can’t withdraw more than unlocked
fees are transferred according to withdrawn amount
Transfer
Authority: configured by transferable_by_sender and transferable_by_recipient flags
Change Recipient address, usually accepts these parameters
new_recipient: address
on transfer unlocked funds remain in a contract (so new recipient can withdraw them)