Skip to content

Commit ca6feb3

Browse files
committed
Rename VotesAdditionalCheckpoints to VotesExtended
1 parent 99bfb73 commit ca6feb3

File tree

9 files changed

+21
-27
lines changed

9 files changed

+21
-27
lines changed

.changeset/great-lions-hear.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'openzeppelin-solidity': patch
33
---
44

5-
`VotesAdditionalCheckpoints`: Create an extension of `Votes` which checkpoints balances and delegates.
5+
`VotesExtended`: Create an extension of `Votes` which checkpoints balances and delegates.

contracts/governance/README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ NOTE: Functions of the `Governor` contract do not include access control. If you
9292

9393
{{Votes}}
9494

95-
{{VotesAdditionalCheckpoints}}
95+
{{VotesExtended}}
9696

9797
== Timelock
9898

contracts/governance/extensions/GovernorCountingOverridable.sol

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ pragma solidity ^0.8.20;
44

55
import {SignatureChecker} from "../../utils/cryptography/SignatureChecker.sol";
66
import {SafeCast} from "../../utils/math/SafeCast.sol";
7-
import {VotesAdditionalCheckpoints} from "../utils/VotesAdditionalCheckpoints.sol";
7+
import {VotesExtended} from "../utils/VotesExtended.sol";
88
import {GovernorVotes} from "./GovernorVotes.sol";
99

1010
/**
1111
* @dev Extension of {Governor} which enables delegatees to override the vote of their delegates. This module requires a
12-
* token token that inherits `VotesAdditionalCheckpoints`.
12+
* token token that inherits `VotesExtended`.
1313
*/
1414
abstract contract GovernorCountingOverridable is GovernorVotes {
1515
bytes32 public constant OVERRIDE_BALLOT_TYPEHASH =
@@ -133,11 +133,8 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
133133
}
134134

135135
uint256 proposalSnapshot = proposalSnapshot(proposalId);
136-
uint256 overridenWeight = VotesAdditionalCheckpoints(address(token())).getPastBalanceOf(
137-
account,
138-
proposalSnapshot
139-
);
140-
address delegate = VotesAdditionalCheckpoints(address(token())).getPastDelegate(account, proposalSnapshot);
136+
uint256 overridenWeight = VotesExtended(address(token())).getPastBalanceOf(account, proposalSnapshot);
137+
address delegate = VotesExtended(address(token())).getPastDelegate(account, proposalSnapshot);
141138
uint8 delegateCasted = proposalVote.voteReceipt[delegate].casted;
142139

143140
proposalVote.voteReceipt[account].hasOverriden = true;

