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

views.gno

0.95 Kb · 27 lines
 1package config
 2
 3import (
 4	"strconv"
 5
 6	"gno.land/p/samcrew/launchpad/meta/v1"
 7)
 8
 9// ActionStatusJSON reports only the current config gate for a new action.
10// Other realm, custody and publication requirements are separate.
11func ActionStatusJSON(lane, currency string) string {
12	if !validLane(lane) || currency == "" || len(currency) > 200 {
13		panic("launchpad/config: invalid action status query")
14	}
15	blocked := IsPaused(lane)
16	allowlisted := IsCurrencyAllowed(currency)
17	ready := IsLaneReady(lane, currency)
18	return "{" +
19		`"schema":"launchpad-config-action-v1"` +
20		`,"lane":` + meta.JSONString(lane) +
21		`,"currency":` + meta.JSONString(currency) +
22		`,"version":` + meta.JSONString(strconv.FormatInt(GetCurrentVersion(), 10)) +
23		`,"paused":` + strconv.FormatBool(blocked) +
24		`,"allowlisted":` + strconv.FormatBool(allowlisted) +
25		`,"laneReady":` + strconv.FormatBool(ready) +
26		`,"configGateOpen":` + strconv.FormatBool(!blocked && allowlisted && ready) + "}"
27}