ITokenDistributor
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
Name | Type | Description |
---|---|---|
_proof | bytes32[] | Array of bytes32 merkle proof hashes |
_user | address | Address of the user to check |
_amount | uint256 | Amount of tokens to check |
Returns
Name | Type | Description |
---|---|---|
_claimable | bool | Whether 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
Name | Type | Description |
---|---|---|
_proof | bytes32[] | Array of bytes32 merkle proof hashes |
_amount | uint256 | Amount 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
Name | Type | Description |
---|---|---|
_proof | bytes32[] | Array of bytes32 merkle proof hashes |
_amount | uint256 | Amount of tokens to claim |
_delegatee | address | Address to delegate the token votes to |
_expiry | uint256 | Expiration timestamp of the signature |
_v | uint8 | Recovery byte of the signature |
_r | bytes32 | ECDSA signature r value |
_s | bytes32 | ECDSA signature s value |
claimed
Mapping containing the users that have already claimed
function claimed(address _user) external view returns (bool _claimed);
Parameters
Name | Type | Description |
---|---|---|
_user | address | Address of the user to check |
Returns
Name | Type | Description |
---|---|---|
_claimed | bool | Boolean 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
Name | Type | Description |
---|---|---|
_sweepReceiver | address | Address to send the tokens to |
Events
Claimed
Emitted when a user claims tokens
event Claimed(address _user, uint256 _amount);
Parameters
Name | Type | Description |
---|---|---|
_user | address | Address of the user that claimed |
_amount | uint256 | Amount of tokens claimed |
Swept
Emitted when the distributor is swept (after the claim period has ended)
event Swept(address _sweepReceiver, uint256 _amount);
Parameters
Name | Type | Description |
---|---|---|
_sweepReceiver | address | Address that received the swept tokens |
_amount | uint256 | Amount 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;
}