Skip to content

Commit

Permalink
update proposal contract.
Browse files Browse the repository at this point in the history
  • Loading branch information
YancyParker committed Jan 30, 2024
1 parent 4d1bf5d commit 31cce04
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions examples/source/quickstart/proposal.ola
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,18 @@ contract ProposalContract {
assert(proposals[i] != _contentHash);
}

u32 weight = 1;
if (oldProposal.votingType == VotingType.Weighted) {
weight = _weight;
}

// check if deadline is in the future
Proposal proposal = proposalByHash[_contentHash];
assert(block_timestamp() < proposal.deadline, "Voting period has ended");
if (_support) {
proposal.totalSupport += _weight;
proposal.totalSupport += weight;
} else {
proposal.totalAgainst += _weight;
proposal.totalAgainst += weight;
}
proposalByHash[_contentHash] = proposal;
proposalsByVoter[origin_address()].push(_contentHash);
Expand Down

0 comments on commit 31cce04

Please sign in to comment.