Skip to main content

SablierMerkleLT

Git Source

Inherits: ISablierMerkleLT, SablierMerkleLockup

See the documentation in ISablierMerkleLT.

State Variables

VESTING_START_TIME

Retrieves the start time of the vesting stream, as a Unix timestamp. Zero is a sentinel value for block.timestamp.

uint40 public immutable override VESTING_START_TIME;

_tranchesWithPercentages

The tranches with their respective unlock percentages and durations.

MerkleLT.TrancheWithPercentage[] private _tranchesWithPercentages;

Functions

constructor

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

constructor(
MerkleLT.ConstructorParams memory params,
address campaignCreator,
address comptroller
)
SablierMerkleLockup(
campaignCreator,
params.campaignName,
params.campaignStartTime,
params.cancelable,
comptroller,
params.lockup,
params.expiration,
params.initialAdmin,
params.ipfsCID,
params.merkleRoot,
params.shape,
params.token,
params.transferable
);

tranchesWithPercentages

Retrieves the tranches with their respective unlock percentages and durations.

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

claim

Claim airdrop on behalf of eligible recipient. If the vesting end time is in the future, it creates a Lockup Tranched stream, otherwise it transfers the tokens directly to the recipient address.

It emits either {ClaimLTWithTransfer} or {ClaimLTWithVesting} event. Requirements:

  • The current time must be greater than or equal to the campaign start time.
  • The campaign must not have expired.
  • msg.value must not be less than the value returned by {COMPTROLLER.calculateMinFeeWei}.
  • The index must not be claimed already.
  • The Merkle proof must be valid.
  • All requirements from {ISablierLockupTranched.createWithTimestampsLT} must be met.
function claim(
uint256 index,
address recipient,
uint128 amount,
bytes32[] calldata merkleProof
)
external
payable
override;

Parameters

NameTypeDescription
indexuint256The index of the recipient in the Merkle tree.
recipientaddressThe address of the airdrop recipient.
amountuint128The amount of ERC-20 tokens allocated to the recipient.
merkleProofbytes32[]The proof of inclusion in the Merkle tree.

claimTo

Claim airdrop. If the vesting end time is in the future, it creates a Lockup Tranched stream with to address as the stream recipient, otherwise it transfers the tokens directly to the to address.

It emits either {ClaimLTWithTransfer} or {ClaimLTWithVesting} event. Requirements:

  • msg.sender must be the airdrop recipient.
  • The to must not be the zero address.
  • Refer to the requirements in {claim}.
function claimTo(
uint256 index,
address to,
uint128 amount,
bytes32[] calldata merkleProof
)
external
payable
override
notZeroAddress(to);

Parameters

NameTypeDescription
indexuint256The index of the msg.sender in the Merkle tree.
toaddressThe address to which Lockup stream or ERC-20 tokens will be sent on behalf of msg.sender.
amountuint128The amount of ERC-20 tokens allocated to the msg.sender.
merkleProofbytes32[]The proof of inclusion in the Merkle tree.

claimViaSig

Claim airdrop on behalf of eligible recipient using an EIP-712 or EIP-1271 signature. If the vesting end time is in the future, it creates a Lockup Tranched stream with to address as the stream recipient, otherwise it transfers the tokens directly to the to address.

It emits either {ClaimLTWithTransfer} or {ClaimLTWithVesting} event. Requirements:

{
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{ "name": "verifyingContract", "type": "address" }
],
"Claim": [
{ "name": "index", "type": "uint256" },
{ "name": "recipient", "type": "address" },
{ "name": "to", "type": "address" },
{ "name": "amount", "type": "uint128" },
{ "name": "validFrom", "type": "uint40" }
]
},
"domain": {
"name": "Sablier Airdrops Protocol",
"chainId": 1,
"verifyingContract": "0xTheAddressOfThisContract"
},
"primaryType": "Claim",
"message": {
"index": 2,
"recipient": "0xTheAddressOfTheRecipient",
"to": "0xTheAddressReceivingTheTokens",
"amount": "1000000000000000000000",
"validFrom": 1752425637
}
}
function claimViaSig(
uint256 index,
address recipient,
address to,
uint128 amount,
uint40 validFrom,
bytes32[] calldata merkleProof,
bytes calldata signature
)
external
payable
override
notZeroAddress(to);

Parameters

NameTypeDescription
indexuint256The index of the recipient in the Merkle tree.
recipientaddressThe address of the airdrop recipient who is providing the signature.
toaddressThe address to which Lockup stream or ERC-20 tokens will be sent on behalf of the recipient.
amountuint128The amount of ERC-20 tokens allocated to the recipient.
validFromuint40The timestamp from which the claim signature is valid.
merkleProofbytes32[]The proof of inclusion in the Merkle tree.
signaturebytesThe EIP-712 or EIP-1271 signature from the airdrop recipient.

_calculateStartTimeAndTranches

Calculates the vesting start time, and the tranches based on the claim amount and the unlock percentages for each tranche.

function _calculateStartTimeAndTranches(uint128 claimAmount)
private
view
returns (uint40 vestingStartTime, LockupTranched.Tranche[] memory tranches);

_postProcessClaim

Post-processes the claim execution by creating the stream or transferring the tokens directly and emitting an event.

function _postProcessClaim(uint256 index, address recipient, address to, uint128 amount, bool viaSig) private;