Skip to main content

Etherscan: Manual Operations

Introduction

Just like any other open protocol, Lockup can be interacted with directly through a blockchain explorer like Etherscan.

In this guide, we will show you how to create a stream and withdraw from a stream by manually interacting with the Lockup Core contracts on Etherscan.

If you're interested in interacting with V1, please refer to this article.

Creating a Stream

Prerequisites

Before being able to create a stream using the Lockup Core contracts you need to have granted a sufficient token allowance. See the Allowances section below for a guide on how to do that.

Step 1: Go to contract page

Head over to our deployments list to pick the contract address you want to interact with. In this tutorial, we will create a Lockup stream on Sepolia.

Once you find the right contract, click on the address to access its explorer's page. Click on the "Contract" tab, and then on the "Write Contract" sub-tab.

Etherscan 01

Etherscan 02

You can now connect your wallet to the interface by clicking on "Connect to Web3".

Etherscan 03

Step 2: Fill in parameters

We will now proceed to create our first stream. Let's go with the following parameters:

  • a Lockup Linear stream
  • and a deposit of 100 DAI
  • starting Jan 27, 2025
  • ending Jan 27, 2026
  • with cliff until Jan 30, 2025 and cliff amount of 2 DAI
  • no token unlock at start time
  • non-cancelable
  • and transferrable

As the start and end date are fixed, we'll be using the createwithtimestampsLL method. Please note that using createwithdurationsLL is also possible if you specify durations instead of the timestamps.

Open the "createwithtimestampsLL" method, and start filling in the stream details:

note

All functions are marked as payable, however, its entirely optional to attach any value (in native token) to the transaction. For this example, we will not be attaching any value and therefore payableAmount(ether) will be 0.

Etherscan 04

{
"sender": "0xf26994E6Af0b95cCa8DFA22A0BC25E1f38a54C42",
"recipient": "0xb4bf8a8475d1e8e9a2088f118ad0e2cdc2896183",
"totalAmount": 100000000000000000000,
"token": "0x3DcBc355c5B5FdF45D2d2ccc8890d76C5b30394A",
"cancelable": false,
"transferable": true,
"timestamps": [1737936000, 1769472000],
"shape": "",
"broker": ["0x0000000000000000000000000000000000000000", 0],
"unlockAmounts": ["0", "2000000000000000000"],
"cliffTime": 1738195200
}

If the Etherscan UI does not break down the inputs into separate fields (like in the screenshot above), you will have to provide it like this:

[
"0xf26994E6Af0b95cCa8DFA22A0BC25E1f38a54C42",
"0xb4bf8a8475d1e8e9a2088f118ad0e2cdc2896183",
100000000000000000000,
"0x3DcBc355c5B5FdF45D2d2ccc8890d76C5b30394A",
false,
true,
[1737936000, 1769472000],
"",
["0x0000000000000000000000000000000000000000", 0],
["0", "2000000000000000000"],
1738195200
]
tip

In case of a tuple, ensure to follow the best practices:

  1. Use square brackets
  2. Wrap addresses in double quotes
  3. Wrap large numbers in quotes

Follow this guide from Etherscan to learn how to correctly format input data for Write Contract tab.

As an example, in the screenshot below, we are providing input parameters for createWithTimestampsLL function in SablierBatchLockup contract. As you can see, since batch requires a tuple and does not break it down into separate fields, we had to use the above method.

Etherscan 08

Sender

If the stream is cancelable, the sender is the wallet that will have the ability to cancel and renounce the stream. But if the stream is non-cancelable, the sender cannot cancel the stream.

Most users will set their own wallet address as the sender.

Recipient

The address you want to stream tokens to. The owner of this address is the stream recipient and will receive tokens on withdraw.

Total Amount

This is the total amount of tokens available to be streamed, DECIMALS INCLUDED. If the asset has 18 decimals, for example, you will need to add eighteen zeros after the amount. Let's say you want to stream 20,000 DAI like in this example, you will need to fill in 20000000000000000000000.

note

The total amount will also include any broker fee. While fees are kept at zero in Sablier UI, the total amount should be equal to the streamed amount plus the broker fee amount.

Token

The token is the contract address of the ERC-20 token being streamed. You can obtain this from the Sablier Interface or from Etherscan explorer. Please double check the token address is correct before continuing.

Cancelable

This field indicates whether or not you want the stream to be cancelable. This can be set to either true or false. If set to true, the stream will be cancelable.

You can make a cancelable stream non-cancelable after the stream has been created, but if it's a non-cancelable stream, it cannot become cancelable post-creation.

Transferable

The transferable field indicates whether the NFT owner is allowed to transfer te NFT or not. This can be set to either true or false.

This flag cannot be changed later.

Timestamps

The timestamps field contains the start time, and the end time of the stream, in this order. The values should be UNIX timestamps (represented in seconds). You can find a Unix timestamp converter here.

Shape

The shape field can be used to specify the shape of the stream that you want the User Interface to display. This is an optional field and can be left empty.

Broker

