Skip to main content

SablierMerkleBase

Git Source

Inherits: ISablierMerkleBase, Adminable

See the documentation in ISablierMerkleBase.

State Variables

_CACHED_CHAIN_ID

Cache the chain ID in order to invalidate the cached domain separator if the chain ID changes in case of a chain split.

uint256 private immutable _CACHED_CHAIN_ID;

_CACHED_DOMAIN_SEPARATOR

The domain separator, as required by EIP-712 and EIP-1271, used for signing claim to prevent replay attacks across different campaigns.

bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;

CAMPAIGN_START_TIME

The timestamp at which campaign starts and claim begins.

This is an immutable state variable.

uint40 public immutable override CAMPAIGN_START_TIME;

COMPTROLLER

Retrieves the address of the comptroller contract.

address public immutable override COMPTROLLER;

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;

IS_SABLIER_MERKLE

Returns true indicating that this campaign contract is deployed using the Sablier Factory.

This is a constant state variable.

bool public constant override IS_SABLIER_MERKLE = true;

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;

TOKEN

The ERC-20 token to distribute.

This is an immutable state variable.

IERC20 public immutable override TOKEN;

campaignName

Retrieves the name of the campaign.

string public override campaignName;

firstClaimTime

Retrieves the timestamp when the first claim is made, and zero if no claim was made yet.

uint40 public override firstClaimTime;

ipfsCID

The content identifier for indexing the campaign on IPFS.

An empty value may break certain UI features that depend upon the IPFS CID.

string public override ipfsCID;

minFeeUSD

Retrieves the min USD fee required to claim the airdrop, denominated in 8 decimals.

The denomination is based on Chainlink's 8-decimal format for USD prices, where 1e8 is $1.

uint256 public override minFeeUSD;

_claimedBitMap

Packed booleans that record the history of claims.

BitMaps.BitMap internal _claimedBitMap;

Functions

notZeroAddress

Modifier to check that to is not zero address.

modifier notZeroAddress(address to);

constructor

Constructs the contract by initializing the immutable state variables.

constructor(
address campaignCreator,
string memory campaignName_,
uint40 campaignStartTime,
address comptroller,
uint40 expiration,
address initialAdmin,
string memory ipfsCID_,
bytes32 merkleRoot,
IERC20 token
)
[Adminable](/docs/reference/airdrops/contracts/abstracts/abstract.Adminable.md)(initialAdmin);

calculateMinFeeWei

Calculates the minimum fee in wei required to claim the airdrop.

function calculateMinFeeWei() external view override returns (uint256);

domainSeparator

The domain separator, as required by EIP-712 and EIP-1271, used for signing claim to prevent replay attacks across different campaigns.

function domainSeparator() external view override returns (bytes32);

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);

clawback

Claws back the unclaimed tokens.

*Emits a {Clawback} event. Requirements:

  • msg.sender 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.

lowerMinFeeUSD

Lowers the min USD fee.

*Emits a {LowerMinFeeUSD} event. Requirements:

  • msg.sender must be the comptroller.
  • The new fee must be less than the current {minFeeUSD}.*
function lowerMinFeeUSD(uint256 newMinFeeUSD) external override;

Parameters

NameTypeDescription
newMinFeeUSDuint256The new min USD fee to set, denominated in 8 decimals.

_checkSignature

Verifies the signature against the provided parameters. It supports both EIP-712 and EIP-1271 signatures.

function _checkSignature(
uint256 index,
address recipient,
address to,
uint128 amount,
uint40 validFrom,
bytes calldata signature
)
internal
view;

_domainSeparator

Returns the domain separator for the current chain.

function _domainSeparator() private view returns (bytes32);

_hasGracePeriodPassed

Returns a flag indicating whether the grace period has passed.

The grace period is 7 days after the first claim.

function _hasGracePeriodPassed() private view returns (bool);

_revertIfToZeroAddress

This function checks if to is zero address.

function _revertIfToZeroAddress(address to) private pure;

_preProcessClaim

See the documentation for the user-facing functions that call this internal function.

function _preProcessClaim(uint256 index, address recipient, uint128 amount, bytes32[] calldata merkleProof) internal;