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

1.23 Kb · 34 lines
 1package bond
 2
 3import (
 4	"strconv"
 5
 6	"gno.land/p/nt/ufmt/v0"
 7)
 8
 9func Render(path string) string {
10	_ = path
11	out := "# gnomemepad create-bond policy\n\n"
12	out += "Separate realm — pad upgrades do not replace this schedule.\n\n"
13	if !inited {
14		out += "> [!CAUTION]\n> Call Init first.\n"
15		return out
16	}
17	out += ufmt.Sprintf("- **Current bond:** %d ugnot (~%d GNOT)\n", CurrentBondUgnot(), CurrentBondUgnot()/1_000_000)
18	out += ufmt.Sprintf("- **Normal bond:** %d ugnot\n", normalBondUgnot)
19	out += ufmt.Sprintf("- **Promo bond:** %d ugnot\n", promoBondUgnot)
20	if IsPromoActive() {
21		out += ufmt.Sprintf("- **Promo active** — ends at unix %d (~%d s left)\n", promoEndsAt, PromoSecondsLeft())
22	} else {
23		out += "- Promo: inactive (using normal bond)\n"
24	}
25	out += ufmt.Sprintf("- Admin: `%s`\n\n", admin.String())
26	out += "## API\n\n"
27	out += "- `CurrentBondUgnot()` — pad reads this on Create\n"
28	out += "- `StartPromo(promoUgnot, durationSec)` — admin; 0 amount keeps set promo bond; 0 duration → 10d\n"
29	out += "- `EndPromo()` — admin → normal bond immediately\n"
30	out += "- `SetNormalBond` / `SetPromoBond` / `ExtendPromo`\n"
31	out += "- `BondInfo()` → status|current|normal|promo|endsAt|left|admin\n"
32	_ = strconv.Itoa(0)
33	return out
34}