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.

bridge.gno

1.55 Kb · 25 lines
 1package guardians_reveal_bridge_v1
 2
 3import guardians "gno.land/r/g1nmqhha0ua730vejxqhrelldm4pga5j5ptle5ea/guardians"
 4
 5const admin address = "g1nmqhha0ua730vejxqhrelldm4pga5j5ptle5ea"
 6const originalRealm = "gno.land/r/g1nmqhha0ua730vejxqhrelldm4pga5j5ptle5ea/guardians"
 7const originalCollectionID = originalRealm + ".GUARDIANS.0000000"
 8
 9func Version() string { return "GUARDIANS_REVEAL_BRIDGE_V1" }
10func OriginalRealm() string { return originalRealm }
11func OriginalCollectionID() string { return originalCollectionID }
12
13// Only forwards the original deterministic metadata-update operation.
14// No init, ledger, mint, transfer, custody, freeze or configuration operation.
15func Apply(cur realm, start int64, quantity int) {
16	if cur.Previous().Address() != admin || cur.Previous().PkgPath() != "" { panic("reveal bridge: unauthorized caller") }
17	if guardians.CollectionID() != originalCollectionID { panic("reveal bridge: unexpected collection") }
18	if guardians.TotalSupply() != 3333 || guardians.RevealTarget() != 3333 { panic("reveal bridge: unexpected supply or target") }
19	if guardians.RevealState() != "REVEALING" { panic("reveal bridge: reveal is not active") }
20	if quantity < 1 || quantity > 20 { panic("reveal bridge: invalid batch quantity") }
21	if start != guardians.RevealProcessed()+1 { panic("reveal bridge: stale batch cursor") }
22	if start+int64(quantity)-1 > guardians.RevealTarget() { panic("reveal bridge: target exceeded") }
23	guardians.ApplyRevealBatch(start, quantity)
24	if guardians.RevealProcessed() != start+int64(quantity)-1 { panic("reveal bridge: progress mismatch") }
25}