This function retrieves the details of a specific lockup for a given staker and lockup index.
Parameters
Name
Type
Description
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
Name
Type
Description
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.
Parameters
Name
Type
Description
staker
address
The address of the staker for which to retrieve the lockup count.
Returns
Name
Type
Description
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.
Parameters
Name
Type
Description
amount
uint128
The amount of tokens to be locked.
duration
uint256
The duration of the lockup period.
Returns
Name
Type
Description
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.
Parameters
Name
Type
Description
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.
Parameters
Name
Type
Description
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.
Parameters
Name
Type
Description
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
Name
Type
Description
<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.
Parameters
Name
Type
Description
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
Name
Type
Description
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.
Parameters
Name
Type
Description
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
Name
Type
Description
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.
Parameters
Name
Type
Description
lockupIds
uint256[]
An array containing the IDs of the lockups to be merged.
Returns
Name
Type
Description
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.
Parameters
Name
Type
Description
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
Name
Type
Description
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).
Parameters
Name
Type
Description
lockupId
uint256
The ID of the lockup to be unstaked.
Returns
Name
Type
Description
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.
Parameters
Name
Type
Description
amount
uint128
The amount of tokens to be staked.
duration
uint256
The duration of the lockup period.
Returns
Name
Type
Description
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.
Parameters
Name
Type
Description
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
Name
Type
Description
<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.
Parameters
Name
Type
Description
token
IERC20
The address of the ERC20 token for which to retrieve incentive totals.
Returns
Name
Type
Description
<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.
Returns
Name
Type
Description
<none>
uint256
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
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
Name
Type
Description
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.
Parameters
Name
Type
Description
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
Name
Type
Description
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.
Parameters
Name
Type
Description
batchIndex
uint256
The index of the incentive batch from which to claim rewards.
Returns
Name
Type
Description
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().
Parameters
Name
Type
Description
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.