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/ratelimitdemo/v0

Realm
Open in gnoweb ↗

Overview

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

Files (3)

  • README.mdmarkdown
  • gnomod.tomltoml
  • ratelimitdemo.gnogno
README.mdPreviewRaw
# `gno.land/r/moul/x/daily/ratelimitdemo/v0`

Live demo of the [`p/moul/x/daily/ratelimit`](https://github.com/moul/gno-contracts/tree/main/p/moul/x/daily/ratelimit/v0)
token-bucket rate limiter.

Holds one package-level `ratelimit.Limiter` (0.5 tokens/block, capacity 5) and
wires it to the chain — the tick is `runtime.ChainHeight()`, each caller is keyed
by `unsafe.PreviousRealm().Address()`:

- `Allow(cur) bool` — consume one token for the caller.
- `SetConfig(cur, rate, burst)` — retune the shared bucket.
- `Tokens(addr) int` — read-only balance.
- `Render("/")` — config + a table of callers; `Render("/addr/<address>")` focuses one.

All refill/consume math lives in the library; this realm is just the wiring and
the gnoweb view. Render it at [`/r/moul/x/daily/ratelimitdemo/v0`](https://gno.land/r/moul/x/daily/ratelimitdemo/v0).

<!-- 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/ratelimitdemo/v0 dependency graph](https://raw.githubusercontent.com/moul/gno-contracts/main/_assets/gno.land/r/moul/x/daily/ratelimitdemo/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

  • Allow(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}) bool

  • Render(path string) string

  • SetConfig(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}, rate float64, burst float64)

  • Tokens(addr string) int

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.