MaverickV2VotingEscrow

Inherits: VotingEscrow

Provides staking, vote power history, vote delegation, and incentive disbursement to ve holders.

VotingEscrow contract provides details on the staking and delegation features.

Incentive disbursement can take place in any token and happens when a user permissionlessly 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().

State Variables

_incentiveBatches

mapping(uint256 => IncentiveSpecification) private _incentiveBatches;

_tokenIncentiveTotals

mapping(IERC20 => TokenIncentiveTotals) private _tokenIncentiveTotals;

incentiveBatchCount

This function retrieves the total number of created incentive batches.

uint256 public incentiveBatchCount;

Functions

constructor

constructor(string memory __name, string memory __symbol) VotingEscrow(__name, __symbol);

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)
    public
    returns (uint256 index);

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.

Returns

Name
Type
Description

index

uint256

The index of the newly created incentive batch.

claimFromIncentiveBatch

This function allows claiming rewards from a specific incentive batch, without extending any lockups.

function claimFromIncentiveBatch(uint256 batchIndex) public returns (Lockup memory lockup, uint128 claimAmount);

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.

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)
    public
    returns (Lockup memory lockup, uint128 claimAmount);

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.

incentiveTotals

This function retrieves the total incentive information for a specific ERC-20 token.

function incentiveTotals(IERC20 incentiveToken) external view returns (TokenIncentiveTotals memory totals);

Parameters

Name
Type
Description

incentiveToken

IERC20

Returns

Name
Type
Description

totals

TokenIncentiveTotals

A TokenIncentiveTotals struct containing details about the token's incentives (see struct definition for details).

claimInformation

This function retrieves claim information for a specific account and incentive batch index.

function claimInformation(address account, uint256 batchIndex) public view returns (ClaimInformation memory info);

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).

_claim

function _claim(uint256 batchIndex)
    internal
    returns (uint128 claimAmount, uint256 stakeDuration, IERC20 incentiveToken);

Structs

IncentiveSpecification

struct IncentiveSpecification {
    uint128 totalIncentives;
    uint128 stakeDuration;
    uint48 claimTimepoint;
    IERC20 incentiveToken;
    mapping(address => bool) hasClaimed;
}

Last updated