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

render_example_test.gno

0.63 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/moul/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}