Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

/v0 package

Overview

Package ratelimitdemo is a small on-chain demo of the token-bucket rate limiter provided by the p/moul/x/daily/ratelimit(/p/moul/x/daily/ratelimit/v0) library.

It holds a single package-level ratelimit.Limiter and wires it to the chain: the tick is runtime.ChainHeight() and each caller is keyed by its address (unsafe.PreviousRealm().Address()). It contains no limiter logic of its own — refill/consume math all lives in the library.

Function

Tokens

func Tokens(addr address) int
Ask AI Claude ChatGPT

Tokens reports how many whole tokens `addr` has available at the current block height, without mutating any state.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/ratelimitdemo/v0.Tokens()"

Result

Gno Expression Evaluator

Evaluate any read-only Gno expression against gno.land/r/moul/x/daily/ratelimitdemo/v0, for example a function call with arguments.