Skip to main content

ISablierV2MerkleStreamer

Git Source

Inherits: IAdminable

A contract that lets user claim Sablier streams using Merkle proofs. An interesting use case for MerkleStream is airstreams, which is a portmanteau of "airdrop" and "stream". This is an airdrop model where the tokens are distributed over time, as opposed to all at once.

This is the base interface for MerkleStreamer contracts. See the Sablier docs for more guidance on how streaming works: https://docs.sablier.com/.

Functions

ASSET

The streamed ERC-20 asset.

This is an immutable state variable.

function ASSET() external returns (IERC20);

CANCELABLE

A flag indicating whether the streams can be canceled.

This is an immutable state variable.

function CANCELABLE() external returns (bool);

EXPIRATION

The cut-off point for the Merkle streamer, as a Unix timestamp. A value of zero means there is no expiration.

This is an immutable state variable.

function EXPIRATION() external returns (uint40);

hasClaimed

Returns a flag indicating whether a claim has been made for a given index.

Uses a bitmap to save gas.

function hasClaimed(uint256 index) external returns (bool);

Parameters

NameTypeDescription
indexuint256The index of the recipient to check.

hasExpired

Returns a flag indicating whether the Merkle streamer has expired.

function hasExpired() external view returns (bool);

LOCKUP

The address of the SablierV2Lockup contract.

function LOCKUP() external returns (ISablierV2Lockup);

MERKLE_ROOT

The root of the Merkle tree used to validate the claims.

This is an immutable state variable.

function MERKLE_ROOT() external returns (bytes32);

TRANSFERABLE

A flag indicating whether the stream NFTs are transferable.

This is an immutable state variable.

function TRANSFERABLE() external returns (bool);

clawback

Claws back the unclaimed tokens from the Merkle streamer.

Emits a Clawback event. Notes:

  • If the protocol is not zero, the expiration check is not made. Requirements:
  • The caller must be the admin.
  • The campaign must either be expired or not have an expiration.
function clawback(address to, uint128 amount) external;

Parameters

NameTypeDescription
toaddressThe address to receive the tokens.
amountuint128The amount of tokens to claw back.

Events

Claim

Emitted when a recipient claims a stream.

event Claim(uint256 index, address indexed recipient, uint128 amount, uint256 indexed streamId);

Clawback

Emitted when the admin claws back the unclaimed tokens.

event Clawback(address indexed admin, address indexed to, uint128 amount);