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

grants state

Back to all declarations

Denom

untyped string

Denom is the only asset this realm accepts.

Value

"ugnot"

MaxFeeBps

int64

MaxFeeBps is the hard protocol-fee cap: 1000 bps = 10%.

Value

1000

StatusOpen

untyped string

Grant status values.

Value

"open"

StatusAwarded

untyped string

Grant status values.

Value

"awarded"

StatusCancelled

untyped string

Grant status values.

Value

"cancelled"

StatusExpired

untyped string

Grant status values.

Value

"expired"

MaxTitleLen

untyped bigint

Input bounds.

Value

(80 <untyped> bigint)

MaxDescLen

untyped bigint

Input bounds.

Value

(2000 <untyped> bigint)

MaxPitchLen

untyped bigint

Input bounds.

Value

(1000 <untyped> bigint)

MinDurationBlocks

int64

Input bounds.

Value

1

MaxDurationBlocks

int64

Input bounds.

Value

10000000

ExpiryGraceBlocks

int64

Input bounds.

Value

100

application

type

Value

grants.application

grant

type

Value

grants.grant

admin

.uverse.address

// may set fee, fee recipient, successor admin

Value

<gnolang.StringValue>

feeRecipient

.uverse.address

// may withdraw fees and sweep surplus

Value

<gnolang.StringValue>

feeBps

int64

// fee snapshotted into NEW grants

Value

0

self

.uverse.address

// this realm's address, captured at deploy

Value

<gnolang.StringValue>

nextID

int64

Value

2

openTotal

int64

// == Σ amount over grants with status Open

Value

0

CreateGrant

func(title string, description string, durationBlocks int64, maxFeeBps int64) int64

CreateGrant escrows the attached GNOT as a new open grant and returns its id. Only direct EOA calls with -send are accepted. The current protocol fee is snapshotted into the grant — and must not exceed maxFeeBps, the ceiling the caller signed for (rejects a fee raise sequenced ahead of this transaction); pass MaxFeeBps to accept any legal fee. The application window is durationBlocks from now.

Open
OID
0e2ab8…5493:19
CreateGrant details

Inspect func

Apply

func(id int64, pitch string)

Apply submits (or re-submits) the caller's application to an open grant before its deadline. One application per address per grant — re-applying replaces the caller's own pitch only. The creator cannot apply to their own grant.

Open
OID
0e2ab8…5493:20
Apply details

Inspect func

SelectWinner

func(id int64, winner .uverse.address)

SelectWinner awards an open grant to one of its applicants: the escrow leaves the open pool and is credited to the winner's claimable balance through the ledger, charging the fee snapshotted at creation. Only the grant's creator may select, and only an address that actually applied can win. Terminal.

Open
OID
0e2ab8…5493:21
SelectWinner details

Inspect func

CancelGrant

func(id int64)

CancelGrant closes an open grant and refunds its escrow to the creator's claimable balance, fee-free. Only the creator may cancel. Terminal.

Open
OID
0e2ab8…5493:22
CancelGrant details

Inspect func

ExpireGrant

func(id int64)

ExpireGrant closes an open grant whose deadline passed more than ExpiryGraceBlocks ago, refunding the creator fee-free. ANYONE may call it — this is the permissionless valve that guarantees escrow can never be trapped by an inactive creator. Terminal.

Open
OID
0e2ab8…5493:23
ExpireGrant details

Inspect func

refundOpen

func(g *grants.grant, terminal string)

refundOpen moves an Open grant's escrow into the creator's claimable balance fee-free and finalizes the status. Callers have already verified authorization and status.

Open
OID
0e2ab8…5493:24
refundOpen details

Inspect func

Claim

func(amount int64)

Claim sends amount ugnot of the caller's claimable balance (won grants and refunds) back to the caller.

Open
OID
0e2ab8…5493:25
Claim details

Inspect func

ClaimAll

func()

ClaimAll sends the caller's entire claimable balance back to the caller. Fails if there is nothing to claim.

Open
OID
0e2ab8…5493:26
ClaimAll details

Inspect func

WithdrawFees

func()

WithdrawFees sends the accrued fee pot to the fee recipient. Only the fee recipient may call it.

