diff --git a/.soliumrc.json b/.soliumrc.json index 09bb174..41a0a93 100644 --- a/.soliumrc.json +++ b/.soliumrc.json @@ -12,7 +12,7 @@ "no-with": true, "no-empty-blocks": true, "no-unused-vars": true, - "double-quotes": true, + "quotes": true, "blank-lines": true, "indentation": true, "whitespace": true, diff --git a/contracts/LPVault.sol b/contracts/LPVault.sol index b2f4313..186edac 100644 --- a/contracts/LPVault.sol +++ b/contracts/LPVault.sol @@ -7,7 +7,8 @@ pragma solidity ^0.4.11; /// safety precaution, but once fully tested and optimized this contract will /// be a safe place to store funds equipped with optional variable time delays /// to allow for an optional escape hatch to be implemented -import "../node_modules/giveth-common-contracts/contracts/Escapable.sol"; +import "giveth-common-contracts/contracts/Escapable.sol"; + /// @dev `LiquidPledging` is a basic interface to allow the `LPVault` contract /// to confirm and cancel payments in the `LiquidPledging` contract. @@ -42,8 +43,9 @@ contract LPVault is Escapable { // @dev An array that contains all the payments for this LPVault Payment[] public payments; - function Vault(address _escapeHatchCaller, address _escapeHatchDestination) - Escapable(_escapeHatchCaller, _escapeHatchDestination) public { + function LPVault(address _escapeHatchCaller, address _escapeHatchDestination) + Escapable(_escapeHatchCaller, _escapeHatchDestination) public + { } /// @dev `liquidPledging` is the only address that can call a function with @@ -82,7 +84,9 @@ contract LPVault is Escapable { function authorizePayment( bytes32 _ref, address _dest, - uint _amount ) public onlyLiquidPledging returns (uint) { + uint _amount + ) public onlyLiquidPledging returns (uint) + { uint idPayment = payments.length; payments.length ++; payments[idPayment].state = PaymentStatus.Pending; diff --git a/contracts/LiquidPledging.sol b/contracts/LiquidPledging.sol index 7d3a05d..e7027eb 100644 --- a/contracts/LiquidPledging.sol +++ b/contracts/LiquidPledging.sol @@ -37,7 +37,12 @@ contract LiquidPledging is LiquidPledgingBase { /// @dev This constructor also calls the constructor /// for `LiquidPledgingBase` /// @param _vault The vault where ETH backing this pledge is stored - function LiquidPledging(address _vault) LiquidPledgingBase(_vault) { + function LiquidPledging( + address _vault, + address _escapeHatchCaller, + address _escapeHatchDestination + ) LiquidPledgingBase(_vault, _escapeHatchCaller, _escapeHatchDestination) { + } /// @notice This is how value enters into the system which creates pledges; diff --git a/contracts/LiquidPledgingBase.sol b/contracts/LiquidPledgingBase.sol index 13bc059..071baa7 100644 --- a/contracts/LiquidPledgingBase.sol +++ b/contracts/LiquidPledgingBase.sol @@ -18,7 +18,7 @@ pragma solidity ^0.4.11; */ import "./ILiquidPledgingPlugin.sol"; -import "../node_modules/giveth-common-contracts/contracts/Owned.sol"; +import "giveth-common-contracts/contracts/Escapable.sol"; /// @dev `LPVault` serves as an interface to allow the `LiquidPledgingBase` /// contract to interface with a `LPVault` contract @@ -30,7 +30,7 @@ contract LPVault { /// @dev `LiquidPledgingBase` is the base level contract used to carry out /// liquid pledging's most basic functions, mostly handling and searching the /// data structures -contract LiquidPledgingBase is Owned { +contract LiquidPledgingBase is Escapable { // Limits inserted to prevent large loops that could prevent canceling uint constant MAX_DELEGATES = 20; @@ -97,7 +97,11 @@ contract LiquidPledgingBase is Owned { /// @notice The Constructor creates `LiquidPledgingBase` on the blockchain /// @param _vault The vault where the ETH backing the pledges is stored - function LiquidPledgingBase(address _vault) { + function LiquidPledgingBase( + address _vault, + address _escapeHatchCaller, + address _escapeHatchDestination + ) Escapable(_escapeHatchCaller, _escapeHatchDestination) public { admins.length = 1; // we reserve the 0 admin pledges.length = 1; // we reserve the 0 pledge vault = LPVault(_vault); // Assigns the specified vault diff --git a/contracts/LiquidPledgingMock.sol b/contracts/LiquidPledgingMock.sol index ec6e07f..a9485f0 100644 --- a/contracts/LiquidPledgingMock.sol +++ b/contracts/LiquidPledgingMock.sol @@ -29,7 +29,11 @@ contract LiquidPledgingMock is LiquidPledging { /// @dev `LiquidPledgingMock` creates a standard `LiquidPledging` /// instance and sets the mocked time to the current blocktime. /// @param _vault The vault where ETH backing this pledge is stored - function LiquidPledgingMock(address _vault) LiquidPledging(_vault) { + function LiquidPledgingMock( + address _vault, + address _escapeHatchCaller, + address _escapeHatchDestination + ) LiquidPledging(_vault, _escapeHatchCaller, _escapeHatchDestination) { mock_time = now; } diff --git a/test/AdminPlugins.js b/test/AdminPlugins.js index baa2d88..39e5312 100644 --- a/test/AdminPlugins.js +++ b/test/AdminPlugins.js @@ -55,7 +55,7 @@ describe('LiquidPledging plugins test', function () { it('Should deploy LiquidPledging contract', async function() { vault = await Vault.new(web3, accounts[0], accounts[1]); - liquidPledging = await LiquidPledging.new(web3, vault.$address, { gas: 6500000 }); + liquidPledging = await LiquidPledging.new(web3, vault.$address, accounts[0], accounts[1], { gas: 6500000 }); await vault.setLiquidPledging(liquidPledging.$address); liquidPledgingState = new LiquidPledgingState(liquidPledging); }); diff --git a/test/CancelPledge.js b/test/CancelPledge.js index 42fe794..84443e4 100644 --- a/test/CancelPledge.js +++ b/test/CancelPledge.js @@ -52,7 +52,7 @@ describe('LiquidPledging cancelPledge normal scenario', function () { it('Should deploy LiquidPledging contract', async () => { vault = await Vault.new(web3, accounts[0], accounts[1]); - liquidPledging = await LiquidPledging.new(web3, vault.$address, { gas: 5800000 }); + liquidPledging = await LiquidPledging.new(web3, vault.$address, accounts[0], accounts[1], { gas: 5800000 }); await vault.setLiquidPledging(liquidPledging.$address); liquidPledgingState = new LiquidPledgingState(liquidPledging); }); diff --git a/test/DelegationChain.js b/test/DelegationChain.js index a5d4598..5e7268e 100644 --- a/test/DelegationChain.js +++ b/test/DelegationChain.js @@ -58,7 +58,7 @@ describe('DelegationChain test', function () { it('Should deploy LiquidPledging contract', async () => { vault = await Vault.new(web3, accounts[0], accounts[1]); - liquidPledging = await LiquidPledging.new(web3, vault.$address, { gas: 5800000 }); + liquidPledging = await LiquidPledging.new(web3, vault.$address, accounts[0], accounts[1], { gas: 5800000 }); await vault.setLiquidPledging(liquidPledging.$address); liquidPledgingState = new LiquidPledgingState(liquidPledging); }); diff --git a/test/NormalOperation.js b/test/NormalOperation.js index 1a07cff..fa42a7e 100644 --- a/test/NormalOperation.js +++ b/test/NormalOperation.js @@ -63,7 +63,7 @@ describe('LiquidPledging test', function () { it('Should deploy LiquidPledging contract', async () => { vault = await LPVault.new(web3, accounts[0], accounts[1]); - liquidPledging = await LiquidPledging.new(web3, vault.$address, { gas: 5800000 }); + liquidPledging = await LiquidPledging.new(web3, vault.$address, accounts[0], accounts[1], { gas: 5800000 }); await vault.setLiquidPledging(liquidPledging.$address); liquidPledgingState = new LiquidPledgingState(liquidPledging); }); diff --git a/test/NormalizePledge.js b/test/NormalizePledge.js index 80d96b3..9d0cec9 100644 --- a/test/NormalizePledge.js +++ b/test/NormalizePledge.js @@ -58,7 +58,7 @@ describe('NormalizePledge test', function () { it('Should deploy LiquidPledging contract', async () => { vault = await Vault.new(web3, accounts[0], accounts[1]); - liquidPledging = await LiquidPledging.new(web3, vault.$address, { gas: 5800000 }); + liquidPledging = await LiquidPledging.new(web3, vault.$address, accounts[0], accounts[1], { gas: 5800000 }); await vault.setLiquidPledging(liquidPledging.$address); liquidPledgingState = new LiquidPledgingState(liquidPledging); }); diff --git a/test/Vault.js b/test/Vault.js index dcbe1f8..c1e8215 100644 --- a/test/Vault.js +++ b/test/Vault.js @@ -8,7 +8,7 @@ const assertFail = require('./helpers/assertFail'); const LiquidPledging = liquidpledging.LiquidPledgingMock; const LiquidPledgingState = liquidpledging.LiquidPledgingState; -const Vault = liquidpledging.Vault; +const Vault = liquidpledging.LPVault; const assert = chai.assert; describe('Vault test', function () { @@ -51,7 +51,7 @@ describe('Vault test', function () { it('Should deploy Vault contract', async function () { vault = await Vault.new(web3, escapeHatchCaller, escapeHatchDestination, { from: vaultOwner }); - liquidPledging = await LiquidPledging.new(web3, vault.$address, { gas: 6500000 }); + liquidPledging = await LiquidPledging.new(web3, vault.$address, escapeHatchCaller, escapeHatchDestination, { gas: 6500000 }); await vault.setLiquidPledging(liquidPledging.$address, { from: vaultOwner }); liquidPledgingState = new LiquidPledgingState(liquidPledging); @@ -94,7 +94,5 @@ describe('Vault test', function () { assert.equal(expected, postBalance); }); - - it('should') });