[day22-ICO] withdraw() never possible, because `released` never set to true.
Throvn opened this issue · comments
Louis Stanko commented
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);
}
}