contracts/governance/utils/VotesAdditionalCheckpoints.sol renamed to contracts/governance/utils/VotesExtended.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {SafeCast} from "../../utils/math/SafeCast.sol";
88
/**
99
* @dev Extension of {Votes} that adds exposes checkpoints for delegations and balances.
1010
*/
11-
abstract contract VotesAdditionalCheckpoints is Votes {
11+
abstract contract VotesExtended is Votes {
1212
using SafeCast for uint256;
1313
using Checkpoints for Checkpoints.Trace160;
1414
using Checkpoints for Checkpoints.Trace208;

contracts/mocks/VotesAdditionalCheckpointsMock.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
pragma solidity ^0.8.20;
44

5-
import {VotesAdditionalCheckpoints} from "../governance/utils/VotesAdditionalCheckpoints.sol";
5+
import {VotesExtended} from "../governance/utils/VotesExtended.sol";
66

7-
abstract contract VotesAdditionalCheckpointsMock is VotesAdditionalCheckpoints {
7+
abstract contract VotesExtendedMock is VotesExtended {
88
mapping(address voter => uint256) private _votingUnits;
99

1010
function getTotalSupply() public view returns (uint256) {
@@ -30,7 +30,7 @@ abstract contract VotesAdditionalCheckpointsMock is VotesAdditionalCheckpoints {
3030
}
3131
}
3232

33-
abstract contract VotesAdditionalCheckpointsTimestampMock is VotesAdditionalCheckpointsMock {
33+
abstract contract VotesExtendedTimestampMock is VotesExtendedMock {
3434
function clock() public view override returns (uint48) {
3535
return uint48(block.timestamp);
3636
}

contracts/mocks/governance/GovernorCountingOverridableMock.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pragma solidity ^0.8.20;
55
import {Governor} from "../../governance/Governor.sol";
66
import {GovernorSettings} from "../../governance/extensions/GovernorSettings.sol";
77
import {GovernorVotesQuorumFraction} from "../../governance/extensions/GovernorVotesQuorumFraction.sol";
8-
import {GovernorCountingOverridable, VotesAdditionalCheckpoints} from "../../governance/extensions/GovernorCountingOverridable.sol";
8+
import {GovernorCountingOverridable, VotesExtended} from "../../governance/extensions/GovernorCountingOverridable.sol";
99

1010
abstract contract GovernorCountingOverridableMock is
1111
GovernorSettings,

contracts/mocks/token/ERC20VotesAdditionalCheckpointsMock.sol

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,24 @@
22
pragma solidity ^0.8.20;
33

44
import {ERC20Votes} from "../../token/ERC20/extensions/ERC20Votes.sol";
5-
import {VotesAdditionalCheckpoints, Votes} from "../../governance/utils/VotesAdditionalCheckpoints.sol";
5+
import {VotesExtended, Votes} from "../../governance/utils/VotesExtended.sol";
66
import {SafeCast} from "../../utils/math/SafeCast.sol";
77

8-
abstract contract ERC20VotesAdditionalCheckpointsMock is ERC20Votes, VotesAdditionalCheckpoints {
9-
function _delegate(
10-
address account,
11-
address delegatee
12-
) internal virtual override(Votes, VotesAdditionalCheckpoints) {
8+
abstract contract ERC20VotesExtendedMock is ERC20Votes, VotesExtended {
9+
function _delegate(address account, address delegatee) internal virtual override(Votes, VotesExtended) {
1310
return super._delegate(account, delegatee);
1411
}
1512

1613
function _transferVotingUnits(
1714
address from,
1815
address to,
1916
uint256 amount
20-
) internal virtual override(Votes, VotesAdditionalCheckpoints) {
17+
) internal virtual override(Votes, VotesExtended) {
2118
return super._transferVotingUnits(from, to, amount);
2219
}
2320
}
2421

25-
abstract contract ERC20VotesAdditionalCheckpointsTimestampMock is ERC20VotesAdditionalCheckpointsMock {
22+
abstract contract ERC20VotesExtendedTimestampMock is ERC20VotesExtendedMock {
2623
function clock() public view virtual override returns (uint48) {
2724
return SafeCast.toUint48(block.timestamp);
2825
}

test/governance/extensions/GovernorCountingOverridable.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const { getDomain, OverrideBallot } = require('../../helpers/eip712');
77
const { VoteType } = require('../../helpers/enums');
88

99
const TOKENS = [
10-
{ Token: '$ERC20VotesAdditionalCheckpointsMock', mode: 'blocknumber' },
11-
// { Token: '$ERC20VotesOverridableTimestampMock', mode: 'timestamp' },
10+
{ Token: '$ERC20VotesExtendedMock', mode: 'blocknumber' },
11+
// { Token: '$ERC20VotesExtendedTimestampMock', mode: 'timestamp' },
1212
];
1313

1414
const name = 'Override Governor';

test/governance/utils/VotesAdditionalCheckpoints.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ const time = require('../../helpers/time');
99
const { shouldBehaveLikeVotes } = require('./Votes.behavior');
1010

1111
const MODES = {
12-
blocknumber: '$VotesAdditionalCheckpointsMock',
13-
timestamp: '$VotesAdditionalCheckpointsTimestampMock',
12+
blocknumber: '$VotesExtendedMock',
13+
timestamp: '$VotesExtendedTimestampMock',
1414
};
1515

1616
const AMOUNTS = [ethers.parseEther('10000000'), 10n, 20n];
1717

18-
describe('VotesAdditionalCheckpoints', function () {
18+
describe('VotesExtended', function () {
1919
for (const [mode, artifact] of Object.entries(MODES)) {
2020
const fixture = async () => {
2121
const accounts = await ethers.getSigners();

0 commit comments

Comments
 (0)