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

permbook_demo state

Back to all declarations

PermBump

untyped string

The permission names this realm gates on. They are constants rather than caller-supplied strings for the gated actions, so a typo cannot silently create an unenforced gate.

Value

"bump"

PermNotice

untyped string

The permission names this realm gates on. They are constants rather than caller-supplied strings for the gated actions, so a typo cannot silently create an unenforced gate.

Value

"notice"

MaxPermissions

untyped bigint

Value

(8 <untyped> bigint)

MaxHolders

untyped bigint

Value

(32 <untyped> bigint)

MaxNameLen

untyped bigint

Value

(24 <untyped> bigint)

MaxNoticeLen

untyped bigint

Value

(200 <untyped> bigint)

MaxListed

untyped bigint

Value

(50 <untyped> bigint)

book

*permbook.Book

book is the permission set. It is unexported and never returned: handing a \*permbook.Book across a realm boundary would hand out every mutator on it, and borrow rule #2 commits those writes under THIS realm's authority (permbook consumer contract 2).

Open
OID
036cd1…c358:48
book details

Inspect pointer

bumps

int64

The state the gated actions move. This is the observable evidence that a gate was open at one height and closed at another.

Value

2

lastBumper

.uverse.address

The state the gated actions move. This is the observable evidence that a gate was open at one height and closed at another.

Value

<gnolang.StringValue>

lastBumpHeight

int64

The state the gated actions move. This is the observable evidence that a gate was open at one height and closed at another.

Value

612779

notice

string

The state the gated actions move. This is the observable evidence that a gate was open at one height and closed at another.

Value

""

noticeAuthor

.uverse.address

The state the gated actions move. This is the observable evidence that a gate was open at one height and closed at another.

Value

<zero>

noticeSetAtBlock

int64

The state the gated actions move. This is the observable evidence that a gate was open at one height and closed at another.

Value

0

demoLimits

func() permbook.Limits

demoLimits are the limits every Book this realm constructs is given.

Open
OID
036cd1…c358:10
demoLimits details

Inspect func

Ready

func() bool

Ready reports whether init captured a deploy-time admin and constructed the book. False means the realm is inert; see the note in init.

Open
OID
036cd1…c358:13
Ready details

Inspect func

rejectStraySend

func()

rejectStraySend aborts if an EOA attached coins to an entrypoint that has no use for them. This realm never holds value; without this guard a mistyped send would be silently absorbed by the realm bank.

Open
OID
036cd1…c358:14
rejectStraySend details

Inspect func

Bump

func() string

Bump increments the counter. Requires the "bump" permission. This is the experiment: call it with the permission and it succeeds; have the admin revoke, call it again in a later transaction, and it aborts.

Open
OID
036cd1…c358:15
Bump details

Inspect func

SetNotice

func(text string) string

SetNotice replaces the public notice. Requires the "notice" permission. It exists so the demo shows two INDEPENDENT permissions on one book: holding "bump" does not let an address set the notice, and revoking one leaves the other intact.

Open
OID
036cd1…c358:16
SetNotice details

Inspect func

Grant

func(perm string, addr .uverse.address) string

Grant gives addr a permission. Admin only.

Open
OID
036cd1…c358:17
Grant details

Inspect func

Revoke

func(perm string, addr .uverse.address) string

Revoke removes a permission from addr. Admin only. The revoke is committed by this transaction. Any later transaction that reaches a gate on that permission is refused — that is the claim.

Open
OID
036cd1…c358:18
Revoke details

Inspect func

RevokeAll

func(addr .uverse.address) string

RevokeAll removes every permission addr holds and reports how many. Admin only.

Open
OID
036cd1…c358:19
RevokeAll details

Inspect func

DropPermission

func(perm string) string

DropPermission removes a permission and every grant of it. Admin only.

Open
OID
036cd1…c358:20
DropPermission details

Inspect func

NominateAdmin

func(nominee .uverse.address) string

NominateAdmin records a nominee for the admin role. Admin only. The handoff does not take effect until the nominee calls AcceptAdmin.

Open
OID
036cd1…c358:21
NominateAdmin details

Inspect func

CancelNomination

func() string

CancelNomination withdraws a pending nomination. Admin only.

Open
OID
036cd1…c358:22
CancelNomination details

Inspect func

AcceptAdmin

func() string

AcceptAdmin completes a pending handoff. Only the nominee may call it.

Open
OID
036cd1…c358:23
AcceptAdmin details

Inspect func

Height

func() int64

Height returns the chain height this realm is reading as "now".

Open
OID
036cd1…c358:24
Height details

Inspect func

Admin

func() string

Admin returns the book's current admin.

Open
OID
036cd1…c358:25
Admin details

Inspect func

PendingAdmin

func() string

PendingAdmin returns the nominated-but-not-yet-accepted admin, or "".

Open
OID
036cd1…c358:26
PendingAdmin details

Inspect func

Has

func(perm string, addr .uverse.address) bool

Has reports whether addr holds perm. This is the primitive's core query, exposed verbatim so it can be checked from off-chain.

Open
OID
036cd1…c358:27
Has details

Inspect func

CanBump

func(addr .uverse.address) bool

CanBump reports whether addr would be allowed to call Bump right now.

Open
OID
036cd1…c358:28
CanBump details

Inspect func

PermissionsOf

func(addr .uverse.address) string

PermissionsOf returns the permissions addr holds, comma-separated in lexicographic order, or "" for none. Names are restricted by permbook to lowercase alphanumerics and underscore, so a comma can never appear in one and this encoding is unambiguous.

Open
OID
036cd1…c358:29
PermissionsOf details

Inspect func

PermissionCount

func() int

PermissionCount returns how many distinct permissions currently exist.

Open
OID
036cd1…c358:30
PermissionCount details

Inspect func

Permissions

func() string

Permissions returns up to MaxListed permission names, comma-separated in lexicographic order.

Open
OID
036cd1…c358:31
Permissions details

Inspect func

HolderCount

func(perm string) int

HolderCount returns how many addresses hold perm, or 0 if it does not exist.

Open
OID
036cd1…c358:32
HolderCount details

Inspect func

Holders

func(perm string) string

Holders returns up to MaxListed holders of perm, comma-separated in sorted order.

Open
OID
036cd1…c358:33
Holders details

Inspect func

Bumps

func() int64

Bumps returns how many times Bump has succeeded.

Open
OID
036cd1…c358:34
Bumps details

Inspect func

LastBump

func() string

LastBump describes the most recent successful Bump, or "none".

Open
OID
036cd1…c358:35
LastBump details

Inspect func

Notice

func() string

Notice returns the current public notice, or "".

Open
OID
036cd1…c358:36
Notice details

Inspect func

Limits

func() string

Limits reports the book's fixed limits.

Open
OID
036cd1…c358:37
Limits details

Inspect func

realmPath

untyped string

realmPath is this realm's gnoweb prefix, used to build view links.

Value

"/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/permbook_demo"

Render

func(path string) string

Render serves three views, selected by path. (empty) summary, the permission table, and the gated state holders every permission with its holders, up to MaxListed each about what this realm is and why it exists An inert realm (see init) reports that instead of rendering. Every view reads the book, so without this the gnoweb page would abort on a nil dereference — which is exactly the moment an operator needs it to say what is wrong. The typed read functions still abort when inert; Ready is the probe that answers the question without panicking.

Open
OID
036cd1…c358:38
Render details

Inspect func

renderPermissions

func() string
Open
OID
036cd1…c358:40
renderPermissions details

Inspect func

gateFor

func(perm string) string

gateFor names the entrypoint a permission opens, or says it opens none. A permission with no gate is not a bug: the admin may grant a name this realm does not read, and saying so plainly is better than implying every permission is enforced somewhere.

Open
OID
036cd1…c358:41
gateFor details

Inspect func

renderHolders

func() string
Open
OID
036cd1…c358:42
renderHolders details

Inspect func

normalizePath

func(path string) string

normalizePath reduces a gnoweb render path to a bare view name, so "", "/", "holders" and "/holders/" all select the same view.

Open
OID
036cd1…c358:45
normalizePath details

Inspect func

join

func(names []string) string

join comma-separates names. Safe because permbook restricts permission names to lowercase alphanumerics and underscore, so no name can contain the delimiter.

Open
OID
036cd1…c358:46
join details

Inspect func
PermBump : untyped string ="bump"
PermNotice : untyped string ="notice"
MaxPermissions : untyped bigint =(8 <untyped> bigint)
MaxHolders : untyped bigint =(32 <untyped> bigint)
MaxNameLen : untyped bigint =(24 <untyped> bigint)
MaxNoticeLen : untyped bigint =(200 <untyped> bigint)
MaxListed : untyped bigint =(50 <untyped> bigint)
book : *permbook.Book Inspect
bumps : int64 =2
lastBumper : .uverse.address =<gnolang.StringValue>
lastBumpHeight : int64 =612779
notice : string =""
noticeAuthor : .uverse.address =<zero>
noticeSetAtBlock : int64 =0
demoLimits : func() permbook.Limits Inspect
init.15 : func() Inspect
Ready : func() bool Inspect
rejectStraySend : func() Inspect
Bump : func() string Inspect
SetNotice : func(text string) string Inspect
Grant : func(perm string, addr .uverse.address) string Inspect
Revoke : func(perm string, addr .uverse.address) string Inspect
RevokeAll : func(addr .uverse.address) string Inspect
DropPermission : func(perm string) string Inspect
NominateAdmin : func(nominee .uverse.address) string Inspect
CancelNomination : func() string Inspect
AcceptAdmin : func() string Inspect
Height : func() int64 Inspect
Admin : func() string Inspect
PendingAdmin : func() string Inspect
Has : func(perm string, addr .uverse.address) bool Inspect
CanBump : func(addr .uverse.address) bool Inspect
PermissionsOf : func(addr .uverse.address) string Inspect
PermissionCount : func() int Inspect
Permissions : func() string Inspect
HolderCount : func(perm string) int Inspect
Holders : func(perm string) string Inspect
Bumps : func() int64 Inspect
LastBump : func() string Inspect
Notice : func() string Inspect
Limits : func() string Inspect
realmPath : untyped string ="/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/permbook_demo"
Render : func(path string) string Inspect
renderHeader : func() string Inspect
renderPermissions : func() string Inspect
gateFor : func(perm string) string Inspect
renderHolders : func() string Inspect
renderState : func() string Inspect
renderAbout : func() string Inspect
normalizePath : func(path string) string Inspect
join : func(names []string) string Inspect
itoa : func(n int64) string Inspect