From 19ca89e1ebb3ea3635a4435feb6099aba729ec5f Mon Sep 17 00:00:00 2001 From: Haythem Sellami Date: Sat, 20 Apr 2019 14:51:38 +0100 Subject: [PATCH] should revert when update contributor account that does not exist --- apps/contributor/contracts/Contributor.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/contributor/contracts/Contributor.sol b/apps/contributor/contracts/Contributor.sol index 1c21e58..e9a6271 100644 --- a/apps/contributor/contracts/Contributor.sol +++ b/apps/contributor/contracts/Contributor.sol @@ -54,10 +54,13 @@ contract Contributor is AragonApp { } function updateContributorAccount(uint32 id, address oldAccount, address newAccount) public auth(MANAGE_CONTRIBUTORS_ROLE) { + require(getContributorAddressById(id) == oldAccount, "contributor does not exist"); + contributorIds[oldAccount] = 0; contributorIds[newAccount] = id; contributors[id].account = newAccount; - ContributorAccountUpdated(id, oldAccount, newAccount); + + emit ContributorAccountUpdated(id, oldAccount, newAccount); } function updateContributorProfileHash(uint32 id, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public isInitialized auth(MANAGE_CONTRIBUTORS_ROLE) {