Skip to main content

ISablierMerkleFactory

Git Source

Inherits: IAdminable

A contract that deploys Merkle Lockups and Merkle Instant campaigns. Both use Merkle proofs for token distribution. Merkle Lockup enable Airstreams, a portmanteau of "airdrop" and "stream", an airdrop model where the tokens are distributed over time, as opposed to all at once. On the other hand, Merkle Instant enables instant airdrops where tokens are unlocked and distributed immediately. See the Sablier docs for more guidance: https://docs.sablier.com

The contracts are deployed using CREATE2.

Functions

defaultFee

Retrieves the default fee charged for claiming an airdrop.

The fee is denominated in the native token of the chain, e.g., ETH for Ethereum Mainnet.

function defaultFee() external view returns (uint256);

getCustomFee

Retrieves the custom fee struct for the provided campaign creator.

The fee is denominated in the native token of the chain, e.g., ETH for Ethereum Mainnet.

function getCustomFee(address campaignCreator) external view returns (MerkleFactory.CustomFee memory);

Parameters

NameTypeDescription
campaignCreatoraddressThe address of the campaign creator.

getFee

Retrieves the fee for the provided campaign creator, using the default fee if no custom fee is set.

The fee is denominated in the native token of the chain, e.g., ETH for Ethereum Mainnet.

function getFee(address campaignCreator) external view returns (uint256);

Parameters

NameTypeDescription
campaignCreatoraddressThe address of the campaign creator.

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 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.

collectFees

Collects the fees accrued in the merkleBase contract, and transfers them to the factory admin.

Emits a CollectFees event. Notes:

  • If the admin is a contract, it must be able to receive native token payments, e.g., ETH for Ethereum Mainnet.
function collectFees(ISablierMerkleBase merkleBase) external;

Parameters

NameTypeDescription
merkleBaseISablierMerkleBaseThe address of the Merkle contract where the fees are collected from.

createMerkleInstant

Creates a new MerkleInstant campaign for instant distribution of tokens.

Emits a CreateMerkleInstant event. Notes:

  • The MerkleInstant contract is created with CREATE2.
  • The immutable fee will be set to the default value unless a custom fee is set.
function createMerkleInstant(
MerkleBase.ConstructorParams memory baseParams,
uint256 aggregateAmount,
uint256 recipientCount
)
external
returns (ISablierMerkleInstant merkleInstant);

Parameters

NameTypeDescription
baseParamsMerkleBase.ConstructorParamsStruct encapsulating the SablierMerkleBase parameters, which are documented in {DataTypes}.
aggregateAmountuint256The total amount of ERC-20 tokens to be distributed to all recipients.
recipientCountuint256The total number of recipients who are eligible to claim.

Returns

NameTypeDescription
merkleInstantISablierMerkleInstantThe address of the newly created MerkleInstant contract.

createMerkleLL

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

Emits a CreateMerkleLL event. Notes:

  • The MerkleLL contract is created with CREATE2.
  • The immutable fee will be set to the default value unless a custom fee is set.
function createMerkleLL(
MerkleBase.ConstructorParams memory baseParams,
ISablierLockup lockup,
bool cancelable,
bool transferable,
MerkleLL.Schedule memory schedule,
uint256 aggregateAmount,
uint256 recipientCount
)
external
returns (ISablierMerkleLL merkleLL);

Parameters

NameTypeDescription
baseParamsMerkleBase.ConstructorParamsStruct encapsulating the SablierMerkleBase parameters, which are documented in {DataTypes}.
lockupISablierLockupThe address of the SablierLockup contract.
cancelableboolIndicates if the stream will be cancelable after claiming.
transferableboolIndicates if the stream will be transferable after claiming.
scheduleMerkleLL.ScheduleStruct encapsulating the unlocks schedule, which are documented in {DataTypes}.
aggregateAmountuint256The total amount of ERC-20 tokens to be distributed to all recipients.
recipientCountuint256The total number of recipients who are eligible to claim.

Returns

NameTypeDescription
merkleLLISablierMerkleLLThe address of the newly created Merkle Lockup contract.

createMerkleLT

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

Emits a CreateMerkleLT event. Notes:

  • The MerkleLT contract is created with CREATE2.
  • The immutable fee will be set to the default value unless a custom fee is set.
