Skip to content

fix(staking): expose get_stake_amount and get_all_stakers (#272) - #410

Merged
cypriannwokolo2-creator merged 2 commits into
cocor-tech:masterfrom
FaveTeamz:fix/272-dead-code-staking-queries
Aug 31, 2026
Merged

fix(staking): expose get_stake_amount and get_all_stakers (#272)#410
cypriannwokolo2-creator merged 2 commits into
cocor-tech:masterfrom
FaveTeamz:fix/272-dead-code-staking-queries

Conversation

@FaveTeamz

Copy link
Copy Markdown
Contributor
  • Add StakersList DataKey (persistent storage) to types.rs
  • Maintain StakersList in stake() (add) and unstake() (remove)
  • Add get_stake_amount(user) -> i128: returns raw staked token amount, 0 if no active stake (including during unbonding)
  • Add get_all_stakers() -> Vec: returns all currently active stakers from persistent storage
  • Expose both new methods in lib.rs contractimpl block
  • Add 11 new tests (5 for get_stake_amount, 6 for get_all_stakers): happy path, no stake, after unstake, all periods, full lifecycle, empty list, single/multi-user, partial unstake, restake after

closes #274

…#272)

- Add StakersList DataKey (persistent storage) to types.rs
- Maintain StakersList in stake() (add) and unstake() (remove)
- Add get_stake_amount(user) -> i128: returns raw staked token amount,
  0 if no active stake (including during unbonding)
- Add get_all_stakers() -> Vec<Address>: returns all currently active
  stakers from persistent storage
- Expose both new methods in lib.rs contractimpl block
- Add 11 new tests (5 for get_stake_amount, 6 for get_all_stakers):
  happy path, no stake, after unstake, all periods, full lifecycle,
  empty list, single/multi-user, partial unstake, restake after cycle

Resolves cocor-tech#272
@cypriannwokolo2-creator
cypriannwokolo2-creator merged commit c0e140e into cocor-tech:master Aug 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.

Inconsistent serde: reputation-registry uses snake_case vs camelCase elsewhere

2 participants