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

fix: balance calculations to be compatible with new chain changes #3395

Merged
merged 4 commits into from
Sep 22, 2024

Conversation

0oM4R
Copy link
Contributor

@0oM4R 0oM4R commented Sep 10, 2024

Description

To get the total balance now we have to add the free and the reserved, locked balance is not used anymore

Changes

  • replaced locked with reserved
  • show the sum of reserved and free in profile manager
  • make freeBalance variable computed to make it always synced with the balanc

Related Issues

Tested Scenarios

  • having zero tft, and check the profile manager

  • use polkadot UI and call system/account to retrieve the actual balance and compare it with the shown in profile manager

  • try to empty you account from balance at all and check for the shown values

  • also try to deploy when you have balance less than 2 TFT < should fail>

  • try to deploy when the free balance is larger than 2 TFT

Screenshot from 2024-09-10 11-47-17

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstrings
  • Screenshots/Video attached (needed for UI changes)

adjust caculating balance to be compatible with new tfchain changes
Copy link
Contributor

@amiraabouhadid amiraabouhadid left a comment

Choose a reason for hiding this comment

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

works when balance is exactly 2tft
image

@0oM4R
Copy link
Contributor Author

0oM4R commented Sep 18, 2024

works when balance is exactly 2tft image

this is the expected behavior right ?

Copy link
Contributor

@amiraabouhadid amiraabouhadid left a comment

Choose a reason for hiding this comment

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

however, rounding the numbers (1.998 is rounded to 2) is confusing in the err msg . I suggest you use the same number of decimals in err msg as used in balance display
image

remove the current balance as the showing the numbers with floor, tofixed, trunc will be misleading
@0oM4R
Copy link
Contributor Author

0oM4R commented Sep 22, 2024

image

Copy link
Contributor

@amiraabouhadid amiraabouhadid left a comment

Choose a reason for hiding this comment

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

tested with less than 2TFT, works
Screenshot from 2024-09-22 12-23-55tested with exactly 2TFT, works
image

@0oM4R 0oM4R merged commit f87fbb3 into development Sep 22, 2024
10 checks passed
@xmonader xmonader added this to the 2.6.0 milestone Sep 24, 2024
@0oM4R 0oM4R deleted the development_chain_release2.9_balance branch October 3, 2024 16:52
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