Skip to content

Conversation

@aleksei-udalov
Copy link
Contributor

No description provided.

Copy link

@frostiq frostiq left a 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);
Copy link

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) {
Copy link

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();
Copy link

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);
}
Copy link

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) {
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants