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

bubbletreasury source realm

The BUBBLE treasury: where the pools' royalty lands, and the one power that moves it.

Overview

The BUBBLE treasury: where the pools' royalty lands, and the one power that moves it.

Bubble Rumble's pools (v5 on) send 5 % of every boop to an address that belongs to the BUBBLE token realm and to nobody else: the token's SUB-realm for the kind published here, `treasury:spend`. A sub-realm is a distinct package path (`…/bubble#treasury-spend`) with its own address; it can hold and send coins and can never issue tokens. The token's governor hands exactly that sub-realm to this kind's Do when the holders have decided a spend, and to nothing else — so the only way a coin leaves the treasury is a proposal under `treasury:spend`, adopted by the holders (govern:adopt) and passed on the token's own money terms: a fifth of the supply turning out, two thirds yes, a week to vote, two days' delay.

This realm holds no coins and no power of its own. It publishes the kind (Offer, at its deploy), says where the treasury is (Address), how much it holds (Balance) and renders the terms. The kind's Do runs inside the token realm and crosses back here with the sub-realm's own token to note each spend (noteSpend: the pace lives here); nothing else writes here, and what was spent is also on the chain (the TreasurySpend event).

Constants 1

const bubblePath, ownPath, KindName, subpath, one, MaxSpend, MaxShare, SmallTreasury, Window

 1const (
 2	bubblePath = "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/bubble"
 3	ownPath    = "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/bubbletreasury"
 4
 5	// KindName is what the holders adopt and propose under. The governor derives the sub-realm's path from it:
 6	// lower-cased, every character outside [a-z0-9] turned into '-' — so `treasury:spend` lives at `treasury-spend`.
 7	KindName = "treasury:spend"
 8	subpath  = "treasury-spend"
 9
10	one = int64(1_000_000) // ugnot in one GNOT
11
12	// MaxSpend is the most one proposal may move, in whole GNOT — and never more than a QUARTER of what the treasury
13	// holds (MaxShare), or SmallTreasury whole GNOT if that is more (so a small treasury can be spent whole, and a
14	// treasury just over it has no cliff). The cap bounds one question; the PACE is the window: a window opens at
15	// the first spend after Window seconds of none, and the spends in the Window seconds from that first spend
16	// together may move at most that same quarter of what the treasury held then (spentAt/windowBase below); the
17	// next spend after those seconds opens the next window. So "a quarter per two-day window" is true in code: a
18	// majority that wants it all has to say so in public, and wait, several times over.
19	MaxSpend      = int64(100_000)
20	MaxShare      = int64(4)                // a proposal, and a window, may move at most balance/MaxShare…
21	SmallTreasury = int64(40)               // …or this many whole GNOT, whichever is more (up to the balance)
22	Window        = int64(2 * 24 * 60 * 60) // seconds: the pace — one quarter per window
23)
source

Functions 10

func Balance

Action
1func Balance() int64
source

Balance is what the treasury holds right now, in ugnot.

func MaxNow

Action
1func MaxNow() int64
source

MaxNow is the most one proposal may move right now, in whole GNOT: the cap for a balance.

func Offer

crossing Action
1func Offer(cur realm)
source

Offer is the same publication for a realm loaded without its init having run it (a test harness): it does nothing once the token's governor knows the name. The holders still have to adopt the kind by vote before a spend can be proposed.

func Offered

Action
1func Offered() bool
source

Offered is whether the kind has been published to the token's governor.

func Preview

Action
1func Preview(payload string) string
source

Preview is what a proposal with this payload would say, and whether it could open now.

func Render

1func Render(path string) string
source

Render: the treasury for a reader — where, how much, and how it moves.

func SpentAt

Action
1func SpentAt() int64
source

SpentAt is the height of the last spend; Spends and Spent, the count and the sum — the realm's own log.

func WindowLeft

Action
1func WindowLeft() int64
source

WindowLeft is what may still move before the window closes, in ugnot — the whole cap for a window not open.

Imports 8

Source Files 2