-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Add reset
function to Counters
library
#2677
Comments
Hello issue @xu-tian , and tank for your issue. |
You are welcome. I noticed
|
In reset, assigning 0 doesn't include safemath protection, so unchecked is not needed (and won't do anything good or bad) |
Got it. I did a test and it is indeed using less gas. Thanks for the clarification. |
🧐 Motivation
In a scenario like moving a point in one direction in a bounded segment, a counter can reach the upper limit and then needs to get reset to start all over again. It would be great if a reset function can be added to the Counters library.
📝 Details
The text was updated successfully, but these errors were encountered: