Simple Staking Contract
A basic staking contract where users stake tokens and earn rewards proportional to their stake. A basic staking contract where users stake tokens and earn rewards proportional to their stake.Explanation
This staking contract implements the standard reward distribution pattern. rewardPerToken tracks accumulated rewards per staked token. The updateReward modifier syncs state before any stake/withdraw to ensure accurate accounting.Code
Canonical knowledge ID:
code-example:simple-staking-contract