cleanup contract debugging and make sure contributions are only once claimable

This commit is contained in:
bumi 2019-03-24 22:33:16 +01:00
parent cd7df3893e
commit fbda45376e
2 changed files with 3 additions and 4 deletions

View File

@ -27,8 +27,6 @@ contract Contribution is AragonApp {
string internal name_; string internal name_;
string internal symbol_; string internal symbol_;
address public tokenContract;
mapping(uint256 => address) contributionOwner; mapping(uint256 => address) contributionOwner;
mapping(address => uint256[]) ownedContributions; mapping(address => uint256[]) ownedContributions;
@ -112,9 +110,10 @@ contract Contribution is AragonApp {
require(c.exists, 'NOT_FOUND'); require(c.exists, 'NOT_FOUND');
require(!c.claimed, 'ALREADY_CLAIMED'); require(!c.claimed, 'ALREADY_CLAIMED');
require(block.number > c.claimAfterBlock, 'NOT_CLAIMABLE'); require(block.number > c.claimAfterBlock, 'NOT_CLAIMABLE');
c.claimed = true;
address token = getTokenContract(); address token = getTokenContract();
IToken(token).mintFor(c.contributor, c.amount, contributionId); IToken(token).mintFor(c.contributor, c.amount, contributionId);
emit ContributionClaimed(contributionId, c.contributor, c.amount); emit ContributionClaimed(contributionId, c.contributor, c.amount);
} }

View File

@ -123,9 +123,9 @@ contract Proposal is AragonApp {
require(!p.executed, 'ALREADY_EXECUTED'); require(!p.executed, 'ALREADY_EXECUTED');
require(p.votesCount >= p.votesNeeded, 'MISSING_VOTES'); require(p.votesCount >= p.votesNeeded, 'MISSING_VOTES');
p.executed = true;
address contributorAccount = IContributor(getContributorContract()).getContributorAddressById(p.contributorId); address contributorAccount = IContributor(getContributorContract()).getContributorAddressById(p.contributorId);
IContribution(getContributionContract()).add(p.amount, contributorAccount, p.hashDigest, p.hashFunction, p.hashSize); IContribution(getContributionContract()).add(p.amount, contributorAccount, p.hashDigest, p.hashFunction, p.hashSize);
p.executed = true;
emit ProposalExecuted(proposalId, p.contributorId, p.amount); emit ProposalExecuted(proposalId, p.contributorId, p.amount);
} }