func Earned
ActionEarned reports the rewards currently owed to `addr` (accrued but unminted), projected to the current block without mutating any state.
Package staking is a simplified, accounting-only port of Synthetix StakingRewards to gno.land. Users stake a fungible...
⚠️ Experimental — generated with no human supervision by the daily MCP pipeline (Solidity→Gno port). Not audited. See r/moul/x/daily.
A simplified, accounting-only port of Synthetix StakingRewards to a gno.land realm.
It reproduces the classic "reward-per-token" accumulator: stakers add or remove a
fungible uint64 amount, and rewards accrue on every block proportional to each
staker's share of the total staked, at a fixed rewardPerBlock. Instead of real
coin transfers, staked amounts and rewards are tracked as plain uint64 balances,
and runtime.ChainHeight() is used as the deterministic clock. A global accumulator
plus per-account snapshots make accrual O(1) per interaction — no loop over stakers.
Stake(amount) — add amount to your staked balance.Withdraw(amount) — remove amount from your staked balance.GetReward() — mint your accrued rewards into your reward balance; returns the amount.Earned(addr) — rewards currently owed to addr, projected to the current block.StakedOf(addr) — current staked balance of addr.Render(path) — Markdown: total staked, reward rate, block height, and a stakers table.1staking.Stake(cross, 100) // stake 100 units
2// ... blocks pass, rewards accrue ...
3staking.Earned(myAddr) // check pending rewards
4staking.GetReward(cross) // claim into reward balance
5staking.Withdraw(cross, 40) // unstake 40
Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
Dependency graph:

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.
Package staking is a simplified, accounting-only port of Synthetix StakingRewards to gno.land. Users stake a fungible amount; rewards accrue every block, proportional to each staker's share of the total staked, at a fixed rewardPerBlock. There is no real coin transfer — balances and rewards are plain uint64 accounting (a demonstration of the classic "reward-per-token" accumulator pattern).
Earned reports the rewards currently owed to `addr` (accrued but unminted), projected to the current block without mutating any state.
GetReward mints all accrued rewards into the caller's reward balance and resets the accrual counter. Returns the amount minted this call.
Render renders pool stats and a stakers table.
Stake adds `amount` to the caller's staked balance.
StakedOf reports the current staked balance of `addr`.
Withdraw removes `amount` from the caller's staked balance.