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: wrong transferable part calculation #1796

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

pgolovkin
Copy link
Collaborator

Closes #1794

@pgolovkin pgolovkin requested review from tuul-wq and Asmadek and removed request for tuul-wq May 24, 2024 08:23
Copy link
Contributor

Jest Unit tests results

Generic badge

Duration: 54.588 seconds
Start: 2024-05-24 08:24:16.282 UTC
Finish: 2024-05-24 08:25:10.870 UTC
Duration: 54.588 seconds
Outcome: Passed | Total Tests: 631 | Passed: 631 | Failed: 0
Total Test Suites: 143
Total Tests: 631
Failed Test Suites: 0
Failed Tests: 0
Passed Test Suites: 143
Passed Tests: 631

@pgolovkin
Copy link
Collaborator Author

Calculation reference from Nova Wallet:

https://github.com/novasamatech/nova-wallet-android/blob/6fcc7f37cda8f98e540a18c196d0d60c1e69185c/feature-wallet-api/src/main/java/io/novafoundation/nova/feature_wallet_api/domain/model/Asset.kt#L39-L44

 fun holdAndFreezesTransferable(free: Balance, frozen: Balance, reserved: Balance): Balance {
      val freeCannotDropBelow = (frozen - reserved).atLeastZero()

      return (free - freeCannotDropBelow).atLeastZero()
  }

@pgolovkin pgolovkin marked this pull request as draft May 24, 2024 08:48
@pgolovkin
Copy link
Collaborator Author

For each asset REGULAR and HOLDS_AND_FREEZES modes have to be added.

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.

Wrong transferable part calculation.
1 participant