IMaverickV2VotingEscrowBase
Inherits: IVotes, IHistoricalBalance
Functions
MIN_STAKE_DURATION
function MIN_STAKE_DURATION() external returns (uint256 duration);
MAX_STAKE_DURATION
function MAX_STAKE_DURATION() external returns (uint256 duration);
YEAR_BASE
function YEAR_BASE() external returns (uint256);
baseToken
This function retrieves the address of the ERC20 token used as the base token for staking and rewards.
function baseToken() external returns (IERC20);
Returns
<none>
IERC20
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.
function startTimestamp() external returns (uint256 timestamp);
getLockup
This function retrieves the details of a specific lockup for a given staker and lockup index.
function getLockup(address staker, uint256 index) external view returns (Lockup memory lockup);
Parameters
staker
address
The address of the staker for which to retrieve the lockup details.
index
uint256
The index of the lockup within the staker's lockup history.
Returns
lockup
Lockup
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.
function lockupCount(address staker) external view returns (uint256 count);
Parameters
staker
address
The address of the staker for which to retrieve the lockup count.
Returns
count
uint256
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.
function previewVotes(uint128 amount, uint256 duration) external view returns (Lockup memory lockup);
Parameters
amount
uint128
The amount of tokens to be locked.
duration
uint256
The duration of the lockup period.
Returns
lockup
Lockup
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.
function approveExtender(address extender, uint256 lockupId) external;
Parameters
extender
address
The address of the extender contract to be approved.
lockupId
uint256
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.
function revokeExtender(address extender, uint256 lockupId) external;
Parameters
extender
address
The address of the extender contract whose approval is being revoked.
lockupId
uint256
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.
function isApprovedExtender(address account, address extender, uint256 lockupId) external view returns (bool);
Parameters
account
address
The address of the account to check for approval (may be the extender or another account).
extender
address
The address of the extender contract for which to check approval.
lockupId
uint256
The ID of the lockup to verify approval for.
Returns
<none>
bool
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.
function extendForSender(uint256 lockupId, uint256 duration, uint128 amount)
external
returns (Lockup memory newLockup);
Parameters
lockupId
uint256
The ID of the lockup to be extended.
duration
uint256
The additional duration to extend the lockup by.
amount
uint128
The additional amount of tokens to be locked.
Returns
newLockup
Lockup
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.
function extendForAccount(address account, uint256 lockupId, uint256 duration, uint128 amount)
external
returns (Lockup memory newLockup);
Parameters
account
address
The address of the account whose lockup is being extended.
lockupId
uint256
The ID of the lockup to be extended.
duration
uint256
The additional duration to extend the lockup by.
amount
uint128
The additional amount of tokens to be locked.
Returns
newLockup
Lockup
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.
function merge(uint256[] memory lockupIds) external returns (Lockup memory newLockup);
Parameters
lockupIds
uint256[]
An array containing the IDs of the lockups to be merged.
Returns
newLockup
Lockup
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.
function unstake(uint256 lockupId, address to) external returns (Lockup memory lockup);
Parameters
lockupId
uint256
The ID of the lockup to be unstaked.
to
address
The address to which the unstaked tokens should be sent (optional, defaults to msg.sender).
Returns
lockup
Lockup
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).
function unstakeToSender(uint256 lockupId) external returns (Lockup memory lockup);
Parameters
lockupId
uint256
The ID of the lockup to be unstaked.
Returns
lockup
Lockup
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.
function stakeToSender(uint128 amount, uint256 duration) external returns (Lockup memory lockup);
Parameters
amount
uint128
The amount of tokens to be staked.
duration
uint256
The duration of the lockup period.
Returns
lockup
Lockup
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.
function stake(uint128 amount, uint256 duration, address to) external returns (Lockup memory);
Parameters
amount
uint128
The amount of tokens to be staked.
duration
uint256
The duration of the lockup period.
to
address
The address to which the staked tokens will be credited (optional, defaults to msg.sender).
Returns
<none>
Lockup
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.
function incentiveTotals(IERC20 token) external view returns (TokenIncentiveTotals memory);
Parameters
token
IERC20
The address of the ERC20 token for which to retrieve incentive totals.
Returns
<none>
TokenIncentiveTotals
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.
function incentiveBatchCount() external view returns (uint256);
Returns
<none>
uint256
count The total number of incentive batches.
claimInformation
This function retrieves claim information for a specific account and incentive batch index.
function claimInformation(address account, uint256 batchIndex) external view returns (ClaimInformation memory info);
Parameters
account
address
The address of the account for which to retrieve claim information.
batchIndex
uint256
The index of the incentive batch for which to retrieve claim information.
Returns
info
ClaimInformation
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.
function claimFromIncentiveBatchAndExtend(uint256 batchIndex, uint256 lockupId)
external
returns (Lockup memory lockup, uint128 claimAmount);
Parameters
batchIndex
uint256
The index of the incentive batch from which to claim rewards.
lockupId
uint256
The ID of the lockup to be extended with the claimed tokens.
Returns
lockup
Lockup
A Lockup struct containing details about the updated lockup after extension (see struct definition for details).
claimAmount
uint128
The amount of tokens claimed from the incentive batch.
claimFromIncentiveBatch
This function allows claiming rewards from a specific incentive batch, without extending any lockups.
function claimFromIncentiveBatch(uint256 batchIndex) external returns (Lockup memory lockup, uint128 claimAmount);
Parameters
batchIndex
uint256
The index of the incentive batch from which to claim rewards.
Returns
lockup
Lockup
A Lockup struct containing details about the user's lockup that might have been affected by the claim (see struct definition for details).
claimAmount
uint128
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()
.
function createIncentiveBatch(uint128 amount, uint48 timepoint, uint128 stakeDuration, IERC20 incentiveToken)
external
returns (uint256 index);
Parameters
amount
uint128
The total amount of incentive tokens to be distributed in the batch.
timepoint
uint48
The timepoint at which the incentive batch starts accruing rewards.
stakeDuration
uint128
The duration of the lockup period required to be eligible for the incentive batch rewards.
incentiveToken
IERC20
The address of the ERC20 token used for the incentive rewards.
Returns
index
uint256
The index of the newly created incentive batch.
Events
Stake
event Stake(address indexed user, uint256 lockupId, Lockup);
Unstake
event Unstake(address indexed user, uint256 lockupId, Lockup);
ExtenderApproval
event ExtenderApproval(address staker, address extender, uint256 lockupId, bool newState);
ClaimIncentiveBatch
event ClaimIncentiveBatch(uint256 batchIndex, address account, uint256 claimAmount);
CreateNewIncentiveBatch
event CreateNewIncentiveBatch(
address user, uint256 amount, uint256 timepoint, uint256 stakeDuration, IERC20 incentiveToken
);
Errors
VotingEscrowTransferNotSupported
error VotingEscrowTransferNotSupported();
VotingEscrowInvalidAddress
error VotingEscrowInvalidAddress(address);
VotingEscrowInvalidAmount
error VotingEscrowInvalidAmount(uint256);
VotingEscrowInvalidDuration
error VotingEscrowInvalidDuration(uint256 duration, uint256 minDuration, uint256 maxDuration);
VotingEscrowInvalidEndTime
error VotingEscrowInvalidEndTime(uint256 newEnd, uint256 oldEnd);
VotingEscrowStakeStillLocked
error VotingEscrowStakeStillLocked(uint256 currentTime, uint256 endTime);
VotingEscrowStakeAlreadRedeemed
error VotingEscrowStakeAlreadRedeemed();
VotingEscrowNotApprovedExtender
error VotingEscrowNotApprovedExtender(address account, address extender, uint256 lockupId);
VotingEscrowIncentiveAlreadyClaimed
error VotingEscrowIncentiveAlreadyClaimed(address account, uint256 batchIndex);
VotingEscrowNoIncentivesToClaim
error VotingEscrowNoIncentivesToClaim(address account, uint256 batchIndex);
VotingEscrowInvalidExtendIncentiveToken
error VotingEscrowInvalidExtendIncentiveToken(IERC20 incentiveToken);
Structs
Lockup
struct Lockup {
uint128 amount;
uint128 end;
uint256 votes;
}
ClaimInformation
struct ClaimInformation {
bool hasClaimed;
uint128 claimAmount;
uint256 stakeDuration;
IERC20 incentiveToken;
}
TokenIncentiveTotals
struct TokenIncentiveTotals {
uint128 totalIncentives;
uint128 claimedIncentives;
}
Last updated