Merge pull request #23 from Giveth/parent_project

Allow a any address to set parentProject, not only the parentProject.addr
This commit is contained in:
Jordi Baylina 2017-10-06 11:08:14 +02:00 committed by GitHub
commit a3d7ffee99
8 changed files with 17 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -197,7 +197,6 @@ contract LiquidPledgingBase {
if (parentProject != 0) {
PledgeAdmin storage pa = findAdmin(parentProject);
require(pa.adminType == PledgeAdminType.Project);
require(pa.addr == msg.sender);
require(getProjectLevel(pa) < MAX_SUBPROJECT_LEVEL);
}

File diff suppressed because one or more lines are too long

View File

@ -197,7 +197,6 @@ contract LiquidPledgingBase {
if (parentProject != 0) {
PledgeAdmin storage pa = findAdmin(parentProject);
require(pa.adminType == PledgeAdminType.Project);
require(pa.addr == msg.sender);
require(getProjectLevel(pa) < MAX_SUBPROJECT_LEVEL);
}

View File

@ -197,7 +197,6 @@ contract LiquidPledgingBase {
if (parentProject != 0) {
PledgeAdmin storage pa = findAdmin(parentProject);
require(pa.adminType == PledgeAdminType.Project);
require(pa.addr == msg.sender);
require(getProjectLevel(pa) < MAX_SUBPROJECT_LEVEL);
}

View File

@ -161,7 +161,6 @@ contract LiquidPledgingBase {
if (parentProject != 0) {
PledgeAdmin storage pa = findAdmin(parentProject);
require(pa.adminType == PledgeAdminType.Project);
require(pa.addr == msg.sender);
require(getProjectLevel(pa) < MAX_SUBPROJECT_LEVEL);
}

View File

@ -49,6 +49,7 @@ describe('LiquidPledging test', () => {
let adminProject1;
let adminProject2;
let adminProject2a;
let adminProject3;
let delegate2;
before(async () => {
const testrpc = TestRPC.server({
@ -68,6 +69,7 @@ describe('LiquidPledging test', () => {
adminProject2a = accounts[5];
delegate2 = accounts[6];
giver2 = accounts[7];
adminProject3 = accounts[8];
});
it('Should deploy LiquidPledging contract', async () => {
vault = await Vault.new(web3);
@ -331,4 +333,10 @@ describe('LiquidPledging test', () => {
assert.equal(res[3], '');
assert.equal(res[4], 259200); // default to 3 day commitTime
}).timeout(6000);
it('Should allow childProject with different parentProject owner', async () => {
const nAdminsBefore = await liquidPledging.numberOfPledgeAdmins();
await liquidPledging.addProject('Project3', 'URLProject3', adminProject3, 4, 86400, 0, { from: adminProject3 });
const nAdmins = await liquidPledging.numberOfPledgeAdmins();
assert.equal(nAdmins, utils.toDecimal(nAdminsBefore) + 1);
}).timeout(6000);
});