HistoricalBalance

Inherits: ERC20Votes, IHistoricalBalance

Adds support for tracking historical balance on ERC20Votes (not just historical voting power) and adds support for contributing and retrieving incentives pro-rata of historical balanceOf.

Uses a timestamp-based clock for checkpoints as opposed to the default OZ implementation that is blocknumber based.

State Variables

_balanceOfCheckpoints

mapping(address account => Checkpoints.Trace208) private _balanceOfCheckpoints;

Functions

getPastBalanceOf

This function retrieves the historical balance of an account at a specific point in time.

function getPastBalanceOf(address account, uint256 timepoint) public view returns (uint256 balance);

Parameters

Name
Type
Description

account

address

The address of the account for which to retrieve the historical balance.

timepoint

uint256

The timepoint (block number or timestamp depending on implementation) at which to query the balance (uint256).

Returns

Name
Type
Description

balance

uint256

The balance of the account at the specified timepoint.

_update

clock

CLOCK_MODE

Machine-readable description of the clock as specified in ERC-6372.

__push

__add

__subtract

Last updated