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.

v4 source realm

Package treasury holds funds and accounts for reservations across independent policies.

Overview

Package treasury holds funds and accounts for reservations across independent policies.

Constants 2

Functions 45

func AddPolicy

crossing Action
1func AddPolicy(cur realm, programID int64, lane, policyPath string, periodCap, itemCap int64, canBreachFloor bool)
source

func Approve

crossing Action
1func Approve(cur realm, programID int64, lane string, itemID int64)
source

func Cancel

crossing Action
1func Cancel(cur realm, programID int64, lane string, itemID int64)
source

func CheckSpend

Action
1func CheckSpend(programID int64, lane string, amount int64) budget.SpendCheck
source

CheckSpend preflights a reservation amount against an active, registered lane.

func CreateProgram

crossing Action
1func CreateProgram(cur realm, title, asset string, reserveFloor, periodBlocks, issueBlocks, maxHold, govDelay int64) int64
source

func Expire

crossing Action
1func Expire(cur realm, programID int64, lane string, itemID int64)
source

func FinalizeClose

crossing Action
1func FinalizeClose(cur realm, programID int64)
source

FinalizeClose creates a sponsor refund and freezes the period displayed for the program.

func GetTreasuryAssetBalance

Action
1func GetTreasuryAssetBalance(asset string) (int64, int64)
source

GetTreasuryAssetBalance returns physical custody and outstanding claims and allocations.

func QueuePolicyCaps

crossing Action
1func QueuePolicyCaps(cur realm, programID int64, lane string, periodCap, itemCap int64) int64
source

QueuePolicyCaps changes an active lane's spending limits without altering prior usage.

func QueueReserveFloor

crossing Action
1func QueueReserveFloor(cur realm, programID, newFloor int64) int64
source

QueueReserveFloor returns the first block at which the change may take effect. With a zero delay, the change takes effect immediately.

func RegisterToken

crossing Action
1func RegisterToken(cur realm, key string, token *grc20.Token)
source

RegisterToken binds a key to a GRC20 ledger for the lifetime of the treasury.

func Reject

crossing Action
1func Reject(cur realm, programID int64, lane string, itemID int64)
source

func Reserve

crossing Action
1func Reserve(cur realm, programID int64, lane string, recipient address, amount, deadline int64, memo string) (int64, int64)
source

Reserve assigns the next item ID in the lane and returns it with the remaining available balance.

func Withdraw

crossing Action
1func Withdraw(cur realm, programID int64, lane string, itemID int64)
source

Withdraw pays an approved claim. Use lane "refund" and item ID 0 for the sponsor refund.

func ListPrograms

Action
1func ListPrograms(offset, limit int) []ProgramView
source

ListPrograms returns programs in descending ID order.

func PolicyRenderRoute

Action
1func PolicyRenderRoute(path, policyPath string) (ProgramView, []string, int64)
source

PolicyRenderRoute resolves a policy route against the lanes registered to its realm. A bare program route may return several lanes for the caller to display.

func ListReservations

Action
1func ListReservations(programID int64, lane string, offset, limit int) []ReservationView
source

ListReservations returns a lane's items in ascending ID order.

Types 6

type ClaimView

struct
1type ClaimView struct {
2	Exists    bool
3	Recipient address
4	Amount    int64
5	Paid      bool
6}
source

type PolicyView

struct
 1type PolicyView struct {
 2	Lane             string
 3	Path             string
 4	Address          address
 5	PeriodCap        int64
 6	ItemCap          int64
 7	CanBreachFloor   bool
 8	Registered       bool
 9	Used             int64
10	PendingPeriodCap int64
11	PendingItemCap   int64
12	PendingCapsETA   int64
13}
source

type ProgramView

struct
 1type ProgramView struct {
 2	ID                 int64
 3	Title              string
 4	Sponsor            address
 5	PendingSponsor     address
 6	Status             string
 7	Asset              string
 8	AssetSymbol        string
 9	AssetDecimals      int
10	ReserveFloor       int64
11	GovDelay           int64
12	PendingFloor       int64
13	PendingFloorETA    int64
14	CurrentHeight      int64
15	StartHeight        int64
16	IssueEndHeight     int64
17	IssueClosedHeight  int64
18	IssueBlocks        int64
19	PeriodBlocks       int64
20	MaxHoldBlocks      int64
21	CurrentPeriod      int64
22	ClosedHeight       int64
23	ClosedPeriod       int64
24	Pruned             bool
25	ActiveReservations int64
26	Balance            budget.Ledger
27	Policies           []PolicyView
28}
source

Methods on ProgramView

func FormatAmount

method on ProgramView
1func (view ProgramView) FormatAmount(amount int64) string
source

type ReservationView

struct
 1type ReservationView struct {
 2	ID              int64
 3	Lane            string
 4	Recipient       address
 5	Amount          int64
 6	Status          string
 7	Period          int64
 8	Deadline        int64
 9	Memo            string
10	ExpiredAtHeight bool
11	Paid            bool
12}
source

type TokenView

struct
1type TokenView struct {
2	Exists   bool
3	ID       string
4	Name     string
5	Symbol   string
6	Decimals int
7}
source

Dependencies

Source Files 6