add ipfs hash to removeCOntributor function and add test
This commit is contained in:
parent
5d069afb06
commit
7c308ef261
|
@ -226,7 +226,7 @@ contract Meritocracy {
|
|||
// Remove Contributor from Registry
|
||||
// Note: Should not be easy to remove multiple contributors in one tx
|
||||
// WARN: Changed to idx, client can do loop by enumerating registry
|
||||
function removeContributor(uint256 idx) external onlyAdmin { // address _contributor
|
||||
function removeContributor(uint256 idx, string calldata _contributorListIPFSHash) external onlyAdmin { // address _contributor
|
||||
// Locals
|
||||
uint256 registryLength = registry.length - 1;
|
||||
// Requirements
|
||||
|
@ -237,6 +237,8 @@ contract Meritocracy {
|
|||
registry[idx] = registry[registryLength];
|
||||
registry.pop();
|
||||
delete contributors[c]; // TODO check if this works
|
||||
// Set new IPFS hash for the list
|
||||
contributorListIPFSHash = _contributorListIPFSHash;
|
||||
emit ContributorRemoved(c);
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,18 @@ contract("Meritocracy", function () {
|
|||
}
|
||||
});
|
||||
|
||||
describe('removeContributor', () => {
|
||||
it('removes with normal values', async () => {
|
||||
let oldRegistry = await Meritocracy.methods.getRegistry().call();
|
||||
|
||||
let result = await Meritocracy.methods.removeContributor(1, IPFS_HASH).send({from: owner});
|
||||
|
||||
let registry = await Meritocracy.methods.getRegistry().call();
|
||||
|
||||
assert.strictEqual(registry.length, oldRegistry.length - 1);
|
||||
})
|
||||
})
|
||||
|
||||
// TODO award
|
||||
// TODO withdraw before and after
|
||||
|
||||
|
@ -128,7 +140,6 @@ contract("Meritocracy", function () {
|
|||
// TODO withdraw after forfeitAllocations
|
||||
|
||||
// TODO setMaxContributors smaller than max
|
||||
// TODO removeContributors
|
||||
// TODO setMaxContributors again
|
||||
// TODO addContributors
|
||||
// TODO changeOwner
|
||||
|
|
Loading…
Reference in New Issue