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.

adstation source realm

Package adstation sells the panels of gno.world's ad station by the week, for GNOT, to ads an approver has passed (ja...

Overview

Package adstation sells the panels of gno.world's ad station by the week, for GNOT, to ads an approver has passed (jae, his terminal, 2026-10-14: "lets make a site for the ad station, maybe ads.gno.world, where you can bid in gnot for your ad to show after approval" … "if somebody comes in and says i want this this this this panel, well, if they pay, they get it right? so make it flexible, market based, interesting").

THE UNIT is a panel, by index 0 … Panels()-1; the page maps an index to the station (face, row, column) and offers its colour groups as ready-made selections, so the groups can change without this realm knowing. A bid names any set of panels ("0-8,27-35"), one ad and one week, and carries its GNOT with it.

THE WEEK starts Monday 00:00 UTC and is named by that unix time. Bids for a week close a day before it starts; weeks up to AheadWeeks ahead are open. An approver passes or turns down each ad; a turned-down ad's open bids are refunded at once. From the week's start anyone may Settle it: the open bids whose ad is approved are ranked two ways — by price per panel, and by the whole amount — each in turn winning if none of its panels is taken yet, and the way that pays more decides the week (see allocate); the winners' GNOT goes to the ad station's treasury (r/…/adtreasury), everyone else's back to them. Refunds are credited and paid by Withdraw (the owner of the money) or PayOut (anyone, for them).

THE ROLES: an owner (two-step hand-off) names the approvers and sets the minimum bid, the panel count of weeks not yet bid on, and a pause on new bids; neither the owner nor an approver can move a bid's GNOT anywhere but back to its bidder or, by settling, to the treasury. The owner and first approver is Jae's cold key.

Immutable, not private (gnomod.toml).

Constants 1

const pkgPath, coldKey, GNOT, WeekLen, Monday0, CloseAhead, AheadWeeks, MaxPanels, MaxBidsWeek, MaxBidsBidderWeek, MaxOpenBidsAd, MaxPending, MaxPendingOwner, maxRejectMany, maxTitle, maxLink, maxReason, maxPanelsSpec, listMax, defaultPanels, defaultMinBid

 1const (
 2	pkgPath = "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/adstation" // must match gnomod.toml
 3	coldKey = address("g1ecsuj0q572jr0dhu29q9njtnmw03hyu7tyyvv6")             // Jae's: the first owner and approver
 4	GNOT    = "ugnot"
 5
 6	WeekLen    = int64(7 * 86400)
 7	Monday0    = int64(4 * 86400) // 1970-01-05 00:00 UTC, the first Monday after the epoch
 8	CloseAhead = int64(86400)     // a week's bidding closes a day before it starts
 9	AheadWeeks = int64(8)         // weeks open for bidding, counting from the next one
10
11	MaxPanels         = 1024 // the most panels a week may have
12	MaxBidsWeek       = 200  // bids a week holds (Settle ranks them all in one call); a full week takes a larger bid in place of its smallest
13	MaxBidsBidderWeek = 10   // open bids one wallet may hold in one week
14	MaxOpenBidsAd     = 32   // open bids one ad may carry (a turn-down refunds them in one call)
15	MaxPending        = 100  // ads waiting for an approver with a bid at stake, at once
16	MaxPendingOwner   = 5    // … of them one advertiser's
17	maxRejectMany     = 10   // ads one RejectMany turns down: ten with 32 open bids each in full weeks cost ~0.94B gas on a node, fifty ~3.57B, more than a block (review round 2, R2-3)
18	maxTitle          = 60
19	maxLink           = 200
20	maxReason         = 120
21	maxPanelsSpec     = 2000
22	listMax           = 50
23	defaultPanels     = 108         // the ring: 27 columns × 2 rows × 2 faces
24	defaultMinBid     = 100_000_000 // 100 GNOT (jae: "100 GNOT (~$7)")
25)
source

Functions 31

func AcceptOwner

crossing Action
1func AcceptOwner(cur realm)
source

AcceptOwner takes the owner role, by the one named (a user or a realm).

func AddApprover

crossing Action
1func AddApprover(cur realm, a address)
source

AddApprover and RemoveApprover name who may pass or turn down ads.

func Approve

crossing Action
1func Approve(cur realm, adID int64)
source

Approve passes a waiting ad: its bids compete when their weeks settle.

func Bid

crossing Action
1func Bid(cur realm, week int64, panelSpec string, image, link, title string) int64
source

Bid opens an ad (its picture by hash, a link, a title) and bids for it in one call: the GNOT sent is the bid, for the panels named ("3", "0-8", "0-8,27-35") in the week starting at week (a Monday 00:00 UTC, unix seconds). Returns the bid's id; the ad's id is GetBid(id).Ad.

func BidAd

crossing Action
1func BidAd(cur realm, adID int64, week int64, panelSpec string) int64
source

BidAd bids again with an ad of yours, approved or still waiting: the GNOT sent is the bid.

func Owed

Action
1func Owed(a address) int64
source

Owed is what an address could withdraw now: refunds of lost and turned-down bids.

func PayOut

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

PayOut pays an address what it is owed; anyone may call it for anyone (the money has one destination).

func Raise

crossing Action
1func Raise(cur realm, bidID int64)
source

Raise adds the GNOT sent to an open bid of yours, before its week closes.

func Reject

crossing Action
1func Reject(cur realm, adID int64, reason string)
source

Reject turns an ad down, waiting or approved, with a reason (plain text): every open bid of it is refunded now and leaves its week, whose place it frees. Weeks it already won stay paid.

func RejectMany

crossing Action
1func RejectMany(cur realm, adIDs string, reason string) int
source

RejectMany turns down several ads in one call ("4,9,12", at most 50), with one reason; ads already turned down are passed over. Returns how many it turned down.

func Render

1func Render(path string) string
source

Render: "" the station's market; "json" its settings; "json/week/<start>" a week's bids and winners; "json/ad/<id>" an ad; "json/pending" the ads waiting; "json/owed" who is owed refunds; "json/by/<address>" one address's own ads and bids, every state, and what it is owed.

func SetMinBid

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

SetMinBid sets the least bid, in ugnot, for bids placed from now on.

func SetOwner

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

SetOwner names the next owner; nothing changes until they AcceptOwner. "" withdraws the offer.

func SetPanels

crossing Action
1func SetPanels(cur realm, n int)
source

SetPanels sets the panel count of weeks nobody has bid on yet (the station's panels can change; a week keeps the count it had at its first bid).

func SetPaused

crossing Action
1func SetPaused(cur realm, p bool)
source

SetPaused stops (true) or resumes new bids and raises; approving, settling and refunds go on.

func Settle

crossing Action
1func Settle(cur realm, week int64) int64
source

Settle closes the books of a week that has started (anyone may call it, once): it picks the winners among the open bids whose ad is approved (allocate), pays the winners' GNOT to the treasury and credits everyone else's back. Returns the winning bids' total.

func ThisWeek

Action
1func ThisWeek() int64
source

ThisWeek is the start of the week running now; NextWeek the one after it.

func Unsettled

Action
1func Unsettled() []int64
source

Unsettled is the latest ten weeks that have started, hold bids, and were never settled.

func WeekOf

Action
1func WeekOf(t int64) int64
source

WeekOf is the start of the week holding t (unix seconds).

func Winners

Action
1func Winners(week int64) []int64
source

Winners is the week's winning bids: final once it is settled, else as things stand now.

Types 3

type Ad

struct
 1type Ad struct {
 2	ID      int64
 3	Owner   address // the advertiser who made it with their first bid
 4	Image   string  // sha256 hex of the picture as the site stores it
 5	Link    string  // https://…
 6	Title   string
 7	State   string // "pending", "approved", "rejected"
 8	Reason  string // why it was turned down
 9	By      address
10	At      int64 // when it was decided
11	Created int64
12	open    []int64 // its open bids
13	queued  bool    // counted in pending: waiting, with a bid at stake
14}
source

Ad is one approved-or-not picture with its link and title; immutable once made, so an approval covers exactly it.

type Offer

struct
 1type Offer struct {
 2	ID     int64
 3	Week   int64 // the week's start
 4	Ad     int64
 5	Bidder address
 6	Panels string // canonical: "0-8,27-35"
 7	Count  int    // panels in it
 8	Amount int64  // ugnot
 9	Placed int64
10	State  string // "open", "won", "lost", "refunded" (its ad was turned down), "bumped" (a full week gave its place up)
11	bits   []uint64
12}
source

Offer is one bid: a price for a set of panels in one week, for one ad, its GNOT held here until the week settles.

type Week

struct
 1type Week struct {
 2	Start   int64
 3	N       int // its panel count, fixed at its first bid
 4	Settled bool
 5	Paid    int64 // to the treasury
 6	bids    []int64
 7	amts    []int64 // each listed bid's amount, beside bids: a full week finds its smallest bid without reading every bid
 8	appr    []bool  // beside bids: its ad is approved, so a full week never gives its place up (review round 2, R2-1)
 9	won     []int64
10	per     map[address]int // each bidder's open bids in it, until it settles (a bid counts its bidder's without a scan)
11}
source

Week holds a week's bids and, once settled, its winners.

Dependencies

Source Files 2