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.

v3 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

const packagePath, maxScheduleBlocks, maxPolicies, Draft, Active, IssuanceClosed, Closed, Reserved, Approved, Rejected, Canceled, Expired

 1const (
 2	packagePath             = "gno.land/r/g1aj9pzthj36aav0kff2zcmx9llapa7ng7xzcfct/shared_budget/treasury/v3"
 3	maxScheduleBlocks int64 = 2147483647
 4	maxPolicies             = 8
 5
 6	Draft          = "draft"
 7	Active         = "active"
 8	IssuanceClosed = "issuance_closed"
 9	Closed         = "closed"
10
11	Reserved = "reserved"
12	Approved = "approved"
13	Rejected = "rejected"
14	Canceled = "canceled"
15	Expired  = "expired"
16)
source

Functions 26

func AddPolicy

crossing Action
1func AddPolicy(cur realm, programID int64, lane, policyPath string, periodCap, itemCap int64, canBreachFloor bool)
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 string, reserveFloor, periodBlocks, issueBlocks, maxHold 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 Reserve

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

Reserve assigns the next item ID in the caller's 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 ListReservations

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

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

Types 5

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}
source

type ProgramView

struct
 1type ProgramView struct {
 2	ID                 int64
 3	Title              string
 4	Sponsor            address
 5	Status             string
 6	ReserveFloor       int64
 7	StartHeight        int64
 8	IssueEndHeight     int64
 9	IssueBlocks        int64
10	PeriodBlocks       int64
11	MaxHoldBlocks      int64
12	CurrentPeriod      int64
13	ClosedHeight       int64
14	ClosedPeriod       int64
15	Pruned             bool
16	ActiveReservations int64
17	Balance            budget.Ledger
18	Policies           []PolicyView
19}
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

Dependencies

Source Files 4