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.

v2 source pure

Package budget provides accounting, spending limits, and presentation for a shared pool.

Overview

Package budget provides accounting, spending limits, and presentation for a shared pool.

Constants 1

Functions 17

func Add

1func Add(a, b int64) int64
source

func CapMeterSVG

1func CapMeterSVG(label string, used, cap int64, colorHex string) string
source

func EvidenceCommitment

1func EvidenceCommitment(programID int64, lane string, itemID int64, proofDigest string) string
source

EvidenceCommitment binds a salted proof digest to its program and item.

func FormatUGNOT

1func FormatUGNOT(amount int64) string
source

FormatUGNOT shows the exact amount in both ugnot and GNOT.

func MarkdownText

1func MarkdownText(s string) string
source

MarkdownText escapes printable text for inline Markdown and table cells.

func ParsePolicyViewPath

1func ParsePolicyViewPath(path string) (int64, int64)
source

ParsePolicyViewPath reads programID or programID/itemID for policy renders.

func PeriodAt

1func PeriodAt(height, start, periodBlocks int64) int64
source

func RequireMemo

1func RequireMemo(memo string)
source

RequireMemo accepts a single line of up to 80 printable UTF-8 bytes.

func EvaluateSpend

1func EvaluateSpend(available, reserveFloor int64, canBreachFloor bool, itemCap, periodCap, periodUsed, amount int64) SpendCheck
source

EvaluateSpend reports the tightest room, breaking ties in item, period, pool order. A pool failure identifies a shortfall of cash before floor protection.

Types 2

type Ledger

struct
1type Ledger struct {
2	Funded    int64
3	Available int64
4	Reserved  int64
5	Claimable int64
6	Paid      int64
7}
source

Methods on Ledger

func Approve

method on Ledger
1func (l Ledger) Approve(amount int64) Ledger
source

func AssertConserved

method on Ledger
1func (l Ledger) AssertConserved()
source

AssertConserved checks that all balances are non-negative and account for all funding.

func Fund

method on Ledger
1func (l Ledger) Fund(amount int64) Ledger
source

func Pay

method on Ledger
1func (l Ledger) Pay(amount int64) Ledger
source

func Release

method on Ledger
1func (l Ledger) Release(amount int64) Ledger
source

func Reserve

method on Ledger
1func (l Ledger) Reserve(amount int64) Ledger
source

type SpendCheck

struct
 1type SpendCheck struct {
 2	Allowed           bool
 3	Amount            int64
 4	MaxAllowed        int64
 5	Shortfall         int64
 6	BindingConstraint string
 7	ItemRoom          int64
 8	PeriodRoom        int64
 9	PoolRoom          int64
10}
source

Dependencies

Source Files 3