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

US-996 RIF Wallet libs - Sending a transaction should check if the user has the funds + fee before sending (RIF RELAY) #739

Merged
merged 2 commits into from
Sep 15, 2023

Conversation

TravellerOnTheRun
Copy link
Collaborator

Simulator.Screen.Recording.-.iPhone.13.-.2023-09-12.at.13.15.03.mp4

@jormelCoin
Copy link
Contributor

@TravellerOnTheRun I attempted to test this PR but received the following error message:

20230912_123925.mp4

if (tokenToBoolMap.get(symbol as TokenSymbol)) {
insufficientFunds =
Number(value) + Number(feeValue) >
Number(balances[RIF_TOKEN_ADDRESS_TESTNET].balance)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RIF TOKEN ADDRESS TESTNET should be dynamic in terms of which chainId the app currently has defined in settingsSlice because when we switch to mainnet it'll not. be testnet anymore

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought since you're handling TESTNET to MAINNET, you can do that as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember what I said in a daily that we must always use the chainId since I changed all the references to use the one we have in Redux and not a hardcoded one, it's as easy as getting the chainId from redux and using it there

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed in general, you can use feeSymbol from line 80 and then feeContract on line 81 to get the address of the fee payment. From there, you should be able to check the balances.

We also need to check if the user is trying to send a different token, like RDOC, and doesn't have enough RIF to pay the fee. I'm not sure if that is being covered here.

Copy link
Collaborator Author

@TravellerOnTheRun TravellerOnTheRun Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jessgusclark That is being covered, I check if the symbol is not being found(means not RIF), I check that there's enough balance only for fee

@jormelCoin
Copy link
Contributor

I just tested the following test cases:

  • Try to send RIF with insufficient funds
  • Try to send RDOC with insufficient funds
  • Try to send TRBTC with insufficient funds
  • Send RDOC and RIF to validate everything works as expected when sending.

all of them worked as expected

@jormelCoin jormelCoin added the Tested Ready to move forward label Sep 14, 2023
Copy link
Collaborator

@Freshenext Freshenext left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good.
Functional tested OK.

@Freshenext Freshenext merged commit cb02e27 into develop Sep 15, 2023
@Freshenext Freshenext deleted the us-996 branch September 15, 2023 13:45
jormelCoin pushed a commit that referenced this pull request Sep 28, 2023
…er has the funds + fee before sending (RIF RELAY) (#739)

* feat: handle insuffient funds

* refactor: use feeContract as address to search balances
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tested Ready to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants