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.

collections.gno

0.96 Kb · 39 lines
 1package tavern_offers
 2
 3import (
 4	"gno.land/r/g1j4ehkkrqcr53a233wamtvqggt3skr86c6777xd/tavern_v1/guardians"
 5	stamps "gno.land/r/g1j4ehkkrqcr53a233wamtvqggt3skr86c6777xd/tavern_v1/tavern_stamps"
 6)
 7
 8// Only reviewed NFT entry points may participate in settlement.
 9func ownerOf(collection, id string) address {
10	switch collection {
11	case "guardians":
12		return guardians.OwnerOf(id)
13	case "stamps":
14		return stamps.OwnerOf(id)
15	default:
16		panic("unsupported collection")
17	}
18}
19
20func deliver(cur realm, collection, id string, to address) {
21	switch collection {
22	case "guardians":
23		guardians.TransferFrom(cross(cur), Address(), to, id)
24	case "stamps":
25		stamps.TransferFrom(cross(cur), Address(), to, id)
26	default:
27		panic("unsupported collection")
28	}
29}
30
31func royalty(collection, id string, gross int64) (address, int64) {
32	if collection == "guardians" {
33		return guardians.RoyaltyInfo(id, gross)
34	}
35	if collection == "stamps" {
36		return address(""), 0
37	}
38	panic("unsupported collection")
39}