/p/nym-moultest123/entity/v0
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.