Fix lookup documentation in ERC20Votes and Checkpoints (#4218)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
@ -114,7 +114,7 @@ abstract contract ERC20Votes is ERC20Permit, IERC5805 {
|
||||
* @dev Lookup a value in a list of (sorted) checkpoints.
|
||||
*/
|
||||
function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 timepoint) private view returns (uint256) {
|
||||
// We run a binary search to look for the earliest checkpoint taken after `timepoint`.
|
||||
// We run a binary search to look for the last (most recent) checkpoint taken before (or at) `timepoint`.
|
||||
//
|
||||
// Initially we check if the block is recent to narrow the search range.
|
||||
// During the loop, the index of the wanted checkpoint remains in the range [low-1, high).
|
||||
|
||||
Reference in New Issue
Block a user