diff --git a/.solcover.js b/.solcover.js index 890c158..b96cae4 100644 --- a/.solcover.js +++ b/.solcover.js @@ -1,4 +1,3 @@ module.exports = { - skipFiles: ['imports', 'mocks'], - deepSkip: true + skipFiles: ['imports'] }; diff --git a/contracts/Master.sol b/contracts/Master.sol index b45095b..68abd32 100644 --- a/contracts/Master.sol +++ b/contracts/Master.sol @@ -99,6 +99,14 @@ contract Master is Ownable { changeAllAddress(); } + /// @dev upgrades a single contract + function upgradeContract(bytes2 _contractsName, address _contractsAddress) public { + require(isAuth()); + allContractVersions[versionDates.length - 1][_contractsName] = _contractsAddress; + changeMasterAddress(address(this)); + changeAllAddress(); + } + /// @dev sets dAppTokenProxy address /// @param _dAppTokenProxy token proxy address function setDAppTokenProxy(address _dAppTokenProxy) public { diff --git a/package-lock.json b/package-lock.json index 311b004..c4a261f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4238,7 +4238,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -4447,7 +4448,8 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", @@ -4472,6 +4474,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4651,7 +4654,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -4707,6 +4711,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4750,12 +4755,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, diff --git a/test/08_Master.js b/test/08_Master.js index 288274b..873257f 100644 --- a/test/08_Master.js +++ b/test/08_Master.js @@ -139,6 +139,18 @@ contract('Master', function([owner, notOwner]) { assert.equal(b.toNumber() + 10, b2.toNumber() - b1.toNumber()); }); + it('Should upgrade contract', async function() { + this.timeout(100000); + const poo = await Pool.new(); + await ms.upgradeContract('PL', poo.address); + assert( + await ms.getLatestAddress('PL'), + poo.address, + 'contract not upgraded' + ); + await catchRevert(ms.upgradeContract('PL', owner, { from: notOwner })); + }); + it('Should add new contract', async function() { this.timeout(100000); // Will throw once owner's permissions are removed. will need to create proposal then.