*`SafeMath`: fix a memory allocation issue by adding new `SafeMath.tryOp(uint,uint)→(bool,uint)` functions. `SafeMath.op(uint,uint,string)→uint` are now deprecated. ([#2462](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2462))
*`SafeMath`: fix a memory allocation issue by adding new `SafeMath.tryOp(uint,uint)→(bool,uint)` functions. `SafeMath.op(uint,uint,string)→uint` are now deprecated. ([#2462](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2462))
*`EnumerableMap`: fix a memory allocation issue by adding new `EnumerableMap.tryGet(uint)→(bool,address)` functions. `EnumerableMap.get(uint)→string` is now deprecated. ([#2462](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2462))
*`EnumerableMap`: fix a memory allocation issue by adding new `EnumerableMap.tryGet(uint)→(bool,address)` functions. `EnumerableMap.get(uint)→string` is now deprecated. ([#2462](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2462))
*`RefundEscrow`: `beneficiaryWithdraw` will forward all available gas to the beneficiary. ([#2480](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2480))
* Many view and pure functions have been made virtual to customize them via overrides. In many cases this will not imply that other functions in the contract will automatically adapt to the overridden definitions. People who wish to override should consult the source code to understand the impact and if they need to override any additional functions to achieve the desired behavior.
### Security Fixes
*`ERC777`: fix potential reentrancy issues for custom extensions to `ERC777`. ([#2483](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2483))
If you're using our implementation of ERC777 from version 3.3.0 or earlier, and you define a custom `_beforeTokenTransfer` function that writes to a storage variable, you may be vulnerable to a reentrancy attack. If you're affected and would like assistance please write to security@openzeppelin.com. [Read more in the pull request.](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2483)
@@ -37,15 +37,15 @@ contract GSNRecipientERC20Fee is GSNRecipient {
...
@@ -37,15 +37,15 @@ contract GSNRecipientERC20Fee is GSNRecipient {
/**
/**
* @dev Returns the gas payment token.
* @dev Returns the gas payment token.
*/
*/
function token() public view returns (IERC20) {
function token() public view virtual returns (__unstable__ERC20Owned) {
return IERC20(_token);
return _token;
}
}
/**
/**
* @dev Internal function that mints the gas payment token. Derived contracts should expose this function in their public API, with proper access control mechanisms.
* @dev Internal function that mints the gas payment token. Derived contracts should expose this function in their public API, with proper access control mechanisms.
*/
*/
function _mint(address account, uint256 amount) internal virtual {
function _mint(address account, uint256 amount) internal virtual {
_token.mint(account, amount);
token().mint(account, amount);
}
}
/**
/**
...
@@ -68,7 +68,7 @@ contract GSNRecipientERC20Fee is GSNRecipient {
...
@@ -68,7 +68,7 @@ contract GSNRecipientERC20Fee is GSNRecipient {
override
override
returns (uint256, bytes memory)
returns (uint256, bytes memory)
{
{
if (_token.balanceOf(from) < maxPossibleCharge) {
if (token().balanceOf(from) < maxPossibleCharge) {