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.

v0 source pure

Package ownable proposes an abstraction around the ownership which provides various kind of owners and some compositi...

Readme View source

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.

Overview

Package ownable proposes an abstraction around the ownership which provides various kind of owners and some composition options.

Functions 2

func And

1func And(a Owner, b ...Owner) Owner
source

func Or

1func Or(a Owner, b ...Owner) Owner
source

Types 6

type Owner

interface
1type Owner interface {
2	Addr() address
3	Kind() Kind
4	owner()
5}
source

Dependencies

Imports 1

/p/nym-moultest123/ownable/v0

Imported by indexer

Source Files 4