Skip to content Search Apps Documentation Source Content Run Reset Eval Playground 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.

tillsol.gno

0.65 Kb · 20 lines
 1// Package tillsol buys a round with an envelope that never reaches the till.
 2package tillsol
 3
 4import (
 5	"chain/runtime/unsafe"
 6
 7	"gno.land/r/g15c02s5hhdny9uvr9za3xsyn9sw8p0klptrh6kf/cellar/hall"
 8	"gno.land/r/g15c02s5hhdny9uvr9za3xsyn9sw8p0klptrh6kf/cellar/till"
 9)
10
11// Solve must be called with -send 100000ugnot. The coins land here, so this
12// realm reads the envelope (the chain refuses a send nobody observes), then
13// lets the barkeep read the very same envelope.
14func Solve(cur realm) {
15	if unsafe.OriginSend().AmountOf("ugnot") < till.Price {
16		panic("send the price of a round with the call")
17	}
18	till.BuyRound(cross(cur))
19	hall.Claim(cross(cur), "till")
20}