Skip to content

feat: add get rewards balance view - #1052

Merged
Uyoxy merged 2 commits into
stellarspend:mainfrom
somotochukwu-dev:add-get-rewards-balance-view-974
Jul 31, 2026
Merged

feat: add get rewards balance view#1052
Uyoxy merged 2 commits into
stellarspend:mainfrom
somotochukwu-dev:add-get-rewards-balance-view-974

Conversation

@somotochukwu-dev

Copy link
Copy Markdown
Contributor

Add get_rewards_balance view function to rewards contract

Adds a get_rewards_balance(owner: Address) -> i128 view function that returns the current unclaimed reward balance for an address.

Changes

contracts/rewards/src/rewards.rs — Added get_rewards_balance module-level function that delegates to the existing get_reward_balance storage helper. Returns 0 when no account or zero balance.

contracts/rewards/src/lib.rs — Added import and get_rewards_balance entry point on RewardsContract.

Tests added

  • test_get_rewards_balance_returns_balance_after_credit — returns correct balance after crediting rewards.
  • test_get_rewards_balance_returns_zero_for_unregistered — returns 0 for an address with no account.
  • test_get_rewards_balance_returns_zero_for_fresh_account — returns 0 for a newly registered account.
  • test_get_rewards_balance_reflects_debits — balance correctly reflects debits.

Closes #974

@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@somotochukwu-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Uyoxy

Uyoxy commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@somotochukwu-dev

@Uyoxy
Uyoxy merged commit 1665b52 into stellarspend:main Jul 31, 2026
1 check failed
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.

Add get_rewards_balance view to rewards contract

3 participants