An optional parameter that can be set in order to charge a fee as a percentage of totalAmount.

You can set the broker field to address zero and zero fees. Read more about fees here.

Unlock Amounts

The unlockAmounts field contains the amount of tokens that will be unlocked at the start time and at the cliff time. For this example, we do not want to unlock any amount at the start time, however, we want to unlock 2 DAI at the cliff time.

Cliff Time

If you prefer to not have a cliff, you can simply set the cliff time to 0. If, however, you want to have a cliff, fill in the timestamp for the cliff there.

caution

Inside tuples/arrays (the [ ... ] structures in the example) make sure that you:

  • Use square brackets
  • Wrap addresses in double quotes, i.e. " "

Once the data is filled, and after you double-checked, click on the "Write" button and confirm the transaction in your wallet. That's all! You are done. You can now head over to the Sablier Interface, connect your wallet, and your stream should appear like this:

Etherscan 05

How about createWithDurationsLL?

For the durations version, we'll replace the timestamps and cliffTime parameters with a single durations parameter to represent the total duration of the stream (in seconds) and the duration of the cliff (in seconds).

{
"durations": [0, 864000] // no cliff and a total duration of 10 days
}
Total DurationCliff Duration[Cliff, Total]
10 daysno cliff[0, 864000]
10 days1 day[86400, 864000]

Withdrawing from a Stream

Prerequisites

To withdraw from a stream using Etherscan, you will need to obtain the stream's ID. To obtain this without the Sablier Interface, find the transaction which created the stream on Etherscan. Here's an example of what it should look like.

Once found, you will see the stream ID between the two brackets. Note that stream ID and "Token ID" are the same thing.

info

Anyone can withdraw on your behalf if they pay the gas fee. When a third party withdraws, the recipient is the only allowed withdrawal address. However, if you withdraw yourself, you can choose to withdraw to any other address. You can read more about this advanced feature here.

Etherscan 06

Step 1: Go to contract page

Head over to our deployments list and select the contract address you want to interact with.

Once you find the right contract, click on the address to access its explorer's page. Click on the "Contract" tab, and then on the "Write Contract" sub-tab.

Etherscan 01

Etherscan 02

You can now connect your wallet to the interface by clicking on "Connect to Web3".

Etherscan 03

Step 2: Fill in parameters

Head over to the withdraw method, and fill in the data.

Etherscan 07

{
"streamId": 1,
"to": "0xb1bEF51ebCA01EB12001a639bDBbFF6eEcA12B9F",
"amount": 100000000000000000000
}

Stream ID

The streamId is the value you have previously located in the transaction in which the stream was created.

To

The to field is there for the stream recipient's address. This will most likely be your own wallet, but you can also choose to withdraw these funds to another wallet (e.g. a separate cold wallet) if you are the stream's recipient. If you are not the stream recipient, it MUST be the address of the recipient.

Amount

This represents the amount of tokens that you want to withdraw, DECIMALS INCLUDED. For example, if the token you are looking to withdraw has 18 decimals, you will need to add eighteen zeros after the amount. Let's say you want to withdraw 100 DAI like in this example, you will need to put in 100000000000000000000. Oh, and make sure that that amount has already been streamed, you cannot withdraw funds that haven't yet been streamed over to you.

Once ready, click on the "Write" button, and confirm the transaction in your wallet. You are done!


Apart from the main flows, you may be required to do some other actions, usually listed as prerequisites.

Prerequisite: ERC20 Allowances

Before interacting directly with the Lockup contracts to create a stream you will need to manually grant proper ERC20 allowances.

Step 1: Go to token page

Pick a token you want to stream, e.g. DAI. Using its address, visit the token page on Etherscan (in this example, we're using Sepolia): https://sepolia.etherscan.io/token/<INSERT-TOKEN-ADDRESS>

info

To get the address of an asset in the Sablier Interface, you can click on its name in the token list dialog or find an existing stream with that token and click on the icon inside the stream circle.

Etherscan 09 Etherscan 10

Step 2: Go to approve

Next, look for the "Contract" tab and the "Write Contract" sub-tab.

You'll see a list of methods that can be called for that token. Pick the approve method (e.g. DAI's approve). Most ERC-20 approve methods will contain two fields:

  1. The spender
  2. The amount

Step 3: Send transaction

For the purpose of creating a LockupLinear stream with Lockup, the spender will be the SablierLockup contract.

As for the amount, you'll have to pad it with the right number of decimals. For DAI, that's 18 decimals, so a value of 100 will turn into 100 * 1e18 (100 followed by 18 zeroes). For USDC,that's 6 decimals, so a value of 100 will turn into 100 * 1e8 (100 followed by 8 zeroes). The same logic applies to the total amounts when creating the stream.

{
"spender": "0xd116c275541cdBe7594A202bD6AE4DBca4578462",
"amount": 100000000000000000000
}

Etherscan 11

Before clicking on the "Write" button to submit your allowance update, make sure to connect your wallet to the interface by clicking on "Connect to Web3".