From fbda45376e4350a04304e595e9d2f8727c0071b3 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Sun, 24 Mar 2019 22:33:16 +0100 Subject: [PATCH] cleanup contract debugging and make sure contributions are only once claimable --- apps/contribution/contracts/Contribution.sol | 5 ++--- apps/proposal/contracts/Proposal.sol | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/contribution/contracts/Contribution.sol b/apps/contribution/contracts/Contribution.sol index f26c81e..c5ed47d 100644 --- a/apps/contribution/contracts/Contribution.sol +++ b/apps/contribution/contracts/Contribution.sol @@ -27,8 +27,6 @@ contract Contribution is AragonApp { string internal name_; string internal symbol_; - address public tokenContract; - mapping(uint256 => address) contributionOwner; mapping(address => uint256[]) ownedContributions; @@ -112,9 +110,10 @@ contract Contribution is AragonApp { require(c.exists, 'NOT_FOUND'); require(!c.claimed, 'ALREADY_CLAIMED'); require(block.number > c.claimAfterBlock, 'NOT_CLAIMABLE'); + + c.claimed = true; address token = getTokenContract(); IToken(token).mintFor(c.contributor, c.amount, contributionId); - emit ContributionClaimed(contributionId, c.contributor, c.amount); } diff --git a/apps/proposal/contracts/Proposal.sol b/apps/proposal/contracts/Proposal.sol index 50adf96..7d9eca5 100644 --- a/apps/proposal/contracts/Proposal.sol +++ b/apps/proposal/contracts/Proposal.sol @@ -123,9 +123,9 @@ contract Proposal is AragonApp { require(!p.executed, 'ALREADY_EXECUTED'); require(p.votesCount >= p.votesNeeded, 'MISSING_VOTES'); + p.executed = true; address contributorAccount = IContributor(getContributorContract()).getContributorAddressById(p.contributorId); IContribution(getContributionContract()).add(p.amount, contributorAccount, p.hashDigest, p.hashFunction, p.hashSize); - p.executed = true; emit ProposalExecuted(proposalId, p.contributorId, p.amount); }