PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/moul/x/daily/staking/v0

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
v0
Namespace
moul / x / daily / staking
Files
3 (README)(gnomod.toml)
Exported functions
6
Module
gno.land/r/moul/x/daily/staking/v0
gno
0.9

Files (3)

  • README.mdmarkdown
  • gnomod.tomltoml
  • staking.gnogno
README.mdPreviewRaw
# staking

> ⚠️ **Experimental — generated with no human supervision** by the daily MCP pipeline (Solidity→Gno port). Not audited. See [r/moul/x/daily](https://github.com/moul/gno-contracts/blob/main/r/moul/x/daily/README.md).

---


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.

## Transactions

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

## Read-only

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

## Example

```go
staking.Stake(cross, 100)   // stake 100 units
// ... blocks pass, rewards accrue ...
staking.Earned(myAddr)      // check pending rewards
staking.GetReward(cross)    // claim into reward balance
staking.Withdraw(cross, 40) // unstake 40
```

<!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) -->

---

Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

**Dependency graph:**

![gno.land/r/moul/x/daily/staking/v0 dependency graph](https://raw.githubusercontent.com/moul/gno-contracts/main/_assets/gno.land/r/moul/x/daily/staking/v0/deps.png)

> 🧪 **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](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).

<!-- END GNOCONTRACTS FOOTER -->

Functions

  • Earned(addr string) uint64

  • GetReward(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) uint64

  • Render(path string) string

  • Stake(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, amount uint64)

  • StakedOf(addr string) uint64

  • Withdraw(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, amount uint64)

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

Rendered

RenderedRawgnoweb ↗

vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.