diff --git a/contracts/access/roles/CapperRole.sol b/contracts/access/roles/CapperRole.sol index 332cfb774..164720e18 100644 --- a/contracts/access/roles/CapperRole.sol +++ b/contracts/access/roles/CapperRole.sol @@ -12,7 +12,7 @@ contract CapperRole is Initializable { Roles.Role private _cappers; - function _initialize(address sender) internal initializer { + function initialize(address sender) public initializer { if (!isCapper(sender)) { _addCapper(sender); } diff --git a/contracts/access/roles/MinterRole.sol b/contracts/access/roles/MinterRole.sol index 1a68b7ad5..a8378999a 100644 --- a/contracts/access/roles/MinterRole.sol +++ b/contracts/access/roles/MinterRole.sol @@ -12,7 +12,7 @@ contract MinterRole is Initializable { Roles.Role private _minters; - function _initialize(address sender) internal initializer { + function initialize(address sender) public initializer { if (!isMinter(sender)) { _addMinter(sender); } diff --git a/contracts/access/roles/PauserRole.sol b/contracts/access/roles/PauserRole.sol index ba1be2ca3..80fbc8471 100644 --- a/contracts/access/roles/PauserRole.sol +++ b/contracts/access/roles/PauserRole.sol @@ -12,7 +12,7 @@ contract PauserRole is Initializable { Roles.Role private _pausers; - function _initialize(address sender) internal initializer { + function initialize(address sender) public initializer { if (!isPauser(sender)) { _addPauser(sender); } diff --git a/contracts/access/roles/SignerRole.sol b/contracts/access/roles/SignerRole.sol index df889c1f2..424d12b3d 100644 --- a/contracts/access/roles/SignerRole.sol +++ b/contracts/access/roles/SignerRole.sol @@ -12,7 +12,7 @@ contract SignerRole is Initializable { Roles.Role private _signers; - function _initialize(address sender) internal initializer { + function initialize(address sender) public initializer { if (!isSigner(sender)) { _addSigner(sender); } diff --git a/contracts/access/roles/WhitelistAdminRole.sol b/contracts/access/roles/WhitelistAdminRole.sol index cebb50356..cc0399710 100644 --- a/contracts/access/roles/WhitelistAdminRole.sol +++ b/contracts/access/roles/WhitelistAdminRole.sol @@ -16,7 +16,7 @@ contract WhitelistAdminRole is Initializable { Roles.Role private _whitelistAdmins; - function _initialize(address sender) internal initializer { + function initialize(address sender) public initializer { if (!isWhitelistAdmin(sender)) { _addWhitelistAdmin(sender); } diff --git a/contracts/access/roles/WhitelistedRole.sol b/contracts/access/roles/WhitelistedRole.sol index 69687e858..f5d0b3074 100644 --- a/contracts/access/roles/WhitelistedRole.sol +++ b/contracts/access/roles/WhitelistedRole.sol @@ -24,8 +24,8 @@ contract WhitelistedRole is Initializable, WhitelistAdminRole { _; } - function _initialize(address sender) internal initializer { - WhitelistAdminRole._initialize(sender); + function initialize(address sender) public initializer { + WhitelistAdminRole.initialize(sender); } function isWhitelisted(address account) public view returns (bool) { @@ -56,4 +56,3 @@ contract WhitelistedRole is Initializable, WhitelistAdminRole { uint256[50] private ______gap; } -} diff --git a/contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol b/contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol index 13a7cd923..65da37d4f 100644 --- a/contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol +++ b/contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol @@ -18,7 +18,7 @@ contract IndividuallyCappedCrowdsale is Initializable, Crowdsale, CapperRole { function initialize(address sender) public initializer { assert(Crowdsale._hasBeenInitialized()); - CapperRole._initialize(sender); + CapperRole.initialize(sender); } /** diff --git a/contracts/crowdsale/validation/WhitelistCrowdsale.sol b/contracts/crowdsale/validation/WhitelistCrowdsale.sol index 213d62d39..6ac250138 100644 --- a/contracts/crowdsale/validation/WhitelistCrowdsale.sol +++ b/contracts/crowdsale/validation/WhitelistCrowdsale.sol @@ -9,7 +9,7 @@ import "../../access/roles/WhitelistedRole.sol"; */ contract WhitelistCrowdsale is Initializable, WhitelistedRole, Crowdsale { function initialize(address sender) public initializer { - WhitelistedRole._initialize(sender); + WhitelistedRole.initialize(sender); assert(Crowdsale._hasBeenInitialized()); } diff --git a/contracts/drafts/SignatureBouncer.sol b/contracts/drafts/SignatureBouncer.sol index b3fc1567b..169d92a65 100644 --- a/contracts/drafts/SignatureBouncer.sol +++ b/contracts/drafts/SignatureBouncer.sol @@ -44,8 +44,8 @@ contract SignatureBouncer is Initializable, SignerRole { // Signature size is 65 bytes (tightly packed v + r + s), but gets padded to 96 bytes uint256 private constant _SIGNATURE_SIZE = 96; - function _initialize(address sender) internal initializer { - SignerRole._initialize(sender); + function initialize(address sender) public initializer { + SignerRole.initialize(sender); } /** diff --git a/contracts/lifecycle/Pausable.sol b/contracts/lifecycle/Pausable.sol index 311930bb8..c5637bcfc 100644 --- a/contracts/lifecycle/Pausable.sol +++ b/contracts/lifecycle/Pausable.sol @@ -14,7 +14,7 @@ contract Pausable is Initializable, PauserRole { bool private _paused; function initialize(address sender) public initializer { - PauserRole._initialize(sender); + PauserRole.initialize(sender); _paused = false; } diff --git a/contracts/mocks/CapperRoleMock.sol b/contracts/mocks/CapperRoleMock.sol index 65da2d7c7..7b17d2aca 100644 --- a/contracts/mocks/CapperRoleMock.sol +++ b/contracts/mocks/CapperRoleMock.sol @@ -4,7 +4,7 @@ import "../access/roles/CapperRole.sol"; contract CapperRoleMock is CapperRole { constructor() public { - CapperRole._initialize(msg.sender); + CapperRole.initialize(msg.sender); } function removeCapper(address account) public { diff --git a/contracts/mocks/MinterRoleMock.sol b/contracts/mocks/MinterRoleMock.sol index d39559df7..8091918e4 100644 --- a/contracts/mocks/MinterRoleMock.sol +++ b/contracts/mocks/MinterRoleMock.sol @@ -4,7 +4,7 @@ import "../access/roles/MinterRole.sol"; contract MinterRoleMock is MinterRole { constructor() public { - MinterRole._initialize(msg.sender); + MinterRole.initialize(msg.sender); } function removeMinter(address account) public { diff --git a/contracts/mocks/PauserRoleMock.sol b/contracts/mocks/PauserRoleMock.sol index 4ca5714f1..ea01088df 100644 --- a/contracts/mocks/PauserRoleMock.sol +++ b/contracts/mocks/PauserRoleMock.sol @@ -4,7 +4,7 @@ import "../access/roles/PauserRole.sol"; contract PauserRoleMock is PauserRole { constructor () public { - PauserRole._initialize(msg.sender); + PauserRole.initialize(msg.sender); } function removePauser(address account) public { diff --git a/contracts/mocks/PullPaymentMock.sol b/contracts/mocks/PullPaymentMock.sol index 38f093e02..01c883d00 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/SignatureBouncerMock.sol b/contracts/mocks/SignatureBouncerMock.sol index b846d4dde..c764a0a4e 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/SignerRoleMock.sol b/contracts/mocks/SignerRoleMock.sol index c914a82d3..1efedb7ff 100644 --- a/contracts/mocks/SignerRoleMock.sol +++ b/contracts/mocks/SignerRoleMock.sol @@ -4,7 +4,7 @@ import "../access/roles/SignerRole.sol"; contract SignerRoleMock is SignerRole { constructor() public { - SignerRole._initialize(msg.sender); + SignerRole.initialize(msg.sender); } function removeSigner(address account) public { diff --git a/contracts/mocks/WhitelistAdminRoleMock.sol b/contracts/mocks/WhitelistAdminRoleMock.sol index 5c8ffca35..4e9058bc9 100644 --- a/contracts/mocks/WhitelistAdminRoleMock.sol +++ b/contracts/mocks/WhitelistAdminRoleMock.sol @@ -4,7 +4,7 @@ import "../access/roles/WhitelistAdminRole.sol"; contract WhitelistAdminRoleMock is WhitelistAdminRole { constructor () public { - WhitelistAdminRole._initialize(msg.sender); + WhitelistAdminRole.initialize(msg.sender); } function removeWhitelistAdmin(address account) public { diff --git a/contracts/mocks/WhitelistedRoleMock.sol b/contracts/mocks/WhitelistedRoleMock.sol index 756065d96..5a9e9c7d2 100644 --- a/contracts/mocks/WhitelistedRoleMock.sol +++ b/contracts/mocks/WhitelistedRoleMock.sol @@ -4,7 +4,7 @@ import "../access/roles/WhitelistedRole.sol"; contract WhitelistedRoleMock is WhitelistedRole { constructor() public { - WhitelistedRole._initialize(msg.sender); + WhitelistedRole.initialize(msg.sender); } function onlyWhitelistedMock() public view onlyWhitelisted { diff --git a/contracts/payment/PullPayment.sol b/contracts/payment/PullPayment.sol index 0ee85df34..5403feb5c 100644 --- a/contracts/payment/PullPayment.sol +++ b/contracts/payment/PullPayment.sol @@ -12,7 +12,7 @@ import "./escrow/Escrow.sol"; contract PullPayment is Initializable { Escrow private _escrow; - function _initialize() internal initializer { + function initialize() public initializer { // conditional added to make initializer idempotent in case of diamond inheritance if (address(_escrow) == address(0)) { _escrow = new Escrow(); diff --git a/contracts/payment/escrow/RefundEscrow.sol b/contracts/payment/escrow/RefundEscrow.sol index fc146479b..b12616d10 100644 --- a/contracts/payment/escrow/RefundEscrow.sol +++ b/contracts/payment/escrow/RefundEscrow.sol @@ -1,6 +1,6 @@ pragma solidity ^0.5.0; -import 'zos-lib/contracts/Initializable.sol'; +import "zos-lib/contracts/Initializable.sol"; import "./ConditionalEscrow.sol"; diff --git a/contracts/token/ERC20/ERC20Mintable.sol b/contracts/token/ERC20/ERC20Mintable.sol index a3a0e0d0e..378d2c02c 100644 --- a/contracts/token/ERC20/ERC20Mintable.sol +++ b/contracts/token/ERC20/ERC20Mintable.sol @@ -10,7 +10,7 @@ import "../../access/roles/MinterRole.sol"; */ contract ERC20Mintable is Initializable, ERC20, MinterRole { function initialize(address sender) public initializer { - MinterRole._initialize(sender); + MinterRole.initialize(sender); } /** diff --git a/contracts/token/ERC721/ERC721MetadataMintable.sol b/contracts/token/ERC721/ERC721MetadataMintable.sol index f067d1cf4..00c534d4a 100644 --- a/contracts/token/ERC721/ERC721MetadataMintable.sol +++ b/contracts/token/ERC721/ERC721MetadataMintable.sol @@ -13,7 +13,7 @@ contract ERC721MetadataMintable is Initializable, ERC721, ERC721Metadata, Minter function initialize(address sender) public initializer { require(ERC721._hasBeenInitialized()); require(ERC721Metadata._hasBeenInitialized()); - MinterRole._initialize(sender); + MinterRole.initialize(sender); } /** diff --git a/contracts/token/ERC721/ERC721Mintable.sol b/contracts/token/ERC721/ERC721Mintable.sol index 5def74f8a..18933ef52 100644 --- a/contracts/token/ERC721/ERC721Mintable.sol +++ b/contracts/token/ERC721/ERC721Mintable.sol @@ -11,7 +11,7 @@ import "../../access/roles/MinterRole.sol"; contract ERC721Mintable is Initializable, ERC721, MinterRole { function initialize(address sender) public initializer { require(ERC721._hasBeenInitialized()); - MinterRole._initialize(sender); + MinterRole.initialize(sender); } /** diff --git a/package-lock.json b/package-lock.json index 9057072b7..eb1e27518 100644 --- a/package-lock.json +++ b/package-lock.json @@ -155,7 +155,7 @@ }, "acorn-globals": { "version": "1.0.9", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz", + "resolved": "http://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz", "integrity": "sha1-VbtemGkVB7dFedBRNBMhfDgMVM8=", "dev": true, "optional": true, @@ -165,7 +165,7 @@ "dependencies": { "acorn": { "version": "2.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", + "resolved": "http://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", "integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=", "dev": true, "optional": true @@ -457,7 +457,7 @@ }, "axios": { "version": "0.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "resolved": "http://registry.npmjs.org/axios/-/axios-0.18.0.tgz", "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", "dev": true, "requires": { @@ -2758,7 +2758,7 @@ }, "rimraf": { "version": "2.4.5", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", + "resolved": "http://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", "integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=", "dev": true, "requires": { @@ -3655,7 +3655,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } @@ -7187,7 +7187,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -7980,7 +7980,7 @@ }, "jsdom": { "version": "7.2.2", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-7.2.2.tgz", + "resolved": "http://registry.npmjs.org/jsdom/-/jsdom-7.2.2.tgz", "integrity": "sha1-QLQCdwwr2iNGkJa+6Rq2deOx/G4=", "dev": true, "optional": true, @@ -8004,7 +8004,7 @@ "dependencies": { "acorn": { "version": "2.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", + "resolved": "http://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", "integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=", "dev": true, "optional": true @@ -8725,7 +8725,7 @@ }, "marked": { "version": "0.3.19", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", + "resolved": "http://registry.npmjs.org/marked/-/marked-0.3.19.tgz", "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", "dev": true }, @@ -14590,7 +14590,7 @@ }, "scrypt-js": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", + "resolved": "http://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", "integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q=", "dev": true }, @@ -14985,7 +14985,7 @@ }, "ws": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-5.1.1.tgz", + "resolved": "http://registry.npmjs.org/ws/-/ws-5.1.1.tgz", "integrity": "sha512-bOusvpCb09TOBLbpMKszd45WKC2KPtxiyiHanv+H2DE3Az+1db5a/L7sVJZVDPUC1Br8f0SKRr1KjLpD1U/IAw==", "dev": true, "requires": { @@ -15570,7 +15570,7 @@ }, "web3": { "version": "0.16.0", - "resolved": "https://registry.npmjs.org/web3/-/web3-0.16.0.tgz", + "resolved": "http://registry.npmjs.org/web3/-/web3-0.16.0.tgz", "integrity": "sha1-pFVBdc1GKUMDWx8dOUMvdBxrYBk=", "dev": true, "requires": { @@ -17101,7 +17101,7 @@ }, "web3": { "version": "0.20.6", - "resolved": "https://registry.npmjs.org/web3/-/web3-0.20.6.tgz", + "resolved": "http://registry.npmjs.org/web3/-/web3-0.20.6.tgz", "integrity": "sha1-PpcwauAk+yThCj11yIQwJWIhUSA=", "dev": true, "requires": { @@ -17131,7 +17131,7 @@ }, "web3": { "version": "0.20.6", - "resolved": "https://registry.npmjs.org/web3/-/web3-0.20.6.tgz", + "resolved": "http://registry.npmjs.org/web3/-/web3-0.20.6.tgz", "integrity": "sha1-PpcwauAk+yThCj11yIQwJWIhUSA=", "dev": true, "requires": { @@ -19356,7 +19356,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -19387,7 +19387,7 @@ "dependencies": { "commander": { "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -19605,7 +19605,7 @@ }, "web3": { "version": "0.20.6", - "resolved": "https://registry.npmjs.org/web3/-/web3-0.20.6.tgz", + "resolved": "http://registry.npmjs.org/web3/-/web3-0.20.6.tgz", "integrity": "sha1-PpcwauAk+yThCj11yIQwJWIhUSA=", "dev": true, "requires": { diff --git a/test/examples/StandardToken.test.js b/test/examples/StandardToken.test.js index c4a00bc06..59926c81b 100644 --- a/test/examples/StandardToken.test.js +++ b/test/examples/StandardToken.test.js @@ -1,4 +1,3 @@ -const encodeCall = require('zos-lib/lib/helpers/encodeCall').default; const { shouldBehaveLikeERC20Mintable } = require('../token/ERC20/behaviors/ERC20Mintable.behavior'); const { BN } = require('openzeppelin-test-helpers'); @@ -25,8 +24,8 @@ contract('StandardToken', function ([ async function initialize (token, name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from) { const signature = 'initialize(string,string,uint8,uint256,address,address[],address[],address)'; - const arguments = [name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from]; - await token.methods[signature](...arguments, { from }); + const args = [name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from]; + await token.methods[signature](...args, { from }); } context('with all arguments', function () { diff --git a/test/token/ERC20/StandaloneERC20.test.js b/test/token/ERC20/StandaloneERC20.test.js index 0e29ec52e..506073ffe 100644 --- a/test/token/ERC20/StandaloneERC20.test.js +++ b/test/token/ERC20/StandaloneERC20.test.js @@ -1,4 +1,3 @@ -const encodeCall = require('zos-lib/lib/helpers/encodeCall').default; const { shouldBehaveLikeERC20Mintable } = require('./behaviors/ERC20Mintable.behavior'); const { shouldFail, BN } = require('openzeppelin-test-helpers'); @@ -25,14 +24,14 @@ contract('StandaloneERC20', function ([ async function initializeFull (token, name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from) { const signature = 'initialize(string,string,uint8,uint256,address,address[],address[],address)'; - const arguments = [name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from]; - await token.methods[signature](...arguments, { from }); + const args = [name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from]; + await token.methods[signature](...args, { from }); } async function initializePartial (token, name, symbol, decimals, minters, pausers, from) { const signature = 'initialize(string,string,uint8,address[],address[],address)'; - const arguments = [name, symbol, decimals, minters, pausers, from]; - await token.methods[signature](...arguments, { from }); + const args = [name, symbol, decimals, minters, pausers, from]; + await token.methods[signature](...args, { from }); } describe('with all arguments', function () { diff --git a/test/token/ERC721/StandaloneERC721.test.js b/test/token/ERC721/StandaloneERC721.test.js index 7fb022212..8e6b2ebc3 100644 --- a/test/token/ERC721/StandaloneERC721.test.js +++ b/test/token/ERC721/StandaloneERC721.test.js @@ -1,5 +1,3 @@ -const encodeCall = require('zos-lib/lib/helpers/encodeCall').default; - require('openzeppelin-test-helpers'); const StandaloneERC721 = artifacts.require('StandaloneERC721'); @@ -17,8 +15,8 @@ contract('StandaloneERC721', function ([_, deployer, minterA, minterB, pauserA, async function initialize (token, name, symbol, minters, pausers, from) { const signature = 'initialize(string,string,address[],address[],address)'; - const arguments = [name, symbol, minters, pausers, from]; - await token.methods[signature](...arguments, { from }); + const args = [name, symbol, minters, pausers, from]; + await token.methods[signature](...args, { from }); } it('can be created with no minters', async function () {