entity.gno
0.98 Kb · 37 lines
1// Package entity provides an interface that abstracts a notion of entity which
2// can under the hood be an EOA (address), a package realm (PkgPath, address).
3// It also tries to give a notion of type where for instance, a user can be
4// either a simple user or a team, and a contract can be either an arbitrary
5// contract, or one that implements a famous pattern/interface, such as a DAO.
6// It also provides some composition utilities so that an entity can be a flow
7// that matches multiple other entities.
8package entity
9
10import (
11 "chain/runtime"
12)
13
14type Entity interface {
15 Addr() address
16 Path() string
17 Kind
18 isEntity()
19}
20
21type Kind interface {
22 kind()
23}
24
25type UserEntity interface {
26 Entity
27 isUserEntity()
28}
29
30type RealmEntity interface {
31 Entity
32 isRealmEntity()
33}
34
35func NewUserByAddr(addr address) UserEntity { panic("not implemented") }
36func NewUserByName(name string) UserEntity { panic("not implemented") }
37func NewRealm(rlm runtime.Realm) RealmEntity { panic("not implemented") }