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

Deduct transaction fee if user tries to donate/deposit max token balance #3903

Closed
divine-comedian opened this issue Mar 27, 2024 · 20 comments
Closed
Assignees
Labels
P3 nice to have, but not required Product Backlog

Comments

@divine-comedian
Copy link
Contributor

divine-comedian commented Mar 27, 2024

To prevent users from accidentally donating or depositing all of their native tokens we should automatically subtract the estimated transaction fee from their available balances

If a user presses the button to input the max amount into an input field such as depositing into their stream balance or donating to a project we should input their native balance - estimated tx fee

If a user manually inputs an amount that exceeds this projected available balance we should throw a warning underneath the input field and prevent the user from continuing - they must lower the amount to continue

The warning text should say:

"You need to keep at least {amount} {native token} in your wallet to pay the network fees for this transaction. Please enter a lower amount."


to be clear this is a very niche error message, take for example:

  • user balance is 10 tokens
  • they choose to donate 9.9
  • network fee is 0.2
  • the total cost of the tx would be 10.1

which exceeds their balance, even though they are "donating" less than their balance the tx fee added would cause it to fail. so we show the error message.


@divine-comedian @maryjaf All issues have been resolved except case 11. @maryjaf can you reproduce it again?
let's have a call and reproduce it together. but you can check all other issues on the staging environment.
And case 11 happens when for example the user has no super token and in donation flow after getting super token the > user's ETH balance change to lower than minimum for a donation transaction
in this scenario the above message is shown that it would be better a handle message be shown

Originally posted by @maryjaf in #3091 (comment)

@divine-comedian divine-comedian changed the title > @divine-comedian @maryjaf All issues have been resolved except case 11. @maryjaf can you reproduce it again? let's have a call and reproduce it together. but you can check all other issues on the staging environment. Add warning if users try to donate their max balance of Native Token Mar 27, 2024
@divine-comedian divine-comedian added the P3 nice to have, but not required label Mar 27, 2024
@divine-comedian divine-comedian changed the title Add warning if users try to donate their max balance of Native Token Deduct transaction fee if user tries to donate/deposit max token balance Mar 27, 2024
@divine-comedian
Copy link
Contributor Author

Are we still waiting to pick this one up?

@divine-comedian divine-comedian moved this to Done in All-Devs Jun 26, 2024
@divine-comedian divine-comedian moved this from Done to Product Backlog in All-Devs Jun 26, 2024
@RamRamez
Copy link
Collaborator

@Reshzera could you please take it?

@RamRamez RamRamez assigned Reshzera and unassigned MohammadPCh Jul 18, 2024
@Reshzera
Copy link
Contributor

@RamRamez Yes, I'll take a look

@Reshzera Reshzera moved this from Product Backlog to In Progress in All-Devs Jul 22, 2024
@Reshzera Reshzera moved this from In Progress to Code Review/PR in All-Devs Jul 24, 2024
@MohammadPCh MohammadPCh moved this from Code Review/PR to QA in All-Devs Jul 31, 2024
@Reshzera
Copy link
Contributor

@maryjaf @LatifatAbdullahi This Issue is ready to be tested on the staging, could you please take a look?

@maryjaf maryjaf self-assigned this Jul 31, 2024
@maryjaf
Copy link
Collaborator

maryjaf commented Jul 31, 2024

Could you please take a look on below screen record ? @Reshzera

  • by entering the number in box, the available amount is changed
Screen.Recording.2024-07-31.at.7.13.07.PM.mov

@Reshzera
Copy link
Contributor

@maryjaf Sure

@Reshzera
Copy link
Contributor

@maryjaf I just push a new PR to staging to correct this bug, could you please take a look?

@maryjaf
Copy link
Collaborator

maryjaf commented Aug 1, 2024

Could you please take a look on below screen record ? @Reshzera

  • by entering the number in box, the available amount is changed

Thanks @Reshzera
This problem has been fixed

one question
showing this long number in UI for gas fee is accepted?
0.000629999999895

image

@Reshzera
Copy link
Contributor

Reshzera commented Aug 1, 2024

@maryjaf I don't know I'll check with Mitch

@divine-comedian
Copy link
Contributor Author

This doesn't look right @maryjaf @Reshzera

If you are trying to donate MORE than your balance of tokens we should show an error related to "insufficient balance" which we already handle on the app

Screencast.2024-08-01.10.24.02.mp4
Screencast.2024-08-01.10.25.31.mp4

please both of you have a look at these videos to properly understand the scenario where this error should be shown..

if I try to donate the max balance of a native token, it will fail in the MM because we are not accounting for the required gas fee. If as a user I try to manually input a donation amount that is NOT GREATER THAN MY TOTAL NATIVE TOKEN BALANCE but does not leave enough native token balance to cover the cost of the transaction THEN we should show the error message.

IF I try to donate more than my total native token balance then we stick with showing the current insufficient wallet balance modal that is already in place.

@Reshzera
Copy link
Contributor

Reshzera commented Aug 1, 2024

@divine-comedian, I just realized, I didn't know about the modal telling the user they don't have enough funds. I'll fix it.

