snapshot.gno
1.72 Kb · 21 lines
1package guardians
2
3import (
4 "strconv"
5 "time"
6 "chain/runtime"
7 "gno.land/p/nt/ufmt/v0"
8)
9
10func LaunchVersion() string { return "GUARDIANS_MAINNET_V1" }
11
12// One read produces a consistent supply/reserve/timing snapshot and avoids
13// issuing thousands of owner queries as the collection approaches 3,333.
14func SaleSnapshot() string {
15 return ufmt.Sprintf(`{"version":%s,"network":%s,"collectionId":%s,"admin":%s,"treasury":%s,"maxSupply":%d,"supply":%d,"configured":%t,"paused":%t,"phase":%s,"startsAt":%d,"endsAt":%d,"allowlistStartsAt":%d,"allowlistEndsAt":%d,"priceUgnot":%d,"freePriceUgnot":%d,"publicLimit":%d,"freeLimit":%d,"root":%s,"reserveCapacity":%d,"freeMintedSupply":%d,"reserveReleased":%t,"protectedRemaining":%d,"publicAvailable":%d,"revealState":%s,"revealProcessed":%d,"revealTarget":%d,"veiledURI":%s,"finalBaseURI":%s,"provenance":%s,"serverTime":%d}`,
16 strconv.Quote(LaunchVersion()),strconv.Quote(runtime.ChainID()),strconv.Quote(CollectionID()),strconv.Quote(Admin().String()),strconv.Quote(SaleTreasury().String()),MaxSupply(),TotalSupply(),SaleConfigured(),SalePaused(),strconv.Quote(SalePhase()),PublicStart(),PublicEnd(),AllowlistStart(),AllowlistEnd(),PublicPrice(),AllowlistPrice(),PublicWalletLimit(),AllowlistWalletLimit(),strconv.Quote(AllowlistRoot()),AllowlistReservedSupply(),AllowlistMintedSupply(),AllowlistReserveReleased(),AllowlistReserveRemaining(),PublicMintableSupply(),strconv.Quote(RevealState()),RevealProcessed(),RevealTarget(),strconv.Quote(VeiledURI()),strconv.Quote(FinalBaseURI()),strconv.Quote(ProvenanceRoot()),time.Now().Unix())
17}
18
19func WalletSnapshot(owner address) string {
20 return ufmt.Sprintf(`{"freeMinted":%d,"paidMinted":%d,"balance":%d}`,AllowlistMinted(owner),PublicMinted(owner),BalanceOf(owner))
21}