DistributionVault
Inherits: IDistributionVault, StatefulERC712
Author: M^0 Labs
State Variables
_GRANULARITY
The scale to apply when accumulating an account's claimable token, per epoch, before dividing. It is arbitrarily set to 1e9
. The smaller it is, the more dust will accumulate in the contract. Conversely, the larger it is, the more likely it is to overflow when accumulating. The more epochs that are claimed at once, the less dust will remain.
CLAIM_TYPEHASH
Returns the EIP712 typehash used in the encoding of the digest for the claimBySig function.
zeroToken
Returns the address of the Zero Token holders must have in order to be eligible for distributions.
_lastTokenBalances
The last recorded balance per token.
distributionOfAt
Returns the total amount of token
eligible for distribution to holder at the end of epoch epoch
.
hasClaimed
Returns whether account
has already claimed their token
distribution for epoch
.
Functions
constructor
Constructs a new DistributionVault contract.
Parameters
zeroToken_
address
The address of the Zero Token contract.
claim
Allows a caller to claim token
distribution between inclusive epochs startEpoch
and endEpoch
.
Parameters
token_
address
startEpoch_
uint256
endEpoch_
uint256
destination_
address
Returns
<none>
uint256
claimed The total amount of token claimed by account
.
claimBySig
Allows a signer to claim token
distribution between inclusive epochs startEpoch
and endEpoch
.
Parameters
account_
address
token_
address
startEpoch_
uint256
endEpoch_
uint256
destination_
address
deadline_
uint256
v_
uint8
r_
bytes32
s_
bytes32
Returns
<none>
uint256
claimed The total amount of token claimed by account
.
claimBySig
Allows a signer to claim token
distribution between inclusive epochs startEpoch
and endEpoch
.
Parameters
account_
address
token_
address
startEpoch_
uint256
endEpoch_
uint256
destination_
address
deadline_
uint256
signature_
bytes
Returns
<none>
uint256
claimed The total amount of token claimed by account
.
distribute
Distributes the unaccounted balance of token
.
Parameters
token_
address
Returns
amount_
uint256
The total amount of additional tokens accounted in this distribution event.
name
Returns the name of the contract.
CLOCK_MODE
Returns a machine-readable string description of the clock the contract is operating on.
getClaimDigest
Returns the digest to be signed, via EIP-712, given an internal digest (i.e. hash struct).
Parameters
account_
address
token_
address
startEpoch_
uint256
endEpoch_
uint256
destination_
address
nonce_
uint256
deadline_
uint256
Returns
<none>
bytes32
The digest to be signed.
clock
Returns the current timepoint according to the mode the contract is operating on.
getClaimable
Returns the amount of token
account
can claim between inclusive epochs startEpoch
and endEpoch
.
Parameters
token_
address
account_
address
startEpoch_
uint256
endEpoch_
uint256
Returns
claimable_
uint256
The amount of token that account
has yet to claim for these epochs, if any.
getDistributable
Returns the additional balance of token_
that is not yet distributed.
Parameters
token_
address
Returns
<none>
uint256
The total amount of token owned by the vault that is yet to be distributed.
_claim
Allows a caller to claim token_
distribution between inclusive epochs startEpoch
and endEpoch
.
Parameters
account_
address
The address of the account claiming the token.
token_
address
The address of the token being claimed.
startEpoch_
uint256
The starting epoch number as a clock value.
endEpoch_
uint256
The ending epoch number as a clock value.
destination_
address
The address the account where the claimed token will be sent.
Returns
claimed_
uint256
The total amount of token claimed by account_
.