Browse Source

Merge branch 'solc-0.8'

Conflicts:
	CHANGELOG.md
	package-lock.json
	test/math/SafeMath.test.js
Hadrien Croubois 4 years ago
parent
commit
9425a7e0ab
100 changed files with 271 additions and 376 deletions
  1. 2 0
      .github/workflows/test.yml
  2. 11 0
      CHANGELOG.md
  3. 2 2
      README.md
  4. 0 20
      buidler.config.js
  5. 1 1
      contracts/GSN/Context.sol
  6. 9 45
      contracts/GSN/GSNRecipient.sol
  7. 6 8
      contracts/GSN/GSNRecipientERC20Fee.sol
  8. 2 2
      contracts/GSN/GSNRecipientSignature.sol
  9. 1 1
      contracts/GSN/IRelayHub.sol
  10. 1 1
      contracts/GSN/IRelayRecipient.sol
  11. 1 1
      contracts/access/AccessControl.sol
  12. 2 2
      contracts/access/Ownable.sol
  13. 3 6
      contracts/access/TimelockController.sol
  14. 1 1
      contracts/cryptography/ECDSA.sol
  15. 1 1
      contracts/cryptography/MerkleProof.sol
  16. 6 14
      contracts/drafts/EIP712.sol
  17. 2 2
      contracts/drafts/ERC20Permit.sol
  18. 1 1
      contracts/drafts/IERC20Permit.sol
  19. 3 8
      contracts/introspection/ERC165.sol
  20. 7 30
      contracts/introspection/ERC165Checker.sol
  21. 2 2
      contracts/introspection/ERC1820Implementer.sol
  22. 1 1
      contracts/introspection/IERC165.sol
  23. 1 1
      contracts/introspection/IERC1820Implementer.sol
  24. 1 1
      contracts/introspection/IERC1820Registry.sol
  25. 1 1
      contracts/math/Math.sol
  26. 46 49
      contracts/math/SafeMath.sol
  27. 7 34
      contracts/math/SignedSafeMath.sol
  28. 2 2
      contracts/mocks/AccessControlMock.sol
  29. 1 1
      contracts/mocks/AddressImpl.sol
  30. 2 2
      contracts/mocks/ArraysImpl.sol
  31. 1 1
      contracts/mocks/BadBeacon.sol
  32. 1 1
      contracts/mocks/CallReceiverMock.sol
  33. 1 1
      contracts/mocks/ClashingImplementation.sol
  34. 1 1
      contracts/mocks/ClonesMock.sol
  35. 1 1
      contracts/mocks/ConditionalEscrowMock.sol
  36. 1 1
      contracts/mocks/ContextMock.sol
  37. 1 1
      contracts/mocks/CountersImpl.sol
  38. 1 1
      contracts/mocks/Create2Impl.sol
  39. 1 1
      contracts/mocks/DummyImplementation.sol
  40. 1 1
      contracts/mocks/ECDSAMock.sol
  41. 4 8
      contracts/mocks/EIP712External.sol
  42. 2 2
      contracts/mocks/ERC1155BurnableMock.sol
  43. 2 2
      contracts/mocks/ERC1155Mock.sol
  44. 2 2
      contracts/mocks/ERC1155PausableMock.sol
  45. 1 2
      contracts/mocks/ERC1155ReceiverMock.sol
  46. 3 3
      contracts/mocks/ERC165/ERC165InterfacesSupported.sol
  47. 7 0
      contracts/mocks/ERC165/ERC165MissingData.sol
  48. 1 1
      contracts/mocks/ERC165/ERC165NotSupported.sol
  49. 1 1
      contracts/mocks/ERC165CheckerMock.sol
  50. 1 1
      contracts/mocks/ERC165Mock.sol
  51. 1 1
      contracts/mocks/ERC1820ImplementerMock.sol
  52. 2 2
      contracts/mocks/ERC20BurnableMock.sol
  53. 2 2
      contracts/mocks/ERC20CappedMock.sol
  54. 2 2
      contracts/mocks/ERC20DecimalsMock.sol
  55. 2 2
      contracts/mocks/ERC20Mock.sol
  56. 2 2
      contracts/mocks/ERC20PausableMock.sol
  57. 4 8
      contracts/mocks/ERC20PermitMock.sol
  58. 2 2
      contracts/mocks/ERC20SnapshotMock.sol
  59. 2 2
      contracts/mocks/ERC721BurnableMock.sol
  60. 2 3
      contracts/mocks/ERC721GSNRecipientMock.sol
  61. 2 2
      contracts/mocks/ERC721Mock.sol
  62. 2 2
      contracts/mocks/ERC721PausableMock.sol
  63. 20 6
      contracts/mocks/ERC721ReceiverMock.sol
  64. 2 2
      contracts/mocks/ERC777Mock.sol
  65. 1 1
      contracts/mocks/ERC777SenderRecipientMock.sol
  66. 1 1
      contracts/mocks/EnumerableMapMock.sol
  67. 1 1
      contracts/mocks/EnumerableSetMock.sol
  68. 1 1
      contracts/mocks/EtherReceiverMock.sol
  69. 2 2
      contracts/mocks/GSNRecipientERC20FeeMock.sol
  70. 4 4
      contracts/mocks/GSNRecipientMock.sol
  71. 2 2
      contracts/mocks/GSNRecipientSignatureMock.sol
  72. 1 1
      contracts/mocks/InitializableMock.sol
  73. 1 1
      contracts/mocks/MathMock.sol
  74. 1 1
      contracts/mocks/MerkleProofWrapper.sol
  75. 1 1
      contracts/mocks/MultipleInheritanceInitializableMocks.sol
  76. 1 1
      contracts/mocks/OwnableMock.sol
  77. 2 2
      contracts/mocks/PausableMock.sol
  78. 2 2
      contracts/mocks/PullPaymentMock.sol
  79. 1 1
      contracts/mocks/ReentrancyAttack.sol
  80. 2 2
      contracts/mocks/ReentrancyMock.sol
  81. 1 1
      contracts/mocks/RegressionImplementation.sol
  82. 1 1
      contracts/mocks/SafeCastMock.sol
  83. 2 2
      contracts/mocks/SafeERC20Helper.sol
  84. 1 1
      contracts/mocks/SafeMathMock.sol
  85. 1 1
      contracts/mocks/SignedSafeMathMock.sol
  86. 1 1
      contracts/mocks/SingleInheritanceInitializableMocks.sol
  87. 1 1
      contracts/mocks/StringsMock.sol
  88. 7 9
      contracts/payment/PaymentSplitter.sol
  89. 2 2
      contracts/payment/PullPayment.sol
  90. 1 1
      contracts/payment/escrow/ConditionalEscrow.sol
  91. 2 4
      contracts/payment/escrow/Escrow.sol
  92. 4 2
      contracts/payment/escrow/RefundEscrow.sol
  93. 2 2
      contracts/presets/ERC1155PresetMinterPauser.sol
  94. 3 3
      contracts/presets/ERC20PresetFixedSupply.sol
  95. 2 2
      contracts/presets/ERC20PresetMinterPauser.sol
  96. 2 2
      contracts/presets/ERC721PresetMinterPauserAutoId.sol
  97. 3 3
      contracts/presets/ERC777PresetFixedSupply.sol
  98. 2 2
      contracts/proxy/BeaconProxy.sol
  99. 1 1
      contracts/proxy/Clones.sol
  100. 1 1
      contracts/proxy/IBeacon.sol

+ 2 - 0
.github/workflows/test.yml

@@ -43,4 +43,6 @@ jobs:
       - run: npm ci
         if: steps.cache.outputs.cache-hit != 'true'
       - run: npm run coverage
