Skip to main content

SablierV2MerkleLockup

Git Source

Inherits: ISablierV2MerkleLockup, Adminable

See the documentation in ISablierV2MerkleLockup.

State Variables

ASSET

The ERC-20 asset to distribute.

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 campaign, as a Unix timestamp. A value of zero means there is no expiration.

This is an immutable state variable.

uint40 public immutable override EXPIRATION;

MERKLE_ROOT

The root of the Merkle tree used to validate the proofs of inclusion.

This is an immutable state variable.

bytes32 public immutable override MERKLE_ROOT;

NAME

The name of the campaign stored as bytes32.

bytes32 internal immutable NAME;

TRANSFERABLE

A flag indicating whether the stream NFTs are transferable.

This is an immutable state variable.

bool public immutable override TRANSFERABLE;

ipfsCID

The content identifier for indexing the campaign on IPFS.

string public ipfsCID;

_claimedBitMap

Packed booleans that record the history of claims.

BitMaps.BitMap internal _claimedBitMap;

_firstClaimTime

The timestamp when the first claim is made.

uint40 internal _firstClaimTime;

Functions

constructor

Constructs the contract by initializing the immutable state variables.

constructor(MerkleLockup.ConstructorParams memory params);

getFirstClaimTime

Returns the timestamp when the first claim is made.

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

Parameters

NameTypeDescription
indexuint256The index of the recipient to check.

hasExpired

Returns a flag indicating whether the campaign has expired.

function hasExpired() public view override returns (bool);

name

Retrieves the name of the campaign.

function name() external view override returns (string memory);

clawback

Claws back the unclaimed tokens from the campaign.

Emits a {Clawback} event. Requirements:

  • The caller must be the admin.
  • No claim must be made, OR The current timestamp must not exceed 7 days after the first claim, OR The campaign must be expired.
function clawback(address to, uint128 amount) external override onlyAdmin;

Parameters

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

_hasGracePeriodPassed

Returns a flag indicating whether the grace period has passed.

The grace period is 7 days after the first claim.

function _hasGracePeriodPassed() internal view returns (bool);

_checkClaim

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

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