ITokenDistributor

Git Source

Inherits: IAuthorizable

Functions

root

The merkle root of the token distribution

function root() external view returns (bytes32 _root);

token

Address of the ERC20 token to be distributed

function token() external view returns (ERC20Votes _token);

totalClaimable

Total amount of tokens to be distributed

function totalClaimable() external view returns (uint256 _totalClaimable);

claimPeriodStart

Timestamp when the claim period starts

function claimPeriodStart() external view returns (uint256 _claimPeriodStart);

claimPeriodEnd

Timestamp when the claim period ends

function claimPeriodEnd() external view returns (uint256 _claimPeriodEnd);

canClaim

Checks if a user can claim tokens

function canClaim(bytes32[] calldata _proof, address _user, uint256 _amount) external view returns (bool _claimable);

Parameters

NameTypeDescription
_proofbytes32[]Array of bytes32 merkle proof hashes
_useraddressAddress of the user to check
_amountuint256Amount of tokens to check

Returns

NameTypeDescription
_claimableboolWhether the user can claim the amount with the proof provided

claim

Claims tokens from the distributor

function claim(bytes32[] calldata _proof, uint256 _amount) external;

Parameters

NameTypeDescription
_proofbytes32[]Array of bytes32 merkle proof hashes
_amountuint256Amount of tokens to claim

claimAndDelegate

Claims tokens from the distributor and delegates them using a signature

function claimAndDelegate(
  bytes32[] calldata _proof,
  uint256 _amount,
  address _delegatee,
  uint256 _expiry,
  uint8 _v,
  bytes32 _r,
  bytes32 _s
) external;

Parameters

NameTypeDescription
_proofbytes32[]Array of bytes32 merkle proof hashes
_amountuint256Amount of tokens to claim
_delegateeaddressAddress to delegate the token votes to
_expiryuint256Expiration timestamp of the signature
_vuint8Recovery byte of the signature
_rbytes32ECDSA signature r value
_sbytes32ECDSA signature s value

claimed

Mapping containing the users that have already claimed

function claimed(address _user) external view returns (bool _claimed);

Parameters

NameTypeDescription
_useraddressAddress of the user to check

Returns

NameTypeDescription
_claimedboolBoolean indicating if the user has claimed

sweep

Withdraws tokens from the distributor to a given address after the claim period has ended

function sweep(address _sweepReceiver) external;

Parameters

NameTypeDescription
_sweepReceiveraddressAddress to send the tokens to

withdraw

Withdraws tokens from the distributor to a given address

function withdraw(address _to, uint256 _amount) external;

Parameters

NameTypeDescription
_toaddressAddress to send the tokens to
_amountuint256Amount of tokens to send

Events

Claimed

Emitted when a user claims tokens

event Claimed(address _user, uint256 _amount);

Swept

Emitted when the distributor is swept (after the claim period has ended)

event Swept(address _sweepReceiver, uint256 _amount);

Withdrawn

Emitted when tokens are withdrawn from the distributor

event Withdrawn(address _to, uint256 _amount);

Errors

TokenDistributor_ClaimPeriodNotStarted

Throws when trying to claim before the claim period has started

error TokenDistributor_ClaimPeriodNotStarted();

TokenDistributor_ClaimPeriodEnded

Throws when trying to claim after the claim period has ended

error TokenDistributor_ClaimPeriodEnded();

TokenDistributor_AlreadyClaimed

Throws when a user that already claimed tries to claim again

error TokenDistributor_AlreadyClaimed();

TokenDistributor_ZeroAmount

Throws when trying to claim a null amount of tokens

error TokenDistributor_ZeroAmount();

TokenDistributor_FailedMerkleProofVerify

Throws when the merkle proof provided to claim is invalid

error TokenDistributor_FailedMerkleProofVerify();

TokenDistributor_ClaimPeriodNotEnded

Throws when trying to sweep before the claim period has ended

error TokenDistributor_ClaimPeriodNotEnded();