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

Make accurate way of consumers balance calculation #1869

Closed
chompomonim opened this issue Mar 10, 2020 · 0 comments · Fixed by #1921
Closed

Make accurate way of consumers balance calculation #1869

chompomonim opened this issue Mar 10, 2020 · 0 comments · Fixed by #1921
Assignees
Labels

Comments

@chompomonim
Copy link
Contributor

When in CLI consumer is asking to show balance, this is an ideal time to recalculate "true" balance.

Consumer balance can be calculated this way:
Balance (to spend) = BCBalance - (accountantPromised - BCSettled)

caller, _ := bindings.NewMystTokenCaller()
BCBalance = caller.BalanceOf()

caller, _ := bindings.NewChannelImplementation()
BCSettled = caller.Accountant().Settled

accountantPromised = boltDB.issued_invoices.AgreementTotal

We should also store in boltdb last issued promise. If it's not there, we should ask for own latest promise from the accountant.

Ideally, we could also have "recalculate balance" button in WebUI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants