Commit 1fa77bec by github-actions

Merge upstream openzeppelin-contracts into upstream-patched

parents 52153827 e4696f73
# Changelog # Changelog
## Unreleased
* `ERC2771Context`: use private variable from storage to store the forwarder address. Fixes issues where `_msgSender()` was not callable from constructors. ([#2754](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2754))
## 4.2.0 (2021-06-30) ## 4.2.0 (2021-06-30)
* `ERC20Votes`: add a new extension of the `ERC20` token with support for voting snapshots and delegation. ([#2632](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2632)) * `ERC20Votes`: add a new extension of the `ERC20` token with support for voting snapshots and delegation. ([#2632](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2632))
......
...@@ -8,7 +8,7 @@ import "../utils/Context.sol"; ...@@ -8,7 +8,7 @@ import "../utils/Context.sol";
* @dev Context variant with ERC2771 support. * @dev Context variant with ERC2771 support.
*/ */
abstract contract ERC2771Context is Context { abstract contract ERC2771Context is Context {
address immutable _trustedForwarder; address private _trustedForwarder;
constructor(address trustedForwarder) { constructor(address trustedForwarder) {
_trustedForwarder = trustedForwarder; _trustedForwarder = trustedForwarder;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -45,10 +45,10 @@ contract('ERC20FlashMint', function (accounts) { ...@@ -45,10 +45,10 @@ contract('ERC20FlashMint', function (accounts) {
const receiver = await ERC3156FlashBorrowerMock.new(true, true); const receiver = await ERC3156FlashBorrowerMock.new(true, true);
const { tx } = await this.token.flashLoan(receiver.address, this.token.address, loanAmount, '0x'); const { tx } = await this.token.flashLoan(receiver.address, this.token.address, loanAmount, '0x');
expectEvent.inTransaction(tx, this.token, 'Transfer', { from: ZERO_ADDRESS, to: receiver.address, value: loanAmount }); await expectEvent.inTransaction(tx, this.token, 'Transfer', { from: ZERO_ADDRESS, to: receiver.address, value: loanAmount });
expectEvent.inTransaction(tx, this.token, 'Transfer', { from: receiver.address, to: ZERO_ADDRESS, value: loanAmount }); await expectEvent.inTransaction(tx, this.token, 'Transfer', { from: receiver.address, to: ZERO_ADDRESS, value: loanAmount });
expectEvent.inTransaction(tx, receiver, 'BalanceOf', { token: this.token.address, account: receiver.address, value: loanAmount }); await expectEvent.inTransaction(tx, receiver, 'BalanceOf', { token: this.token.address, account: receiver.address, value: loanAmount });
expectEvent.inTransaction(tx, receiver, 'TotalSupply', { token: this.token.address, value: initialSupply.add(loanAmount) }); await expectEvent.inTransaction(tx, receiver, 'TotalSupply', { token: this.token.address, value: initialSupply.add(loanAmount) });
expect(await this.token.totalSupply()).to.be.bignumber.equal(initialSupply); expect(await this.token.totalSupply()).to.be.bignumber.equal(initialSupply);
expect(await this.token.balanceOf(receiver.address)).to.be.bignumber.equal('0'); expect(await this.token.balanceOf(receiver.address)).to.be.bignumber.equal('0');
......
...@@ -52,7 +52,7 @@ async function batchInBlock (txs) { ...@@ -52,7 +52,7 @@ async function batchInBlock (txs) {
} }
} }
contract('ERC20Votes', function (accounts) { contract('ERC20VotesComp', function (accounts) {
const [ holder, recipient, holderDelegatee, recipientDelegatee, other1, other2 ] = accounts; const [ holder, recipient, holderDelegatee, recipientDelegatee, other1, other2 ] = accounts;
const name = 'My Token'; const name = 'My Token';
......
...@@ -44,12 +44,12 @@ contract('ERC20', function (accounts) { ...@@ -44,12 +44,12 @@ contract('ERC20', function (accounts) {
it('valid', async function () { it('valid', async function () {
await this.underlying.approve(this.token.address, initialSupply, { from: initialHolder }); await this.underlying.approve(this.token.address, initialSupply, { from: initialHolder });
const { tx } = await this.token.depositFor(initialHolder, initialSupply, { from: initialHolder }); const { tx } = await this.token.depositFor(initialHolder, initialSupply, { from: initialHolder });
expectEvent.inTransaction(tx, this.underlying, 'Transfer', { await expectEvent.inTransaction(tx, this.underlying, 'Transfer', {
from: initialHolder, from: initialHolder,
to: this.token.address, to: this.token.address,
value: initialSupply, value: initialSupply,
}); });
expectEvent.inTransaction(tx, this.token, 'Transfer', { await expectEvent.inTransaction(tx, this.token, 'Transfer', {
from: ZERO_ADDRESS, from: ZERO_ADDRESS,
to: initialHolder, to: initialHolder,
value: initialSupply, value: initialSupply,
...@@ -74,12 +74,12 @@ contract('ERC20', function (accounts) { ...@@ -74,12 +74,12 @@ contract('ERC20', function (accounts) {
it('to other account', async function () { it('to other account', async function () {
await this.underlying.approve(this.token.address, initialSupply, { from: initialHolder }); await this.underlying.approve(this.token.address, initialSupply, { from: initialHolder });
const { tx } = await this.token.depositFor(anotherAccount, initialSupply, { from: initialHolder }); const { tx } = await this.token.depositFor(anotherAccount, initialSupply, { from: initialHolder });
expectEvent.inTransaction(tx, this.underlying, 'Transfer', { await expectEvent.inTransaction(tx, this.underlying, 'Transfer', {
from: initialHolder, from: initialHolder,
to: this.token.address, to: this.token.address,
value: initialSupply, value: initialSupply,
}); });
expectEvent.inTransaction(tx, this.token, 'Transfer', { await expectEvent.inTransaction(tx, this.token, 'Transfer', {
from: ZERO_ADDRESS, from: ZERO_ADDRESS,
to: anotherAccount, to: anotherAccount,
value: initialSupply, value: initialSupply,
...@@ -104,12 +104,12 @@ contract('ERC20', function (accounts) { ...@@ -104,12 +104,12 @@ contract('ERC20', function (accounts) {
const value = new BN(42); const value = new BN(42);
const { tx } = await this.token.withdrawTo(initialHolder, value, { from: initialHolder }); const { tx } = await this.token.withdrawTo(initialHolder, value, { from: initialHolder });
expectEvent.inTransaction(tx, this.underlying, 'Transfer', { await expectEvent.inTransaction(tx, this.underlying, 'Transfer', {
from: this.token.address, from: this.token.address,
to: initialHolder, to: initialHolder,
value: value, value: value,
}); });
expectEvent.inTransaction(tx, this.token, 'Transfer', { await expectEvent.inTransaction(tx, this.token, 'Transfer', {
from: initialHolder, from: initialHolder,
to: ZERO_ADDRESS, to: ZERO_ADDRESS,
value: value, value: value,
...@@ -118,12 +118,12 @@ contract('ERC20', function (accounts) { ...@@ -118,12 +118,12 @@ contract('ERC20', function (accounts) {
it('entire balance', async function () { it('entire balance', async function () {
const { tx } = await this.token.withdrawTo(initialHolder, initialSupply, { from: initialHolder }); const { tx } = await this.token.withdrawTo(initialHolder, initialSupply, { from: initialHolder });
expectEvent.inTransaction(tx, this.underlying, 'Transfer', { await expectEvent.inTransaction(tx, this.underlying, 'Transfer', {
from: this.token.address, from: this.token.address,
to: initialHolder, to: initialHolder,
value: initialSupply, value: initialSupply,
}); });
expectEvent.inTransaction(tx, this.token, 'Transfer', { await expectEvent.inTransaction(tx, this.token, 'Transfer', {
from: initialHolder, from: initialHolder,
to: ZERO_ADDRESS, to: ZERO_ADDRESS,
value: initialSupply, value: initialSupply,
...@@ -132,12 +132,12 @@ contract('ERC20', function (accounts) { ...@@ -132,12 +132,12 @@ contract('ERC20', function (accounts) {
it('to other account', async function () { it('to other account', async function () {
const { tx } = await this.token.withdrawTo(anotherAccount, initialSupply, { from: initialHolder }); const { tx } = await this.token.withdrawTo(anotherAccount, initialSupply, { from: initialHolder });
expectEvent.inTransaction(tx, this.underlying, 'Transfer', { await expectEvent.inTransaction(tx, this.underlying, 'Transfer', {
from: this.token.address, from: this.token.address,
to: anotherAccount, to: anotherAccount,
value: initialSupply, value: initialSupply,
}); });
expectEvent.inTransaction(tx, this.token, 'Transfer', { await expectEvent.inTransaction(tx, this.token, 'Transfer', {
from: initialHolder, from: initialHolder,
to: ZERO_ADDRESS, to: ZERO_ADDRESS,
value: initialSupply, value: initialSupply,
...@@ -151,7 +151,7 @@ contract('ERC20', function (accounts) { ...@@ -151,7 +151,7 @@ contract('ERC20', function (accounts) {
await this.token.depositFor(initialHolder, initialSupply, { from: initialHolder }); await this.token.depositFor(initialHolder, initialSupply, { from: initialHolder });
const { tx } = await this.token.recover(anotherAccount); const { tx } = await this.token.recover(anotherAccount);
expectEvent.inTransaction(tx, this.token, 'Transfer', { await expectEvent.inTransaction(tx, this.token, 'Transfer', {
from: ZERO_ADDRESS, from: ZERO_ADDRESS,
to: anotherAccount, to: anotherAccount,
value: '0', value: '0',
...@@ -162,7 +162,7 @@ contract('ERC20', function (accounts) { ...@@ -162,7 +162,7 @@ contract('ERC20', function (accounts) {
await this.underlying.transfer(this.token.address, initialSupply, { from: initialHolder }); await this.underlying.transfer(this.token.address, initialSupply, { from: initialHolder });
const { tx } = await this.token.recover(anotherAccount); const { tx } = await this.token.recover(anotherAccount);
expectEvent.inTransaction(tx, this.token, 'Transfer', { await expectEvent.inTransaction(tx, this.token, 'Transfer', {
from: ZERO_ADDRESS, from: ZERO_ADDRESS,
to: anotherAccount, to: anotherAccount,
value: initialSupply, value: initialSupply,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment