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

Implement more user friendly burn, increaseAllowance & decreaseAllowance function #34

Merged
merged 6 commits into from
Jun 8, 2023

Conversation

plouis01
Copy link
Contributor

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 :

 token.decreaseAllowance(spenderAccount, U64.MAX_VALUE);

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.

@Thykof
Copy link
Contributor

Thykof commented Mar 21, 2023

Hi @plouis01 thanks you for you contribution!

@plouis01 plouis01 requested a review from Thykof March 21, 2023 15:45
@Thykof Thykof requested a review from peterjah March 29, 2023 09:49
@peterjah peterjah force-pushed the main branch 2 times, most recently from 3de80db to 38b7b97 Compare June 8, 2023 14:19
@peterjah peterjah merged commit 56ac179 into massalabs:main Jun 8, 2023
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

Successfully merging this pull request may close these issues.

4 participants