Implement recommendations from 5.0 audit Phase 1A (#4398)
Co-authored-by: Francisco Giordano <fg@frang.io> Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
@ -6,13 +6,12 @@ const header = `\
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
import {Math} from "../math/Math.sol";
|
||||
import {SafeCast} from "../math/SafeCast.sol";
|
||||
|
||||
/**
|
||||
* @dev This library defines the \`History\` struct, for checkpointing values as they change at different points in
|
||||
* @dev This library defines the \`Trace*\` struct, for checkpointing values as they change at different points in
|
||||
* time, and later looking up past values by block number. See {Votes} as an example.
|
||||
*
|
||||
* To create a history of checkpoints define a variable type \`Checkpoints.History\` in your contract, and store a new
|
||||
* To create a history of checkpoints define a variable type \`Checkpoints.Trace*\` in your contract, and store a new
|
||||
* checkpoint for the current transaction block using the {push} function.
|
||||
*
|
||||
* _Available since v4.5._
|
||||
@ -40,6 +39,8 @@ struct ${opts.checkpointTypeName} {
|
||||
* @dev Pushes a (\`key\`, \`value\`) pair into a ${opts.historyTypeName} so that it is stored as the checkpoint.
|
||||
*
|
||||
* Returns previous value and new value.
|
||||
*
|
||||
* IMPORTANT: Never accept \`key\` as a user input, since an arbitrary \`type(${opts.keyTypeName}).max\` key set will disable the library.
|
||||
*/
|
||||
function push(
|
||||
${opts.historyTypeName} storage self,
|
||||
|
||||
Reference in New Issue
Block a user