diff --git a/contracts/access/roles/WhitelistAdminRole.sol b/contracts/access/roles/WhitelistAdminRole.sol index 8af7412ba..e8bc0ab48 100644 --- a/contracts/access/roles/WhitelistAdminRole.sol +++ b/contracts/access/roles/WhitelistAdminRole.sol @@ -1,12 +1,14 @@ pragma solidity ^0.5.0; +import "zos-lib/contracts/Initializable.sol"; + import "../Roles.sol"; /** * @title WhitelistAdminRole * @dev WhitelistAdmins are responsible for assigning and removing Whitelisted accounts. */ -contract WhitelistAdminRole { +contract WhitelistAdminRole is Initializable { using Roles for Roles.Role; event WhitelistAdminAdded(address indexed account); @@ -14,8 +16,10 @@ contract WhitelistAdminRole { Roles.Role private _whitelistAdmins; - constructor () internal { - _addWhitelistAdmin(msg.sender); + function _initialize(address sender) internal initializer { + if (!isWhitelistAdmin(sender)) { + _addWhitelistAdmin(sender); + } } modifier onlyWhitelistAdmin() { diff --git a/contracts/access/roles/WhitelistedRole.sol b/contracts/access/roles/WhitelistedRole.sol index 3ba5ae0cf..87b146b95 100644 --- a/contracts/access/roles/WhitelistedRole.sol +++ b/contracts/access/roles/WhitelistedRole.sol @@ -1,5 +1,7 @@ pragma solidity ^0.5.0; +import "zos-lib/contracts/Initializable.sol"; + import "../Roles.sol"; import "./WhitelistAdminRole.sol"; @@ -9,7 +11,7 @@ import "./WhitelistAdminRole.sol"; * crowdsale). This role is special in that the only accounts that can add it are WhitelistAdmins (who can also remove * it), and not Whitelisteds themselves. */ -contract WhitelistedRole is WhitelistAdminRole { +contract WhitelistedRole is Initializable, WhitelistAdminRole { using Roles for Roles.Role; event WhitelistedAdded(address indexed account); @@ -22,6 +24,10 @@ contract WhitelistedRole is WhitelistAdminRole { _; } + function _initialize(address sender) internal initializer { + WhitelistAdminRole._initialize(sender); + } + function isWhitelisted(address account) public view returns (bool) { return _whitelisteds.has(account); } diff --git a/contracts/crowdsale/Crowdsale.sol b/contracts/crowdsale/Crowdsale.sol index 2ab365033..87a1d91d9 100644 --- a/contracts/crowdsale/Crowdsale.sol +++ b/contracts/crowdsale/Crowdsale.sol @@ -54,7 +54,7 @@ contract Crowdsale is Initializable, ReentrancyGuard { * @param wallet Address where collected funds will be forwarded to * @param token Address of the token being sold */ - function initialize(uint256 rate, address wallet, IERC20 token) public initializer { + function initialize(uint256 rate, address payable wallet, IERC20 token) public initializer { require(rate > 0); require(wallet != address(0)); require(address(token) != address(0)); @@ -128,7 +128,7 @@ contract Crowdsale is Initializable, ReentrancyGuard { } function _hasBeenInitialized() internal view returns (bool) { - return ((_rate > 0) && (_wallet != address(0)) && (_token != address(0))); + return ((_rate > 0) && (_wallet != address(0)) && (address(_token) != address(0))); } /** diff --git a/contracts/crowdsale/validation/WhitelistCrowdsale.sol b/contracts/crowdsale/validation/WhitelistCrowdsale.sol index 16e28786e..29e13b617 100644 --- a/contracts/crowdsale/validation/WhitelistCrowdsale.sol +++ b/contracts/crowdsale/validation/WhitelistCrowdsale.sol @@ -7,7 +7,11 @@ import "../../access/roles/WhitelistedRole.sol"; * @title WhitelistCrowdsale * @dev Crowdsale in which only whitelisted users can contribute. */ -contract WhitelistCrowdsale is WhitelistedRole, Crowdsale { +contract WhitelistCrowdsale is Initializable, WhitelistedRole, Crowdsale { + function initialize(address sender) public initializer { + WhitelistedRole._initialize(sender); + } + /** * @dev Extend parent behavior requiring beneficiary to be whitelisted. Note that no * restriction is imposed on the account sending the transaction. diff --git a/contracts/drafts/TokenVesting.sol b/contracts/drafts/TokenVesting.sol index d4839f7ae..623c37a4a 100644 --- a/contracts/drafts/TokenVesting.sol +++ b/contracts/drafts/TokenVesting.sol @@ -47,7 +47,7 @@ contract TokenVesting is Initializable, Ownable { * @param duration duration in seconds of the period in which the tokens will vest * @param revocable whether the vesting is revocable or not */ - constructor (address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable, address sender) public initializer { + function initialize(address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable, address sender) public initializer { Ownable.initialize(sender); require(beneficiary != address(0)); diff --git a/contracts/examples/StandardToken.sol b/contracts/examples/StandardToken.sol index e004a2562..b024ea49c 100644 --- a/contracts/examples/StandardToken.sol +++ b/contracts/examples/StandardToken.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "zos-lib/contracts/Initializable.sol"; import "../token/ERC20/ERC20Detailed.sol"; @@ -12,8 +12,8 @@ import "../token/ERC20/ERC20Pausable.sol"; */ contract StandardToken is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable { function initialize( - string name, string symbol, uint8 decimals, uint256 initialSupply, address initialHolder, - address[] minters, address[] pausers + string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, address initialHolder, + address[] memory minters, address[] memory pausers ) public initializer { ERC20Detailed.initialize(name, symbol, decimals); @@ -35,7 +35,7 @@ contract StandardToken is Initializable, ERC20Detailed, ERC20Mintable, ERC20Paus _addMinter(minters[i]); } - for (i = 0; i < pausers.length; ++i) { + for (uint256 i = 0; i < pausers.length; ++i) { _addPauser(pausers[i]); } } diff --git a/contracts/introspection/ERC165.sol b/contracts/introspection/ERC165.sol index 8666fa2b5..1181d91b7 100644 --- a/contracts/introspection/ERC165.sol +++ b/contracts/introspection/ERC165.sol @@ -25,13 +25,13 @@ contract ERC165 is Initializable, IERC165 { * implement ERC165 itself */ function initialize() public initializer { - _registerInterface(_InterfaceId_ERC165); + _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev implement supportsInterface(bytes4) using a lookup table */ - function supportsInterface(bytes4 interfaceId) external view returns (bool) { + function supportsInterface(bytes4 interfaceId) public view returns (bool) { return _supportedInterfaces[interfaceId]; } diff --git a/contracts/mocks/ERC20CappedMock.sol b/contracts/mocks/ERC20CappedMock.sol index ee0b75425..6be7f8834 100644 --- a/contracts/mocks/ERC20CappedMock.sol +++ b/contracts/mocks/ERC20CappedMock.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../token/ERC20/ERC20Capped.sol"; import "./MinterRoleMock.sol"; diff --git a/contracts/mocks/ERC20MigratorMock.sol b/contracts/mocks/ERC20MigratorMock.sol index ec7fd691a..24b28b226 100644 --- a/contracts/mocks/ERC20MigratorMock.sol +++ b/contracts/mocks/ERC20MigratorMock.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../drafts/ERC20Migrator.sol"; diff --git a/contracts/mocks/ERC721PausableMock.sol b/contracts/mocks/ERC721PausableMock.sol index 26c1cb4b2..5e64396ca 100644 --- a/contracts/mocks/ERC721PausableMock.sol +++ b/contracts/mocks/ERC721PausableMock.sol @@ -8,7 +8,7 @@ import "./PauserRoleMock.sol"; * This mock just provides a public mint, burn and exists functions for testing purposes */ contract ERC721PausableMock is ERC721Pausable, PauserRoleMock { - constructor() { + constructor() public { ERC721.initialize(); ERC721Pausable.initialize(msg.sender); } diff --git a/contracts/mocks/EscrowMock.sol b/contracts/mocks/EscrowMock.sol index f156307fc..20f33f985 100644 --- a/contracts/mocks/EscrowMock.sol +++ b/contracts/mocks/EscrowMock.sol @@ -1,6 +1,6 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; -import "../payment/Escrow.sol"; +import "../payment/escrow/Escrow.sol"; contract EscrowMock is Escrow { constructor() public { diff --git a/contracts/mocks/ForceEther.sol b/contracts/mocks/ForceEther.sol index dd4e7bf7c..9ac81d0e4 100644 --- a/contracts/mocks/ForceEther.sol +++ b/contracts/mocks/ForceEther.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; // @title Force Ether into a contract. @@ -10,7 +10,7 @@ contract ForceEther { constructor() public payable { } - function destroyAndSend(address recipient) public { + function destroyAndSend(address payable recipient) public { selfdestruct(recipient); } } diff --git a/contracts/mocks/MessageHelper.sol b/contracts/mocks/MessageHelper.sol index a73ce3bec..2afd680bb 100644 --- a/contracts/mocks/MessageHelper.sol +++ b/contracts/mocks/MessageHelper.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; contract MessageHelper { @@ -9,7 +9,7 @@ contract MessageHelper { function showMessage( bytes32 _message, uint256 _number, - string _text + string memory _text ) public returns (bool) @@ -21,7 +21,7 @@ contract MessageHelper { function buyMessage( bytes32 _message, uint256 _number, - string _text + string memory _text ) public payable @@ -39,9 +39,10 @@ contract MessageHelper { require(false); } - function call(address _to, bytes _data) public returns (bool) { + function call(address _to, bytes memory _data) public returns (bool) { // solium-disable-next-line security/no-low-level-calls - if (_to.call(_data)) + (bool success,) = _to.call(_data); + if (success) return true; else return false; diff --git a/contracts/mocks/OwnableMock.sol b/contracts/mocks/OwnableMock.sol index 54d62f6dd..49726ab72 100644 --- a/contracts/mocks/OwnableMock.sol +++ b/contracts/mocks/OwnableMock.sol @@ -3,7 +3,7 @@ pragma solidity ^0.5.0; import "../ownership/Ownable.sol"; contract OwnableMock is Ownable { - constructor() { + constructor() public { Ownable.initialize(msg.sender); } } diff --git a/contracts/mocks/PausableCrowdsaleImpl.sol b/contracts/mocks/PausableCrowdsaleImpl.sol index 11f44c7b8..9ae9399de 100644 --- a/contracts/mocks/PausableCrowdsaleImpl.sol +++ b/contracts/mocks/PausableCrowdsaleImpl.sol @@ -4,7 +4,7 @@ import "../token/ERC20/ERC20.sol"; import "../crowdsale/validation/PausableCrowdsale.sol"; contract PausableCrowdsaleImpl is PausableCrowdsale { - constructor (uint256 _rate, address payable _wallet, ERC20 _token) public Crowdsale(_rate, _wallet, _token) { - // solhint-disable-previous-line no-empty-blocks + constructor (uint256 _rate, address payable _wallet, ERC20 _token) public { + Crowdsale.initialize(_rate, _wallet, _token); } } diff --git a/contracts/mocks/PaymentSplitterMock.sol b/contracts/mocks/PaymentSplitterMock.sol index 5a0882ab0..393e3018a 100644 --- a/contracts/mocks/PaymentSplitterMock.sol +++ b/contracts/mocks/PaymentSplitterMock.sol @@ -1,9 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../payment/PaymentSplitter.sol"; contract PaymentSplitterMock is PaymentSplitter { - constructor(address[] payees, uint256[] shares) public { + constructor(address[] memory payees, uint256[] memory shares) public { PaymentSplitter.initialize(payees, shares); } } diff --git a/contracts/mocks/PostDeliveryCrowdsaleImpl.sol b/contracts/mocks/PostDeliveryCrowdsaleImpl.sol index c9c38fc86..ec4a6da08 100644 --- a/contracts/mocks/PostDeliveryCrowdsaleImpl.sol +++ b/contracts/mocks/PostDeliveryCrowdsaleImpl.sol @@ -6,8 +6,6 @@ import "../crowdsale/distribution/PostDeliveryCrowdsale.sol"; contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale { constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address payable wallet, IERC20 token) public - TimedCrowdsale(openingTime, closingTime) - Crowdsale(rate, wallet, token) { Crowdsale.initialize(rate, wallet, token); TimedCrowdsale.initialize(openingTime, closingTime); diff --git a/contracts/mocks/PullPaymentMock.sol b/contracts/mocks/PullPaymentMock.sol index 01c883d00..38f093e02 100644 --- a/contracts/mocks/PullPaymentMock.sol +++ b/contracts/mocks/PullPaymentMock.sol @@ -5,7 +5,7 @@ import "../payment/PullPayment.sol"; // mock class using PullPayment contract PullPaymentMock is PullPayment { constructor () public payable { - PullPayment.initialize(); + PullPayment._initialize(); } // test helper function to call asyncTransfer diff --git a/contracts/mocks/RefundEscrowMock.sol b/contracts/mocks/RefundEscrowMock.sol index 35e56f809..213c18af2 100644 --- a/contracts/mocks/RefundEscrowMock.sol +++ b/contracts/mocks/RefundEscrowMock.sol @@ -1,9 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; -import "../payment/RefundEscrow.sol"; +import "../payment/escrow/RefundEscrow.sol"; contract RefundEscrowMock is RefundEscrow { - constructor(address beneficiary) public { + constructor(address payable beneficiary) public { RefundEscrow.initialize(beneficiary, msg.sender); } } diff --git a/contracts/mocks/RefundablePostDeliveryCrowdsaleImpl.sol b/contracts/mocks/RefundablePostDeliveryCrowdsaleImpl.sol index b81f0757c..830ffc247 100644 --- a/contracts/mocks/RefundablePostDeliveryCrowdsaleImpl.sol +++ b/contracts/mocks/RefundablePostDeliveryCrowdsaleImpl.sol @@ -13,10 +13,9 @@ contract RefundablePostDeliveryCrowdsaleImpl is RefundablePostDeliveryCrowdsale uint256 goal ) public - Crowdsale(rate, wallet, token) - TimedCrowdsale(openingTime, closingTime) - RefundableCrowdsale(goal) { - // solhint-disable-previous-line no-empty-blocks + Crowdsale.initialize(rate, wallet, token); + TimedCrowdsale.initialize(openingTime, closingTime); + RefundableCrowdsale.initialize(goal); } } diff --git a/contracts/mocks/SampleCrowdsaleMock.sol b/contracts/mocks/SampleCrowdsaleMock.sol index 70a4da8e1..7f5143785 100644 --- a/contracts/mocks/SampleCrowdsaleMock.sol +++ b/contracts/mocks/SampleCrowdsaleMock.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../examples/SampleCrowdsale.sol"; @@ -14,7 +14,7 @@ contract SampleCrowdsaleMock is SampleCrowdsale { uint256 openingTime, uint256 closingTime, uint256 rate, - address wallet, + address payable wallet, uint256 cap, ERC20Mintable token, uint256 goal diff --git a/contracts/mocks/SignatureBouncerMock.sol b/contracts/mocks/SignatureBouncerMock.sol index c764a0a4e..b846d4dde 100644 --- a/contracts/mocks/SignatureBouncerMock.sol +++ b/contracts/mocks/SignatureBouncerMock.sol @@ -5,7 +5,7 @@ import "./SignerRoleMock.sol"; contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock { constructor() public { - SignatureBouncer.initialize(msg.sender); + SignatureBouncer._initialize(msg.sender); } function checkValidSignature(address account, bytes memory signature) diff --git a/contracts/mocks/SimpleTokenMock.sol b/contracts/mocks/SimpleTokenMock.sol index df8f8b581..11add07cd 100644 --- a/contracts/mocks/SimpleTokenMock.sol +++ b/contracts/mocks/SimpleTokenMock.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../examples/SimpleToken.sol"; diff --git a/contracts/mocks/TokenTimelockMock.sol b/contracts/mocks/TokenTimelockMock.sol index c50892d40..7d8fdf566 100644 --- a/contracts/mocks/TokenTimelockMock.sol +++ b/contracts/mocks/TokenTimelockMock.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../token/ERC20/TokenTimelock.sol"; diff --git a/contracts/mocks/TokenVestingMock.sol b/contracts/mocks/TokenVestingMock.sol index 44bcb6ed4..cab7fbed8 100644 --- a/contracts/mocks/TokenVestingMock.sol +++ b/contracts/mocks/TokenVestingMock.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../drafts/TokenVesting.sol"; diff --git a/contracts/mocks/WhitelistAdminRoleMock.sol b/contracts/mocks/WhitelistAdminRoleMock.sol index 7a267ca21..5c8ffca35 100644 --- a/contracts/mocks/WhitelistAdminRoleMock.sol +++ b/contracts/mocks/WhitelistAdminRoleMock.sol @@ -3,6 +3,10 @@ pragma solidity ^0.5.0; import "../access/roles/WhitelistAdminRole.sol"; contract WhitelistAdminRoleMock is WhitelistAdminRole { + constructor () public { + WhitelistAdminRole._initialize(msg.sender); + } + function removeWhitelistAdmin(address account) public { _removeWhitelistAdmin(account); } diff --git a/contracts/mocks/WhitelistCrowdsaleImpl.sol b/contracts/mocks/WhitelistCrowdsaleImpl.sol index 0200f7f7f..e17cfdd97 100644 --- a/contracts/mocks/WhitelistCrowdsaleImpl.sol +++ b/contracts/mocks/WhitelistCrowdsaleImpl.sol @@ -6,7 +6,8 @@ import "../crowdsale/Crowdsale.sol"; contract WhitelistCrowdsaleImpl is Crowdsale, WhitelistCrowdsale { - constructor (uint256 _rate, address payable _wallet, IERC20 _token) public Crowdsale(_rate, _wallet, _token) { - // solhint-disable-previous-line no-empty-blocks + constructor (uint256 _rate, address payable _wallet, IERC20 _token) public { + Crowdsale.initialize(_rate, _wallet, _token); + WhitelistCrowdsale.initialize(msg.sender); } } diff --git a/contracts/payment/PaymentSplitter.sol b/contracts/payment/PaymentSplitter.sol index 280e4b9ac..82b768ec1 100644 --- a/contracts/payment/PaymentSplitter.sol +++ b/contracts/payment/PaymentSplitter.sol @@ -1,5 +1,7 @@ pragma solidity ^0.5.0; +import "zos-lib/contracts/Initializable.sol"; + import "../math/SafeMath.sol"; /** @@ -7,7 +9,7 @@ import "../math/SafeMath.sol"; * @dev This contract can be used when payments need to be received by a group * of people and split proportionately to some number of shares they own. */ -contract PaymentSplitter { +contract PaymentSplitter is Initializable { using SafeMath for uint256; event PayeeAdded(address account, uint256 shares); @@ -24,7 +26,7 @@ contract PaymentSplitter { /** * @dev Constructor */ - constructor (address[] memory payees, uint256[] memory shares) public payable { + function initialize(address[] memory payees, uint256[] memory shares) public payable initializer { require(payees.length == shares.length); require(payees.length > 0); diff --git a/contracts/payment/escrow/ConditionalEscrow.sol b/contracts/payment/escrow/ConditionalEscrow.sol index 268d731fa..283d59d60 100644 --- a/contracts/payment/escrow/ConditionalEscrow.sol +++ b/contracts/payment/escrow/ConditionalEscrow.sol @@ -7,7 +7,11 @@ import "./Escrow.sol"; * @dev Base abstract escrow to only allow withdrawal if a condition is met. * @dev Intended usage: See Escrow.sol. Same usage guidelines apply here. */ -contract ConditionalEscrow is Escrow { +contract ConditionalEscrow is Initializable, Escrow { + function initialize(address sender) public initializer { + Escrow.initialize(sender); + } + /** * @dev Returns whether an address is allowed to withdraw their funds. To be * implemented by derived contracts. diff --git a/contracts/payment/escrow/Escrow.sol b/contracts/payment/escrow/Escrow.sol index c010add45..5ff736cec 100644 --- a/contracts/payment/escrow/Escrow.sol +++ b/contracts/payment/escrow/Escrow.sol @@ -15,7 +15,7 @@ import "../../ownership/Secondary.sol"; * payment method should be its primary, and provide public methods redirecting * to the escrow's deposit and withdraw. */ -contract Escrow is Secondary { +contract Escrow is Initializable, Secondary { using SafeMath for uint256; event Deposited(address indexed payee, uint256 weiAmount); @@ -23,6 +23,10 @@ contract Escrow is Secondary { mapping(address => uint256) private _deposits; + function initialize(address sender) public initializer { + Secondary.initialize(sender); + } + function depositsOf(address payee) public view returns (uint256) { return _deposits[payee]; } diff --git a/contracts/payment/escrow/RefundEscrow.sol b/contracts/payment/escrow/RefundEscrow.sol index 0c9cd99a6..ac67f8cc3 100644 --- a/contracts/payment/escrow/RefundEscrow.sol +++ b/contracts/payment/escrow/RefundEscrow.sol @@ -1,5 +1,7 @@ pragma solidity ^0.5.0; +import 'zos-lib/contracts/Initializable.sol'; + import "./ConditionalEscrow.sol"; /** @@ -13,7 +15,7 @@ import "./ConditionalEscrow.sol"; * with RefundEscrow will be made through the primary contract. See the * RefundableCrowdsale contract for an example of RefundEscrow’s use. */ -contract RefundEscrow is ConditionalEscrow { +contract RefundEscrow is Initializable, ConditionalEscrow { enum State { Active, Refunding, Closed } event RefundsClosed(); @@ -26,7 +28,9 @@ contract RefundEscrow is ConditionalEscrow { * @dev Constructor. * @param beneficiary The beneficiary of the deposits. */ - constructor (address payable beneficiary) public { + function initialize(address payable beneficiary, address sender) public initializer { + ConditionalEscrow.initialize(sender); + require(beneficiary != address(0)); _beneficiary = beneficiary; _state = State.Active; diff --git a/contracts/token/ERC20/StandaloneERC20.sol b/contracts/token/ERC20/StandaloneERC20.sol index 49e831c1d..3aaf81e34 100644 --- a/contracts/token/ERC20/StandaloneERC20.sol +++ b/contracts/token/ERC20/StandaloneERC20.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "zos-lib/contracts/Initializable.sol"; import "./ERC20Detailed.sol"; @@ -12,11 +12,9 @@ import "./ERC20Pausable.sol"; */ contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable { function initialize( - string name, string symbol, uint8 decimals, uint256 initialSupply, address initialHolder, - address[] minters, address[] pausers + string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, address initialHolder, + address[] memory minters, address[] memory pausers ) public initializer { - require(initialSupply > 0); - ERC20Detailed.initialize(name, symbol, decimals); // Mint the initial supply @@ -35,13 +33,13 @@ contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pa _addMinter(minters[i]); } - for (i = 0; i < pausers.length; ++i) { + for (uint256 i = 0; i < pausers.length; ++i) { _addPauser(pausers[i]); } } function initialize( - string name, string symbol, uint8 decimals, address[] minters, address[] pausers + string memory name, string memory symbol, uint8 decimals, address[] memory minters, address[] memory pausers ) public initializer { ERC20Detailed.initialize(name, symbol, decimals); @@ -58,7 +56,7 @@ contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pa _addMinter(minters[i]); } - for (i = 0; i < pausers.length; ++i) { + for (uint256 i = 0; i < pausers.length; ++i) { _addPauser(pausers[i]); } } diff --git a/contracts/token/ERC721/ERC721Enumerable.sol b/contracts/token/ERC721/ERC721Enumerable.sol index 5c61280ed..3b9dcc54c 100644 --- a/contracts/token/ERC721/ERC721Enumerable.sol +++ b/contracts/token/ERC721/ERC721Enumerable.sol @@ -37,11 +37,11 @@ contract ERC721Enumerable is Initializable, ERC165, ERC721, IERC721Enumerable { require(ERC721._hasBeenInitialized()); // register the supported interface to conform to ERC721 via ERC165 - _registerInterface(_InterfaceId_ERC721Enumerable); + _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } function _hasBeenInitialized() internal view returns (bool) { - return supportsInterface(_InterfaceId_ERC721Enumerable); + return supportsInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** diff --git a/contracts/token/ERC721/ERC721Metadata.sol b/contracts/token/ERC721/ERC721Metadata.sol index 8ca6d0e2e..0fbb1e6ae 100644 --- a/contracts/token/ERC721/ERC721Metadata.sol +++ b/contracts/token/ERC721/ERC721Metadata.sol @@ -36,6 +36,9 @@ contract ERC721Metadata is Initializable, ERC165, ERC721, IERC721Metadata { _registerInterface(_INTERFACE_ID_ERC721_METADATA); } + function _hasBeenInitialized() internal view returns (bool) { + return supportsInterface(_INTERFACE_ID_ERC721_METADATA); +} /** * @dev Gets the token name * @return string representing the token name diff --git a/contracts/token/ERC721/StandaloneERC721.sol b/contracts/token/ERC721/StandaloneERC721.sol index 49059d8ff..14ec4a9d5 100644 --- a/contracts/token/ERC721/StandaloneERC721.sol +++ b/contracts/token/ERC721/StandaloneERC721.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "zos-lib/contracts/Initializable.sol"; import "./ERC721.sol"; @@ -15,7 +15,7 @@ import "./ERC721Pausable.sol"; contract StandaloneERC721 is Initializable, ERC721, ERC721Enumerable, ERC721Metadata, ERC721MetadataMintable, ERC721Pausable { - function initialize(string name, string symbol, address[] minters, address[] pausers) public initializer { + function initialize(string memory name, string memory symbol, address[] memory minters, address[] memory pausers) public initializer { ERC721.initialize(); ERC721Enumerable.initialize(); ERC721Metadata.initialize(name, symbol); @@ -33,7 +33,7 @@ contract StandaloneERC721 _addMinter(minters[i]); } - for (i = 0; i < pausers.length; ++i) { + for (uint256 i = 0; i < pausers.length; ++i) { _addPauser(pausers[i]); } } diff --git a/package-lock.json b/package-lock.json index bd6ba497a..7f1929853 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4900,10 +4900,18 @@ "integrity": "sha512-VU6/DSUX93d1fCzBz7WP/SGCQizO1rKZi4Px9j/3yRyfssHyFcZamMw2/sj4E8TlfMXONvZLoforR8B4bRoyTQ==", "dev": true, "requires": { + "bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", "crypto-js": "^3.1.4", "utf8": "^2.1.1", "xhr2-cookies": "^1.1.0", "xmlhttprequest": "*" + }, + "dependencies": { + "bignumber.js": { + "version": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", + "from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git", + "dev": true + } } } }