mirror of
https://github.com/status-im/meritocracy.git
synced 2025-01-23 03:59:00 +00:00
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
|
// Remove Contributor from Registry
|
||||||
// Note: Should not be easy to remove multiple contributors in one tx
|
// Note: Should not be easy to remove multiple contributors in one tx
|
||||||
// WARN: Changed to idx, client can do loop by enumerating registry
|
// 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
|
// Locals
|
||||||
uint256 registryLength = registry.length - 1;
|
uint256 registryLength = registry.length - 1;
|
||||||
// Requirements
|
// Requirements
|
||||||
@ -237,6 +237,8 @@ contract Meritocracy {
|
|||||||
registry[idx] = registry[registryLength];
|
registry[idx] = registry[registryLength];
|
||||||
registry.pop();
|
registry.pop();
|
||||||
delete contributors[c]; // TODO check if this works
|
delete contributors[c]; // TODO check if this works
|
||||||
|
// Set new IPFS hash for the list
|
||||||
|
contributorListIPFSHash = _contributorListIPFSHash;
|
||||||
emit ContributorRemoved(c);
|
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 award
|
||||||
// TODO withdraw before and after
|
// TODO withdraw before and after
|
||||||
|
|
||||||
@ -128,7 +140,6 @@ contract("Meritocracy", function () {
|
|||||||
// TODO withdraw after forfeitAllocations
|
// TODO withdraw after forfeitAllocations
|
||||||
|
|
||||||
// TODO setMaxContributors smaller than max
|
// TODO setMaxContributors smaller than max
|
||||||
// TODO removeContributors
|
|
||||||
// TODO setMaxContributors again
|
// TODO setMaxContributors again
|
||||||
// TODO addContributors
|
// TODO addContributors
|
||||||
// TODO changeOwner
|
// TODO changeOwner
|
||||||
|
Loading…
x
Reference in New Issue
Block a user