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

[day22-ICO] withdraw() never possible, because released never set to true. #168

Open
Throvn opened this issue Apr 27, 2022 · 0 comments
Open

Comments

@Throvn
Copy link

Throvn commented Apr 27, 2022

In the Smart contract day22-ICO/ICO.sol is a critical logic error.

the modifier tokensReleased and tokensNotReleased depend on the boolean released.
This boolean never gets set to true in the release() function.

Therefore the withdraw function can never be called after deployment of the current implementation.

I will open a PR addressing this simple fix.

My proposed change would be the following:

function release() external onlyAdmin icoEnded tokensNotReleased {
  released = true;
  DoneToken tokenInstance = DoneToken(token);
  for (uint256 i = 0; i < sales.length; i++) {
    Sale storage sale = sales[i];
    tokenInstance.transfer(sale.investor, sale.quantity);
  }
}
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

No branches or pull requests

1 participant