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

v1 source realm

Package tickets is GnoRadio's concert tickets rules, release 1. Concerts belong to artist profiles of the catalog; a ...

Overview

Package tickets is GnoRadio's concert tickets rules, release 1. Concerts belong to artist profiles of the catalog; a ticket is a GRC721 NFT of the permanent realm gno.land/r/nym-alexiscolin000/gnoradio/tickets/nft, drawn on-chain. Ticket money goes straight to the artist's owner address in the same transaction, the service fee to the GnoRadio treasury: this realm ends every transaction holding no coins.

It keeps no state but its admin role. Every record lives in the data realm, in the "tickets/…" collections only the current tickets writer may change (db.gno), and the NFTs in the NFT realm, which only that writer drives: a later release takes over both without copying anything.

Functions 32

func ArtistEvents

Action
1func ArtistEvents(artistID, limit int) []int
source

ArtistEvents returns up to limit visible concert ids of an artist, newest first.

func Attended

Action
1func Attended(holder address) int
source

Attended returns how many concerts a holder checked in at.

func BuyTicket

crossing Action
1func BuyTicket(cur realm, eventID int) int
source

BuyTicket mints a ticket to the caller. A paid ticket needs the exact price plus the service fee attached: the price goes straight to the artist, the fee to the GnoRadio treasury.

func CancelEvent

crossing Action
1func CancelEvent(cur realm, eventID int)
source

CancelEvent stops ticket sales. GnoRadio never held the payments: they went straight to the artist, who handles refunds directly. Artist owner only.

func CheckIn

crossing Action
1func CheckIn(cur realm, ticketID int, code string)
source

CheckIn marks a ticket as used at the door; its holder earns the "I was there" stamp. The concert's artist owner only, while the door is open, and only for a ticket its current holder presented (Present) with this door code in the last 10 minutes.

func CreateEvent

crossing Action
1func CreateEvent(cur realm, title, venue, link, start, price string, capacity int) int
source

CreateEvent announces a concert by the caller's artist profile. start is "YYYY-MM-DD HH:MM" in UTC; price is in GNOT ("0" for free, "2.5"); link is an optional https URL (stream or venue page, public).

func EventSVG

Action
1func EventSVG(id int) string
source

EventSVG returns the specimen ticket of a visible concert as a markdown image, or "" when the concert is not visible.

func EventsJSON

Action
1func EventsJSON(offset, limit int, upcoming bool) string
source

EventsJSON pages through concerts, newest first (limit <= 50): offset and limit count stored concerts, hidden ones are left out of the page, and "next" gives the offset of the following page (0 at the end). upcoming=true lists future, not cancelled, visible concerts instead, soonest first, with offset and limit counting listed concerts ("next" is then a listed-concert offset, 0 when the scan ended).

func FeesJSON

Action
1func FeesJSON() string
source

FeesJSON returns the ticket service fee and where it goes.

func HiddenNote

Action
1func HiddenNote(eventID int) string
source

HiddenNote says why a concert is hidden: "Removed by moderation: <reason>", or "".

func HideEvent

crossing Action
1func HideEvent(cur realm, eventID int, hidden bool, reason string)
source

HideEvent hides or restores a concert. Admin only; hiding takes a public reason (4-200 characters). Tickets stay with their holders.

func OfferAdmin

crossing Action
1func OfferAdmin(cur realm, to address)
source

OfferAdmin offers the admin role to an address (offering it to the admin cancels the offer); AcceptAdmin takes it. Each change is mirrored to the data realm, so the next release keeps the admin.

func PastEvents

Action
1func PastEvents(offset, limit int) (ids []int, total int)
source

PastEvents returns up to limit (1-100) ids of the concerts that have started, were not cancelled and are not hidden, latest first from offset, and how many there are. The start-time index pages them: cancelled or hidden concerts take no room, however many there are.

func Present

crossing Action
1func Present(cur realm, ticketID int, code string)
source

Present shows a ticket at the door: its holder signs from their own wallet, with the door code the staff's screen shows after scanning the ticket's QR. A QR built from public data (the ticket id and its holder) cannot do that for them, and a stranger with a copied QR gets another code: the holder's Present does not admit them. CheckIn then admits the ticket with that code for 10 minutes. Only while the door is open: from 12h before the concert to 12h after its start.

func PresentedAt

Action
1func PresentedAt(ticketID int, code string) int64
source

PresentedAt is when the ticket's current holder last presented it at the door (Present) with this door code, unix seconds; 0 when they did not, or it changed hands since, or it was checked in. CheckIn takes it for 10 minutes.

func Ready

crossing Action
1func Ready(cur realm)
source

Ready tells the data realm that this release is on chain (see data.Propose). Anyone may call it.

func RefreshArtist

crossing Action
1func RefreshArtist(cur realm, artistID int)
source

RefreshArtist re-reads an artist's visibility in the catalog and updates the Upcoming index for its future concerts (at most maxOpenAhead): once moderators hide a profile, its concerts stop taking places in the Upcoming scan; a restored artist's come back. Anyone may call it.

func RefreshArtistPast

crossing Action
1func RefreshArtistPast(cur realm, artistID, offset int)
source

RefreshArtistPast does the same for up to 50 of an artist's past concerts from offset (oldest first; the 500 an artist may have take ten calls), so a hidden profile's past concerts leave the past-concerts index too. Anyone may call it.

func Render

1func Render(_ string) string
source

Render points gnoweb visitors to the GnoRadio site; a retired release says which realm took over.

func RenounceAdmin

crossing Action
1func RenounceAdmin(cur realm)
source

RenounceAdmin gives the admin role up for good, for this release and the next ones.

func ServiceFee

Action
1func ServiceFee() int64
source

ServiceFee returns the per-ticket service fee in ugnot (0 while no treasury is set).

func SetServiceFee

crossing Action
1func SetServiceFee(cur realm, ugnot int64)
source

SetServiceFee sets the per-ticket service fee in ugnot (0..10 GNOT), paid by buyers of paid tickets on top of the price and forwarded to the GnoRadio treasury. Admin only.

func TicketSVG

Action
1func TicketSVG(id int) string
source

TicketSVG returns a ticket as a markdown image, or "" if unknown.

func TicketsOf

Action
1func TicketsOf(owner address, offset, limit int) []int
source

TicketsOf returns up to limit ticket ids held by owner, newest first.

func TicketsOfJSON

Action
1func TicketsOfJSON(owner address) string
source

TicketsOfJSON lists the tickets held by owner, newest first (<= 50).

func TransferTicket

crossing Action
1func TransferTicket(cur realm, to address, ticketID int)
source

TransferTicket gives one of the caller's tickets to someone else. There is no built-in resale market.

func EventInfo

Action
1func EventInfo(id int) (Event, bool)
source

EventInfo returns a copy of a visible concert; ok is false otherwise.

func Upcoming

Action
1func Upcoming(n int) []Event
source

Upcoming returns up to n visible, not cancelled future concerts, soonest first.

Types 2

type Event

struct
 1type Event struct {
 2	ID        int
 3	ArtistID  int
 4	Title     string
 5	Venue     string
 6	Link      string // optional https link, public
 7	Start     int64
 8	Price     int64 // ugnot, 0 = free
 9	Capacity  int
10	Sold      int
11	Cancelled bool
12	Hidden    bool
13	Removed   string // the moderator's reason while hidden
14}
source

Event is a concert.

type Ticket

struct
1type Ticket struct {
2	ID       int
3	Event    int
4	Serial   int
5	Attended bool
6}
source

Ticket is one NFT ticket.

Imports 14

Source Files 4