Merge branch 'project_level_bug' into v1
This commit is contained in:
commit
25fb84965a
|
@ -515,7 +515,7 @@ contract LiquidPledgingBase is Escapable {
|
||||||
assert(m.adminType == PledgeAdminType.Project);
|
assert(m.adminType == PledgeAdminType.Project);
|
||||||
if (m.parentProject == 0) return(1);
|
if (m.parentProject == 0) return(1);
|
||||||
PledgeAdmin storage parentNM = findAdmin(m.parentProject);
|
PledgeAdmin storage parentNM = findAdmin(m.parentProject);
|
||||||
return getProjectLevel(parentNM);
|
return getProjectLevel(parentNM) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @notice A getter to find if a specified Project has been canceled
|
/// @notice A getter to find if a specified Project has been canceled
|
||||||
|
|
|
@ -333,4 +333,33 @@ describe('LiquidPledging test', function () {
|
||||||
const nAdmins = await liquidPledging.numberOfPledgeAdmins();
|
const nAdmins = await liquidPledging.numberOfPledgeAdmins();
|
||||||
assert.equal(nAdmins, utils.toDecimal(nAdminsBefore) + 1);
|
assert.equal(nAdmins, utils.toDecimal(nAdminsBefore) + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should throw if projectLevel > 20', async () => {
|
||||||
|
let nAdmins = await liquidPledging.numberOfPledgeAdmins();
|
||||||
|
|
||||||
|
await liquidPledging.addProject('ProjectLevel1', '', adminProject1, 0, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel2', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel3', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel4', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel5', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel6', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel7', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel8', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel9', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel10', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel11', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel12', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel13', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel14', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel15', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel16', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel17', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel18', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel19', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
await liquidPledging.addProject('ProjectLevel20', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
|
||||||
|
assertFail(async () => {
|
||||||
|
await liquidPledging.addProject('ProjectLevel21', '', adminProject1, ++nAdmins, 86400, 0, { from: adminProject1 });
|
||||||
|
});
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue