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

appstore_reads.gno

1.95 Kb · 19 lines
 1package memba_weighted_host
 2
 3import "strconv"
 4
 5func (h *Host) appstoreConfigJSON() string {
 6	if h.appstorePolicy == nil {
 7		return ""
 8	}
 9	return `,"appstorePolicy":{"target":` + quoteJSON(AppstorePath) + `,"successor":` + quoteJSON(string(h.appstorePolicy.Successor())) + `,"treasury":` + quoteJSON(string(h.appstorePolicy.Treasury())) + `,"maxRegistrationFee":"100000000","curatorCategory":"critical","sealCategory":"critical","moderationCategory":"routine","unpauseCategory":"financial","emergencyPause":true,"returnStagesOnly":true,"invalidatesOtherProposals":true}`
10}
11func appstoreListingJSON(s AppstoreListing) string {
12	return `{"exists":` + strconv.FormatBool(s.Exists) + `,"contentHash":` + quoteJSON(s.ContentHash) + `,"status":` + quoteJSON(s.Status) + `,"reason":` + quoteJSON(s.Reason) + `,"credit":` + strconv.FormatBool(s.Credit) + `,"flags":` + quoteJSON(strconv.Itoa(s.Flags)) + `,"clearKeys":` + quoteJSON(s.ClearKeys) + `}`
13}
14func appstoreStateJSON(s AppstoreState) string {
15	return `{"owner":` + quoteJSON(string(s.Owner)) + `,"pendingOwner":` + quoteJSON(string(s.PendingOwner)) + `,"treasury":` + quoteJSON(string(s.Treasury)) + `,"fee":` + quoteJSON(strconv.FormatInt(s.Fee, 10)) + `,"paused":` + strconv.FormatBool(s.Paused) + `,"sealed":` + strconv.FormatBool(s.Sealed) + `,"ownerCurator":` + strconv.FormatBool(s.OwnerCurator) + `,"daoCurator":` + strconv.FormatBool(s.DAOCurator) + `,"successorCurator":` + strconv.FormatBool(s.SuccessorCurator) + `,"subjectCurator":` + strconv.FormatBool(s.SubjectCurator) + `,"listing":` + appstoreListingJSON(s.Listing) + `}`
16}
17func appstoreActionJSON(a AppstoreAction, s AppstoreState) string {
18	return `{"type":"appstore","target":` + quoteJSON(AppstorePath) + `,"operation":` + quoteJSON(string(a.Kind())) + `,"recipient":` + quoteJSON(string(a.Recipient())) + `,"fee":` + quoteJSON(strconv.FormatInt(a.Fee(), 10)) + `,"path":` + quoteJSON(a.Path()) + `,"reason":` + quoteJSON(a.Reason()) + `,"before":` + appstoreStateJSON(s) + `}`
19}