Re-enable immutable forwarder in ERC2771Context (#2917)
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
* `ERC721`: improved revert reason when transferring from wrong owner. ([#2975](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2975))
|
||||
* `Votes`: Added a base contract for vote tracking with delegation. ([#2944](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2944))
|
||||
* `ERC721Votes`: Added an extension of ERC721 enabled with vote tracking and delegation. ([#2944](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2944))
|
||||
* `ERC2771Context`: use immutable storage to store the forwarder address, no longer an issue since Solidity >=0.8.8 allows reading immutable variables in the constructor. ([#2917](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2917))
|
||||
|
||||
## 4.4.1 (2021-12-14)
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts v4.4.1 (metatx/ERC2771Context.sol)
|
||||
|
||||
pragma solidity ^0.8.0;
|
||||
pragma solidity ^0.8.9;
|
||||
|
||||
import "../utils/Context.sol";
|
||||
|
||||
@ -9,8 +9,10 @@ import "../utils/Context.sol";
|
||||
* @dev Context variant with ERC2771 support.
|
||||
*/
|
||||
abstract contract ERC2771Context is Context {
|
||||
address private _trustedForwarder;
|
||||
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
||||
address private immutable _trustedForwarder;
|
||||
|
||||
/// @custom:oz-upgrades-unsafe-allow constructor
|
||||
constructor(address trustedForwarder) {
|
||||
_trustedForwarder = trustedForwarder;
|
||||
}
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.0;
|
||||
pragma solidity ^0.8.9;
|
||||
|
||||
import "./ContextMock.sol";
|
||||
import "../metatx/ERC2771Context.sol";
|
||||
|
||||
// By inheriting from ERC2771Context, Context's internal functions are overridden automatically
|
||||
contract ERC2771ContextMock is ContextMock, ERC2771Context {
|
||||
constructor(address trustedForwarder) ERC2771Context(trustedForwarder) {}
|
||||
constructor(address trustedForwarder) ERC2771Context(trustedForwarder) {
|
||||
emit Sender(_msgSender()); // _msgSender() should be accessible during construction
|
||||
}
|
||||
|
||||
function _msgSender() internal view virtual override(Context, ERC2771Context) returns (address) {
|
||||
return ERC2771Context._msgSender();
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// - COVERAGE: enable coverage report
|
||||
// - ENABLE_GAS_REPORT: enable gas report
|
||||
// - COMPILE_MODE: production modes enables optimizations (default: development)
|
||||
// - COMPILE_VERSION: compiler version (default: 0.8.3)
|
||||
// - COMPILE_VERSION: compiler version (default: 0.8.9)
|
||||
// - COINMARKETCAP: coinmarkercat api key for USD value in gas report
|
||||
|
||||
const fs = require('fs');
|
||||
@ -33,7 +33,7 @@ const argv = require('yargs/yargs')()
|
||||
compiler: {
|
||||
alias: 'compileVersion',
|
||||
type: 'string',
|
||||
default: '0.8.3',
|
||||
default: '0.8.9',
|
||||
},
|
||||
coinmarketcap: {
|
||||
alias: 'coinmarketcapApiKey',
|
||||
|
||||
Reference in New Issue
Block a user