Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix contract 5 #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions 5_fix_CountContribution.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ contract CountContribution{
* @param _amount The amount of the contribution.
*/
function recordContribution(address _user, uint _amount) {
require(contribution[_user] + _amount >= contribution[_user]);
require(totalContributions + _amount >= totalContributions);
Copy link

@n1c01a5 n1c01a5 Apr 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't sure the second check is necessary. If the first test is okay, the input amount is a valid number.
Your overflow check is good idea but I think there is an another issue.

contribution[_user]+=_amount;
totalContributions+=_amount;
}
Expand Down