Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

/p/nym-moultest123/ownable/v0

Directory · 4 Files
README.md Open

gno.land/p/nym-moultest123/ownable

🚧 API sketch, not an implementation. The types below are declared; the two composition helpers panic("not implemented"). Nothing here works yet. Do not import it expecting behaviour.

A proposal for one Owner interface covering every kind of thing that can own a realm, so that ownership checks stop being written four different ways.

1type Owner interface {
2	Addr() address
3	Kind() Kind
4	owner()   // unexported: only this package may implement Owner
5}

Four owner kinds are declared: UserOwner (an address), RealmOwner (a runtime.Realm), MembstoreOwner and DAOOwner (both still empty structs, waiting on the membstore and dao interfaces).

The part worth keeping is the composition idea: ownership as an expression rather than a single address.

1func And(a Owner, b ...Owner) Owner   // panics today
2func Or(a Owner, b ...Owner) Owner    // panics today

Or(user, dao) is "the owner, or the DAO that can override them". And(a, b) is a 2-of-2. Today every realm hardcodes one of these shapes.

The tests pin the surface on purpose: they assert that And and Or panic, so implementing one is a visible change to this package rather than a silent shift in behaviour for whoever imported it.

Recovered from an unmerged upstream proposal. For ownership that works today, use p/nt/ownable or p/moul/authz.


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.