How Rill works
One contract holds every stream. This page is the whole of what it does with the money in it.
A stream
A stream has a sender, a recipient, a token (native HYPE or any ERC-20), an amount, a start and an end, an optional cliff, and whether the sender may cancel it.
At any moment flowed = amount × (now − start) ÷ (end − start), capped at the amount after the end. Before the cliff nothing can be withdrawn; at the cliff, everything that flowed since the start becomes available.
Withdrawing
withdraw(id) pays the recipient everything that has flowed and not been taken yet. Anyone may call it, and the money always goes to the recipient, so a service can collect for its users.
Cancelling
If the stream was created cancellable, the sender can call cancel(id) before the end. In the same transaction the recipient receives what has flowed and not been withdrawn, and the sender receives the rest. Nothing flows after that.
A stream created not cancellable can't be stopped by anyone. That is the shape for vesting.
Fees
| Starting a stream | 0.25% of the amount, to the treasury |
| Withdrawing, cancelling | 0 |
Tokens that tax transfers are counted by what actually arrived, so the stream never promises more than it holds.
Safeguards
- No owner, no upgrade. The treasury address is fixed at deployment and only receives the starting fee.
- Funds move two ways only: to the recipient as they flow, or back to the sender on a cancel.
- Tested with fuzzing that random amounts, times, withdrawals and cancels never pay out more than was put in. Not audited.
Contract
| Rill streams | Published at launch |
| Treasury | - |
Elysium, chain id 99901.