Skip to main content

SablierV2MerkleLT

Git Source

Inherits: ISablierV2MerkleLT, SablierV2MerkleLockup

See the documentation in ISablierV2MerkleLT.

State Variables

LOCKUP_TRANCHED

The address of the SablierV2LockupTranched contract.

ISablierV2LockupTranched public immutable override LOCKUP_TRANCHED;

TOTAL_PERCENTAGE

The total percentage of the tranches.

uint64 public immutable override TOTAL_PERCENTAGE;

_tranchesWithPercentages

The tranches with their respective unlock percentages and durations.

MerkleLT.TrancheWithPercentage[] internal _tranchesWithPercentages;

Functions

constructor

Constructs the contract by initializing the immutable state variables, and max approving the Sablier contract.

constructor(
MerkleLockup.ConstructorParams memory baseParams,
ISablierV2LockupTranched lockupTranched,
MerkleLT.TrancheWithPercentage[] memory tranchesWithPercentages
)
SablierV2MerkleLockup(baseParams);

getTranchesWithPercentages

Retrieves the tranches with their respective unlock percentages and durations.

function getTranchesWithPercentages() external view override returns (MerkleLT.TrancheWithPercentage[] memory);

claim

Makes the claim by creating a LockupTranched stream to the recipient. A stream NFT is minted to the recipient.

Emits a {Claim} event. Requirements:

  • The campaign must not have expired.
  • The stream must not have been claimed already.
  • The Merkle proof must be valid.
  • TOTAL_PERCENTAGE must be equal to 100%.
function claim(
uint256 index,
address recipient,
uint128 amount,
bytes32[] calldata merkleProof
)
external
override
returns (uint256 streamId);

Parameters

NameTypeDescription
indexuint256The index of the recipient in the Merkle tree.
recipientaddressThe address of the stream holder.
amountuint128The amount of ERC-20 assets to be distributed via the claimed stream.
merkleProofbytes32[]The proof of inclusion in the Merkle tree.

Returns

NameTypeDescription
streamIduint256The id of the newly created stream.

_calculateTranches

Calculates the tranches based on the claim amount and the unlock percentages for each tranche.

function _calculateTranches(uint128 claimAmount)
internal
view
returns (LockupTranched.TrancheWithDuration[] memory tranches);