Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

staking source realm

Package staking is a simplified, accounting-only port of Synthetix StakingRewards to gno.land. Users stake a fungible...

Overview

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).

Functions 6

func Earned

Action
1func Earned(addr address) uint64
source

Earned reports the rewards currently owed to `addr` (accrued but unminted), projected to the current block without mutating any state.

func GetReward

crossing Action
1func GetReward(cur realm) uint64
source

GetReward mints all accrued rewards into the caller's reward balance and resets the accrual counter. Returns the amount minted this call.

func Render

1func Render(path string) string
source

Render renders pool stats and a stakers table.

func Stake

crossing Action
1func Stake(cur realm, amount uint64)
source

Stake adds `amount` to the caller's staked balance.

func StakedOf

Action
1func StakedOf(addr address) uint64
source

StakedOf reports the current staked balance of `addr`.

func Withdraw

crossing Action
1func Withdraw(cur realm, amount uint64)
source

Withdraw removes `amount` from the caller's staked balance.

Imports 5

Source Files 2