Fix lookup documentation in ERC20Votes and Checkpoints (#4218)

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
ToonVanHove
2023-05-05 22:25:23 +02:00
committed by GitHub
parent 72ed4ca67a
commit 692d8c85a4
3 changed files with 18 additions and 18 deletions

View File

@ -46,7 +46,7 @@ function push(
}
/**
* @dev Returns the value in the oldest checkpoint with key greater or equal than the search key, or zero if there is none.
* @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if there is none.
*/
function lowerLookup(${opts.historyTypeName} storage self, ${opts.keyTypeName} key) internal view returns (${opts.valueTypeName}) {
uint256 len = self.${opts.checkpointFieldName}.length;
@ -55,7 +55,7 @@ function lowerLookup(${opts.historyTypeName} storage self, ${opts.keyTypeName} k
}
/**
* @dev Returns the value in the most recent checkpoint with key lower or equal than the search key.
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key.
*/
function upperLookup(${opts.historyTypeName} storage self, ${opts.keyTypeName} key) internal view returns (${opts.valueTypeName}) {
uint256 len = self.${opts.checkpointFieldName}.length;
@ -64,7 +64,7 @@ function upperLookup(${opts.historyTypeName} storage self, ${opts.keyTypeName} k
}
/**
* @dev Returns the value in the most recent checkpoint with key lower or equal than the search key.
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key.
*
* NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high keys).
*/
@ -227,7 +227,7 @@ function _insert(
}
/**
* @dev Return the index of the oldest checkpoint whose key is greater than the search key, or \`high\` if there is none.
* @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or \`high\` if there is none.
* \`low\` and \`high\` define a section where to do the search, with inclusive \`low\` and exclusive \`high\`.
*
* WARNING: \`high\` should not be greater than the array's length.
@ -250,7 +250,7 @@ function _upperBinaryLookup(
}
/**
* @dev Return the index of the oldest checkpoint whose key is greater or equal than the search key, or \`high\` if there is none.
* @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or \`high\` if there is none.
* \`low\` and \`high\` define a section where to do the search, with inclusive \`low\` and exclusive \`high\`.
*
* WARNING: \`high\` should not be greater than the array's length.