Implement more user friendly burn, increaseAllowance & decreaseAllowance function #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I feel like the current usage of burn, increaseAllowance & decreaseAllowance could be optimized by allowing the user to set an allowance to 0 by using
U64.MAX_VALUE
(same to burn all his tokens & set an allowance to the max value).This would allow decreasing the allowance to 0 without having to know the current one, see the following interface call :
This could also prevent the case of an allowance changing between the call and the execution of the transaction (or, for the burn function a balance changing).
I had to adapt the overflow/underflow tests as those cases now result in either 0, max allowance, or entire balance burned.