Move Context from GSN to utils directory (#2453)

Co-authored-by: Hadrien Croubois <hadrien@openzeppelin.com>
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
pull/2453/merge
Hadrien Croubois 4 years ago committed by GitHub
parent b6e5187973
commit 318c4b44ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 21
      contracts/GSN/Context.sol
  3. 2
      contracts/GSN/GSNRecipient.sol
  4. 2
      contracts/access/AccessControl.sol
  5. 2
      contracts/access/Ownable.sol
  6. 2
      contracts/mocks/ContextMock.sol
  7. 2
      contracts/mocks/ERC777Mock.sol
  8. 2
      contracts/mocks/ERC777SenderRecipientMock.sol
  9. 2
      contracts/mocks/ReentrancyAttack.sol
  10. 2
      contracts/mocks/SafeERC20Helper.sol
  11. 2
      contracts/payment/PaymentSplitter.sol
  12. 2
      contracts/presets/ERC1155PresetMinterPauser.sol
  13. 2
      contracts/presets/ERC20PresetMinterPauser.sol
  14. 2
      contracts/presets/ERC721PresetMinterPauserAutoId.sol
  15. 2
      contracts/token/ERC1155/ERC1155.sol
  16. 2
      contracts/token/ERC20/ERC20.sol
  17. 2
      contracts/token/ERC20/ERC20Burnable.sol
  18. 2
      contracts/token/ERC721/ERC721.sol
  19. 2
      contracts/token/ERC721/ERC721Burnable.sol
  20. 2
      contracts/token/ERC777/ERC777.sol
  21. 24
      contracts/utils/Context.sol
  22. 2
      contracts/utils/Pausable.sol

@ -7,6 +7,7 @@
* `ERC20Permit`: added an implementation of the ERC20 permit extension for gasless token approvals. ([#2237](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2237))
* Presets: added token presets with preminted fixed supply `ERC20PresetFixedSupply` and `ERC777PresetFixedSupply`. ([#2399](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2399))
* `Address`: added `functionDelegateCall`, similar to the existing `functionCall`. ([#2333](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2333))
* `Context`: moved from `contracts/GSN` to `contracts/utils`. ([#2453](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2453))
* `PaymentSplitter`: replace usage of `.transfer()` with `Address.sendValue` for improved compatibility with smart wallets. ([#2455](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2455))
* `UpgradeableProxy`: bubble revert reasons from initialization calls. ([#2454](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2454))

@ -2,23 +2,4 @@
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
import "../utils/Context.sol";

@ -2,9 +2,9 @@
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
import "./IRelayRecipient.sol";
import "./IRelayHub.sol";
import "./Context.sol";
/**
* @dev Base GSN recipient contract: includes the {IRelayRecipient} interface

@ -4,7 +4,7 @@ pragma solidity >=0.6.0 <0.8.0;
import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../GSN/Context.sol";
import "../utils/Context.sol";
/**
* @dev Contract module that allows children to implement role-based access

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../GSN/Context.sol";
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../GSN/Context.sol";
import "../utils/Context.sol";
contract ContextMock is Context {
event Sender(address sender);

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../GSN/Context.sol";
import "../utils/Context.sol";
import "../token/ERC777/ERC777.sol";
contract ERC777Mock is Context, ERC777 {

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../GSN/Context.sol";
import "../utils/Context.sol";
import "../token/ERC777/IERC777.sol";
import "../token/ERC777/IERC777Sender.sol";
import "../token/ERC777/IERC777Recipient.sol";

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../GSN/Context.sol";
import "../utils/Context.sol";
contract ReentrancyAttack is Context {
function callSender(bytes4 data) public {
// solhint-disable-next-line avoid-low-level-calls

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../GSN/Context.sol";
import "../utils/Context.sol";
import "../token/ERC20/IERC20.sol";
import "../token/ERC20/SafeERC20.sol";

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../GSN/Context.sol";
import "../utils/Context.sol";
import "../math/SafeMath.sol";
import "../utils/Address.sol";

@ -3,7 +3,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../access/AccessControl.sol";
import "../GSN/Context.sol";
import "../utils/Context.sol";
import "../token/ERC1155/ERC1155.sol";
import "../token/ERC1155/ERC1155Burnable.sol";
import "../token/ERC1155/ERC1155Pausable.sol";

@ -3,7 +3,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../access/AccessControl.sol";
import "../GSN/Context.sol";
import "../utils/Context.sol";
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Burnable.sol";
import "../token/ERC20/ERC20Pausable.sol";

@ -3,7 +3,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../access/AccessControl.sol";
import "../GSN/Context.sol";
import "../utils/Context.sol";
import "../utils/Counters.sol";
import "../token/ERC721/ERC721.sol";
import "../token/ERC721/ERC721Burnable.sol";

@ -5,7 +5,7 @@ pragma solidity >=0.6.0 <0.8.0;
import "./IERC1155.sol";
import "./IERC1155MetadataURI.sol";
import "./IERC1155Receiver.sol";
import "../../GSN/Context.sol";
import "../../utils/Context.sol";
import "../../introspection/ERC165.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../../GSN/Context.sol";
import "../../utils/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../../GSN/Context.sol";
import "../../utils/Context.sol";
import "./ERC20.sol";
/**

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../../GSN/Context.sol";
import "../../utils/Context.sol";
import "./IERC721.sol";
import "./IERC721Metadata.sol";
import "./IERC721Enumerable.sol";

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../../GSN/Context.sol";
import "../../utils/Context.sol";
import "./ERC721.sol";
/**

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../../GSN/Context.sol";
import "../../utils/Context.sol";
import "./IERC777.sol";
import "./IERC777Recipient.sol";
import "./IERC777Sender.sol";

@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}

@ -2,7 +2,7 @@
pragma solidity >=0.6.0 <0.8.0;
import "../GSN/Context.sol";
import "./Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop

Loading…
Cancel
Save