Commit 16793c38 by github-actions

Merge upstream master into patched/master

parents aa8af06e f8bfa560
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* `ERC1155`: Add a `_afterTokenTransfer` hook for improved extensibility. ([#3166](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3166)) * `ERC1155`: Add a `_afterTokenTransfer` hook for improved extensibility. ([#3166](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3166))
* `DoubleEndedQueue`: a new data structure that supports efficient push and pop to both front and back, useful for FIFO and LIFO queues. ([#3153](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3153)) * `DoubleEndedQueue`: a new data structure that supports efficient push and pop to both front and back, useful for FIFO and LIFO queues. ([#3153](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3153))
* `Governor`: improved security of `onlyGovernance` modifier when using an external executor contract (e.g. a timelock) that can operate without necessarily going through the governance protocol. ([#3147](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3147)) * `Governor`: improved security of `onlyGovernance` modifier when using an external executor contract (e.g. a timelock) that can operate without necessarily going through the governance protocol. ([#3147](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3147))
* `ERC20FlashMint`: support infinite allowance when paying back a flash loan. ([#3226](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3226))
* `Governor`: Add a way to parameterize votes. This can be used to implement voting systems such as fractionalized voting, ERC721 based voting, or any number of other systems. The `params` argument added to `_countVote` method, and included in the newly added `_getVotes` method, can be used by counting and voting modules respectively for such purposes. * `Governor`: Add a way to parameterize votes. This can be used to implement voting systems such as fractionalized voting, ERC721 based voting, or any number of other systems. The `params` argument added to `_countVote` method, and included in the newly added `_getVotes` method, can be used by counting and voting modules respectively for such purposes.
### Breaking changes ### Breaking changes
......
...@@ -73,9 +73,7 @@ abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender { ...@@ -73,9 +73,7 @@ abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender {
receiver.onFlashLoan(msg.sender, token, amount, fee, data) == _RETURN_VALUE, receiver.onFlashLoan(msg.sender, token, amount, fee, data) == _RETURN_VALUE,
"ERC20FlashMint: invalid return value" "ERC20FlashMint: invalid return value"
); );
uint256 currentAllowance = allowance(address(receiver), address(this)); _spendAllowance(address(receiver), address(this), amount + fee);
require(currentAllowance >= amount + fee, "ERC20FlashMint: allowance does not allow refund");
_approve(address(receiver), address(this), currentAllowance - amount - fee);
_burn(address(receiver), amount + fee); _burn(address(receiver), amount + fee);
return true; return true;
} }
......
...@@ -67,7 +67,7 @@ contract('ERC20FlashMint', function (accounts) { ...@@ -67,7 +67,7 @@ contract('ERC20FlashMint', function (accounts) {
const receiver = await ERC3156FlashBorrowerMock.new(true, false); const receiver = await ERC3156FlashBorrowerMock.new(true, false);
await expectRevert( await expectRevert(
this.token.flashLoan(receiver.address, this.token.address, loanAmount, '0x'), this.token.flashLoan(receiver.address, this.token.address, loanAmount, '0x'),
'ERC20FlashMint: allowance does not allow refund', 'ERC20: insufficient allowance',
); );
}); });
......
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