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 entity provides an interface that abstracts a notion of entity which can under the hood be an EOA (address), ...

Readme View source

gno.land/p/nym-moultest123/entity

🚧 API sketch, not an implementation. The interfaces below are declared; all three constructors panic("not implemented"). Nothing here works yet.

A proposal for one type that stands for "whoever is acting", whether that is an externally owned account or a realm.

1type Entity interface {
2	Addr() address
3	Path() string    // "" for an EOA, the pkgpath for a realm
4	Kind
5	isEntity()
6}

UserEntity and RealmEntity narrow it, and Kind is meant to carry the second axis: a user can be a person or a team, a realm can be an arbitrary contract or one that implements a known interface such as a DAO.

1func NewUserByAddr(addr address) UserEntity    // panics today
2func NewUserByName(name string) UserEntity     // panics today
3func NewRealm(rlm runtime.Realm) RealmEntity   // panics today

The motivation is that gno code constantly branches on "is this an address or a pkgpath", and that branch leaks into every API that wants to accept either. A single Entity would let a realm accept both and let composition (an entity that matches several others) be expressed once.

Closely related to p/moul/ownable, which is the same idea narrowed to ownership.


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 entity provides an interface that abstracts a notion of entity which can under the hood be an EOA (address), a package realm (PkgPath, address). It also tries to give a notion of type where for instance, a user can be either a simple user or a team, and a contract can be either an arbitrary contract, or one that implements a famous pattern/interface, such as a DAO. It also provides some composition utilities so that an entity can be a flow that matches multiple other entities.

Functions 3

Types 4

type Entity

interface
1type Entity interface {
2	Addr() address
3	Path() string
4	Kind
5	isEntity()
6}
source

type Kind

interface
1type Kind interface {
2	kind()
3}
source

Dependencies

Imports 1

/p/nym-moultest123/entity/v0

Imported by indexer

Source Files 4