ITokenDistributor

Git Source

Inherits: IAuthorizable

Functions

token

Address of the ERC20 token to be distributed

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

root

The merkle root of the token distribution

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

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

Events

Claimed

Emitted when a user claims tokens

event Claimed(address _user, uint256 _amount);

Parameters

NameTypeDescription
_useraddressAddress of the user that claimed
_amountuint256Amount of tokens claimed

Swept

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

event Swept(address _sweepReceiver, uint256 _amount);

Parameters

NameTypeDescription
_sweepReceiveraddressAddress that received the swept tokens
_amountuint256Amount of tokens swept

Errors

TokenDistributor_ClaimPeriodNotEnded

Throws when trying to sweep before the claim period has ended

error TokenDistributor_ClaimPeriodNotEnded();

TokenDistributor_ClaimInvalid

Throws when trying to claim but the claim is not valid

error TokenDistributor_ClaimInvalid();

Structs

TokenDistributorParams

struct TokenDistributorParams {
  bytes32 root;
  uint256 totalClaimable;
  uint256 claimPeriodStart;
  uint256 claimPeriodEnd;
}