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

launch.gno

2.06 Kb · 46 lines
 1package advent
 2
 3import (
 4	"time"
 5
 6	"chain/runtime"
 7)
 8
 9// Launch the approved first door on the empty Onyx realm. The cutoff keeps
10// this one-day seed out of later installs and leaves daily publishing
11// and clue edits with the organizer.
12func init() {
13	const cutoff = 1796252400 // Midnight on 3 December 2026 in Paris.
14	if runtime.ChainID() != "onyx-1" || time.Now().Unix() >= cutoff {
15		return
16	}
17	openDoor(1, "There’s Gno Place Like Home", `The Gno-mes moved their workshop onto Gno.land. It has an address but no mailbox. You can visit it in a browser, and a transaction can change what’s inside. Close the tab and the workshop remembers exactly where you left things.
18
19Its address starts with gno.land/r/. What kind of place is it?
20
21Five letters, all caps.`,
22		"30820122300d06092a864886f70d01010105000382010f003082010a0282010100c4331b8d8af127ae0c5a1c751b4d007903fb274acf2ce12d851c8ad0c9884ee7316c3e411a22befc1186abb185c942fa95573bf321e485ee29e88b96cef918f3631596538601404cc5d7b9fc10bb592ba12d3c46a95d116fb74ed66fae9853dcbefd98c5d9aa2d4a0885bcc64f30808945d1dc9708ddf819fdd980ed766fa2fe3ecd3ac593b5f1e35c67cd2af7d28f6e60bba3e2abd15a00c44186df3706191217ff213271cd5803c92447e584b6539c992db46f3abb9a6ecb0320ea9b1932b378ae58f008b12029be8e3786a958f9863e9908bcecc9cd7f079e0230bf72e1949ef5ae088dbaf9f4d5b2a5d8a15bcb9dce3fdaacf6236ab8f1306afde435baf50203010001", cutoff)
23	carryingOver = true
24}
25
26// CarryOver records a pending seal from the first deployment on Onyx.
27func CarryOver(cur realm, player address, commitment, sealedSalt string) {
28	if caller(cur) != organizer || !carryingOver {
29		panic("carry-over is closed")
30	}
31	assertSeal(commitment, sealedSalt)
32	d := requireDoor(1)
33	if d.status(player.String()) != 0 {
34		panic("this seal is already carried over")
35	}
36	legacy := "gno.land/r/" + onyxAgent.String() + "/advent/v0"
37	d.record(player.String(), commitment, sealedSalt, legacy)
38}
39
40// FinishCarryOver closes imports and opens regular submissions and reviews.
41func FinishCarryOver(cur realm) {
42	if caller(cur) != organizer || !carryingOver {
43		panic("carry-over is closed")
44	}
45	carryingOver = false
46}