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

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

render_example_test.gno

0.64 Kb · 25 lines
 1package ratelimitdemo
 2
 3// ExampleRender pins the realm's Render output as a testable example.
 4func ExampleRender() {
 5	print(Render(""))
 6	// Output:
 7	// # Rate Limiter
 8	//
 9	// Demo of the [`p/moul/x/daily/ratelimit`](/p/nym-moultest123/x/daily/ratelimit/v0) library — an on-chain token-bucket limiter (port of `golang.org/x/time/rate`).
10	//
11	// ## Config
12	//
13	// | Parameter | Value |
14	// |---|---|
15	// | Rate (tokens/block) | 0.5 |
16	// | Burst (capacity) | 5 |
17	// | Clock height | 123 |
18	//
19	// ## Callers
20	//
21	// _No caller has hit the limiter yet._
22	//
23	// ---
24	// Call `Allow(cur)` to consume a token; read `Tokens(addr)` for a caller's balance.
25}