PathrockNetwork Gno Explorer
HomeBlocksTransactionsRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/gov/dao/impl/v0

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
v0
Namespace
gov / dao / impl
Files
25 (gnomod.toml)
Exported functions
17
Module
gno.land/r/gov/dao/impl/v0
gno
0.9

Files (25)

  • gnomod.tomltoml
  • clamp.gnogno
  • filter.gnogno
  • govdao.gnogno
  • impl.gnogno
  • prop_requests.gnogno
  • render.gnogno
  • types.gnogno
  • clamp_test.gnogno
  • denied_reason_test.gnogno
  • executor_disclosure_filetest.gnogno
  • executor_invocation_authority_filetest.gnogno
  • govdao_execute_proposal_00_filetest.gnogno
  • govdao_execute_proposal_01_filetest.gnogno
  • govdao_execute_proposal_02_filetest.gnogno
  • govdao_execute_proposal_03_filetest.gnogno
  • govdao_test.gnogno
  • render_error_paths_filetest.gnogno
  • stringify_proposal_00_filetest.gnogno
  • title_clamp_filetest.gnogno
  • z_addr_validation_test.gnogno
  • z_denied_reason_store_test.gnogno
  • z_treasury_payment_request_test.gnogno
  • z_unknown_proposal_test.gnogno
  • z_upgrade_request_test.gnogno
  • stringify_proposal_00_filetest.gnogno
    1// PKGPATH: gno.land/r/test2package test34import (5	"strings"6	"testing"78

    Functions

    • AddMember(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, addr string)

    • GetInstance(int, rlm interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) *gno.land/r/gov/dao/impl/v0.GovDAO

    • NewAddMemberRequest(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, addr string, tier string, portfolio string) struct{title string; description string; executor gno.land/r/gov/dao.Executor; filter gno.land/r/gov/dao.Filter}

    • NewChangeLawRequest(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, newLaw struct{Supermajority float64}) struct{title string; description string; executor gno.land/r/gov/dao.Executor; filter gno.land/r/gov/dao.Filter}

    • NewFilterByTier(tier string) struct{Tier string}

    • NewGovDAO() *gno.land/r/gov/dao/impl/v0.GovDAO

    • NewLaw(supermajority float64) struct{Supermajority float64}

    • NewPromoteMemberRequest(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, addr string, fromTier string, toTier string) struct{title string; description string; executor gno.land/r/gov/dao.Executor; filter gno.land/r/gov/dao.Filter}

    • NewProposalsStatuses() struct{BPTree *gno.land/p/nt/bptree/v0.BPTree}

    • NewRender(d *gno.land/r/gov/dao/impl/v0.GovDAO) *gno.land/r/gov/dao/impl/v0.render

    • NewTreasuryGRC20TokensUpdate(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, newTokenKeys []string) struct{title string; description string; executor gno.land/r/gov/dao.Executor; filter gno.land/r/gov/dao.Filter}

    • NewTreasuryPaymentRequest(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, payment interface {BankerID func() string; String func() string}, reason string) struct{title string; description string; executor gno.land/r/gov/dao.Executor; filter gno.land/r/gov/dao.Filter}

    • NewUpgradeDaoImplRequest(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, newDao interface {ExecuteProposal func(int, .uverse.realm, gno.land/r/gov/dao.ProposalID, gno.land/r/gov/dao.Executor) .uverse.error; PostCreateProposal func(int, .uverse.realm, gno.land/r/gov/dao.ProposalRequest, gno.land/r/gov/dao.ProposalID); PreCreateProposal func(int, .uverse.realm, gno.land/r/gov/dao.ProposalRequest) (.uverse.address, .uverse.error); PreExecuteProposal func(int, .uverse.realm, gno.land/r/gov/dao.ProposalID) (bool, .uverse.error); Render func(.uverse.realm, string, string) string; VoteOnProposal func(int, .uverse.realm, gno.land/r/gov/dao.VoteRequest) .uverse.error}, realmPkg string, reason string) struct{title string; description string; executor gno.land/r/gov/dao.Executor; filter gno.land/r/gov/dao.Filter}

    • NewWithdrawMemberRequest(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, addr string, reason string) struct{title string; description string; executor gno.land/r/gov/dao.Executor; filter gno.land/r/gov/dao.Filter}

    • Render(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, in string) string

    • StringifyProposal(p *gno.land/r/gov/dao.Proposal) string

    • StringifyVotes(int, rlm interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, ps *gno.land/r/gov/dao/impl/v0.proposalStatus) string

    Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

    Rendered

    RenderedRawgnoweb ↗

    vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.

    "gno.land/p/nt/testutils/v0"
    9 "gno.land/r/gov/dao"
    10 "gno.land/r/gov/dao/impl/v0"
    11 "gno.land/r/gov/dao/memberstore/v0"
    12)
    13
    14var (
    15 testUser = testutils.TestAddress("test")
    16)
    17
    18// StringifyProposal carries its own copy of the disclosure expression, separate
    19// from the one in render.gno. It has no production caller today, but it is
    20// exported, and an untested copy of a security-relevant expression is free to
    21// drift from the tested one. This executor pins it: CreationRealm is reached
    22// through the public interface, so it can return anything, and the run of two
    23// backticks closes a narrower fence.
    24type hostileExec struct{}
    25
    26func (e *hostileExec) Execute(cur realm) error { return nil }
    27
    28func (e *hostileExec) String() string { return "" }
    29
    30// Padded on both ends as well as fenced: without the TrimSpace, InlineCode
    31// pads the fence to protect the leading and trailing spaces, and the expected
    32// span below no longer matches. That makes one payload cover both the escaping
    33// and the trim.
    34func (e *hostileExec) CreationRealm() string { return " gno.land/r/evil`` **INJECTED** " }
    35
    36func memberByTier(tier string) *memberstore.Member {
    37 switch tier {
    38 case memberstore.T1:
    39 t, _ := memberstore.GetTier(memberstore.T1)
    40 return memberstore.NewMember(t.InvitationPoints)
    41 default:
    42 panic("unsupported tier: " + tier)
    43 }
    44}
    45
    46func init(cur realm) {
    47 // Load members for testing
    48 mstore := memberstore.Get(0, cur)
    49 mstore.DeleteAll()
    50 mstore.SetTier(memberstore.T1)
    51 mstore.SetMember(memberstore.T1, testUser, memberByTier(memberstore.T1))
    52
    53 // Set up the DAO implementation using proper constructor
    54 govDAO := impl.NewGovDAO()
    55 dao.UpdateImpl(cross(cur), dao.NewUpdateRequest(govDAO, []string{"gno.land/r/test", "gno.land/r/gov/dao/impl/v0"}))
    56}
    57
    58func main(cur realm) {
    59 // Create an executor in a specific realm to test creation realm tracking
    60 testing.SetRealm(testing.NewCodeRealm("gno.land/r/template/contract"))
    61 executor := dao.NewSimpleExecutor(0, cur, func(realm) error { return nil }, "Test executor description")
    62
    63 // Create a proposal request
    64 proposalRequest := dao.NewProposalRequest(
    65 "Test Proposal Title",
    66 "This is a test proposal description to verify StringifyProposal works correctly.",
    67 executor,
    68 )
    69
    70 // Switch to user realm to create the proposal
    71 testing.SetOriginCaller(testUser)
    72 testing.SetRealm(testing.NewUserRealm(testUser))
    73 pid := dao.MustCreateProposal(cross(cur), proposalRequest)
    74
    75 // Get the proposal and test the core functionality
    76 prop := dao.MustGetProposal(pid)
    77
    78 // Test that executor string is captured correctly
    79 println("Executor string:", prop.ExecutorString())
    80
    81 // Test that executor creation realm is captured correctly
    82 println("Executor creation realm:", prop.ExecutorCreationRealm())
    83
    84 // Stringify
    85 println("----")
    86 println(impl.StringifyProposal(prop))
    87
    88 // The same disclosure, through a hostile executor.
    89 hpid := dao.MustCreateProposal(cross(cur), dao.NewProposalRequest(
    90 "Hostile", "creation realm attacks the code span", &hostileExec{}))
    91 hout := impl.StringifyProposal(dao.MustGetProposal(hpid))
    92
    93 println("stringify widens the fence too:",
    94 strings.Contains(hout, "```gno.land/r/evil`` **INJECTED**```"))
    95 println("and no bold escapes it:", !strings.Contains(hout, "\n**INJECTED**"))
    96}
    97
    98// Output:
    99// Executor string: Test executor description
    100// Executor creation realm: gno.land/r/template/contract
    101// ----
    102//
    103// ### Title: Test Proposal Title
    104//
    105// ### Proposed by: g1w3jhxazlta047h6lta047h6lta047h6lwmjv0n
    106//
    107// This is a test proposal description to verify StringifyProposal works correctly.
    108//
    109// This proposal contains the following metadata:
    110//
    111// Test executor description
    112//
    113// Executor created in: `gno.land/r/template/contract`
    114//
    115// stringify widens the fence too: true
    116// and no bold escapes it: true
    117