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.

probe1789429680.gno

1.65 Kb · 47 lines
 1// Package probe1789429680 is a minimal, throwaway realm deployed ONLY to
 2// confirm two mainnet-specific behaviors before the real gems5 launch:
 3// (1) whether a freshly-deployed package is immediately callable or
 4// held in some "inert until enabled" state, and (2) whether the exact
 5// AssertOriginCall + OriginSend + BankerTypeRealmSend payment-check
 6// pattern gems5/v1's MintAssembled relies on still behaves as expected
 7// on mainnet's current node build. Not part of the Gems collection --
 8// disposable.
 9package probe1789429680
10
11import (
12	"chain"
13	"chain/banker"
14	runtime "chain/runtime"
15	unsaferealm "chain/runtime/unsafe"
16)
17
18var (
19	owner    address = "g1gn6t0q9wenwhdda47rkrpfd63kcxjvyp7eqwku"
20	received int64
21	calls    int64
22)
23
24// TestPayment mirrors gems5/v1's MintAssembled payment check exactly.
25// Forwards whatever ugnot is attached straight back to owner, so this
26// costs only gas + storage deposit, not the attached amount itself.
27func TestPayment(cur realm) {
28	runtime.AssertOriginCall()
29	if !unsaferealm.PreviousRealm().IsUserCall() {
30		panic("payment verification requires a direct user call")
31	}
32	got := unsaferealm.OriginSend().AmountOf("ugnot")
33	if got <= 0 {
34		panic("attach a small amount of ugnot to test the payment path")
35	}
36	b := banker.NewBanker(banker.BankerTypeRealmSend, cur)
37	b.SendCoins(cur.Address(), owner, chain.Coins{{Denom: "ugnot", Amount: got}})
38	received += got
39	calls++
40}
41
42func Received() int64 { return received }
43func Calls() int64    { return calls }
44
45func Render(path string) string {
46	return "# gems5 mainnet probe\n\nThrowaway realm, not part of the Gems collection. Confirms deploy + payment-check semantics before the real launch."
47}