EpochBasedInflationaryVoteToken
Inherits: IEpochBasedInflationaryVoteToken, EpochBasedVoteToken
Author: M^0 Labs
State Variables
ONE
Returns 100% in basis point, to be used to correctly ascertain the participation inflation rate.
participationInflation
Returns the participation inflation rate used to inflate tokens for participation.
_participations
A mapping of delegatees to their participation snaps, marking epochs in which they have participated.
Functions
notDuringVoteEpoch
Reverts if the current epoch is a voting epoch.
onlyDuringVoteEpoch
Reverts if the current epoch is not a voting epoch.
constructor
Constructs a new EpochBasedInflationaryVoteToken contract.
Parameters
Name | Type | Description |
---|---|---|
|
| The name of the token. |
|
| The symbol of the token. |
|
| The decimals of the token. |
|
| The participation inflation rate used to inflate tokens for participation. |
sync
Syncs account
so that its balance Snap array in storage, reflects their unrealized inflation.
Parameters
Name | Type | Description |
---|---|---|
|
|
hasParticipatedAt
Returns whether delegatee
has participated in voting during clock value epoch
.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
|
Returns
Name | Type | Description |
---|---|---|
|
| Whether |
_delegate
Delegate voting power from delegator_
to newDelegatee_
.
The inflation is first realized according to participation of the current delegatee by calling _sync()
.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the account delegating voting power. |
|
| The address of the account receiving voting power. |
_markParticipation
Allows for the inflation of a delegatee's voting power (and total supply) up to one time per epoch.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the account being marked as having participated. |
_mint
Mint amount_
tokens to recipient_
.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the account to mint tokens to. |
|
| The amount of tokens to mint. |
_sync
Syncs account_
so that its balance Snap array in storage, reflects their unrealized inflation.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the account to sync. |
_transfer
Transfers amount_
tokens from sender_
to recipient_
.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the account to transfer tokens from. |
|
| The address of the account to transfer tokens to. |
|
| The amount of tokens to transfer. |
_update
Update a storage VoidSnap array to contain the current epoch as the latest snap.
Parameters
Name | Type | Description |
---|---|---|
|
| The storage pointer to a VoidSnap array to update. |
|
| The epoch to write as the latest element of the VoidSnap array. |
Returns
Name | Type | Description |
---|---|---|
|
| Whether the VoidSnap array was updated, and thus did not already contain the current epoch. |
_getBalance
Returns the balance of account_
plus any inflation that in unrealized before epoch_
.
Parameters
Name | Type | Description |
---|---|---|
|
| The account to get the balance for. |
|
| The epoch to get the balance at. |
Returns
Name | Type | Description |
---|---|---|
|
| The balance of |
_getBalanceWithoutUnrealizedInflation
Returns the balance of account_
at epoch_
without any unrealized inflation.
Parameters
Name | Type | Description |
---|---|---|
|
| The account to get the balance for. |
|
| The epoch to get the balance at. |
Returns
Name | Type | Description |
---|---|---|
|
| The balance of |
_getInflation
Returns the inflation of amount
due to participation inflation.
Parameters
Name | Type | Description |
---|---|---|
|
| The amount to determine inflation for. |
Returns
Name | Type | Description |
---|---|---|
|
| The inflation of |
_getLastSync
Returns the epoch of the last sync of account_
at or before epoch_
. Override this function in order to return the "default"/starting epoch if the account has never synced.
Parameters
Name | Type | Description |
---|---|---|
|
| The account to get the last sync for. |
|
| The epoch to get the last sync at or before. |
Returns
Name | Type | Description |
---|---|---|
|
| The epoch of the last sync of |
_hasParticipatedAt
Returns whether delegatee_
has participated during the clock value epoch_
.
Parameters
Name | Type | Description |
---|---|---|
|
| The account whose participation is being queried. |
|
| The epoch at which to determine participation. |
Returns
Name | Type | Description |
---|---|---|
|
| Whether |
_getUnrealizedInflation
Returns the unrealized inflation for account_
from their last sync to the epoch before lastEpoch_
.
Parameters
Name | Type | Description |
---|---|---|
|
| The account being queried. |
|
| The last epoch at which to determine unrealized inflation, not inclusive. |
Returns
Name | Type | Description |
---|---|---|
|
| The total unrealized inflation that has yet to be synced. |
_revertIfInVoteEpoch
Reverts if the current epoch is a voting epoch.
_revertIfNotInVoteEpoch
Reverts if the current epoch is not a voting epoch.
_isVotingEpoch
Returns whether the clock value epoch_
is a voting epoch or not.
Parameters
Name | Type | Description |
---|---|---|
|
| Some clock value. |
Returns
Name | Type | Description |
---|---|---|
|
| Whether the epoch is a voting epoch. |
_unsafeAccess
Returns the VoidSnap in an array at a given index without doing bounds checking.
Parameters
Name | Type | Description |
---|---|---|
|
| The array of VoidSnaps to parse. |
|
| The index of the VoidSnap to return. |
Returns
Name | Type | Description |
---|---|---|
|
| The VoidSnap at |
Structs
VoidSnap
A 32-byte struct containing a starting epoch that merely marks that something occurred in this epoch.