diff --git a/examples/gno.land/r/gov/dao/dao.gno b/examples/gno.land/r/gov/dao/dao.gno index 6fcb8b39949..632935dafed 100644 --- a/examples/gno.land/r/gov/dao/dao.gno +++ b/examples/gno.land/r/gov/dao/dao.gno @@ -61,7 +61,7 @@ func Propose(comment string, executor pproposal.Executor) int { if executor == nil { panic(msgMissingExecutor) } - caller := std.PrevRealm().Addr() + caller := std.GetOrigCaller() // XXX: CHANGE THIS WHEN MSGRUN PERSIST CODE ESCAPING THE main() SCOPE! IT IS UNSAFE! AssertIsMember(caller) prop := &proposal{ @@ -78,7 +78,7 @@ func Propose(comment string, executor pproposal.Executor) int { func VoteOnProposal(idx int, option string) { assertProposalExists(idx) - caller := std.PrevRealm().Addr() + caller := std.GetOrigCaller() // XXX: CHANGE THIS WHEN MSGRUN PERSIST CODE ESCAPING THE main() SCOPE! IT IS UNSAFE! AssertIsMember(caller) prop := getProposal(idx) @@ -151,7 +151,7 @@ func Render(path string) string { output := "" for idx, prop := range proposals { - output += ufmt.Sprintf("- [/r/gov/dao:%d](%d) - %s (**%s**)(by %s)\n", idx, idx, prop.comment, string(prop.Status()), prop.author) + output += ufmt.Sprintf("- [%d](/r/gov/dao:%d) - %s (**%s**)(by %s)\n", idx, idx, prop.comment, string(prop.Status()), prop.author) } return output @@ -174,15 +174,17 @@ func Render(path string) string { } output := "" - output += ufmt.Sprintf("# Prop#%d", idx) + "\n" - output += "\n" + output += ufmt.Sprintf("# Prop #%d", idx) + output += "\n\n" output += prop.comment - output += "\n" + output += "\n\n" output += ufmt.Sprintf("Status: %s", string(prop.Status())) - output += "\n" + output += "\n\n" output += ufmt.Sprintf("Voting status: %s", prop.voter.Status(vs)) - output += "\n" + output += "\n\n" output += ufmt.Sprintf("Author: %s", string(prop.author)) + output += "\n\n" + return output } diff --git a/examples/gno.land/r/gov/dao/dao_test.gno b/examples/gno.land/r/gov/dao/dao_test.gno index d0362153715..96eaba7f5e9 100644 --- a/examples/gno.land/r/gov/dao/dao_test.gno +++ b/examples/gno.land/r/gov/dao/dao_test.gno @@ -51,12 +51,17 @@ func TestPackage(t *testing.T) { }) out = Render("0") - expected = `# Prop#0 + expected = `# Prop #0 dummy proposal + Status: active + Voting status: YES: 1, NO: 0, percent: 33, members: 3 -Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` + +Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr + +` urequire.Equal(t, expected, out) @@ -69,12 +74,17 @@ Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` }) out = Render("0") - expected = `# Prop#0 + expected = `# Prop #0 dummy proposal + Status: active + Voting status: YES: 1, NO: 1, percent: 33, members: 3 -Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` + +Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr + +` urequire.Equal(t, expected, out) @@ -84,12 +94,17 @@ Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` }) out = Render("0") - expected = `# Prop#0 + expected = `# Prop #0 dummy proposal + Status: accepted + Voting status: YES: 2, NO: 1, percent: 66, members: 3 -Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` + +Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr + +` urequire.Equal(t, expected, out) @@ -98,12 +113,17 @@ Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` members = append(members, u4) out = Render("0") - expected = `# Prop#0 + expected = `# Prop #0 dummy proposal + Status: active + Voting status: YES: 2, NO: 1, percent: 50, members: 4 -Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` + +Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr + +` urequire.Equal(t, expected, out) @@ -113,12 +133,17 @@ Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` }) out = Render("0") - expected = `# Prop#0 + expected = `# Prop #0 dummy proposal + Status: accepted + Voting status: YES: 3, NO: 1, percent: 75, members: 4 -Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` + +Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr + +` urequire.Equal(t, expected, out) @@ -126,12 +151,17 @@ Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` urequire.True(t, called) out = Render("0") - expected = `# Prop#0 + expected = `# Prop #0 dummy proposal + Status: succeeded + Voting status: YES: 3, NO: 1, percent: 75, members: 4 -Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` + +Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr + +` urequire.Equal(t, expected, out) @@ -145,12 +175,17 @@ Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` // even if we added a new member the executed proposal is showing correctly the members that voted on it out = Render("0") - expected = `# Prop#0 + expected = `# Prop #0 dummy proposal + Status: succeeded + Voting status: YES: 3, NO: 1, percent: 75, members: 4 -Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr` + +Author: g1w5c47h6lta047h6lta047h6lta047h6ly5kscr + +` urequire.Equal(t, expected, out) diff --git a/examples/gno.land/r/gov/dao/prop1_filetest.gno b/examples/gno.land/r/gov/dao/prop1_filetest.gno index 24db8801d1d..49a200fd561 100644 --- a/examples/gno.land/r/gov/dao/prop1_filetest.gno +++ b/examples/gno.land/r/gov/dao/prop1_filetest.gno @@ -81,34 +81,49 @@ func main() { // Output: // -- -// - [/r/gov/dao:0](0) - adding someone to vote (**succeeded**)(by g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm) -// - [/r/gov/dao:1](1) - manual valset changes proposal example (**active**)(by g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm) +// - [0](/r/gov/dao:0) - adding someone to vote (**succeeded**)(by g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm) +// - [1](/r/gov/dao:1) - manual valset changes proposal example (**active**)(by g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm) // // -- -// # Prop#1 +// # Prop #1 // // manual valset changes proposal example +// // Status: active +// // Voting status: YES: 0, NO: 0, percent: 0, members: 1 +// // Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm +// +// // -- // -- -// # Prop#1 +// # Prop #1 // // manual valset changes proposal example +// // Status: accepted +// // Voting status: YES: 1, NO: 0, percent: 100, members: 1 +// // Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm +// +// // -- // No valset changes to apply. // -- // -- -// # Prop#1 +// # Prop #1 // // manual valset changes proposal example +// // Status: succeeded +// // Voting status: YES: 1, NO: 0, percent: 100, members: 1 +// // Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm +// +// // -- // Valset changes: // - #123: g12345678 (10) diff --git a/examples/gno.land/r/gov/dao/prop2_filetest.gno b/examples/gno.land/r/gov/dao/prop2_filetest.gno index c6111439393..047709cc45f 100644 --- a/examples/gno.land/r/gov/dao/prop2_filetest.gno +++ b/examples/gno.land/r/gov/dao/prop2_filetest.gno @@ -65,36 +65,51 @@ func main() { // Output: // -- -// - [/r/gov/dao:0](0) - adding someone to vote (**succeeded**)(by g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm) -// - [/r/gov/dao:1](1) - post a new blogpost about govdao (**active**)(by g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm) +// - [0](/r/gov/dao:0) - adding someone to vote (**succeeded**)(by g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm) +// - [1](/r/gov/dao:1) - post a new blogpost about govdao (**active**)(by g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm) // // -- -// # Prop#1 +// # Prop #1 // // post a new blogpost about govdao +// // Status: active +// // Voting status: YES: 0, NO: 0, percent: 0, members: 1 +// // Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm +// +// // -- // -- -// # Prop#1 +// # Prop #1 // // post a new blogpost about govdao +// // Status: accepted +// // Voting status: YES: 1, NO: 0, percent: 100, members: 1 +// // Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm +// +// // -- // # Gnoland's Blog // // No posts. // -- // -- -// # Prop#1 +// # Prop #1 // // post a new blogpost about govdao +// // Status: succeeded +// // Voting status: YES: 1, NO: 0, percent: 100, members: 1 +// // Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm +// +// // -- // # Gnoland's Blog //