+        env:
+          NODE_OPTIONS: --max_old_space_size=4096
       - uses: codecov/codecov-action@v1

+ 11 - 0
CHANGELOG.md

@@ -1,5 +1,10 @@
 # Changelog
 
+## Unreleased
+
+* Now targeting the 0.8.x line of Solidity compilers. For 0.6.x (resp 0.7.x) support, use version 3.4.0 (resp 3.4.0-solc-0.7) of OpenZeppelin.
+* `Context`: making `_msgData` return `bytes calldata` instead of `bytes memory` ([#2492](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2492))
+
 ## 3.4.0 (2021-02-02)
 
  * `BeaconProxy`: added new kind of proxy that allows simultaneous atomic upgrades. ([#2411](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2411))
@@ -30,6 +35,12 @@ If you're using our implementation of ERC777 from version 3.3.0 or earlier, and
  * `TimelockController`: added a contract to augment access control schemes with a delay. ([#2354](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2354))
  * `EnumerableSet`: added `Bytes32Set`, for sets of `bytes32`. ([#2395](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2395))
 
+## 3.2.2-solc-0.7 (2020-10-28)
+ * Resolve warnings introduced by Solidity 0.7.4. ([#2396](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2396))
+
+## 3.2.1-solc-0.7 (2020-09-15)
+ * `ERC777`: Remove a warning about function state visibility in Solidity 0.7. ([#2327](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2327))
+
 ## 3.2.0 (2020-09-10)
 
 ### New features

+ 2 - 2
README.md

@@ -27,12 +27,12 @@ OpenZeppelin Contracts features a [stable API](https://docs.openzeppelin.com/con
 Once installed, you can use the contracts in the library by importing them:
 
 ```solidity
-pragma solidity ^0.6.0;
+pragma solidity ^0.8.0;
 
 import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
 
 contract MyCollectible is ERC721 {
-    constructor() ERC721("MyCollectible", "MCO") public {
+    constructor() ERC721("MyCollectible", "MCO") {
     }
 }
 ```

+ 0 - 20
buidler.config.js

@@ -1,20 +0,0 @@
-const fs = require('fs');
-const path = require('path');
-
-usePlugin('solidity-coverage');
-usePlugin('@nomiclabs/buidler-truffle5');
-
-for (const f of fs.readdirSync(path.join(__dirname, 'buidler'))) {
-  require(path.join(__dirname, 'buidler', f));
-}
-
-module.exports = {
-  networks: {
-    buidlerevm: {
-      blockGasLimit: 10000000,
-    },
-  },
-  solc: {
-    version: '0.6.12',
-  },
-};

+ 1 - 1
contracts/GSN/Context.sol

@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Context.sol";

+ 9 - 45
contracts/GSN/GSNRecipient.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Context.sol";
 import "./IRelayRecipient.sol";
@@ -87,11 +87,11 @@ abstract contract GSNRecipient is IRelayRecipient, Context {
      *
      * IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.sender`, and use {_msgSender} instead.
      */
-    function _msgSender() internal view virtual override returns (address payable) {
-        if (msg.sender != getHubAddr()) {
-            return msg.sender;
+    function _msgSender() internal view virtual override returns (address msgSender) {
+        if (msg.sender == getHubAddr()) {
+            assembly { msgSender := shr(96, calldataload(sub(calldatasize(), 20))) }
         } else {
-            return _getRelayedCallSender();
+            return msg.sender;
         }
     }
 
@@ -101,11 +101,11 @@ abstract contract GSNRecipient is IRelayRecipient, Context {
      *
      * IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.data`, and use {_msgData} instead.
      */
-    function _msgData() internal view virtual override returns (bytes memory) {
-        if (msg.sender != getHubAddr()) {
-            return msg.data;
+    function _msgData() internal view virtual override returns (bytes calldata) {
+        if (msg.sender == getHubAddr()) {
+            return msg.data[:msg.data.length - 20];
         } else {
-            return _getRelayedCallData();
+            return msg.data;
         }
     }
 
@@ -191,40 +191,4 @@ abstract contract GSNRecipient is IRelayRecipient, Context {
         // charged for 1.4 times the spent amount.
         return (gas * gasPrice * (100 + serviceFee)) / 100;
     }
-
-    function _getRelayedCallSender() private pure returns (address payable result) {
-        // We need to read 20 bytes (an address) located at array index msg.data.length - 20. In memory, the array
-        // is prefixed with a 32-byte length value, so we first add 32 to get the memory read index. However, doing
-        // so would leave the address in the upper 20 bytes of the 32-byte word, which is inconvenient and would
-        // require bit shifting. We therefore subtract 12 from the read index so the address lands on the lower 20
-        // bytes. This can always be done due to the 32-byte prefix.
-
-        // The final memory read index is msg.data.length - 20 + 32 - 12 = msg.data.length. Using inline assembly is the
-        // easiest/most-efficient way to perform this operation.
-
-        // These fields are not accessible from assembly
-        bytes memory array = msg.data;
-        uint256 index = msg.data.length;
-
-        // solhint-disable-next-line no-inline-assembly
-        assembly {
-            // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
-            result := and(mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff)
-        }
-        return result;
-    }
-
-    function _getRelayedCallData() private pure returns (bytes memory) {
-        // RelayHub appends the sender address at the end of the calldata, so in order to retrieve the actual msg.data,
-        // we must strip the last 20 bytes (length of an address type) from it.
-
-        uint256 actualDataLength = msg.data.length - 20;
-        bytes memory actualData = new bytes(actualDataLength);
-
-        for (uint256 i = 0; i < actualDataLength; ++i) {
-            actualData[i] = msg.data[i];
-        }
-
-        return actualData;
-    }
 }

+ 6 - 8
contracts/GSN/GSNRecipientERC20Fee.sol

@@ -1,9 +1,8 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "./GSNRecipient.sol";
-import "../math/SafeMath.sol";
 import "../access/Ownable.sol";
 import "../token/ERC20/SafeERC20.sol";
 import "../token/ERC20/ERC20.sol";
@@ -19,7 +18,6 @@ import "../token/ERC20/ERC20.sol";
  */
 contract GSNRecipientERC20Fee is GSNRecipient {
     using SafeERC20 for __unstable__ERC20Owned;
-    using SafeMath for uint256;
 
     enum GSNRecipientERC20FeeErrorCodes {
         INSUFFICIENT_BALANCE
@@ -30,7 +28,7 @@ contract GSNRecipientERC20Fee is GSNRecipient {
     /**
      * @dev The arguments to the constructor are the details that the gas payment token will have: `name` and `symbol`. `decimals` is hard-coded to 18.
      */
-    constructor(string memory name, string memory symbol) public {
+    constructor(string memory name, string memory symbol) {
         _token = new __unstable__ERC20Owned(name, symbol);
     }
 
@@ -100,11 +98,11 @@ contract GSNRecipientERC20Fee is GSNRecipient {
         // actualCharge is an _estimated_ charge, which assumes postRelayedCall will use all available gas.
         // This implementation's gas cost can be roughly estimated as 10k gas, for the two SSTORE operations in an
         // ERC20 transfer.
-        uint256 overestimation = _computeCharge(_POST_RELAYED_CALL_MAX_GAS.sub(10000), gasPrice, transactionFee);
-        actualCharge = actualCharge.sub(overestimation);
+        uint256 overestimation = _computeCharge(_POST_RELAYED_CALL_MAX_GAS - 10000, gasPrice, transactionFee);
+        actualCharge = actualCharge - overestimation;
 
         // After the relayed call has been executed and the actual charge estimated, the excess pre-charge is returned
-        token().safeTransfer(from, maxPossibleCharge.sub(actualCharge));
+        token().safeTransfer(from, maxPossibleCharge - actualCharge);
     }
 }
 
@@ -118,7 +116,7 @@ contract GSNRecipientERC20Fee is GSNRecipient {
 contract __unstable__ERC20Owned is ERC20, Ownable {
     uint256 private constant _UINT256_MAX = 2**256 - 1;
 
-    constructor(string memory name, string memory symbol) public ERC20(name, symbol) { }
+    constructor(string memory name, string memory symbol) ERC20(name, symbol) { }
 
     // The owner (GSNRecipientERC20Fee) can mint tokens
     function mint(address account, uint256 amount) public virtual onlyOwner {

+ 2 - 2
contracts/GSN/GSNRecipientSignature.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "./GSNRecipient.sol";
 import "../cryptography/ECDSA.sol";
@@ -23,7 +23,7 @@ contract GSNRecipientSignature is GSNRecipient {
     /**
      * @dev Sets the trusted signer that is going to be producing signatures to approve relayed calls.
      */
-    constructor(address trustedSigner) public {
+    constructor(address trustedSigner) {
         require(trustedSigner != address(0), "GSNRecipientSignature: trusted signer is the zero address");
         _trustedSigner = trustedSigner;
     }

+ 1 - 1
contracts/GSN/IRelayHub.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev Interface for `RelayHub`, the core contract of the GSN. Users should not need to interact with this contract

+ 1 - 1
contracts/GSN/IRelayRecipient.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev Base interface for a contract that will be called via the GSN from {IRelayHub}.

+ 1 - 1
contracts/access/AccessControl.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/EnumerableSet.sol";
 import "../utils/Address.sol";

+ 2 - 2
contracts/access/Ownable.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Context.sol";
 /**
@@ -23,7 +23,7 @@ abstract contract Ownable is Context {
     /**
      * @dev Initializes the contract setting the deployer as the initial owner.
      */
-    constructor () internal {
+    constructor () {
         address msgSender = _msgSender();
         _owner = msgSender;
         emit OwnershipTransferred(address(0), msgSender);

+ 3 - 6
contracts/access/TimelockController.sol

@@ -1,9 +1,7 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.9 <0.8.0;
-pragma experimental ABIEncoderV2;
+pragma solidity ^0.8.0;
 
-import "./../math/SafeMath.sol";
 import "./AccessControl.sol";
 
 /**
@@ -22,7 +20,6 @@ import "./AccessControl.sol";
  * _Available since v3.3._
  */
 contract TimelockController is AccessControl {
-
     bytes32 public constant TIMELOCK_ADMIN_ROLE = keccak256("TIMELOCK_ADMIN_ROLE");
     bytes32 public constant PROPOSER_ROLE = keccak256("PROPOSER_ROLE");
     bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE");
@@ -54,7 +51,7 @@ contract TimelockController is AccessControl {
     /**
      * @dev Initializes the contract with a given `minDelay`.
      */
-    constructor(uint256 minDelay, address[] memory proposers, address[] memory executors) public {
+    constructor(uint256 minDelay, address[] memory proposers, address[] memory executors) {
         _setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE);
         _setRoleAdmin(PROPOSER_ROLE, TIMELOCK_ADMIN_ROLE);
         _setRoleAdmin(EXECUTOR_ROLE, TIMELOCK_ADMIN_ROLE);
@@ -199,7 +196,7 @@ contract TimelockController is AccessControl {
         require(!isOperation(id), "TimelockController: operation already scheduled");
         require(delay >= getMinDelay(), "TimelockController: insufficient delay");
         // solhint-disable-next-line not-rely-on-time
-        _timestamps[id] = SafeMath.add(block.timestamp, delay);
+        _timestamps[id] = block.timestamp + delay;
     }
 
     /**

+ 1 - 1
contracts/cryptography/ECDSA.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.

+ 1 - 1
contracts/cryptography/MerkleProof.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev These functions deal with verification of Merkle trees (hash trees),

+ 6 - 14
contracts/drafts/EIP712.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
@@ -45,13 +45,13 @@ abstract contract EIP712 {
      * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
      * contract upgrade].
      */
-    constructor(string memory name, string memory version) internal {
+    constructor(string memory name, string memory version) {
         bytes32 hashedName = keccak256(bytes(name));
         bytes32 hashedVersion = keccak256(bytes(version));
         bytes32 typeHash = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
         _HASHED_NAME = hashedName;
         _HASHED_VERSION = hashedVersion;
-        _CACHED_CHAIN_ID = _getChainId();
+        _CACHED_CHAIN_ID = block.chainid;
         _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
         _TYPE_HASH = typeHash;
     }
@@ -59,8 +59,8 @@ abstract contract EIP712 {
     /**
      * @dev Returns the domain separator for the current chain.
      */
-    function _domainSeparatorV4() internal view virtual returns (bytes32) {
-        if (_getChainId() == _CACHED_CHAIN_ID) {
+    function _domainSeparatorV4() internal view returns (bytes32) {
+        if (block.chainid == _CACHED_CHAIN_ID) {
             return _CACHED_DOMAIN_SEPARATOR;
         } else {
             return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
@@ -73,7 +73,7 @@ abstract contract EIP712 {
                 typeHash,
                 name,
                 version,
-                _getChainId(),
+                block.chainid,
                 address(this)
             )
         );
@@ -97,12 +97,4 @@ abstract contract EIP712 {
     function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
         return keccak256(abi.encodePacked("\x19\x01", _domainSeparatorV4(), structHash));
     }
-
-    function _getChainId() private view returns (uint256 chainId) {
-        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
-        // solhint-disable-next-line no-inline-assembly
-        assembly {
-            chainId := chainid()
-        }
-    }
 }

+ 2 - 2
contracts/drafts/ERC20Permit.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.5 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC20/ERC20.sol";
 import "./IERC20Permit.sol";
@@ -31,7 +31,7 @@ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
      *
      * It's a good idea to use the same `name` that is defined as the ERC20 token name.
      */
-    constructor(string memory name) internal EIP712(name, "1") {
+    constructor(string memory name) EIP712(name, "1") {
     }
 
     /**

+ 1 - 1
contracts/drafts/IERC20Permit.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in

+ 3 - 8
contracts/introspection/ERC165.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "./IERC165.sol";
 
@@ -11,20 +11,15 @@ import "./IERC165.sol";
  * their support of an interface.
  */
 abstract contract ERC165 is IERC165 {
-    /*
-     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
-     */
-    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
-
     /**
      * @dev Mapping of interface ids to whether or not it's supported.
      */
     mapping(bytes4 => bool) private _supportedInterfaces;
 
-    constructor () internal {
+    constructor () {
         // Derived contracts need only register support for their own interfaces,
         // we register support for ERC165 itself here
-        _registerInterface(_INTERFACE_ID_ERC165);
+        _registerInterface(type(IERC165).interfaceId);
     }
 
     /**

+ 7 - 30
contracts/introspection/ERC165Checker.sol

@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.2 <0.8.0;
+pragma solidity ^0.8.0;
+
+import "./IERC165.sol";
 
 /**
  * @dev Library used to query support of an interface declared via {IERC165}.
@@ -13,18 +15,13 @@ library ERC165Checker {
     // As per the EIP-165 spec, no interface should ever match 0xffffffff
     bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;
 
-    /*
-     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
-     */
-    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
-
     /**
      * @dev Returns true if `account` supports the {IERC165} interface,
      */
     function supportsERC165(address account) internal view returns (bool) {
         // Any contract that implements ERC165 must explicitly indicate support of
         // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
-        return _supportsERC165Interface(account, _INTERFACE_ID_ERC165) &&
+        return _supportsERC165Interface(account, type(IERC165).interfaceId) &&
             !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
     }
 
@@ -103,29 +100,9 @@ library ERC165Checker {
      * Interface identification is specified in ERC-165.
      */
     function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
-        // success determines whether the staticcall succeeded and result determines
-        // whether the contract at account indicates support of _interfaceId
-        (bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);
-
-        return (success && result);
-    }
-
-    /**
-     * @notice Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw
-     * @param account The address of the contract to query for support of an interface
-     * @param interfaceId The interface identifier, as specified in ERC-165
-     * @return success true if the STATICCALL succeeded, false otherwise
-     * @return result true if the STATICCALL succeeded and the contract at account
-     * indicates support of the interface with identifier interfaceId, false otherwise
-     */
-    function _callERC165SupportsInterface(address account, bytes4 interfaceId)
-        private
-        view
-        returns (bool, bool)
-    {
-        bytes memory encodedParams = abi.encodeWithSelector(_INTERFACE_ID_ERC165, interfaceId);
+        bytes memory encodedParams = abi.encodeWithSelector(IERC165(account).supportsInterface.selector, interfaceId);
         (bool success, bytes memory result) = account.staticcall{ gas: 30000 }(encodedParams);
-        if (result.length < 32) return (false, false);
-        return (success, abi.decode(result, (bool)));
+        if (result.length < 32) return false;
+        return success && abi.decode(result, (bool));
     }
 }

+ 2 - 2
contracts/introspection/ERC1820Implementer.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "./IERC1820Implementer.sol";
 
@@ -13,7 +13,7 @@ import "./IERC1820Implementer.sol";
  * registration to be complete.
  */
 contract ERC1820Implementer is IERC1820Implementer {
-    bytes32 constant private _ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC"));
+    bytes32 private constant _ERC1820_ACCEPT_MAGIC = keccak256("ERC1820_ACCEPT_MAGIC");
 
     mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces;
 

+ 1 - 1
contracts/introspection/IERC165.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev Interface of the ERC165 standard, as defined in the

+ 1 - 1
contracts/introspection/IERC1820Implementer.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev Interface for an ERC1820 implementer, as defined in the

+ 1 - 1
contracts/introspection/IERC1820Registry.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev Interface of the global ERC1820 Registry, as defined in the

+ 1 - 1
contracts/math/Math.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev Standard math utilities missing in the Solidity language.

+ 46 - 49
contracts/math/SafeMath.sol

@@ -1,19 +1,9 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
- * @dev Wrappers over Solidity's arithmetic operations with added overflow
- * checks.
- *
- * Arithmetic operations in Solidity wrap on overflow. This can easily result
- * in bugs, because programmers usually assume that an overflow raises an
- * error, which is the standard behavior in high level programming languages.
- * `SafeMath` restores this intuition by reverting the transaction when an
- * operation overflows.
- *
- * Using this library instead of the unchecked operations eliminates an entire
- * class of bugs, so it's recommended to use it always.
+ * @dev Wrappers over Solidity's arithmetic operations.
  */
 library SafeMath {
     /**
@@ -22,9 +12,11 @@ library SafeMath {
      * _Available since v3.4._
      */
     function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
-        uint256 c = a + b;
-        if (c < a) return (false, 0);
-        return (true, c);
+        unchecked {
+            uint256 c = a + b;
+            if (c < a) return (false, 0);
+            return (true, c);
+        }
     }
 
     /**
@@ -33,8 +25,10 @@ library SafeMath {
      * _Available since v3.4._
      */
     function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
-        if (b > a) return (false, 0);
-        return (true, a - b);
+        unchecked {
+            if (b > a) return (false, 0);
+            return (true, a - b);
+        }
     }
 
     /**
@@ -43,13 +37,15 @@ library SafeMath {
      * _Available since v3.4._
      */
     function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
-        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
-        // benefit is lost if 'b' is also tested.
-        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
-        if (a == 0) return (true, 0);
-        uint256 c = a * b;
-        if (c / a != b) return (false, 0);
-        return (true, c);
+        unchecked {
+            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
+            // benefit is lost if 'b' is also tested.
+            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
+            if (a == 0) return (true, 0);
+            uint256 c = a * b;
+            if (c / a != b) return (false, 0);
+            return (true, c);
+        }
     }
 
     /**
@@ -58,8 +54,10 @@ library SafeMath {
      * _Available since v3.4._
      */
     function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
-        if (b == 0) return (false, 0);
-        return (true, a / b);
+        unchecked {
+            if (b == 0) return (false, 0);
+            return (true, a / b);
+        }
     }
 
     /**
@@ -68,8 +66,10 @@ library SafeMath {
      * _Available since v3.4._
      */
     function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
-        if (b == 0) return (false, 0);
-        return (true, a % b);
+        unchecked {
+            if (b == 0) return (false, 0);
+            return (true, a % b);
+        }
     }
 
     /**
@@ -83,9 +83,7 @@ library SafeMath {
      * - Addition cannot overflow.
      */
     function add(uint256 a, uint256 b) internal pure returns (uint256) {
-        uint256 c = a + b;
-        require(c >= a, "SafeMath: addition overflow");
-        return c;
+        return a + b;
     }
 
     /**
@@ -99,7 +97,6 @@ library SafeMath {
      * - Subtraction cannot overflow.
      */
     function sub(uint256 a, uint256 b) internal pure returns (uint256) {
-        require(b <= a, "SafeMath: subtraction overflow");
         return a - b;
     }
 
@@ -114,26 +111,20 @@ library SafeMath {
      * - Multiplication cannot overflow.
      */
     function mul(uint256 a, uint256 b) internal pure returns (uint256) {
-        if (a == 0) return 0;
-        uint256 c = a * b;
-        require(c / a == b, "SafeMath: multiplication overflow");
-        return c;
+        return a * b;
     }
 
     /**
      * @dev Returns the integer division of two unsigned integers, reverting on
      * division by zero. The result is rounded towards zero.
      *
-     * Counterpart to Solidity's `/` operator. Note: this function uses a
-     * `revert` opcode (which leaves remaining gas untouched) while Solidity
-     * uses an invalid opcode to revert (consuming all remaining gas).
+     * Counterpart to Solidity's `/` operator.
      *
      * Requirements:
      *
      * - The divisor cannot be zero.
      */
     function div(uint256 a, uint256 b) internal pure returns (uint256) {
-        require(b > 0, "SafeMath: division by zero");
         return a / b;
     }
 
@@ -150,7 +141,6 @@ library SafeMath {
      * - The divisor cannot be zero.
      */
     function mod(uint256 a, uint256 b) internal pure returns (uint256) {
-        require(b > 0, "SafeMath: modulo by zero");
         return a % b;
     }
 
@@ -168,16 +158,19 @@ library SafeMath {
      * - Subtraction cannot overflow.
      */
     function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
-        require(b <= a, errorMessage);
-        return a - b;
+        unchecked {
+            require(b <= a, errorMessage);
+            return a - b;
+        }
     }
 
     /**
      * @dev Returns the integer division of two unsigned integers, reverting with custom message on
      * division by zero. The result is rounded towards zero.
      *
-     * CAUTION: This function is deprecated because it requires allocating memory for the error
-     * message unnecessarily. For custom revert reasons use {tryDiv}.
+     * Counterpart to Solidity's `%` operator. This function uses a `revert`
+     * opcode (which leaves remaining gas untouched) while Solidity uses an
+     * invalid opcode to revert (consuming all remaining gas).
      *
      * Counterpart to Solidity's `/` operator. Note: this function uses a
      * `revert` opcode (which leaves remaining gas untouched) while Solidity
@@ -188,8 +181,10 @@ library SafeMath {
      * - The divisor cannot be zero.
      */
     function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
-        require(b > 0, errorMessage);
-        return a / b;
+        unchecked {
+            require(b > 0, errorMessage);
+            return a / b;
+        }
     }
 
     /**
@@ -208,7 +203,9 @@ library SafeMath {
      * - The divisor cannot be zero.
      */
     function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
-        require(b > 0, errorMessage);
-        return a % b;
+        unchecked {
+            require(b > 0, errorMessage);
+            return a % b;
+        }
     }
 }

+ 7 - 34
contracts/math/SignedSafeMath.sol

@@ -1,14 +1,12 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @title SignedSafeMath
- * @dev Signed math operations with safety checks that revert on error.
+ * @dev Signed math operations that revert on error.
  */
 library SignedSafeMath {
-    int256 constant private _INT256_MIN = -2**255;
-
     /**
      * @dev Returns the multiplication of two signed integers, reverting on
      * overflow.
@@ -20,40 +18,21 @@ library SignedSafeMath {
      * - Multiplication cannot overflow.
      */
     function mul(int256 a, int256 b) internal pure returns (int256) {
-        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
-        // benefit is lost if 'b' is also tested.
-        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
-        if (a == 0) {
-            return 0;
-        }
-
-        require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow");
-
-        int256 c = a * b;
-        require(c / a == b, "SignedSafeMath: multiplication overflow");
-
-        return c;
+        return a * b;
     }
 
     /**
      * @dev Returns the integer division of two signed integers. Reverts on
      * division by zero. The result is rounded towards zero.
      *
-     * Counterpart to Solidity's `/` operator. Note: this function uses a
-     * `revert` opcode (which leaves remaining gas untouched) while Solidity
-     * uses an invalid opcode to revert (consuming all remaining gas).
+     * Counterpart to Solidity's `/` operator.
      *
      * Requirements:
      *
      * - The divisor cannot be zero.
      */
     function div(int256 a, int256 b) internal pure returns (int256) {
-        require(b != 0, "SignedSafeMath: division by zero");
-        require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow");
-
-        int256 c = a / b;
-
-        return c;
+        return a / b;
     }
 
     /**
@@ -67,10 +46,7 @@ library SignedSafeMath {
      * - Subtraction cannot overflow.
      */
     function sub(int256 a, int256 b) internal pure returns (int256) {
-        int256 c = a - b;
-        require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow");
-
-        return c;
+        return a - b;
     }
 
     /**
@@ -84,9 +60,6 @@ library SignedSafeMath {
      * - Addition cannot overflow.
      */
     function add(int256 a, int256 b) internal pure returns (int256) {
-        int256 c = a + b;
-        require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow");
-
-        return c;
+        return a + b;
     }
 }

+ 2 - 2
contracts/mocks/AccessControlMock.sol

@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../access/AccessControl.sol";
 
 contract AccessControlMock is AccessControl {
-    constructor() public {
+    constructor() {
         _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
     }
 

+ 1 - 1
contracts/mocks/AddressImpl.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Address.sol";
 

+ 2 - 2
contracts/mocks/ArraysImpl.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Arrays.sol";
 
@@ -9,7 +9,7 @@ contract ArraysImpl {
 
     uint256[] private _array;
 
-    constructor (uint256[] memory array) public {
+    constructor (uint256[] memory array) {
         _array = array;
     }
 

+ 1 - 1
contracts/mocks/BadBeacon.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 contract BadBeaconNoImpl {
 }

+ 1 - 1
contracts/mocks/CallReceiverMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 contract CallReceiverMock {
     string public sharedAnswer;

+ 1 - 1
contracts/mocks/ClashingImplementation.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 
 /**

+ 1 - 1
contracts/mocks/ClonesMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../proxy/Clones.sol";
 import "../utils/Address.sol";

+ 1 - 1
contracts/mocks/ConditionalEscrowMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../payment/escrow/ConditionalEscrow.sol";
 

+ 1 - 1
contracts/mocks/ContextMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Context.sol";
 

+ 1 - 1
contracts/mocks/CountersImpl.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Counters.sol";
 

+ 1 - 1
contracts/mocks/Create2Impl.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Create2.sol";
 import "../introspection/ERC1820Implementer.sol";

+ 1 - 1
contracts/mocks/DummyImplementation.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 abstract contract Impl {
   function version() public pure virtual returns (string memory); 

+ 1 - 1
contracts/mocks/ECDSAMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../cryptography/ECDSA.sol";
 

+ 4 - 8
contracts/mocks/EIP712External.sol

@@ -1,12 +1,12 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../drafts/EIP712.sol";
 import "../cryptography/ECDSA.sol";
 
 contract EIP712External is EIP712 {
-    constructor(string memory name, string memory version) public EIP712(name, version) {}
+    constructor(string memory name, string memory version) EIP712(name, version) {}
 
     function domainSeparator() external view returns (bytes32) {
         return _domainSeparatorV4();
@@ -22,11 +22,7 @@ contract EIP712External is EIP712 {
         require(recoveredSigner == signer);
     }
 
-    function getChainId() external view returns (uint256 chainId) {
-        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
-        // solhint-disable-next-line no-inline-assembly
-        assembly {
-            chainId := chainid()
-        }
+    function getChainId() external view returns (uint256) {
+        return block.chainid;
     }
 }

+ 2 - 2
contracts/mocks/ERC1155BurnableMock.sol

@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC1155/ERC1155Burnable.sol";
 
 contract ERC1155BurnableMock is ERC1155Burnable {
-    constructor(string memory uri) public ERC1155(uri) { }
+    constructor(string memory uri) ERC1155(uri) { }
 
     function mint(address to, uint256 id, uint256 value, bytes memory data) public {
         _mint(to, id, value, data);

+ 2 - 2
contracts/mocks/ERC1155Mock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC1155/ERC1155.sol";
 
@@ -9,7 +9,7 @@ import "../token/ERC1155/ERC1155.sol";
  * This mock just publicizes internal functions for testing purposes
  */
 contract ERC1155Mock is ERC1155 {
-    constructor (string memory uri) public ERC1155(uri) {
+    constructor (string memory uri) ERC1155(uri) {
         // solhint-disable-previous-line no-empty-blocks
     }
 

+ 2 - 2
contracts/mocks/ERC1155PausableMock.sol

@@ -1,12 +1,12 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "./ERC1155Mock.sol";
 import "../token/ERC1155/ERC1155Pausable.sol";
 
 contract ERC1155PausableMock is ERC1155Mock, ERC1155Pausable {
-    constructor(string memory uri) public ERC1155Mock(uri) { }
+    constructor(string memory uri) ERC1155Mock(uri) { }
 
     function pause() external {
         _pause();

+ 1 - 2
contracts/mocks/ERC1155ReceiverMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC1155/IERC1155Receiver.sol";
 import "./ERC165Mock.sol";
@@ -20,7 +20,6 @@ contract ERC1155ReceiverMock is IERC1155Receiver, ERC165Mock {
         bytes4 batRetval,
         bool batReverts
     )
-        public
     {
         _recRetval = recRetval;
         _recReverts = recReverts;

+ 3 - 3
contracts/mocks/ERC165/ERC165InterfacesSupported.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../../introspection/IERC165.sol";
 
@@ -29,7 +29,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
      * @dev A contract implementing SupportsInterfaceWithLookup
      * implement ERC165 itself.
      */
-    constructor () public {
+    constructor () {
         _registerInterface(INTERFACE_ID_ERC165);
     }
 
@@ -50,7 +50,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
 }
 
 contract ERC165InterfacesSupported is SupportsInterfaceWithLookupMock {
-    constructor (bytes4[] memory interfaceIds) public {
+    constructor (bytes4[] memory interfaceIds) {
         for (uint256 i = 0; i < interfaceIds.length; i++) {
             _registerInterface(interfaceIds[i]);
         }

+ 7 - 0
contracts/mocks/ERC165/ERC165MissingData.sol

@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+contract ERC165MissingData {
+    function supportsInterface(bytes4 interfaceId) public view {} // missing return
+}

+ 1 - 1
contracts/mocks/ERC165/ERC165NotSupported.sol

@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 contract ERC165NotSupported { }

+ 1 - 1
contracts/mocks/ERC165CheckerMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../introspection/ERC165Checker.sol";
 

+ 1 - 1
contracts/mocks/ERC165Mock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../introspection/ERC165.sol";
 

+ 1 - 1
contracts/mocks/ERC1820ImplementerMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../introspection/ERC1820Implementer.sol";
 

+ 2 - 2
contracts/mocks/ERC20BurnableMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC20/ERC20Burnable.sol";
 
@@ -10,7 +10,7 @@ contract ERC20BurnableMock is ERC20Burnable {
         string memory symbol,
         address initialAccount,
         uint256 initialBalance
-    ) public ERC20(name, symbol) {
+    ) ERC20(name, symbol) {
         _mint(initialAccount, initialBalance);
     }
 }

+ 2 - 2
contracts/mocks/ERC20CappedMock.sol

@@ -1,12 +1,12 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC20/ERC20Capped.sol";
 
 contract ERC20CappedMock is ERC20Capped {
     constructor (string memory name, string memory symbol, uint256 cap)
-        public ERC20(name, symbol) ERC20Capped(cap)
+        ERC20(name, symbol) ERC20Capped(cap)
     { }
 
     function mint(address to, uint256 tokenId) public {

+ 2 - 2
contracts/mocks/ERC20DecimalsMock.sol

@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC20/ERC20.sol";
 
 contract ERC20DecimalsMock is ERC20 {
-    constructor (string memory name, string memory symbol, uint8 decimals) public ERC20(name, symbol) {
+    constructor (string memory name, string memory symbol, uint8 decimals) ERC20(name, symbol) {
         _setupDecimals(decimals);
     }
 }

+ 2 - 2
contracts/mocks/ERC20Mock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC20/ERC20.sol";
 
@@ -11,7 +11,7 @@ contract ERC20Mock is ERC20 {
         string memory symbol,
         address initialAccount,
         uint256 initialBalance
-    ) public payable ERC20(name, symbol) {
+    ) payable ERC20(name, symbol) {
         _mint(initialAccount, initialBalance);
     }
 

+ 2 - 2
contracts/mocks/ERC20PausableMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC20/ERC20Pausable.sol";
 
@@ -11,7 +11,7 @@ contract ERC20PausableMock is ERC20Pausable {
         string memory symbol,
         address initialAccount,
         uint256 initialBalance
-    ) public ERC20(name, symbol) {
+    ) ERC20(name, symbol) {
         _mint(initialAccount, initialBalance);
     }
 

+ 4 - 8
contracts/mocks/ERC20PermitMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../drafts/ERC20Permit.sol";
 
@@ -10,15 +10,11 @@ contract ERC20PermitMock is ERC20Permit {
         string memory symbol,
         address initialAccount,
         uint256 initialBalance
-    ) public payable ERC20(name, symbol) ERC20Permit(name) {
+    ) payable ERC20(name, symbol) ERC20Permit(name) {
         _mint(initialAccount, initialBalance);
     }
 
-    function getChainId() external view returns (uint256 chainId) {
-        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
-        // solhint-disable-next-line no-inline-assembly
-        assembly {
-            chainId := chainid()
-        }
+    function getChainId() external view returns (uint256) {
+        return block.chainid;
     }
 }

+ 2 - 2
contracts/mocks/ERC20SnapshotMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC20/ERC20Snapshot.sol";
 
@@ -11,7 +11,7 @@ contract ERC20SnapshotMock is ERC20Snapshot {
         string memory symbol,
         address initialAccount,
         uint256 initialBalance
-    ) public ERC20(name, symbol) {
+    ) ERC20(name, symbol) {
         _mint(initialAccount, initialBalance);
     }
 

+ 2 - 2
contracts/mocks/ERC721BurnableMock.sol

@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC721/ERC721Burnable.sol";
 
 contract ERC721BurnableMock is ERC721Burnable {
-    constructor(string memory name, string memory symbol) public ERC721(name, symbol) { }
+    constructor(string memory name, string memory symbol) ERC721(name, symbol) { }
 
     function mint(address to, uint256 tokenId) public {
         _mint(to, tokenId);

+ 2 - 3
contracts/mocks/ERC721GSNRecipientMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC721/ERC721.sol";
 import "../GSN/GSNRecipient.sol";
@@ -12,7 +12,6 @@ import "../GSN/GSNRecipientSignature.sol";
  */
 contract ERC721GSNRecipientMock is ERC721, GSNRecipient, GSNRecipientSignature {
     constructor(string memory name, string memory symbol, address trustedSigner)
-        public
         ERC721(name, symbol)
         GSNRecipientSignature(trustedSigner)
     { }
@@ -21,7 +20,7 @@ contract ERC721GSNRecipientMock is ERC721, GSNRecipient, GSNRecipientSignature {
         _mint(_msgSender(), tokenId);
     }
 
-    function _msgSender() internal view override(Context, GSNRecipient) returns (address payable) {
+    function _msgSender() internal view override(Context, GSNRecipient) returns (address) {
         return GSNRecipient._msgSender();
     }
 

+ 2 - 2
contracts/mocks/ERC721Mock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC721/ERC721.sol";
 
@@ -9,7 +9,7 @@ import "../token/ERC721/ERC721.sol";
  * This mock just provides a public safeMint, mint, and burn functions for testing purposes
  */
 contract ERC721Mock is ERC721 {
-    constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
+    constructor (string memory name, string memory symbol) ERC721(name, symbol) { }
 
     function exists(uint256 tokenId) public view returns (bool) {
         return _exists(tokenId);

+ 2 - 2
contracts/mocks/ERC721PausableMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC721/ERC721Pausable.sol";
 
@@ -9,7 +9,7 @@ import "../token/ERC721/ERC721Pausable.sol";
  * This mock just provides a public mint, burn and exists functions for testing purposes
  */
 contract ERC721PausableMock is ERC721Pausable {
-    constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
+    constructor (string memory name, string memory symbol) ERC721(name, symbol) { }
 
     function mint(address to, uint256 tokenId) public {
         super._mint(to, tokenId);

+ 20 - 6
contracts/mocks/ERC721ReceiverMock.sol

@@ -1,24 +1,38 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../token/ERC721/IERC721Receiver.sol";
 
 contract ERC721ReceiverMock is IERC721Receiver {
-    bytes4 private _retval;
-    bool private _reverts;
+    enum Error {
+        None,
+        RevertWithMessage,
+        RevertWithoutMessage,
+        Panic
+    }
+
+    bytes4 private immutable _retval;
+    Error private immutable _error;
 
     event Received(address operator, address from, uint256 tokenId, bytes data, uint256 gas);
 
-    constructor (bytes4 retval, bool reverts) public {
+    constructor (bytes4 retval, Error error) {
         _retval = retval;
-        _reverts = reverts;
+        _error = error;
     }
 
     function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
         public override returns (bytes4)
     {
-        require(!_reverts, "ERC721ReceiverMock: reverting");
+        if (_error == Error.RevertWithMessage) {
+            revert("ERC721ReceiverMock: reverting");
+        } else if (_error == Error.RevertWithoutMessage) {
+            revert();
+        } else if (_error == Error.Panic) {
+            uint256 a = uint256(0) / uint256(0);
+            a;
+        }
         emit Received(operator, from, tokenId, data, gasleft());
         return _retval;
     }

+ 2 - 2
contracts/mocks/ERC777Mock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Context.sol";
 import "../token/ERC777/ERC777.sol";
@@ -14,7 +14,7 @@ contract ERC777Mock is Context, ERC777 {
         string memory name,
         string memory symbol,
         address[] memory defaultOperators
-    ) public ERC777(name, symbol, defaultOperators) {
+    ) ERC777(name, symbol, defaultOperators) {
         _mint(initialHolder, initialBalance, "", "");
     }
 

+ 1 - 1
contracts/mocks/ERC777SenderRecipientMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Context.sol";
 import "../token/ERC777/IERC777.sol";

+ 1 - 1
contracts/mocks/EnumerableMapMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/EnumerableMap.sol";
 

+ 1 - 1
contracts/mocks/EnumerableSetMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/EnumerableSet.sol";
 

+ 1 - 1
contracts/mocks/EtherReceiverMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 contract EtherReceiverMock {
     bool private _acceptEther;

+ 2 - 2
contracts/mocks/GSNRecipientERC20FeeMock.sol

@@ -1,12 +1,12 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../GSN/GSNRecipient.sol";
 import "../GSN/GSNRecipientERC20Fee.sol";
 
 contract GSNRecipientERC20FeeMock is GSNRecipient, GSNRecipientERC20Fee {
-    constructor(string memory name, string memory symbol) public GSNRecipientERC20Fee(name, symbol) { }
+    constructor(string memory name, string memory symbol) GSNRecipientERC20Fee(name, symbol) { }
 
     function mint(address account, uint256 amount) public {
         _mint(account, amount);

+ 4 - 4
contracts/mocks/GSNRecipientMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "./ContextMock.sol";
 import "../GSN/GSNRecipient.sol";
@@ -13,7 +13,7 @@ contract GSNRecipientMock is ContextMock, GSNRecipient {
 
     function acceptRelayedCall(address, address, bytes calldata, uint256, uint256, uint256, uint256, bytes calldata, uint256)
         external
-        view
+        pure
         override
         returns (uint256, bytes memory)
     {
@@ -28,11 +28,11 @@ contract GSNRecipientMock is ContextMock, GSNRecipient {
         return _upgradeRelayHub(newRelayHub);
     }
 
-    function _msgSender() internal override(Context, GSNRecipient) view virtual returns (address payable) {
+    function _msgSender() internal override(Context, GSNRecipient) view virtual returns (address) {
         return GSNRecipient._msgSender();
     }
 
-    function _msgData() internal override(Context, GSNRecipient) view virtual returns (bytes memory) {
+    function _msgData() internal override(Context, GSNRecipient) view virtual returns (bytes calldata) {
         return GSNRecipient._msgData();
     }
 }

+ 2 - 2
contracts/mocks/GSNRecipientSignatureMock.sol

@@ -1,12 +1,12 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../GSN/GSNRecipient.sol";
 import "../GSN/GSNRecipientSignature.sol";
 
 contract GSNRecipientSignatureMock is GSNRecipient, GSNRecipientSignature {
-    constructor(address trustedSigner) public GSNRecipientSignature(trustedSigner) { }
+    constructor(address trustedSigner) GSNRecipientSignature(trustedSigner) { }
 
     event MockFunctionCalled();
 

+ 1 - 1
contracts/mocks/InitializableMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../proxy/Initializable.sol";
 

+ 1 - 1
contracts/mocks/MathMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../math/Math.sol";
 

+ 1 - 1
contracts/mocks/MerkleProofWrapper.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import { MerkleProof } from "../cryptography/MerkleProof.sol";
 

+ 1 - 1
contracts/mocks/MultipleInheritanceInitializableMocks.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../proxy/Initializable.sol";
 

+ 1 - 1
contracts/mocks/OwnableMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../access/Ownable.sol";
 

+ 2 - 2
contracts/mocks/PausableMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Pausable.sol";
 
@@ -8,7 +8,7 @@ contract PausableMock is Pausable {
     bool public drasticMeasureTaken;
     uint256 public count;
 
-    constructor () public {
+    constructor () {
         drasticMeasureTaken = false;
         count = 0;
     }

+ 2 - 2
contracts/mocks/PullPaymentMock.sol

@@ -1,12 +1,12 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../payment/PullPayment.sol";
 
 // mock class using PullPayment
 contract PullPaymentMock is PullPayment {
-    constructor () public payable { }
+    constructor () payable { }
 
     // test helper function to call asyncTransfer
     function callTransfer(address dest, uint256 amount) public {

+ 1 - 1
contracts/mocks/ReentrancyAttack.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Context.sol";
 contract ReentrancyAttack is Context {

+ 2 - 2
contracts/mocks/ReentrancyMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/ReentrancyGuard.sol";
 import "./ReentrancyAttack.sol";
@@ -8,7 +8,7 @@ import "./ReentrancyAttack.sol";
 contract ReentrancyMock is ReentrancyGuard {
     uint256 public counter;
 
-    constructor () public {
+    constructor () {
         counter = 0;
     }
 

+ 1 - 1
contracts/mocks/RegressionImplementation.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../proxy/Initializable.sol";
 

+ 1 - 1
contracts/mocks/SafeCastMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/SafeCast.sol";
 

+ 2 - 2
contracts/mocks/SafeERC20Helper.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Context.sol";
 import "../token/ERC20/IERC20.sol";
@@ -98,7 +98,7 @@ contract SafeERC20Wrapper is Context {
 
     IERC20 private _token;
 
-    constructor (IERC20 token) public {
+    constructor (IERC20 token) {
         _token = token;
     }
 

+ 1 - 1
contracts/mocks/SafeMathMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../math/SafeMath.sol";
 

+ 1 - 1
contracts/mocks/SignedSafeMathMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../math/SignedSafeMath.sol";
 

+ 1 - 1
contracts/mocks/SingleInheritanceInitializableMocks.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../proxy/Initializable.sol";
 

+ 1 - 1
contracts/mocks/StringsMock.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Strings.sol";
 

+ 7 - 9
contracts/payment/PaymentSplitter.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../utils/Context.sol";
 import "../math/SafeMath.sol";
@@ -20,8 +20,6 @@ import "../utils/Address.sol";
  * function.
  */
 contract PaymentSplitter is Context {
-    using SafeMath for uint256;
-
     event PayeeAdded(address account, uint256 shares);
     event PaymentReleased(address to, uint256 amount);
     event PaymentReceived(address from, uint256 amount);
@@ -40,7 +38,7 @@ contract PaymentSplitter is Context {
      * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
      * duplicates in `payees`.
      */
-    constructor (address[] memory payees, uint256[] memory shares_) public payable {
+    constructor (address[] memory payees, uint256[] memory shares_) payable {
         // solhint-disable-next-line max-line-length
         require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
         require(payees.length > 0, "PaymentSplitter: no payees");
@@ -105,13 +103,13 @@ contract PaymentSplitter is Context {
     function release(address payable account) public virtual {
         require(_shares[account] > 0, "PaymentSplitter: account has no shares");
 
-        uint256 totalReceived = address(this).balance.add(_totalReleased);
-        uint256 payment = totalReceived.mul(_shares[account]).div(_totalShares).sub(_released[account]);
+        uint256 totalReceived = address(this).balance + _totalReleased;
+        uint256 payment = totalReceived * _shares[account] / _totalShares - _released[account];
 
         require(payment != 0, "PaymentSplitter: account is not due payment");
 
-        _released[account] = _released[account].add(payment);
-        _totalReleased = _totalReleased.add(payment);
+        _released[account] = _released[account] + payment;
+        _totalReleased = _totalReleased + payment;
 
         Address.sendValue(account, payment);
         emit PaymentReleased(account, payment);
@@ -129,7 +127,7 @@ contract PaymentSplitter is Context {
 
         _payees.push(account);
         _shares[account] = shares_;
-        _totalShares = _totalShares.add(shares_);
+        _totalShares = _totalShares + shares_;
         emit PayeeAdded(account, shares_);
     }
 }

+ 2 - 2
contracts/payment/PullPayment.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.2 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "./escrow/Escrow.sol";
 
@@ -25,7 +25,7 @@ import "./escrow/Escrow.sol";
 abstract contract PullPayment {
     Escrow private _escrow;
 
-    constructor () internal {
+    constructor () {
         _escrow = new Escrow();
     }
 

+ 1 - 1
contracts/payment/escrow/ConditionalEscrow.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "./Escrow.sol";
 

+ 2 - 4
contracts/payment/escrow/Escrow.sol

@@ -1,8 +1,7 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
-import "../../math/SafeMath.sol";
 import "../../access/Ownable.sol";
 import "../../utils/Address.sol";
 
@@ -20,7 +19,6 @@ import "../../utils/Address.sol";
   * to the escrow's deposit and withdraw.
   */
 contract Escrow is Ownable {
-    using SafeMath for uint256;
     using Address for address payable;
 
     event Deposited(address indexed payee, uint256 weiAmount);
@@ -38,7 +36,7 @@ contract Escrow is Ownable {
      */
     function deposit(address payee) public payable virtual onlyOwner {
         uint256 amount = msg.value;
-        _deposits[payee] = _deposits[payee].add(amount);
+        _deposits[payee] = _deposits[payee] + amount;
 
         emit Deposited(payee, amount);
     }

+ 4 - 2
contracts/payment/escrow/RefundEscrow.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "./ConditionalEscrow.sol";
 
@@ -15,6 +15,8 @@ import "./ConditionalEscrow.sol";
  * with `RefundEscrow` will be made through the owner contract.
  */
 contract RefundEscrow is ConditionalEscrow {
+    using Address for address payable;
+
     enum State { Active, Refunding, Closed }
 
     event RefundsClosed();
@@ -27,7 +29,7 @@ contract RefundEscrow is ConditionalEscrow {
      * @dev Constructor.
      * @param beneficiary_ The beneficiary of the deposits.
      */
-    constructor (address payable beneficiary_) public {
+    constructor (address payable beneficiary_) {
         require(beneficiary_ != address(0), "RefundEscrow: beneficiary is the zero address");
         _beneficiary = beneficiary_;
         _state = State.Active;

+ 2 - 2
contracts/presets/ERC1155PresetMinterPauser.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../access/AccessControl.sol";
 import "../utils/Context.sol";
@@ -30,7 +30,7 @@ contract ERC1155PresetMinterPauser is Context, AccessControl, ERC1155Burnable, E
      * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, and `PAUSER_ROLE` to the account that
      * deploys the contract.
      */
-    constructor(string memory uri) public ERC1155(uri) {
+    constructor(string memory uri) ERC1155(uri) {
         _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
 
         _setupRole(MINTER_ROLE, _msgSender());

+ 3 - 3
contracts/presets/ERC20PresetFixedSupply.sol

@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: MIT
-pragma solidity ^0.6.2;
+pragma solidity ^0.8.0;
 
 import "../token/ERC20/ERC20Burnable.sol";
 
@@ -17,7 +17,7 @@ import "../token/ERC20/ERC20Burnable.sol";
  */
 contract ERC20PresetFixedSupply is ERC20Burnable {
     /**
-     * @dev Mints `initialSupply` amount of token and transfers them to `owner`.  
+     * @dev Mints `initialSupply` amount of token and transfers them to `owner`.
      *
      * See {ERC20-constructor}.
      */
@@ -26,7 +26,7 @@ contract ERC20PresetFixedSupply is ERC20Burnable {
         string memory symbol,
         uint256 initialSupply,
         address owner
-    ) public ERC20(name, symbol) {
+    ) ERC20(name, symbol) {
         _mint(owner, initialSupply);
     }
 }

+ 2 - 2
contracts/presets/ERC20PresetMinterPauser.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../access/AccessControl.sol";
 import "../utils/Context.sol";
@@ -32,7 +32,7 @@ contract ERC20PresetMinterPauser is Context, AccessControl, ERC20Burnable, ERC20
      *
      * See {ERC20-constructor}.
      */
-    constructor(string memory name, string memory symbol) public ERC20(name, symbol) {
+    constructor(string memory name, string memory symbol) ERC20(name, symbol) {
         _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
 
         _setupRole(MINTER_ROLE, _msgSender());

+ 2 - 2
contracts/presets/ERC721PresetMinterPauserAutoId.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "../access/AccessControl.sol";
 import "../utils/Context.sol";
@@ -39,7 +39,7 @@ contract ERC721PresetMinterPauserAutoId is Context, AccessControl, ERC721Burnabl
      * Token URIs will be autogenerated based on `baseURI` and their token IDs.
      * See {ERC721-tokenURI}.
      */
-    constructor(string memory name, string memory symbol, string memory baseURI) public ERC721(name, symbol) {
+    constructor(string memory name, string memory symbol, string memory baseURI) ERC721(name, symbol) {
         _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
 
         _setupRole(MINTER_ROLE, _msgSender());

+ 3 - 3
contracts/presets/ERC777PresetFixedSupply.sol

@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: MIT
-pragma solidity ^0.6.2;
+pragma solidity ^0.8.0;
 
 import "../token/ERC777/ERC777.sol";
 
@@ -13,7 +13,7 @@ import "../token/ERC777/ERC777.sol";
  */
 contract ERC777PresetFixedSupply is ERC777 {
     /**
-     * @dev Mints `initialSupply` amount of token and transfers them to `owner`.  
+     * @dev Mints `initialSupply` amount of token and transfers them to `owner`.
      *
      * See {ERC777-constructor}.
      */
@@ -23,7 +23,7 @@ contract ERC777PresetFixedSupply is ERC777 {
         address[] memory defaultOperators,
         uint256 initialSupply,
         address owner
-    ) public ERC777(name, symbol, defaultOperators) {
+    ) ERC777(name, symbol, defaultOperators) {
         _mint(owner, initialSupply, "", "");
     }
 }

+ 2 - 2
contracts/proxy/BeaconProxy.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 import "./Proxy.sol";
 import "../utils/Address.sol";
@@ -32,7 +32,7 @@ contract BeaconProxy is Proxy {
      *
      * - `beacon` must be a contract with the interface {IBeacon}.
      */
-    constructor(address beacon, bytes memory data) public payable {
+    constructor(address beacon, bytes memory data) payable {
         assert(_BEACON_SLOT == bytes32(uint256(keccak256("eip1967.proxy.beacon")) - 1));
         _setBeacon(beacon, data);
     }

+ 1 - 1
contracts/proxy/Clones.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for

+ 1 - 1
contracts/proxy/IBeacon.sol

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: MIT
 
-pragma solidity >=0.6.0 <0.8.0;
+pragma solidity ^0.8.0;
 
 /**
  * @dev This is the interface that {BeaconProxy} expects of its beacon.

Some files were not shown because too many files changed in this diff