Skip to main content

SablierV2MerkleStreamer

Git Source

Inherits: ISablierV2MerkleStreamer, Adminable

See the documentation in ISablierV2MerkleStreamer.

State Variables

ASSET

The streamed ERC-20 asset.

This is an immutable state variable.

IERC20 public immutable override ASSET;

CANCELABLE

A flag indicating whether the streams can be canceled.

This is an immutable state variable.

bool public immutable override CANCELABLE;

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.

uint40 public immutable override EXPIRATION;

LOCKUP

The address of the SablierV2Lockup contract.

ISablierV2Lockup public immutable override LOCKUP;

MERKLE_ROOT

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

This is an immutable state variable.

bytes32 public immutable override MERKLE_ROOT;

TRANSFERABLE

A flag indicating whether the stream NFTs are transferable.

This is an immutable state variable.

bool public immutable override TRANSFERABLE;

_claimedBitMap

Packed booleans that record the history of claims.

BitMaps.BitMap internal _claimedBitMap;

Functions

constructor

Constructs the contract by initializing the immutable state variables.

constructor(
address initialAdmin,
IERC20 asset,
ISablierV2Lockup lockup,
bytes32 merkleRoot,
uint40 expiration,
bool cancelable,
bool transferable
);

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) public view override returns (bool);

Parameters

NameTypeDescription
indexuint256The index of the recipient to check.

hasExpired

Returns a flag indicating whether the Merkle streamer has expired.

function hasExpired() public view override 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 override onlyAdmin;

Parameters

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

_checkClaim

Validates the parameters of the claim function, which is implemented by child contracts.

function _checkClaim(uint256 index, bytes32 leaf, bytes32[] calldata merkleProof) internal view;