Move the Checkpoints library to utils/structs (#4275)
This commit is contained in:
5
.changeset/fresh-birds-kiss.md
Normal file
5
.changeset/fresh-birds-kiss.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': major
|
||||
---
|
||||
|
||||
`Checkpoints`: library moved from `utils` to `utils/structs`
|
||||
@ -4,8 +4,8 @@
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "./GovernorVotes.sol";
|
||||
import "../../utils/Checkpoints.sol";
|
||||
import "../../utils/math/SafeCast.sol";
|
||||
import "../../utils/structs/Checkpoints.sol";
|
||||
|
||||
/**
|
||||
* @dev Extension of {Governor} for voting weight extraction from an {ERC20Votes} token and a quorum expressed as a
|
||||
|
||||
@ -5,8 +5,8 @@ pragma solidity ^0.8.0;
|
||||
import "../../interfaces/IERC5805.sol";
|
||||
import "../../utils/Context.sol";
|
||||
import "../../utils/Nonces.sol";
|
||||
import "../../utils/Checkpoints.sol";
|
||||
import "../../utils/cryptography/EIP712.sol";
|
||||
import "../../utils/structs/Checkpoints.sol";
|
||||
|
||||
/**
|
||||
* @dev This is a base abstract contract that tracks voting units, which are a measure of voting power that can be
|
||||
|
||||
@ -5,8 +5,8 @@ pragma solidity ^0.8.1;
|
||||
|
||||
import "../ERC721.sol";
|
||||
import "../../../interfaces/IERC2309.sol";
|
||||
import "../../../utils/Checkpoints.sol";
|
||||
import "../../../utils/structs/BitMaps.sol";
|
||||
import "../../../utils/structs/Checkpoints.sol";
|
||||
|
||||
/**
|
||||
* @dev Implementation of the ERC2309 "Consecutive Transfer Extension" as defined in
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Checkpoints.sol)
|
||||
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/Checkpoints.sol)
|
||||
// This file was procedurally generated from scripts/generate/templates/Checkpoints.js.
|
||||
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "./math/Math.sol";
|
||||
import "./math/SafeCast.sol";
|
||||
import "../math/Math.sol";
|
||||
import "../math/SafeCast.sol";
|
||||
|
||||
/**
|
||||
* @dev This library defines the `History` struct, for checkpointing values as they change at different points in
|
||||
@ -35,7 +35,7 @@ for (const [file, template] of Object.entries({
|
||||
'utils/math/SafeCast.sol': './templates/SafeCast.js',
|
||||
'utils/structs/EnumerableSet.sol': './templates/EnumerableSet.js',
|
||||
'utils/structs/EnumerableMap.sol': './templates/EnumerableMap.js',
|
||||
'utils/Checkpoints.sol': './templates/Checkpoints.js',
|
||||
'utils/structs/Checkpoints.sol': './templates/Checkpoints.js',
|
||||
'utils/StorageSlot.sol': './templates/StorageSlot.js',
|
||||
})) {
|
||||
generateFromTemplate(file, template, './contracts/');
|
||||
@ -43,7 +43,7 @@ for (const [file, template] of Object.entries({
|
||||
|
||||
// Tests
|
||||
for (const [file, template] of Object.entries({
|
||||
'utils/Checkpoints.t.sol': './templates/Checkpoints.t.js',
|
||||
'utils/structs/Checkpoints.t.sol': './templates/Checkpoints.t.js',
|
||||
})) {
|
||||
generateFromTemplate(file, template, './test/');
|
||||
}
|
||||
|
||||
@ -5,8 +5,8 @@ const { OPTS } = require('./Checkpoints.opts.js');
|
||||
const header = `\
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "./math/Math.sol";
|
||||
import "./math/SafeCast.sol";
|
||||
import "../math/Math.sol";
|
||||
import "../math/SafeCast.sol";
|
||||
|
||||
/**
|
||||
* @dev This library defines the \`History\` struct, for checkpointing values as they change at different points in
|
||||
|
||||
@ -7,8 +7,8 @@ const header = `\
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "forge-std/Test.sol";
|
||||
import "../../contracts/utils/Checkpoints.sol";
|
||||
import "../../contracts/utils/math/SafeCast.sol";
|
||||
import "../../../contracts/utils/math/SafeCast.sol";
|
||||
import "../../../contracts/utils/structs/Checkpoints.sol";
|
||||
`;
|
||||
|
||||
/* eslint-disable max-len */
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "forge-std/Test.sol";
|
||||
import "../../contracts/utils/Checkpoints.sol";
|
||||
import "../../contracts/utils/math/SafeCast.sol";
|
||||
import "../../../contracts/utils/math/SafeCast.sol";
|
||||
import "../../../contracts/utils/structs/Checkpoints.sol";
|
||||
|
||||
contract CheckpointsTrace224Test is Test {
|
||||
using Checkpoints for Checkpoints.Trace224;
|
||||
@ -1,7 +1,7 @@
|
||||
const { expectRevert } = require('@openzeppelin/test-helpers');
|
||||
const { expect } = require('chai');
|
||||
|
||||
const { VALUE_SIZES } = require('../../scripts/generate/templates/Checkpoints.opts.js');
|
||||
const { VALUE_SIZES } = require('../../../scripts/generate/templates/Checkpoints.opts.js');
|
||||
|
||||
const $Checkpoints = artifacts.require('$Checkpoints');
|
||||
|
||||
Reference in New Issue
Block a user