Skip to content

Commit

Permalink
Re-enable immutable forwarder in ERC2771Context
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Oct 18, 2021
1 parent e6f26b4 commit e460f39
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions contracts/metatx/ERC2771Context.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma solidity ^0.8.8;

import "../utils/Context.sol";

/**
* @dev Context variant with ERC2771 support.
*/
abstract contract ERC2771Context is Context {
address private _trustedForwarder;
address private immutable _trustedForwarder;

constructor(address trustedForwarder) {
_trustedForwarder = trustedForwarder;
Expand Down
6 changes: 4 additions & 2 deletions contracts/mocks/ERC2771ContextMock.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma solidity ^0.8.8;

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();
Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit e460f39

Please sign in to comment.