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.

envelope.gno

0.64 Kb · 19 lines
 1package bolo
 2
 3import "chain/runtime/unsafe"
 4
 5// envelopeUgnot returns the ugnot attached to this call (API C3, C4): an envelope is
 6// one ugnot coin, or nothing; anything else is ErrWrongDenom. It is the one place
 7// Bolo reads OriginSend, and only user-only writes reach it: C11's keyed refusal, then
 8// AssertOriginCall, in their own body (make check). Never a write behind C11's realm
 9// branch, which a deployed realm passes with an envelope paid to itself.
10func envelopeUgnot() int64 {
11	sent := unsafe.OriginSend()
12	if len(sent) == 0 {
13		return 0
14	}
15	if len(sent) > 1 || sent[0].Denom != "ugnot" {
16		panic(ErrWrongDenom)
17	}
18	return sent[0].Amount
19}