How it Works
Say Alice wants to pay Bob a salary worth 3,000 DAI over 30 days:
- Alice locks-up the salary in Sablier and sets the “streaming” duration to 30 days
- After 1 second, the contract will “stream” a tiny amount of DAI to Bob (around 0.0011574074 DAI)
- After 1 day, the contract will stream 100 DAI to Bob, the remaining 2,900 DAI still belonging to Alice
- After 5 days, the contract will stream 500 DAI to Bob, the remaining 2,500 DAI still belonging to Alice
- At the end, Bob receives the 3,000 DAI, *if* Alice hasn’t cancelled the payment
Why it matters
The salary use case from above is just one example, as Sablier is actually a new financial primitive that makes the passage of time itself the trust-binding mechanism.
Sablier establishes trust between strangers in ways that hadn’t been possible before:
- UBI payouts
- Parking lots
How we use OpenZeppelin
Sablier.sol (money streaming engine)
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/utils/ReentrancyGuard.sol";
Payroll.sol (dapp proxy)
import "@openzeppelin/contracts-ethereum-package/contracts/GSN/bouncers/GSNBouncerSignature.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNRecipient.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/upgrades/contracts/Initializable.sol";
Gas Station Network
Payroll.sol, we implemented the
acceptRelayedCall function, so that we can subsidise the gas costs for our premium plan users.
Some of our contracts inherit from
Initializable.sol, but right before the launch we decided not to make the contracts upgradeable. We’re a small startup and can’t afford the responsibility that inexorably comes with the power of upgradeability.
We also forked
PauserRoler and removed the renounce function, as per the discussion in Contract request: Ownable without `renounceOwnership`.
If you have any questions, ideas, or issues, ping us on one of the channels below. We’d love to hear from you.