Open
OID
0e2ab8…5493:27
WithdrawFees details

Inspect func

SweepDenom

func(denom string)

SweepDenom sends the surplus of a single denomination to the fee recipient. For ugnot only the excess over Liabilities() moves; other denoms move wholly. Only the fee recipient may call it.

Open
OID
0e2ab8…5493:28
SweepDenom details

Inspect func

SetFeeBps

func(bps int64)

SetFeeBps sets the protocol fee snapshotted into FUTURE grants at creation. Existing grants keep the fee they were created under. Admin only; bounded by \[0, MaxFeeBps].

Open
OID
0e2ab8…5493:29
SetFeeBps details

Inspect func

SetFeeRecipient

func(next .uverse.address)

SetFeeRecipient re-points the fee/surplus role, including the pot accrued so far. Admin only; zero address rejected.

Open
OID
0e2ab8…5493:30
SetFeeRecipient details

Inspect func

TransferAdmin

func(next .uverse.address)

TransferAdmin hands the admin role to next. Admin only; zero address rejected. One-step (documented trade-off).

Open
OID
0e2ab8…5493:31
TransferAdmin details

Inspect func

GrantInfo

func(id int64) (creator .uverse.address, title string, amount int64, feeBps int64, deadline int64, status string, winner .uverse.address, numApplicants int64)

GrantInfo returns a grant's fields by value: creator, title, amount, snapshotted fee bps, application deadline (block height), status, winner (zero unless awarded), and number of applicants.

Open
OID
0e2ab8…5493:32
GrantInfo details

Inspect func

Description

func(id int64) string

Description returns a grant's raw description text.

Open
OID
0e2ab8…5493:33
Description details

Inspect func

ApplicationOf

func(id int64, addr .uverse.address) (pitch string, height int64, ok bool)

ApplicationOf returns addr's pitch and submission height for a grant, with ok reporting whether an application exists.

Open
OID
0e2ab8…5493:34
ApplicationOf details

Inspect func

FeeRecipient

func() .uverse.address
Open
OID
0e2ab8…5493:36
FeeRecipient details

Inspect func

FeeBps

func() int64

FeeBps returns the fee that will be snapshotted into newly created grants (existing grants keep their own snapshot).

Open
OID
0e2ab8…5493:37
FeeBps details

Inspect func

FeeOn

func(amount int64) (fee int64, credited int64)

FeeOn previews the fee and net payout for a grant of amount at the CURRENT FeeBps.

Open
OID
0e2ab8…5493:38
FeeOn details

Inspect func

NumGrants

func() int64

NumGrants returns how many grants have ever been created.

Open
OID
0e2ab8…5493:39
NumGrants details

Inspect func

OpenTotal

func() int64

OpenTotal returns the escrow held by open grants (the G term).

Open
OID
0e2ab8…5493:40
OpenTotal details

Inspect func

BalanceOf

func(addr .uverse.address) int64

BalanceOf returns addr's claimable balance (won grants + refunds).

Open
OID
0e2ab8…5493:41
BalanceOf details

Inspect func

UsersTotal

func() int64

UsersTotal returns the sum of all claimable balances (the U term).

Open
OID
0e2ab8…5493:42
UsersTotal details

Inspect func

FeesAccrued

func() int64

FeesAccrued returns the fee pot (the F term).

Open
OID
0e2ab8…5493:43
FeesAccrued details

Inspect func

Liabilities

func() int64

Liabilities returns everything this realm owes: openTotal + UsersTotal + FeesAccrued.

Open
OID
0e2ab8…5493:44
Liabilities details

Inspect func

Held

func() int64

Held returns the ugnot actually held at the realm address (H).

Open
OID
0e2ab8…5493:45
Held details

Inspect func

Surplus

func() int64

Surplus returns Held() - Liabilities() (the S term).

Open
OID
0e2ab8…5493:46
Surplus details

Inspect func

Height

func() int64

Height returns the current chain height (deadline arithmetic aid).

Open
OID
0e2ab8…5493:48
Height details

Inspect func

Render

func(path string) string

