-
Notifications
You must be signed in to change notification settings - Fork 6
Review #2
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
base: master
Are you sure you want to change the base?
Review #2
Conversation
frostiq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the comments
|
|
||
| // disable transfer | ||
| function transfer(address _to, uint _value) returns (bool) { | ||
| require(1==0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you decided to disable transfer?
In this case please use throw
| if (now > deadline || totalSupply > hardcap) { | ||
| active = false; | ||
| if (totalSupply < softcap) { | ||
| for (uint i = 0; i < balancesForReturn.length; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, don't use for if you can avoid it.
Let's let everyone to refund ether by themselves.
In this case, you can use mapping instead of the array.
The length of the balancesForReturn can be so high, that amount of gas needed for the cycle can be more than block gas limit.
In this case, all gathered ether will be locked forever
|
|
||
| function buyTokens(address beneficiary) canBuy payable { | ||
|
|
||
| finishIfNeed(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, remove the finishIfNeed call here, you can always invoke it manually.
In case when finishIfNeed will throw an exception, it will block every request to buyTokens function
| if (totalSupply < softcap) { | ||
| for (uint i = 0; i < balancesForReturn.length; ++i) { | ||
| balancesForReturn[i].addr.transfer(balancesForReturn[i].amount); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refund and buy logic must be thoroughly covered by unit tests
You can use our git as an example
https://github.com/rootprojectco/backend/tree/master/test
| } | ||
|
|
||
| function finishIfNeed() { | ||
| if (now > deadline || totalSupply > hardcap) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not guaranteed that totalSupply will be <= hardcap by this check
No description provided.