function createMerkleLT(
MerkleBase.ConstructorParams memory baseParams,
ISablierLockup lockup,
bool cancelable,
bool transferable,
uint40 streamStartTime,
MerkleLT.TrancheWithPercentage[] memory tranchesWithPercentages,
uint256 aggregateAmount,
uint256 recipientCount
)
external
returns (ISablierMerkleLT merkleLT);

Parameters

NameTypeDescription
baseParamsMerkleBase.ConstructorParamsStruct encapsulating the SablierMerkleBase parameters, which are documented in {DataTypes}.
lockupISablierLockupThe address of the SablierLockup contract.
cancelableboolIndicates if the stream will be cancelable after claiming.
transferableboolIndicates if the stream will be transferable after claiming.
streamStartTimeuint40The start time of the streams created through {SablierMerkleBase.claim}.
tranchesWithPercentagesMerkleLT.TrancheWithPercentage[]The tranches with their respective unlock percentages.
aggregateAmountuint256The total amount of ERC-20 tokens to be distributed to all recipients.
recipientCountuint256The total number of recipients who are eligible to claim.

Returns

NameTypeDescription
merkleLTISablierMerkleLTThe address of the newly created Merkle Lockup contract.

resetCustomFee

Resets the custom fee for the provided campaign creator to the default fee.

Emits a ResetCustomFee event. Notes:

  • The default fee will only be applied to future campaigns. Requirements:
  • msg.sender must be the admin.
function resetCustomFee(address campaignCreator) external;

Parameters

NameTypeDescription
campaignCreatoraddressThe user for whom the fee is reset for.

setCustomFee

Sets a custom fee for the provided campaign creator.

Emits a SetCustomFee event. Notes:

  • The new fee will only be applied to future campaigns. Requirements:
  • msg.sender must be the admin.
function setCustomFee(address campaignCreator, uint256 newFee) external;

Parameters

NameTypeDescription
campaignCreatoraddressThe user for whom the fee is set.
newFeeuint256The new fee to be set.

setDefaultFee

Sets the default fee to be applied when claiming airdrops.

Emits a SetDefaultFee event. Notes:

  • The new default fee will only be applied to the future campaigns and will not affect the ones already deployed. Requirements:
  • msg.sender must be the admin.
function setDefaultFee(uint256 defaultFee) external;

Parameters

NameTypeDescription
defaultFeeuint256The new default fee to be set.

Events

CollectFees

Emitted when the accrued fees are collected.

event CollectFees(address indexed admin, ISablierMerkleBase indexed merkleBase, uint256 feeAmount);

CreateMerkleInstant

Emitted when a SablierMerkleInstant campaign is created.

event CreateMerkleInstant(
ISablierMerkleInstant indexed merkleInstant,
MerkleBase.ConstructorParams baseParams,
uint256 aggregateAmount,
uint256 recipientCount,
uint256 fee
);

CreateMerkleLL

Emitted when a SablierMerkleLL campaign is created.

event CreateMerkleLL(
ISablierMerkleLL indexed merkleLL,
MerkleBase.ConstructorParams baseParams,
ISablierLockup lockup,
bool cancelable,
bool transferable,
MerkleLL.Schedule schedule,
uint256 aggregateAmount,
uint256 recipientCount,
uint256 fee
);

CreateMerkleLT

Emitted when a SablierMerkleLT campaign is created.

event CreateMerkleLT(
ISablierMerkleLT indexed merkleLT,
MerkleBase.ConstructorParams baseParams,
ISablierLockup lockup,
bool cancelable,
bool transferable,
uint40 streamStartTime,
MerkleLT.TrancheWithPercentage[] tranchesWithPercentages,
uint256 totalDuration,
uint256 aggregateAmount,
uint256 recipientCount,
uint256 fee
);

ResetCustomFee

Emitted when the admin resets the custom fee for the provided campaign creator to the default fee.

event ResetCustomFee(address indexed admin, address indexed campaignCreator);

SetCustomFee

Emitted when the admin sets a custom fee for the provided campaign creator.

event SetCustomFee(address indexed admin, address indexed campaignCreator, uint256 customFee);

SetDefaultFee

Emitted when the default fee is set by the admin.

event SetDefaultFee(address indexed admin, uint256 defaultFee);