Render shows the market at "" and a grant detail at "\<id>". Free text (titles are charset-restricted; descriptions are not) passes through the ecosystem sanitizer before hitting markdown.

Open
OID
0e2ab8…5493:49
Render details

Inspect func

renderGrant

func(path string) string
Open
OID
0e2ab8…5493:50
renderGrant details

Inspect func

assertAdmin

func(caller .uverse.address)
Open
OID
0e2ab8…5493:51
assertAdmin details

Inspect func

mustGetGrant

func(id int64) *grants.grant
Open
OID
0e2ab8…5493:52
mustGetGrant details

Inspect func

assertValidTitle

func(title string)

assertValidTitle bounds length and restricts the charset so titles are list-safe in Render without escaping.

Open
OID
0e2ab8…5493:53
assertValidTitle details

Inspect func

padID

func(id int64) string

padID renders an id as a fixed-width key so avl iteration order is numeric order.

Open
OID
0e2ab8…5493:54
padID details

Inspect func

checkedAdd

func(a int64, b int64) (int64, bool)
Open
OID
0e2ab8…5493:56
checkedAdd details

Inspect func
Denom : untyped string ="ugnot"
MaxFeeBps : int64 =1000
StatusOpen : untyped string ="open"
StatusAwarded : untyped string ="awarded"
StatusCancelled : untyped string ="cancelled"
StatusExpired : untyped string ="expired"
MaxTitleLen : untyped bigint =(80 <untyped> bigint)
MaxDescLen : untyped bigint =(2000 <untyped> bigint)
MaxPitchLen : untyped bigint =(1000 <untyped> bigint)
MinDurationBlocks : int64 =1
MaxDurationBlocks : int64 =10000000
ExpiryGraceBlocks : int64 =100
application : type =grants.application
grant : type =grants.grant
admin : .uverse.address =<gnolang.StringValue>
feeRecipient : .uverse.address =<gnolang.StringValue>
feeBps : int64 =0
self : .uverse.address =<gnolang.StringValue>
nextID : int64 =2
openTotal : int64 =0
grants : *v0.Tree Inspect
ledger : *feeledger.Ledger Inspect
init.22 : func() Inspect
CreateGrant : func(title string, description string, durationBlocks int64, maxFeeBps int64) int64 Inspect
Apply : func(id int64, pitch string) Inspect
SelectWinner : func(id int64, winner .uverse.address) Inspect
CancelGrant : func(id int64) Inspect
ExpireGrant : func(id int64) Inspect
refundOpen : func(g *grants.grant, terminal string) Inspect
Claim : func(amount int64) Inspect
ClaimAll : func() Inspect
WithdrawFees : func() Inspect
SweepDenom : func(denom string) Inspect
SetFeeBps : func(bps int64) Inspect
SetFeeRecipient : func(next .uverse.address) Inspect
TransferAdmin : func(next .uverse.address) Inspect
GrantInfo : func(id int64) (creator .uverse.address, title string, amount int64, feeBps int64, deadline int64, status string, winner .uverse.address, numApplicants int64) Inspect
Description : func(id int64) string Inspect
ApplicationOf : func(id int64, addr .uverse.address) (pitch string, height int64, ok bool) Inspect
Admin : func() .uverse.address Inspect
FeeRecipient : func() .uverse.address Inspect
FeeBps : func() int64 Inspect
FeeOn : func(amount int64) (fee int64, credited int64) Inspect
NumGrants : func() int64 Inspect
OpenTotal : func() int64 Inspect
BalanceOf : func(addr .uverse.address) int64 Inspect
UsersTotal : func() int64 Inspect
FeesAccrued : func() int64 Inspect
Liabilities : func() int64 Inspect
Held : func() int64 Inspect
Surplus : func() int64 Inspect
Address : func() .uverse.address Inspect
Height : func() int64 Inspect
Render : func(path string) string Inspect
renderGrant : func(path string) string Inspect
assertAdmin : func(caller .uverse.address) Inspect
mustGetGrant : func(id int64) *grants.grant Inspect
assertValidTitle : func(title string) Inspect
padID : func(id int64) string Inspect
itoa : func(n int64) string Inspect
checkedAdd : func(a int64, b int64) (int64, bool) Inspect