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

Account for unbonding balances when calculating withdrawn rewards #24

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

codchen
Copy link
Collaborator

@codchen codchen commented Jan 10, 2025

Describe your changes and provide context

Rewards that are withdrawn automatically because of undelegate/redelegate should be calculated as:

withdrawn rewards = bank balance - principals not delegated
                  = bank balance - (original total principals - withdrawn principals - delegated principals - unbonding principals)

Previously there was no way to query unbonding principals from a CW contract so we have been under-withdrawing. This PR fixes that.

Testing performed to validate your change

unit test
integration test with sei-chain (which now supports unbonding balance query)

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.

1 participant