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

feed_reads.gno

1.20 Kb · 16 lines
 1package memba_weighted_host
 2
 3import "strconv"
 4
 5func (h *Host) feedConfigJSON() string {
 6	if h.feedPolicy == nil {
 7		return ""
 8	}
 9	return `,"feedPolicy":{"target":` + quoteJSON(FeedPath) + `,"successor":` + quoteJSON(string(h.feedPolicy.Successor())) + `,"moderatorCategory":"critical","unpauseCategory":"financial","emergencyPause":true,"returnStagesOnly":true,"invalidatesOtherProposals":true}`
10}
11func feedStateJSON(s FeedState) string {
12	return `{"owner":` + quoteJSON(string(s.Owner)) + `,"pendingOwner":` + quoteJSON(string(s.PendingOwner)) + `,"paused":` + strconv.FormatBool(s.Paused) + `,"moderatorCount":` + quoteJSON(strconv.Itoa(s.ModeratorCount)) + `,"ownerModerator":` + strconv.FormatBool(s.OwnerModerator) + `,"daoModerator":` + strconv.FormatBool(s.DAOModerator) + `,"successorModerator":` + strconv.FormatBool(s.SuccessorModerator) + `,"subjectModerator":` + strconv.FormatBool(s.SubjectModerator) + `}`
13}
14func feedActionJSON(a FeedAction, s FeedState) string {
15	return `{"type":"feed","target":` + quoteJSON(FeedPath) + `,"operation":` + quoteJSON(string(a.Kind())) + `,"recipient":` + quoteJSON(string(a.Recipient())) + `,"subject":` + quoteJSON(string(a.Subject())) + `,"before":` + feedStateJSON(s) + `}`
16}