Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f28ede6
Add Nonces contract
JulissaDantes Nov 14, 2022
1931d64
Remove permit from erc20votes
JulissaDantes Nov 15, 2022
cc25b3f
Update ERC20Permit contract
JulissaDantes Nov 15, 2022
39bd173
Update Changelog
JulissaDantes Nov 15, 2022
5df3792
Add Nonces dcumentation
JulissaDantes Nov 15, 2022
b9c425f
Update changelog with PR number
JulissaDantes Nov 16, 2022
485a322
Use Votes for ERC20Votes
JulissaDantes Nov 17, 2022
f40bf1c
Remove duplicate tests
JulissaDantes Nov 21, 2022
1c07a94
Fix Votes tests
JulissaDantes Nov 21, 2022
f4baabe
update changelog
JulissaDantes Nov 22, 2022
a7ec549
Update CHANGELOG.md
JulissaDantes Nov 25, 2022
8fab231
Merge branch 'next-v5.0' into refactor/erc20-votes
JulissaDantes Nov 25, 2022
5202e0d
Add test case
JulissaDantes Nov 25, 2022
0a2a857
Update test
JulissaDantes Nov 25, 2022
c140d72
Merge branch 'refactor/erc20-votes' of https://github.com/JulissaDant…
JulissaDantes Nov 25, 2022
cffa45c
Update tests
JulissaDantes Nov 25, 2022
f881aad
Merge branch 'next-v5.0' into refactor/erc20-votes
JulissaDantes Nov 25, 2022
390f04a
Add numCheckpoints
JulissaDantes Nov 28, 2022
b41574c
Add tests to ERC20VotesComp
JulissaDantes Nov 28, 2022
4cda6a0
Update template
JulissaDantes Nov 28, 2022
c2a9537
Update contracts/token/ERC20/extensions/ERC20Votes.sol
JulissaDantes Nov 29, 2022
6adfc96
Update contracts/token/ERC20/extensions/ERC20Votes.sol
JulissaDantes Nov 29, 2022
e31342b
Update contracts/utils/Checkpoints.sol
JulissaDantes Nov 29, 2022
3f001ad
update template
JulissaDantes Nov 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove permit from erc20votes
  • Loading branch information
JulissaDantes committed Nov 15, 2022
commit 1931d642f7411eb45509ea3d37f2b43cdc00eeed
2 changes: 1 addition & 1 deletion contracts/mocks/ERC20VotesCompMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity ^0.8.0;
import "../token/ERC20/extensions/ERC20VotesComp.sol";

contract ERC20VotesCompMock is ERC20VotesComp {
constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name) {}
constructor(string memory name, string memory symbol) ERC20(name, symbol) EIP712(name, "1") {}

function mint(address account, uint256 amount) public {
_mint(account, amount);
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ERC20VotesMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity ^0.8.0;
import "../token/ERC20/extensions/ERC20Votes.sol";

contract ERC20VotesMock is ERC20Votes {
constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name) {}
constructor(string memory name, string memory symbol) ERC20(name, symbol) EIP712(name, "1") {}

function mint(address account, uint256 amount) public {
_mint(account, amount);
Expand Down
6 changes: 4 additions & 2 deletions contracts/token/ERC20/extensions/ERC20Votes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

pragma solidity ^0.8.0;

import "./ERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/math/Math.sol";
import "../../../utils/Nonces.sol";
import "../../../governance/utils/IVotes.sol";
import "../../../utils/math/SafeCast.sol";
import "../../../utils/cryptography/EIP712.sol";
import "../../../utils/cryptography/ECDSA.sol";

/**
Expand All @@ -24,7 +26,7 @@ import "../../../utils/cryptography/ECDSA.sol";
*
* _Available since v4.2._
*/
abstract contract ERC20Votes is IVotes, ERC20Permit {
abstract contract ERC20Votes is ERC20, IVotes, Nonces, EIP712 {
struct Checkpoint {
uint32 fromBlock;
uint224 votes;
Expand Down
12 changes: 2 additions & 10 deletions test/token/ERC20/extensions/ERC20Votes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Wallet = require('ethereumjs-wallet').default;
const ERC20VotesMock = artifacts.require('ERC20VotesMock');

const { batchInBlock } = require('../../../helpers/txpool');
const { EIP712Domain, domainSeparator } = require('../../../helpers/eip712');
const { EIP712Domain } = require('../../../helpers/eip712');

const Delegation = [
{ name: 'delegatee', type: 'address' },
Expand All @@ -20,7 +20,7 @@ const Delegation = [
];

contract('ERC20Votes', function (accounts) {
const [ holder, recipient, holderDelegatee, recipientDelegatee, other1, other2 ] = accounts;
const [ holder, recipient, holderDelegatee, other1, other2 ] = accounts;

const name = 'My Token';
const symbol = 'MTKN';
Expand All @@ -40,14 +40,6 @@ contract('ERC20Votes', function (accounts) {
expect(await this.token.nonces(holder)).to.be.bignumber.equal('0');
});

it('domain separator', async function () {
expect(
await this.token.DOMAIN_SEPARATOR(),
).to.equal(
await domainSeparator(name, version, this.chainId, this.token.address),
);
});

it('minting restriction', async function () {
const amount = new BN('2').pow(new BN('224'));
await expectRevert(
Expand Down
14 changes: 3 additions & 11 deletions test/token/ERC20/extensions/ERC20VotesComp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const { BN, constants, expectEvent, expectRevert, time } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const { MAX_UINT256, ZERO_ADDRESS, ZERO_BYTES32 } = constants;
const { MAX_UINT256, ZERO_ADDRESS } = constants;

const { fromRpcSig } = require('ethereumjs-util');
const ethSigUtil = require('eth-sig-util');
Expand All @@ -11,7 +11,7 @@ const Wallet = require('ethereumjs-wallet').default;
const ERC20VotesCompMock = artifacts.require('ERC20VotesCompMock');

const { batchInBlock } = require('../../../helpers/txpool');
const { EIP712Domain, domainSeparator } = require('../../../helpers/eip712');
const { EIP712Domain } = require('../../../helpers/eip712');

const Delegation = [
{ name: 'delegatee', type: 'address' },
Expand All @@ -20,7 +20,7 @@ const Delegation = [
];

contract('ERC20VotesComp', function (accounts) {
const [ holder, recipient, holderDelegatee, recipientDelegatee, other1, other2 ] = accounts;
const [ holder, recipient, holderDelegatee, other1, other2 ] = accounts;

const name = 'My Token';
const symbol = 'MTKN';
Expand All @@ -40,14 +40,6 @@ contract('ERC20VotesComp', function (accounts) {
expect(await this.token.nonces(holder)).to.be.bignumber.equal('0');
});

it('domain separator', async function () {
expect(
await this.token.DOMAIN_SEPARATOR(),
).to.equal(
await domainSeparator(name, version, this.chainId, this.token.address),
);
});

it('minting restriction', async function () {
const amount = new BN('2').pow(new BN('96'));
await expectRevert(
Expand Down