@Reshzera
Copy link
Contributor

Reshzera commented Aug 2, 2024

@maryjaf I just fix the problem that @divine-comedian mention and push it to the staging environment, I think now it's everything correct

@maryjaf
Copy link
Collaborator

maryjaf commented Aug 4, 2024

This doesn't look right @maryjaf @Reshzera

If you are trying to donate MORE than your balance of tokens we should show an error related to "insufficient balance" which we already handle on the app

Screencast.2024-08-01.10.24.02.mp4
Screencast.2024-08-01.10.25.31.mp4
please both of you have a look at these videos to properly understand the scenario where this error should be shown..

if I try to donate the max balance of a native token, it will fail in the MM because we are not accounting for the required gas fee. If as a user I try to manually input a donation amount that is NOT GREATER THAN MY TOTAL NATIVE TOKEN BALANCE but does not leave enough native token balance to cover the cost of the transaction THEN we should show the error message.

IF I try to donate more than my total native token balance then we stick with showing the current insufficient wallet balance modal that is already in place.

These videos didn't play for me and I couldn't download them
How ever this is the current behaviour that I've seen on staging

Screen.Recording.2024-08-04.at.10.45.00.AM.mov

and I have some questions :

  • My user has 0.897709 xdai token
    -in donation page I see Available: 0.897709 and by tapping on the available this amount is changed and 0.897674(my balance - transaction gas fee ) is set for donation amount , Is this expected behavior ?

  • If I set for example 0.8977 I see this error
    You need to keep at least 0.0000346500 XDAI in your wallet to pay the network fees for this transaction. Please enter a lower amount.

  • If I set 0.9 the "donate" button is enabled and by tapping on that I see the insufficient modal

Is these scenarios are as expected ?

@divine-comedian @Reshzera

@maryjaf
Copy link
Collaborator

maryjaf commented Aug 4, 2024

  • It seems sth is changed in donation page and maybe it isn't related to exactly this issue

@RamRamez had determined some limitation for donation to giveth in system , that it couldn't be lower than 0.000001
and for example if user enters 0.000001 XDAI for donation by setting 5, 10, 15 , 20 % , the donation to giveth is set 0.000001

but now it is changed on stg and when I set 5, 10, 15 , 20 % for donation to giveth, it is shown 0

in below screen record I try to show the behavior of system on stg and prod

@divine-comedian @Reshzera

Screen.Recording.2024-08-04.at.6.13.49.PM.mov

@maryjaf
Copy link
Collaborator

maryjaf commented Aug 4, 2024

  • It seems sth is changed in donation page and maybe it isn't related to exactly this issue

Maybe it is related to this issue Giveth/impact-graph#1710

@divine-comedian
Copy link
Contributor Author

This doesn't look right @maryjaf @Reshzera
If you are trying to donate MORE than your balance of tokens we should show an error related to "insufficient balance" which we already handle on the app
Screencast.2024-08-01.10.24.02.mp4
Screencast.2024-08-01.10.25.31.mp4
please both of you have a look at these videos to properly understand the scenario where this error should be shown..
if I try to donate the max balance of a native token, it will fail in the MM because we are not accounting for the required gas fee. If as a user I try to manually input a donation amount that is NOT GREATER THAN MY TOTAL NATIVE TOKEN BALANCE but does not leave enough native token balance to cover the cost of the transaction THEN we should show the error message.
IF I try to donate more than my total native token balance then we stick with showing the current insufficient wallet balance modal that is already in place.

These videos didn't play for me and I couldn't download them How ever this is the current behaviour that I've seen on staging

Screen.Recording.2024-08-04.at.10.45.00.AM.mov
and I have some questions :

  • My user has 0.897709 xdai token
    -in donation page I see Available: 0.897709 and by tapping on the available this amount is changed and 0.897674(my balance - transaction gas fee ) is set for donation amount , Is this expected behavior ?
  • If I set for example 0.8977 I see this error
    You need to keep at least 0.0000346500 XDAI in your wallet to pay the network fees for this transaction. Please enter a lower amount.
  • If I set 0.9 the "donate" button is enabled and by tapping on that I see the insufficient modal

Is these scenarios are as expected ?

@divine-comedian @Reshzera

This is the correct behaviour! 🎉

@divine-comedian
Copy link
Contributor Author

please take up investigation @Reshzera on the related bug MJ is reporting as I will be on vacation this week.

@maryjaf
Copy link
Collaborator

maryjaf commented Aug 6, 2024

please take up investigation @Reshzera on the related bug MJ is reporting as I will be on vacation this week.

kindly reminder

@Reshzera
Copy link
Contributor

Reshzera commented Aug 6, 2024

@maryjaf I think this is related to the issue mentioned Giveth/impact-graph#1710, @lovelgeorge99 could you take a look?

@maryjaf
Copy link
Collaborator

maryjaf commented Aug 6, 2024

Thanks @Reshzera
Is this change deployed on prod ?
after deploying on prod the issue could be changed into "closed"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 nice to have, but not required Product Backlog
Projects
Status: Done
Development

No branches or pull requests

8 participants