Skip to content

Commit

Permalink
Resolve issues from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
skmgoldin committed Oct 6, 2017
1 parent 312c010 commit f92e9d5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions contracts/Parameterizer.sol
Expand Up @@ -175,6 +175,7 @@ contract Parameterizer {
} else if (challengeCanBeResolved(_propID)) {
resolveChallenge(_propID);
} else if (now > prop.processBy) {
require(token.transfer(prop.owner, prop.deposit));
} else {
revert();
}
Expand Down Expand Up @@ -232,8 +233,7 @@ contract Parameterizer {
function canBeSet(bytes32 _propID) constant public returns (bool) {
ParamProposal memory prop = proposalMap[_propID];

return (propExists(_propID) && now > prop.appExpiry && now < prop.processBy &&
prop.challengeID == 0);
return (now > prop.appExpiry && now < prop.processBy && prop.challengeID == 0);
}

/**
Expand Down Expand Up @@ -261,8 +261,6 @@ contract Parameterizer {
@param _challengeID The challengeID to determine a reward for
*/
function determineReward(uint _challengeID) public constant returns (uint) {
require(!challengeMap[_challengeID].resolved && voting.pollEnded(_challengeID));

if(voting.getTotalNumberOfTokensForWinningOption(_challengeID) == 0) {
// Edge case, nobody voted, give all tokens to the winner.
return 2 * challengeMap[_challengeID].stake;
Expand Down Expand Up @@ -299,6 +297,9 @@ contract Parameterizer {
function resolveChallenge(bytes32 _propID) private {
ParamProposal memory prop = proposalMap[_propID];

// set flag on challenge being processed
challengeMap[prop.challengeID].resolved = true;

// winner gets back their full staked deposit, and dispensationPct*loser's stake
uint reward = determineReward(prop.challengeID);

Expand All @@ -312,9 +313,6 @@ contract Parameterizer {
require(token.transfer(challengeMap[prop.challengeID].challenger, reward));
}

// set flag on challenge being processed
challengeMap[prop.challengeID].resolved = true;

// store the total tokens used for voting by the winning side for reward purposes
challengeMap[prop.challengeID].totalTokens =
voting.getTotalNumberOfTokensForWinningOption(prop.challengeID);
Expand Down

0 comments on commit f92e9d5

Please sign in to comment.