Unverified Commit 04fc3570 by Elena Gesheva Committed by GitHub

Migrate contracts to Solidity 0.7 (#2319)

* Update contract pragmas to solidity 0.7

* Remove internal declaration on constructors

* Reference SafeMath explicitely

* Remove public constructor declaration from abstract contracts

* Remove public constructor declaration from non-abstract contracts
parent 09014f90
......@@ -4,7 +4,7 @@
"func-order": "off",
"mark-callable-contracts": "off",
"no-empty-blocks": "off",
"compiler-version": ["error", "^0.6.0"],
"compiler-version": ["error", "^0.7.0"],
"private-vars-leading-underscore": "error"
}
}
......@@ -28,12 +28,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.7.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract MyCollectible is ERC721 {
constructor() ERC721("MyCollectible", "MCO") public {
constructor() ERC721("MyCollectible", "MCO") {
}
}
```
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/*
* @dev Provides information about the current execution context, including the
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./IRelayRecipient.sol";
import "./IRelayHub.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./GSNRecipient.sol";
import "../math/SafeMath.sol";
......@@ -30,7 +30,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);
}
......@@ -116,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 onlyOwner {
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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;
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Interface for `RelayHub`, the core contract of the GSN. Users should not need to interact with this contract
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Base interface for a contract that will be called via the GSN from {IRelayHub}.
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../GSN/Context.sol";
/**
......@@ -23,7 +23,7 @@ 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);
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev These functions deal with verification of Merkle trees (hash trees),
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./IERC165.sol";
......@@ -21,7 +21,7 @@ contract ERC165 is IERC165 {
*/
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);
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
pragma solidity ^0.7.0;
/**
* @dev Library used to query support of an interface declared via {IERC165}.
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./IERC1820Implementer.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Interface for an ERC1820 implementer, as defined in the
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Interface of the global ERC1820 Registry, as defined in the
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Standard math utilities missing in the Solidity language.
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @title SignedSafeMath
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../access/AccessControl.sol";
contract AccessControlMock is AccessControl {
constructor() public {
constructor() {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../utils/Address.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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;
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
contract CallReceiverMock {
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../payment/escrow/ConditionalEscrow.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../GSN/Context.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../utils/Counters.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../utils/Create2.sol";
import "../introspection/ERC1820Implementer.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../cryptography/ECDSA.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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);
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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();
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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;
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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]);
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
contract ERC165NotSupported { }
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../introspection/ERC165Checker.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../introspection/ERC165.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../introspection/ERC1820Implementer.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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);
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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 {
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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);
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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);
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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);
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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);
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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);
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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)
{ }
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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);
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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);
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../token/ERC721/IERC721Receiver.sol";
......@@ -10,7 +10,7 @@ contract ERC721ReceiverMock is IERC721Receiver {
event Received(address operator, address from, uint256 tokenId, bytes data, uint256 gas);
constructor (bytes4 retval, bool reverts) public {
constructor (bytes4 retval, bool reverts) {
_retval = retval;
_reverts = reverts;
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../GSN/Context.sol";
import "../token/ERC777/ERC777.sol";
......@@ -12,7 +12,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, "", "");
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../GSN/Context.sol";
import "../token/ERC777/IERC777.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../utils/EnumerableMap.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../utils/EnumerableSet.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
contract EtherReceiverMock {
bool private _acceptEther;
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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);
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./ContextMock.sol";
import "../GSN/GSNRecipient.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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();
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../math/Math.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import { MerkleProof } from "../cryptography/MerkleProof.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../access/Ownable.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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;
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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 {
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../GSN/Context.sol";
contract ReentrancyAttack is Context {
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.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;
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../utils/SafeCast.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../GSN/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;
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../math/SafeMath.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../math/SignedSafeMath.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../utils/Strings.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../GSN/Context.sol";
import "../math/SafeMath.sol";
......@@ -39,7 +39,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");
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
pragma solidity ^0.7.0;
import "./escrow/Escrow.sol";
......@@ -25,7 +25,7 @@ import "./escrow/Escrow.sol";
contract PullPayment {
Escrow private _escrow;
constructor () internal {
constructor () {
_escrow = new Escrow();
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./Escrow.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../../math/SafeMath.sol";
import "../../access/Ownable.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./ConditionalEscrow.sol";
......@@ -27,7 +27,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;
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../access/AccessControl.sol";
import "../GSN/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());
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../access/AccessControl.sol";
import "../GSN/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());
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../access/AccessControl.sol";
import "../GSN/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());
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./IERC1155.sol";
import "./IERC1155MetadataURI.sol";
......@@ -52,7 +52,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
/**
* @dev See {_setURI}.
*/
constructor (string memory uri) public {
constructor (string memory uri) {
_setURI(uri);
// register the supported interfaces to conform to ERC1155 via ERC165
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./ERC1155.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./ERC1155Receiver.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./ERC1155.sol";
import "../../utils/Pausable.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./IERC1155Receiver.sol";
import "../../introspection/ERC165.sol";
......@@ -9,7 +9,7 @@ import "../../introspection/ERC165.sol";
* @dev _Available since v3.1._
*/
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
constructor() public {
constructor() {
_registerInterface(
ERC1155Receiver(0).onERC1155Received.selector ^
ERC1155Receiver(0).onERC1155BatchReceived.selector
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
pragma solidity ^0.7.0;
import "../../introspection/IERC165.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
pragma solidity ^0.7.0;
import "./IERC1155.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../../introspection/IERC165.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../../GSN/Context.sol";
import "./IERC20.sol";
......@@ -54,7 +54,7 @@ contract ERC20 is Context, IERC20 {
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol) public {
constructor (string memory name, string memory symbol) {
_name = name;
_symbol = symbol;
_decimals = 18;
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../../GSN/Context.sol";
import "./ERC20.sol";
......@@ -11,6 +11,8 @@ import "./ERC20.sol";
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
using SafeMath for uint256;
/**
* @dev Destroys `amount` tokens from the caller.
*
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./ERC20.sol";
......@@ -8,13 +8,15 @@ import "./ERC20.sol";
* @dev Extension of {ERC20} that adds a cap to the supply of tokens.
*/
abstract contract ERC20Capped is ERC20 {
using SafeMath for uint256;
uint256 private _cap;
/**
* @dev Sets the value of the `cap`. This value is immutable, it can only be
* set once during construction.
*/
constructor (uint256 cap) public {
constructor (uint256 cap) {
require(cap > 0, "ERC20Capped: cap is 0");
_cap = cap;
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./ERC20.sol";
import "../../utils/Pausable.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../../math/SafeMath.sol";
import "../../utils/Arrays.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./IERC20.sol";
import "../../math/SafeMath.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./SafeERC20.sol";
......@@ -23,7 +23,7 @@ contract TokenTimelock {
// timestamp when token release is enabled
uint256 private _releaseTime;
constructor (IERC20 token, address beneficiary, uint256 releaseTime) public {
constructor (IERC20 token, address beneficiary, uint256 releaseTime) {
// solhint-disable-next-line not-rely-on-time
require(releaseTime > block.timestamp, "TokenTimelock: release time is before current time");
_token = token;
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../../GSN/Context.sol";
import "./IERC721.sol";
......@@ -90,7 +90,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor (string memory name, string memory symbol) public {
constructor (string memory name, string memory symbol) {
_name = name;
_symbol = symbol;
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../../GSN/Context.sol";
import "./ERC721.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./IERC721Receiver.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./ERC721.sol";
import "../../utils/Pausable.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
pragma solidity ^0.7.0;
import "../../introspection/IERC165.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
pragma solidity ^0.7.0;
import "./IERC721.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
pragma solidity ^0.7.0;
import "./IERC721.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @title ERC721 token receiver interface
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../../GSN/Context.sol";
import "./IERC777.sol";
......@@ -70,7 +70,7 @@ contract ERC777 is Context, IERC777, IERC20 {
string memory name,
string memory symbol,
address[] memory defaultOperators
) public {
) {
_name = name;
_symbol = symbol;
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Interface of the ERC777Token standard as defined in the EIP.
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Interface of the ERC777TokensSender standard as defined in the EIP.
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
pragma solidity ^0.7.0;
/**
* @dev Collection of functions related to the address type
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../math/Math.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../math/SafeMath.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Library for managing an enumerable variant of Solidity's
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Library for managing
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../GSN/Context.sol";
......@@ -29,7 +29,7 @@ contract Pausable is Context {
/**
* @dev Initializes the contract in unpaused state.
*/
constructor () internal {
constructor () {
_paused = false;
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
......@@ -35,7 +35,7 @@ contract ReentrancyGuard {
uint256 private _status;
constructor () internal {
constructor () {
_status = _NOT_ENTERED;
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
/**
* @dev String operations.
......
......@@ -13,7 +13,7 @@ OpenZeppelin provides xref:api:access.adoc#Ownable[`Ownable`] for implementing o
----
// contracts/MyContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/access/Ownable.sol";
......@@ -62,7 +62,7 @@ Here's a simple example of using `AccessControl` in an xref:tokens.adoc#ERC20[`E
----
// contracts/MyToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
......@@ -71,7 +71,7 @@ contract MyToken is ERC20, AccessControl {
// Create a new role identifier for the minter role
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
constructor(address minter) public ERC20("MyToken", "TKN") {
constructor(address minter) ERC20("MyToken", "TKN") {
// Grant the minter role to a specified account
_setupRole(MINTER_ROLE, minter);
}
......@@ -94,7 +94,7 @@ Let's augment our ERC20 token example by also defining a 'burner' role, which le
----
// contracts/MyToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
......@@ -103,7 +103,7 @@ contract MyToken is ERC20, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor(address minter, address burner) public ERC20("MyToken", "TKN") {
constructor(address minter, address burner) ERC20("MyToken", "TKN") {
_setupRole(MINTER_ROLE, minter);
_setupRole(BURNER_ROLE, burner);
}
......@@ -139,7 +139,7 @@ Let's take a look at the ERC20 token example, this time taking advantage of the
----
// contracts/MyToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
......@@ -148,7 +148,7 @@ contract MyToken is ERC20, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor() public ERC20("MyToken", "TKN") {
constructor() ERC20("MyToken", "TKN") {
// Grant the contract deployer the default admin role: it will be able
// to grant and revoke any roles
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
......
......@@ -34,7 +34,7 @@ Here's what a contract for tokenized items might look like:
----
// contracts/GameItems.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
......@@ -45,7 +45,7 @@ contract GameItems is ERC1155 {
uint256 public constant SWORD = 3;
uint256 public constant SHIELD = 4;
constructor() public ERC1155("https://game.example/api/item/{1}.json") {
constructor() ERC1155("https://game.example/api/item/{1}.json") {
_mint(msg.sender, GOLD, 10**18, "");
_mint(msg.sender, SILVER, 10**27, "");
_mint(msg.sender, THORS_HAMMER, 1, "");
......@@ -132,7 +132,7 @@ In order for our contract to receive ERC1155 tokens we can inherit from the conv
----
// contracts/MyContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155Holder.sol";
......
......@@ -14,7 +14,7 @@ Let's say we want a token with a fixed supply of 1000, initially allocated to th
[source,solidity]
----
contract ERC20FixedSupply is ERC20 {
constructor() public {
constructor() {
totalSupply += 1000;
balances[msg.sender] += 1000;
}
......@@ -26,7 +26,7 @@ Starting with Contracts v2 this pattern is not only discouraged, but disallowed.
[source,solidity]
----
contract ERC20FixedSupply is ERC20 {
constructor() public ERC20("Fixed", "FIX") {
constructor() ERC20("Fixed", "FIX") {
_mint(msg.sender, 1000);
}
}
......@@ -44,7 +44,7 @@ The mechanism we will implement is a token reward for the miners that produce Et
[source,solidity]
----
contract ERC20WithMinerReward is ERC20 {
constructor() public ERC20("Reward", "RWD") {}
constructor() ERC20("Reward", "RWD") {}
function mintMinerReward() public {
_mint(block.coinbase, 1000);
......@@ -68,7 +68,7 @@ The accounts with the minter role don't need to be externally owned, though, and
contract MinerRewardMinter {
ERC20PresetMinterPauser _token;
constructor(ERC20PresetMinterPauser token) public {
constructor(ERC20PresetMinterPauser token) {
_token = token;
}
......@@ -92,7 +92,7 @@ Adding to the supply mechanism from previous sections, we can use this hook to m
[source,solidity]
----
contract ERC20WithAutoMinerReward is ERC20 {
constructor() public ERC20("Reward", "RWD") {}
constructor() ERC20("Reward", "RWD") {}
function _mintMinerReward() internal {
_mint(block.coinbase, 1000);
......
......@@ -15,12 +15,12 @@ Here's what our GLD token might look like.
----
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract GLDToken is ERC20 {
constructor(uint256 initialSupply) public ERC20("Gold", "GLD") {
constructor(uint256 initialSupply) ERC20("Gold", "GLD") {
_mint(msg.sender, initialSupply);
}
}
......
......@@ -14,7 +14,7 @@ Here's what a contract for tokenized items might look like:
----
// contracts/GameItem.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
......@@ -23,7 +23,7 @@ contract GameItem is ERC721 {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor() public ERC721("GameItem", "ITM") {}
constructor() ERC721("GameItem", "ITM") {}
function awardItem(address player, string memory tokenURI)
public
......
......@@ -20,13 +20,12 @@ We will replicate the `GLD` example of the xref:erc20.adoc#constructing-an-erc20
----
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC777/ERC777.sol";
contract GLDToken is ERC777 {
constructor(uint256 initialSupply, address[] memory defaultOperators)
public
ERC777("Gold", "GLD", defaultOperators)
{
_mint(msg.sender, initialSupply, "", "");
......
......@@ -20,7 +20,7 @@ For example, imagine you want to change xref:api:access.adoc#AccessControl[`Acce
```solidity
// contracts/ModifiedAccessControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
......@@ -48,7 +48,7 @@ Here is a modified version of xref:api:access.adoc#AccessControl[`AccessControl`
```solidity
// contracts/ModifiedAccessControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
......@@ -80,7 +80,7 @@ Hooks are simply functions that are called before or after some action takes pla
Here's how you would implement the `IERC721Receiver` pattern in `ERC20`, using the xref:api:token/ERC20.adoc#ERC20-_beforeTokenTransfer-address-address-uint256-[`_beforeTokenTransfer`] hook:
```solidity
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
......
......@@ -62,7 +62,7 @@ Instead of using `GSNRecipient` directly, your GSN recipient contract will inste
import "@openzeppelin/contracts/GSN/GSNRecipientSignature.sol";
contract MyContract is GSNRecipientSignature {
constructor(address trustedSigner) public GSNRecipientSignature(trustedSigner) {
constructor(address trustedSigner) GSNRecipientSignature(trustedSigner) {
}
}
----
......@@ -108,7 +108,7 @@ Your GSN recipient contract needs to inherit from `GSNRecipientERC20Fee` along w
----
// contracts/MyContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/GSN/GSNRecipientERC20Fee.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
......@@ -116,7 +116,7 @@ import "@openzeppelin/contracts/access/AccessControl.sol";
contract MyContract is GSNRecipientERC20Fee, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
constructor() public GSNRecipientERC20Fee("FeeToken", "FEE") {
constructor() GSNRecipientERC20Fee("FeeToken", "FEE") {
_setupRole(MINTER_ROLE, _msgSender());
}
......@@ -154,7 +154,7 @@ Once your strategy is ready, all your GSN recipient needs to do is inherit from
[source,solidity]
----
contract MyContract is MyCustomGSNStrategy {
constructor() public MyCustomGSNStrategy() {
constructor() MyCustomGSNStrategy() {
}
}
----
......@@ -28,12 +28,12 @@ Once installed, you can use the contracts in the library by importing them:
----
// contracts/MyNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract MyNFT is ERC721 {
constructor() ERC721("MyNFT", "MNFT") public {
constructor() ERC721("MyNFT", "MNFT") {
}
}
----
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment