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

v1 state

Back to all declarations

Denom

untyped string

Denom is the only coin this drop pays in.

Value

"ugnot"

leafPrefix

untyped string

leafPrefix is part of every leaf preimage, so a proof for one drop cannot be replayed against another realm that happens to use the same encoding.

Value

"gno.land/r/moul/x/daily/merkledrop/v1"

Owner

.uverse.address

Owner may set the drop and sweep it. Hardcoded rather than derived from the deployer at init: inside a plain \`func Test(t \*testing.T)\` the gno test runner reports OriginCaller() as the EMPTY address, so an owner taken from it is the empty address in every test and whatever deployed on chain. That divergence is exactly where an authorization bug hides, so the address is written down instead.

Value

<gnolang.StringValue>

root

[]uint8 (len=32)

// the committed allocation root; nil means no drop

Open
OID
078042…0b8c:75
root details (len=32)

+32 more Inspect slice

total

int

// leaf count the root commits to

Value

4

closesAt

int64

// chain height after which claims are refused; 0 = never

Value

0

claimed

v0.Tree

// padded index -> claimer address string

Open
OID
078042…0b8c:76
claimed details

Inspect ref

paid

int64

// running total of ugnot sent

Value

0

Allocation

type

Allocation is one entry of a drop: who may claim, and how much.

Value

v1.Allocation

Leaf

func(index int, addr .uverse.address, amount int64) string

Leaf returns the exact preimage committed for one allocation. Reproduce it off chain to rebuild the tree; it is the whole interface between the drop and its generator. leaf = "<pkgpath>|<index>|<address>|<amount>"

Open
OID
078042…0b8c:40
Leaf details

Inspect func

SetDrop

func(rootHex string, totalLeaves int, closesAtHeight int64)

SetDrop commits a new allocation root. Owner only. totalLeaves is the number of allocations the root commits to; the verifier needs it to rebuild the tree shape, so a wrong value invalidates every proof rather than weakening any. closesAtHeight is the last height at which a claim is accepted, or 0 for a drop that never closes. Setting a new root abandons the previous claim ledger: a drop is a commitment, and replacing it starts a new one.

Open
OID
078042…0b8c:41
SetDrop details

Inspect func

Claim

func(index int, amount int64, proof string)

Claim proves the caller is allocated amount at index and pays it out. proof is the comma-separated hex sibling list from the tree generator, leaf first. It panics on a closed drop, a double claim, a bad proof, or a drop that cannot cover the amount; nothing is marked claimed in any of those cases.

Open
OID
078042…0b8c:42
Claim details

Inspect func

Sweep

func()

Sweep returns whatever is left to the owner, once the drop has closed. Owner only. A drop with no closing height can never be swept, which is the point of setting one.

Open
OID
078042…0b8c:43
Sweep details

Inspect func

Balance

func() int64

Balance returns the ugnot the drop still holds.

Open
OID
078042…0b8c:45
Balance details

Inspect func

Root

func() string

Root returns the committed root, hex-encoded, or "" when no drop is set.

Open
OID
078042…0b8c:46
Root details

Inspect func

Total

func() int

Total returns the number of allocations the root commits to.

Open
OID
078042…0b8c:47
Total details

Inspect func

ClosesAt

func() int64

ClosesAt returns the last height a claim is accepted, or 0 for never.

Open
OID
078042…0b8c:48
ClosesAt details

Inspect func

IsClosed

func() bool

IsClosed reports whether the drop is past its closing height.

Open
OID
078042…0b8c:49
IsClosed details

Inspect func

Paid

func() int64

Paid returns the ugnot claimed so far.

Open
OID
078042…0b8c:50
Paid details

Inspect func

Claims

func() int

Claims returns the number of allocations claimed.

Open
OID
078042…0b8c:51
Claims details

Inspect func

HasClaimed

func(index int) bool

HasClaimed reports whether the allocation at index was claimed.

Open
OID
078042…0b8c:52
HasClaimed details

Inspect func

ClaimedBy

func(index int) .uverse.address
Open
OID
078042…0b8c:53
ClaimedBy details

Inspect func

Verify

func(index int, addr .uverse.address, amount int64, proof string) bool

Verify checks an allocation against the committed root without claiming it, so a recipient can confirm a proof before spending gas on Claim.

Open
OID
078042…0b8c:54
Verify details

Inspect func

parseRoot

func(s string) ([]uint8, .uverse.error)
Open
OID
078042…0b8c:55
parseRoot details

Inspect func

indexKey

func(i int) string

indexKey pads the index so avl iteration is numeric, not lexicographic. ufmt has no width flags, so the padding is by hand: unpadded keys sort "0","1","10","11","2" and Render would lose the order past nine entries.

Open
OID
078042…0b8c:57
indexKey details

Inspect func

demoAllocations

[]v1.Allocation (len=4)

demoAllocations is the example drop seeded at deploy, so the realm renders working proofs instead of an empty page. A real drop calls SetDrop with a root computed off chain and stores no allocations at all.

Open
OID
078042…0b8c:59
demoAllocations details (len=4)

+4 more Inspect slice

seed

func()

seed installs the example drop. Also called by the example tests: realm globals persist for a whole test binary and examples run after every Test, so a pinned Render must start from a known state.

Open
OID
078042…0b8c:64
seed details

Inspect func

DemoProof

func(index int) string

DemoProof returns the proof for one seeded allocation, so the drop can be exercised end to end without an off-chain generator. It is empty once a real drop replaces the seeded one.

Open
OID
078042…0b8c:67
DemoProof details

Inspect func

Render

func(path string) string

Render serves the drop overview at "" and one allocation at "proof/\<index>".

Open
OID
078042…0b8c:68
Render details

Inspect func

renderProof

func(raw string) string
Open
OID
078042…0b8c:70
renderProof details

Inspect func
Denom : untyped string ="ugnot"
leafPrefix : untyped string ="gno.land/r/moul/x/daily/merkledrop/v1"
Owner : .uverse.address =<gnolang.StringValue>
Ownable : *v0.Ownable Inspect
root : []uint8 (len=32) Inspect
total : int =4
closesAt : int64 =0
claimed : v0.Tree Inspect
paid : int64 =0
demo : []v1.Allocation (len=4) Inspect
Allocation : type =v1.Allocation
ErrNoDrop : *errors.errorString Inspect
ErrClosed : *errors.errorString Inspect
ErrClaimed : *errors.errorString Inspect
ErrBadProof : *errors.errorString Inspect
ErrUnfunded : *errors.errorString Inspect
ErrStillOpen : *errors.errorString Inspect
ErrBadRoot : *errors.errorString Inspect
ErrBadTotal : *errors.errorString Inspect
ErrBadAmount : *errors.errorString Inspect
init.20 : func() Inspect
Leaf : func(index int, addr .uverse.address, amount int64) string Inspect
SetDrop : func(rootHex string, totalLeaves int, closesAtHeight int64) Inspect
Claim : func(index int, amount int64, proof string) Inspect
Sweep : func() Inspect
Address : func() .uverse.address Inspect
Balance : func() int64 Inspect
Root : func() string Inspect
Total : func() int Inspect
ClosesAt : func() int64 Inspect
IsClosed : func() bool Inspect
Paid : func() int64 Inspect
Claims : func() int Inspect
HasClaimed : func(index int) bool Inspect
ClaimedBy : func(index int) .uverse.address Inspect
Verify : func(index int, addr .uverse.address, amount int64, proof string) bool Inspect
parseRoot : func(s string) ([]uint8, .uverse.error) Inspect
hexOf : func(b []uint8) string Inspect
indexKey : func(i int) string Inspect
demoAllocations : []v1.Allocation (len=4) Inspect
seed : func() Inspect
demoTree : func() *v0.Tree Inspect
DemoProof : func(index int) string Inspect
Render : func(path string) string Inspect
renderIndex : func() string Inspect
renderProof : func(raw string) string Inspect
closesLabel : func() string Inspect
yesNo : func(b bool) string Inspect