You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement the staking Contract's Staking, Rewards, and Unbonding Entrypoints #201
Description:
Reconstruct the staking crate from a non-compiling shell into a working Soroban contract with stake, unstake/unbond, and reward-claim entrypoints, matching whatever interface the crate's existing tests and callers imply.
Problem Statement & Context:
The task under way notes that the two newer crates staking and streams "currently fail to compile outright." Restoring them to a compiling state is being handled separately, but a stub that compiles provides no protocol functionality. staking matters because price_oracle feeder staking/slashing (covered elsewhere) and LP incentivization both depend on an actual staking primitive; without it those paths have nowhere to lock and reward.
Scope & Acceptance Criteria:
Entrypoints for stake, initiate-unbond (with any lock/cooldown the design requires), withdraw-after-cooldown, and claim rewards.
Correct accounting of per-staker principal and accrued rewards; no cross-staker leakage.
Admin surface to configure reward rate / reward source, gated via common::require_admin_or_multisig if common is adopted here.
Out of scope: any off-chain reward-funding tooling and frontend integration.
Implementation Guidelines:
Key Files/Modules: staking/src/lib.rs, staking/src/types.rs/storage.rs (create if missing), common/ helpers, staking test module.
Design/Architecture: typed persistent storage keyed by staker address for positions, plus a global reward-accumulator (index) so reward math is O(1) per action; keep math in a dedicated module.
Edge Cases/Constraints: zero-amount stake/unstake, unstake before cooldown elapses, staking while a prior unbond is pending, reward-accumulator overflow, and storage TTL extension on every write.
Testing: stake/unstake round-trip, two-staker reward-split correctness, cooldown enforcement, and unauthorized admin calls; assert no reward is claimable twice.
Definition of "Done":
Code written, tested, and documented.
All acceptance criteria met; crate compiles and its tests pass in CI.
PR submitted with a clear description, passing CI, relevant test output.
Activity
Dimank92 commentedon Oct 28, 2026
I have implemented the staking contract's entrypoints in PR #324.
Implementation Summary
zenith-stakinginto a compiling and fully verified Soroban contract with entrypoints for:stake,request_unstake,withdraw,claim_rewards,notify_rewardset_reward_rate,reward_rate(capped at 10,000 bps)set_cooldown,cooldown, with in-flight unbond safetyset_emergency_unstake,emergency_unstake_enabled, andemergency_unstake(instant principal exit, pauses new stakes)build = "../common/build_meta.rs",repository.workspace = true, andevent-spectest dependency.Unified payout wallet:
0xC345C07229307d4f1c7935aD2cAe48e390215808