prop2_filetest.gno

2.14 Kb ยท 110 lines
  1package main
  2
  3import (
  4	"time"
  5
  6	"gno.land/p/demo/dao"
  7	gnoblog "gno.land/r/gnoland/blog"
  8	govdao "gno.land/r/gov/dao/v2"
  9)
 10
 11func init() {
 12	ex := gnoblog.NewPostExecutor(
 13		"hello-from-govdao",                             // slug
 14		"Hello from GovDAO!",                            // title
 15		"This post was published by a GovDAO proposal.", // body
 16		time.Now().Format(time.RFC3339),                 // publication date
 17		"moul",                                          // authors
 18		"govdao,example",                                // tags
 19	)
 20
 21	// Create a proposal
 22	description := "post a new blogpost about govdao"
 23
 24	prop := dao.ProposalRequest{
 25		Description: description,
 26		Executor:    ex,
 27	}
 28
 29	govdao.Propose(prop)
 30}
 31
 32func main() {
 33	println("--")
 34	println(govdao.Render(""))
 35	println("--")
 36	println(govdao.Render("0"))
 37	println("--")
 38	govdao.VoteOnProposal(0, "YES")
 39	println("--")
 40	println(govdao.Render("0"))
 41	println("--")
 42	println(gnoblog.Render(""))
 43	println("--")
 44	govdao.ExecuteProposal(0)
 45	println("--")
 46	println(govdao.Render("0"))
 47	println("--")
 48	println(gnoblog.Render(""))
 49}
 50
 51// Output:
 52// --
 53// - [Proposal #0](/r/gov/dao/v2:0) - (**active**)(by g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm)
 54//
 55// --
 56// # Prop #0
 57//
 58// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
 59//
 60// post a new blogpost about govdao
 61//
 62// Status: active
 63//
 64// Voting stats: YAY 0 (0%), NAY 0 (0%), ABSTAIN 0 (0%), HAVEN'T VOTED 10 (100%)
 65//
 66// Threshold met: false
 67//
 68//
 69// --
 70// --
 71// # Prop #0
 72//
 73// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
 74//
 75// post a new blogpost about govdao
 76//
 77// Status: accepted
 78//
 79// Voting stats: YAY 10 (100%), NAY 0 (0%), ABSTAIN 0 (0%), HAVEN'T VOTED 0 (0%)
 80//
 81// Threshold met: true
 82//
 83//
 84// --
 85// # Gnoland's Blog
 86//
 87// No posts.
 88// --
 89// --
 90// # Prop #0
 91//
 92// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
 93//
 94// post a new blogpost about govdao
 95//
 96// Status: execution successful
 97//
 98// Voting stats: YAY 10 (100%), NAY 0 (0%), ABSTAIN 0 (0%), HAVEN'T VOTED 0 (0%)
 99//
100// Threshold met: true
101//
102//
103// --
104// # Gnoland's Blog
105//
106// <div class='columns-3'><div>
107//
108// ### [Hello from GovDAO!](/r/gnoland/blog:p/hello-from-govdao)
109//  13 Feb 2009
110// </div></div>