v0 source pure
Package safe is inspired by Gnosis Safe
View source
gno.land/p/nym-moultest123/safe
🚧 API sketch, mostly unimplemented. 13 of the 22 functions
panic("not implemented"), including every proposal path. It compiles and its shape is testable; it does not work.
A Gnosis-Safe-shaped multisig interface for gno: an m-of-n set of members, a queue of proposals, and explicit approve / execute / cancel.
What runs today
1func NewSafe() Safe // 1-of-1, owned by the calling realm's address
2func (s safe) Name() string
3func (s safe) Members() []address
4func (s safe) Threshold() uint
5func (s safe) Size() uint
What panics
Everything that would make it a multisig: ProposeAddingMember,
ProposeRemovingMember, ProposeUpdatingThreshold, GetProposal,
ApproveProposal, ExecuteProposal, CancelProposal, NextProposal,
UpcomingProposals, PreviousProposals, Render, and both String methods.
The shape being proposed
The interesting decision is that membership changes are themselves proposals,
so there is one code path for "do a thing" and no privileged side door for
"change who may do things". Proposal exposes Executed() and Voters(), and
proposals are split into upcoming and previous rather than a single log, which
is what a UI actually needs.
For multisig that works today, use the tm2 account-level multisig
(gnokey multisign), not this.
Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
⚠️ Disclaimer: provided as-is, without warranty; not security-audited. Full disclaimer: DISCLAIMER.
Package safe is inspired by Gnosis Safe
1
2
type Proposal
interfacetype Safe
interface 1type Safe interface {
2 Name() string
3 Members() []address
4 Threshold() uint
5 Size() uint
6 NextProposal() Proposal
7 UpcomingProposals(page uint) (props []Proposal, total uint)
8 PreviousProposals(page uint) (props []Proposal, total uint)
9
10 ProposeAddingMember(addr address, newThreshold uint) (prop Proposal, err error)
11 ProposeRemovingMember(addr address, newThreshold uint) (prop Proposal, err error)
12 ProposeUpdatingThreshold(newThreshold uint) (prop Proposal, err error)
13
14 GetProposal(id uint) Proposal
15 ApproveProposal(p Proposal) error
16 ExecuteProposal(p Proposal) error
17 CancelProposal(p Proposal) error // XXX: should be ProposeToCancel?
18
19 Render(path string) string
20}