IMaverickV2VotingEscrowBase
Inherits: IVotes, IHistoricalBalance
Functions
MIN_STAKE_DURATION
MAX_STAKE_DURATION
YEAR_BASE
baseToken
This function retrieves the address of the ERC20 token used as the base token for staking and rewards.
Returns
Name | Type | Description |
---|---|---|
|
| baseToken The address of the IERC20 base token contract. |
startTimestamp
This function retrieves the starting timestamp. This may be used for reward calculations or other time-based logic.
getLockup
This function retrieves the details of a specific lockup for a given staker and lockup index.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the staker for which to retrieve the lockup details. |
|
| The index of the lockup within the staker's lockup history. |
Returns
Name | Type | Description |
---|---|---|
|
| A Lockup struct containing details about the lockup (see struct definition for details). |
lockupCount
This function retrieves the total number of lockups associated with a specific staker.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the staker for which to retrieve the lockup count. |
Returns
Name | Type | Description |
---|---|---|
|
| The total number of lockups for the staker. |
previewVotes
This function simulates a lockup scenario, providing details about the resulting lockup structure for a specified amount and duration.
Parameters
Name | Type | Description |
---|---|---|
|
| The amount of tokens to be locked. |
|
| The duration of the lockup period. |
Returns
Name | Type | Description |
---|---|---|
|
| A Lockup struct containing details about the simulated lockup (see struct definition for details). |
approveExtender
This function grants approval for a designated extender contract to manage a specific lockup on behalf of the staker.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the extender contract to be approved. |
|
| The ID of the lockup for which to grant approval. |
revokeExtender
This function revokes approval previously granted to an extender contract for managing a specific lockup.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the extender contract whose approval is being revoked. |
|
| The ID of the lockup for which to revoke approval. |
isApprovedExtender
This function checks whether a specific account has been approved by a staker to manage a particular lockup through an extender contract.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the account to check for approval (may be the extender or another account). |
|
| The address of the extender contract for which to check approval. |
|
| The ID of the lockup to verify approval for. |
Returns
Name | Type | Description |
---|---|---|
|
| isApproved True if the account is approved for the lockup, False otherwise (bool). |
extendForSender
This function extends the lockup period for the caller (msg.sender) for a specified lockup ID, adding a new duration and amount.
Parameters
Name | Type | Description |
---|---|---|
|
| The ID of the lockup to be extended. |
|
| The additional duration to extend the lockup by. |
|
| The additional amount of tokens to be locked. |
Returns
Name | Type | Description |
---|---|---|
|
| A Lockup struct containing details about the newly extended lockup (see struct definition for details). |
extendForAccount
This function extends the lockup period for a specified account, adding a new duration and amount. The caller (msg.sender) must be authorized to manage the lockup through an extender contract.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the account whose lockup is being extended. |
|
| The ID of the lockup to be extended. |
|
| The additional duration to extend the lockup by. |
|
| The additional amount of tokens to be locked. |
Returns
Name | Type | Description |
---|---|---|
|
| A Lockup struct containing details about the newly extended lockup (see struct definition for details). |
merge
This function merges multiple lockups associated with the caller (msg.sender) into a single new lockup.
Parameters
Name | Type | Description |
---|---|---|
|
| An array containing the IDs of the lockups to be merged. |
Returns
Name | Type | Description |
---|---|---|
|
| A Lockup struct containing details about the newly merged lockup (see struct definition for details). |
unstake
This function unstakes the specified lockup ID for the caller (msg.sender), returning the details of the unstaked lockup.
Parameters
Name | Type | Description |
---|---|---|
|
| The ID of the lockup to be unstaked. |
|
| The address to which the unstaked tokens should be sent (optional, defaults to msg.sender). |
Returns
Name | Type | Description |
---|---|---|
|
| A Lockup struct containing details about the unstaked lockup (see struct definition for details). |
unstakeToSender
This function is a simplified version of unstake
that automatically sends the unstaked tokens to the caller (msg.sender).
Parameters
Name | Type | Description |
---|---|---|
|
| The ID of the lockup to be unstaked. |
Returns
Name | Type | Description |
---|---|---|
|
| A Lockup struct containing details about the unstaked lockup (see struct definition for details). |
stakeToSender
This function stakes a specified amount of tokens for the caller (msg.sender) for a defined duration.
Parameters
Name | Type | Description |
---|---|---|
|
| The amount of tokens to be staked. |
|
| The duration of the lockup period. |
Returns
Name | Type | Description |
---|---|---|
|
| A Lockup struct containing details about the newly created lockup (see struct definition for details). |
stake
This function stakes a specified amount of tokens for a defined duration, allowing the caller (msg.sender) to specify an optional recipient for the staked tokens.
Parameters
Name | Type | Description |
---|---|---|
|
| The amount of tokens to be staked. |
|
| The duration of the lockup period. |
|
| The address to which the staked tokens will be credited (optional, defaults to msg.sender). |
Returns
Name | Type | Description |
---|---|---|
|
| lockup A Lockup struct containing details about the newly created lockup (see struct definition for details). |
incentiveTotals
This function retrieves the total incentive information for a specific ERC-20 token.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the ERC20 token for which to retrieve incentive totals. |
Returns
Name | Type | Description |
---|---|---|
|
| totals A TokenIncentiveTotals struct containing details about the token's incentives (see struct definition for details). |
incentiveBatchCount
This function retrieves the total number of created incentive batches.
Returns
Name | Type | Description |
---|---|---|
|
| count The total number of incentive batches. |
claimInformation
This function retrieves claim information for a specific account and incentive batch index.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the account for which to retrieve claim information. |
|
| The index of the incentive batch for which to retrieve claim information. |
Returns
Name | Type | Description |
---|---|---|
|
| A ClaimInformation struct containing details about the account's claims for the specified batch (see struct definition for details). |
claimFromIncentiveBatchAndExtend
This function allows claiming rewards from a specific incentive batch while simultaneously extending a lockup with the claimed tokens.
Parameters
Name | Type | Description |
---|---|---|
|
| The index of the incentive batch from which to claim rewards. |
|
| The ID of the lockup to be extended with the claimed tokens. |
Returns
Name | Type | Description |
---|---|---|
|
| A Lockup struct containing details about the updated lockup after extension (see struct definition for details). |
|
| The amount of tokens claimed from the incentive batch. |
claimFromIncentiveBatch
This function allows claiming rewards from a specific incentive batch, without extending any lockups.
Parameters
Name | Type | Description |
---|---|---|
|
| The index of the incentive batch from which to claim rewards. |
Returns
Name | Type | Description |
---|---|---|
|
| A Lockup struct containing details about the user's lockup that might have been affected by the claim (see struct definition for details). |
|
| The amount of tokens claimed from the incentive batch. |
createIncentiveBatch
This function creates a new incentive batch for a specified amount of incentive tokens, timepoint, stake duration, and associated ERC-20 token. An incentive batch is a reward of incentives put up by the caller at a certain timepoint. The incentive batch is claimable by ve holders after the timepoint has passed. The ve holders will receive their incentive pro rata of their vote balance (pastbalanceOf
) at that timepoint. The incentivizer can specify that users have to stake the resulting incentive for a given stakeDuration
number of seconds. stakeDuration
can either be zero, meaning that no staking is required on redemption, or can be a number between MIN_STAKE_DURATION()
and MAX_STAKE_DURATION()
.
Parameters
Name | Type | Description |
---|---|---|
|
| The total amount of incentive tokens to be distributed in the batch. |
|
| The timepoint at which the incentive batch starts accruing rewards. |
|
| The duration of the lockup period required to be eligible for the incentive batch rewards. |
|
| The address of the ERC20 token used for the incentive rewards. |
Returns
Name | Type | Description |
---|---|---|
|
| The index of the newly created incentive batch. |
Events
Stake
Unstake
ExtenderApproval
ClaimIncentiveBatch
CreateNewIncentiveBatch
Errors
VotingEscrowTransferNotSupported
VotingEscrowInvalidAddress
VotingEscrowInvalidAmount
VotingEscrowInvalidDuration
VotingEscrowInvalidEndTime
VotingEscrowStakeStillLocked
VotingEscrowStakeAlreadRedeemed
VotingEscrowNotApprovedExtender
VotingEscrowIncentiveAlreadyClaimed
VotingEscrowNoIncentivesToClaim
VotingEscrowInvalidExtendIncentiveToken
Structs
Lockup
ClaimInformation
TokenIncentiveTotals
Last updated