You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please give names to the parameters in your Stake event. It makes it easy to understand your code, its purpose, and will be helpful for indexing (like creating a subgraph).
Good practice to always set initializing values even when opting for default ones (openForWithdraw state variable)
Your execute function can be more optimized if you check for openForWithdraw. As we know that execute has been already performed if the variable is true.
function execute() public notCompleted {
//if excuted was performed succesfully before, show an error to reflect this//
require(!openForWithdraw, "Actions has been already performed!");
// if deadline is not passed, show error to refelct it//
require(block.timestamp > deadline, "Deadline is not completed yet!");
// if is used instead of require becasu we have a counter action to set "openForWithdraw" to true//�
if(address(this).balance >= threshold) {
exampleExternalContract.complete{value: address(this).balance}();
} else {
// If the `threshold` was not met, allow everyone to call a `withdraw()` function
openForWithdraw = true;
}
}
Bug in withdraw function. You are not updating the balances which will allow user to withdraw multiple times.
Your modifiers must be above functions to follow best practices and conventions.
Good job on deploying and verifying the contract. Please try to link them in readme.
Lack of comments. Please add comments with @notice, @params, etc to make your code easy to understand
The text was updated successfully, but these errors were encountered:
Stake
event. It makes it easy to understand your code, its purpose, and will be helpful for indexing (like creating a subgraph).openForWithdraw
state variable)openForWithdraw
. As we know that execute has been already performed if the variable is true.balances
which will allow user to withdraw multiple times.The text was updated successfully, but these errors were encountered: