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

bubblerumble2 source realm

Package bubblerumble2 is the second Bubble Rumble realm: the same last-bidder- wins clock as v1, with the money rearr...

Overview

Package bubblerumble2 is the second Bubble Rumble realm: the same last-bidder- wins clock as v1, with the money rearranged so that players want company.

Of every bid: 55% goes to the pot, 30% is paid at once to the earlier bidders of that pool pro-rata to what they have paid in, 10% goes to whoever first invited the bidder (forever, on every bid they make), 5% to the pool's creator. When the clock runs out, 80% of the pot goes to the last bidder and 20% is shared among everyone who played under the winner's flag — or all of it to the winner if nobody else flew that flag.

So the player on top wants more bids (each one pays them), everyone wants their invitees to bid (10% of everything), and countries are teams.

Constants 1

const MinWindow, MaxWindow, MinBasePrice, MaxBasePrice, MaxNameLen, HistoryLen, RosterMax, MaxBoost, PotShare, DivShare, RefShare, CreatorShare, TeamShare

 1const (
 2	MinWindow    int64 = 10                // seconds
 3	MaxWindow    int64 = 30 * 24 * 3600    // 30 days
 4	MinBasePrice int64 = 1_000             // ugnot, 0.001 GNOT
 5	MaxBasePrice int64 = 1_000_000_000_000 // ugnot, 1,000,000 GNOT
 6	MaxNameLen         = 40
 7	HistoryLen         = 50  // bids kept per pool for the feed
 8	RosterMax          = 200 // distinct bidders a pool pays dividends and team shares to
 9	MaxBoost     int64 = 10  // the shortest clock a bid can buy is window/MaxBoost
10
11	// where every bid goes, in percent
12	PotShare     int64 = 55
13	DivShare     int64 = 30 // to earlier bidders of the pool, pro-rata by paid-in
14	RefShare     int64 = 10 // to the bidder's inviter
15	CreatorShare int64 = 5
16	// of the pot at the close: the rest goes to the winner
17	TeamShare int64 = 20
18)
source

Functions 8

func Bid

crossing Action
1func Bid(cur realm, id int64, ref string, flag string)
source

Bid pays at least the current price and resets the clock. ref is the address that invited the bidder ("" for none; only the first bid ever sets it), flag a two-letter country to play under ("" keeps the last one).

func Cancel

crossing Action
1func Cancel(cur realm, id int64)
source

Cancel lets the creator take the seed back from a pool nobody has bid on.

func Claim

crossing Action
1func Claim(cur realm, id int64)
source

Claim pays out a finished pool: 80% to the winner, 20% shared among the roster members flying the winner's flag (pro-rata by paid-in, the winner included) — or everything to the winner when nobody else flew it. Anyone may call it.

func ClockFor

Action
1func ClockFor(window, price, sent int64) int64
source

ClockFor is the clock a bid buys by paying sent against a price: the window divided by the multiple paid, never below window/MaxBoost.

func CreatePool

crossing Action
1func CreatePool(cur realm, name string, window int64, basePrice int64) int64
source

CreatePool opens a pool. Any ugnot sent with the call seeds its pot. The creator earns CreatorShare of every bid.

func GNOT

Action
1func GNOT(ugnot int64) string
source

GNOT formats ugnot as GNOT with the trailing zeros trimmed.

func Price

Action
1func Price(base, n int64) int64
source

Price of the next bid in a pool with the given base price and n bids so far.

func Render

1func Render(path string) string
source

Render serves gnoweb ("" and "<id>") and the page ("json", "json/<id>", "me/<address>", "teams").

Types 4

type Entry

struct
1type Entry struct {
2	N      int64
3	Bidder address
4	Flag   string
5	Price  int64 // what was paid; at least the price at the time
6	Clock  int64 // seconds this bid had to stand
7	Pot    int64 // pot right after this bid
8	At     time.Time
9}
source

type Member

struct
1type Member struct {
2	Addr   address
3	Flag   string
4	Paid   int64 // gross paid into this pool; the dividend weight
5	Earned int64 // dividends received from this pool
6}
source

Member is a distinct bidder of a pool: the roster dividends and team shares go to.

type Player

struct
 1type Player struct {
 2	Referrer  address // set by the first bid, permanent
 3	Recruits  int64
 4	Flag      string
 5	Bids      int64
 6	Paid      int64
 7	DivEarned int64
 8	RefEarned int64
 9	Won       int64 // pots and team shares received
10}
source

Player is what the realm remembers about an address across pools.

type Pool

struct
 1type Pool struct {
 2	ID          int64
 3	Name        string
 4	Creator     address
 5	Window      int64 // seconds the last bid must stand to win
 6	BasePrice   int64 // ugnot; the Nth bid costs BasePrice·√N
 7	Seed        int64
 8	Pot         int64
 9	Bids        int64
10	LastBidder  address
11	LastBidAt   time.Time
12	Clock       int64 // seconds the current top bid has to stand
13	CreatedAt   time.Time
14	Paid        bool // the pot went out, or the seed back to the creator
15	Cancelled   bool
16	DivPaid     int64 // dividends paid out of this pool so far
17	RefPaid     int64
18	CreatorPaid int64
19	WinnerFlag  string
20	TeamPaid    int64 // what the winner's team received at the close
21	History     []Entry
22	Roster      []*Member
23}
source

Methods on Pool

func Deadline

method on Pool
1func (p *Pool) Deadline() time.Time
source

func Over

method on Pool
1func (p *Pool) Over() bool
source

Imports 7

  • chain stdlib
  • chain/banker stdlib
  • chain/runtime/unsafe stdlib
  • math stdlib
  • strconv stdlib
  • strings stdlib
  • time stdlib

Source Files 2