Skip to main content

SablierFactoryMerkleLT

Git Source

Inherits: ISablierFactoryMerkleLT, SablierFactoryMerkleBase

See the documentation in ISablierFactoryMerkleLT.

Functions

constructor

constructor(address initialComptroller) SablierFactoryMerkleBase(initialComptroller);

Parameters

NameTypeDescription
initialComptrolleraddressThe address of the initial comptroller contract.

computeMerkleLT

Computes the deterministic address where SablierMerkleLT campaign will be deployed.

Reverts if the requirements from {createMerkleLT} are not met.

function computeMerkleLT(
address campaignCreator,
MerkleLT.ConstructorParams calldata params
)
external
view
override
returns (address merkleLT);

isPercentagesSum100

Verifies if the sum of percentages in tranches equals 100%, i.e., 1e18.

This is a helper function for the frontend. It is not used anywhere in the contracts.

function isPercentagesSum100(MerkleLT.TrancheWithPercentage[] calldata tranches)
external
pure
override
returns (bool result);

Parameters

NameTypeDescription
tranchesMerkleLT.TrancheWithPercentage[]The tranches with their respective unlock percentages.

Returns

NameTypeDescription
resultboolTrue if the sum of percentages equals 100%, otherwise false.

createMerkleLT

Creates a new Merkle Lockup campaign with a Lockup Tranched distribution.

Emits a {CreateMerkleLT} event. Notes:

  • The contract is created with CREATE2.
  • The campaign's fee will be set to the min USD fee unless a custom fee is set for msg.sender.
  • A value of zero for params.expiration means the campaign does not expire. Requirements:
  • params.token must not be the forbidden native token.
  • The sum of percentages of the tranches must equal 100%.
function createMerkleLT(
MerkleLT.ConstructorParams calldata params,
uint256 aggregateAmount,
uint256 recipientCount
)
external
override
returns (ISablierMerkleLT merkleLT);

Parameters

NameTypeDescription
paramsMerkleLT.ConstructorParamsStruct encapsulating the input parameters, which are documented in {DataTypes}.
aggregateAmountuint256The total amount of ERC-20 tokens to be distributed to all recipients.
recipientCountuint256The total number of recipient addresses eligible for the airdrop.

Returns

NameTypeDescription
merkleLTISablierMerkleLTThe address of the newly created Merkle Lockup contract.

_calculateTrancheTotals

Calculate the total duration and total percentage of the tranches.

function _calculateTrancheTotals(MerkleLT.TrancheWithPercentage[] memory tranches)
private
pure
returns (uint256 totalDuration, uint64 totalPercentage);

_checkDeploymentParams

Validate the token and the total percentage.

function _checkDeploymentParams(address token, uint64 totalPercentage) private view;