Non-Constant Functions
Create stream
The create stream function transfers the tokens into the Sablier smart contract, stamping the rules of the stream into the blockchain. As soon as the chain clock hits the start time of the stream, a small portion of tokens starts getting "transferred" from the sender to the recipient once every second.
We used scare quotes because what actually happens is not a transfer, but rather an abstract allocation of funds. Every second, the in-contract allowance of the sender decreases. while the recipient's allocation increases, even if the tokens are not transferred to the recipient. Actually transferring the tokens would be excessively expensive in terms of gas costs.
function createStream(address recipient, uint256 deposit, address tokenAddress, uint256 startTime, uint256 stopTime) returns (uint256)
msg.sender
: The account who funds the stream, and pays the recipient in real-time.recipient
: The account toward which the tokens will be streamed.deposit
: The amount of tokens to be streamed, in units of the streaming currency.tokenAddress
: The address of the ERC-20 token to use as streaming currency.startTime
: The unix timestamp for when the stream starts, in seconds.stopTime
: The unix timestamp for when the stream stops, in seconds.RETURN
: The stream's id as an unsigned integer on success, reverts on error.
Before creating a stream, users must first approve the Sablier contract to access their token balance.
The transaction must be processed by the Ethereum blockchain before the start time of the stream, or otherwise the contract will revert with a "start time before block.timestamp" message.