Operating the Sablier V1 Protocol Manually

Operating the Sablier V1 Protocol Manually

Sablier is built on top of Ethereum, a blockchain that has been running uninterruptedly since its inception. This means that even if MetaMask, Wallet Connect or the Sablier Interface are malfunctioning, you are always able to interact with the Sablier protocol.

This is a guide aimed at technical users familiar with Ethereum and smart contract technology. We will use the Etherscan blockchain explorer, but you can use any other web interface with dapp capabilities, such as MyEtherWallet.

Contracts, ABI, and descriptions

Smart contract architecture, addresses, ABIs, and function descriptions for the protocol are available at docs.sablier.finance.

Contract

Sablier v1.1 (the latest version of the protocol) runs on top of one monolith contract, which is not upgradeable and has no owner:

This guide will focus on interacting with this contract on Ethereum Mainnet. But the same logic applies to all other networks Sablier is deployed on.

Connect to Etherscan

Go to the smart contract page on Etherscan:

You will notice that the source code is verified, which means you can use Etherscan’s “Write Contract” feature.

Connect to MetaMask by clicking “Connect to Web3”.

How to get the stream id?

Throughout this article, we will make references to a “stream id”.

To find this value, you have to look at your transaction history and inspect the event logs. Specifically, you have to find the CreateStream event for the Money Streaming Engine. Here’s an example for the stream with id 100,048:

Alternatively, if you know the URL of your stream on pay.sablier.finance or app.sablier.finance, the number at the end of the URL is the stream id.

1. Create Streams

To create streams using Etherscan, use the createStream function on the Money Streaming Engine:

createStream on Etherscan

Steps

  1. Enter the address of the intended recipient under recipient.
  2. Enter the amount you wish to stream, in token units, under deposit — you can use this Ethereum unit converter to get the proper values.
  3. Enter the contract address of the ERC20 token you wish to send under tokenAddress.
  4. Enter the time you wish to start the stream, in seconds since epoch, under startTime.
  5. Enter the time you wish the stream to end, in seconds since epoch, under stopTime.
  6. Click “Write”, and confirm the transaction on MetaMask.

To get the proper timestamp for step 4 and 5, you can use this epoch converter.

Warning

The transaction must be processed by the Ethereum blockchain BEFORE the startTime of the stream, or otherwise the contract will revert with the following error:

start time before block.timestamp

2. Withdraw from Streams

To withdraw from streams using Etherscan, use the withdrawFromStream function on the Money Streaming Engine:

withdrawFromStream on Etherscan

Steps:

  1. Enter the id of the stream you wish to withdraw from under streamId.
  2. Enter the amount of tokens you wish to withdraw, in token units, under amount — you can use this Ethereum unit converter to get the proper values.
  3. Click “Write”, and confirm the transaction on MetaMask.

Side note: you can trigger this action only if you’re either the sender or the recipient of the stream. For all other third-party accounts, the contract call will revert.

3. Cancel Streams

To cancel streams using Etherscan, use the cancelStream function on the Money Streaming Engine:

cancelStream on Etherscan
  1. Enter the id of the stream you wish to cancel under streamId.
  2. Click “Write”, and confirm the transaction on MetaMask.

Side note: you can trigger this action only if you’re either the sender or the recipient of the stream, otherwise the contract call will revert.

Wrap Up

There is a number of other secondary functions you can call on the Money Streaming Engine, but we will let you discover them on your own. All functions are thoroughly documented in our protocol documentation.

Many thanks to Kaden Zipfel for his contribution and feedback on this blog post.

If you ever have trouble operating the Sablier protocol, please join the #development channel in the Sablier Discord server; our team, and members of the community, look forward to helping you.‌


If you have any questions, ideas, or issues, ping us on Discord or Twitter — we’d love to hear from you.