Denom
untyped stringDenom is the only asset this realm accepts.
Value
"ugnot"
MaxFeeBps
int64MaxFeeBps is the hard protocol-fee cap: 1000 bps = 10%.
Value
1000
MeterActive
untyped stringMeter status values.
Value
"active"
MeterRetired
untyped stringMeter status values.
Value
"retired"
EnrollActive
untyped stringEnrollment status values. Exited is terminal.
Value
"active"
EnrollExited
untyped stringEnrollment status values. Exited is terminal.
Value
"exited"
MaxTitleLen
untyped bigintInput bounds.
Value
(80 <untyped> bigint)
MaxUnitLen
untyped bigintInput bounds.
Value
(24 <untyped> bigint)
MinUnitPrice
int64Input bounds.
Value
1
MaxUnitPrice
int64// 1000 GNOT per unit
Value
1000000000
MinPeriodBlocks
int64Input bounds.
Value
10
MaxPeriodBlocks
int64Input bounds.
Value
7500000
MaxMetersPerProvider
untyped bigintInput bounds.
Value
(20 <untyped> bigint)
MaxEnrollmentsPerConsumer
untyped bigintInput bounds.
Value
(100 <untyped> bigint)
RenderLimit
untyped bigintInput bounds.
Value
(20 <untyped> bigint)
meter
typeValue
meters.meter
enrollment
typeValue
meters.enrollment
admin
.uverse.address// may set fee, fee recipient, stage successor
Value
<gnolang.StringValue>
pendingAdmin
.uverse.address// staged by TransferAdmin, completes via AcceptAdmin
Value
<zero>
feeRecipient
.uverse.address// may withdraw fees and sweep surplus
Value
<gnolang.StringValue>
feeBps
int64// fee snapshotted into NEW meters
Value
0
self
.uverse.address// this realm's address, captured at deploy
Value
<gnolang.StringValue>
nextMeter
int64Value
2
nextEnr
int64Value
4
metersT
*v0.Tree// padID(id) -> \*meter
- OID
- 040f01…bfaa:11
metersT details
enrollments
*v0.Tree// padID(id) -> \*enrollment
- OID
- 040f01…bfaa:14
enrollments details
activeByKey
*v0.Tree// padID(meterID)|consumer -> int64 enroll id, while Active
- OID
- 040f01…bfaa:17
activeByKey details
providerNum
*v0.Tree// address -> \*int64, live meters per provider
- OID
- 040f01…bfaa:20
providerNum details
consumerNum
*v0.Tree// address -> \*int64, Active enrollments per consumer
- OID
- 040f01…bfaa:23
consumerNum details
ledger
*feeledger.Ledger- OID
- 040f01…bfaa:26
ledger details
init.30
func()- OID
- 040f01…bfaa:30
init.30 details
CreateMeter
func(title string, unit string, unitPrice int64, periodBlocks int64, edges string, rates string, maxFeeBps int64) int64CreateMeter publishes a meter and returns its id. No coins are accepted; the storage deposit the caller pays is the anti-spam. edges and rates are comma-separated int64 lists building the tiers.Schedule over the ugnot BASE (units × unitPrice): len(rates) == len(edges)+1, each rate in \[0, 10000] ten-thousandths of list price. "" edges with rates "10000" is a flat meter. The current protocol fee is snapshotted in and must not exceed maxFeeBps, the ceiling the provider signed for — pass MaxFeeBps to accept any legal fee. Meters are immutable once created: price, period or schedule changes are a new meter, so nothing a consumer agreed to can move underneath them.
- OID
- 040f01…bfaa:32
CreateMeter details
RetireMeter
func(meterID int64)RetireMeter stops NEW enrollments and NEW usage on the caller's own meter. Existing enrollments keep their funds paths whole: pending usage still settles, deposits stay withdrawable, Exit still refunds. The provider's meter slot frees. Terminal.
- OID
- 040f01…bfaa:33
RetireMeter details
Record
func(enrollID int64, units int64)Record asserts that the enrollment's consumer used units more units of the meter's service in the CURRENT period. Provider only. Fail-closed on the deposit bound: if charging the period's new total at the enrollment's schedule would exceed the deposited balance, the whole posting is refused — never clipped, because a clipped assertion is a wrong assertion with the same signature as a right one. Any elapsed period settles first, so the bound is always measured against the balance that will actually back this period.
- OID
- 040f01…bfaa:34
Record details
Enroll
func(meterID int64) int64Enroll opens an enrollment on a meter for the caller, with any attached coins credited as the initial deposit. One active enrollment per (meter, consumer); Exit frees the slot. Terms (price, schedule, period, fee) are copied in at this moment and never re-read.
- OID
- 040f01…bfaa:35
Enroll details
Deposit
func(enrollID int64)Deposit adds the attached coins to the caller's own enrollment deposit. Elapsed usage settles first, so a top-up lands on a current balance.
- OID
- 040f01…bfaa:36
Deposit details
WithdrawDeposit
func(enrollID int64, amount int64)WithdrawDeposit returns amount of the caller's own enrollment deposit. The current period's pending charge stays covered: withdrawable is balance − Charge(current usage), so a provider's already-recorded usage can never be defunded. Elapsed usage settles first.
- OID
- 040f01…bfaa:37
WithdrawDeposit details
Exit
func(enrollID int64)Exit closes the caller's own enrollment: elapsed periods settle, the CURRENT period's recorded usage settles immediately (the provider served it; exiting is not an escape from it), the remaining deposit refunds in full, and the slot frees. Terminal.
- OID
- 040f01…bfaa:38
Exit details
Settle
func(enrollID int64)Settle settles any fully-elapsed period of an enrollment. Permissionless by design — like the sibling realms' valves, no settlement's liveness may depend on either party showing up. No coins may ride on it, and calling it on an enrollment with nothing elapsed is a refused no-op so the event stream never carries empty settlements.
- OID
- 040f01…bfaa:39
Settle details
Claim
func(amount int64)Claim sends amount ugnot of the caller's claimable balance back to the caller. Providers earn into this balance at every settlement.
- OID
- 040f01…bfaa:40
Claim details
ClaimAll
func()ClaimAll sends the caller's entire claimable balance back to the caller. Fails if there is nothing to claim.
- OID
- 040f01…bfaa:41
ClaimAll details
WithdrawFees
func()WithdrawFees sends the accrued fee pot to the fee recipient. Only the fee recipient may call it, and only the pot moves.
- OID
- 040f01…bfaa:42
WithdrawFees details
SweepDenom
func(denom string)SweepDenom recovers out-of-band coins (sent by raw bank transfer, outside any entrypoint) to the fee recipient. For the ledger denom the reserve is Liabilities() — user balances and the fee pot are structurally unreachable. Fee recipient only.
- OID
- 040f01…bfaa:43
SweepDenom details
SetFeeBps
func(bps int64)SetFeeBps sets the protocol fee snapshotted into NEW meters. Admin only. No existing meter or enrollment moves.
- OID
- 040f01…bfaa:44
SetFeeBps details
SetFeeRecipient
func(recipient .uverse.address)SetFeeRecipient points fee withdrawal and sweeps at recipient. Admin only.
- OID
- 040f01…bfaa:45
SetFeeRecipient details
TransferAdmin
func(successor .uverse.address)TransferAdmin stages successor as the next admin; AcceptAdmin completes it. Two-step with consent — a one-step transfer bricked resources in two prior audits (service\_registry Y4, permission\_registry Y4).
- OID
- 040f01…bfaa:46
TransferAdmin details
AcceptAdmin
func()AcceptAdmin completes a staged admin transfer. Pending admin only.
- OID
- 040f01…bfaa:47
AcceptAdmin details
PriceOf
func(meterID int64, units int64) int64PriceOf prices units of meter meterID at its schedule: the charge a period closing at exactly that usage would settle. The quote every consumer can take before enrolling and every provider can show beside an invoice.
- OID
- 040f01…bfaa:48
PriceOf details
PendingChargeOf
func(enrollID int64) int64PendingChargeOf is the charge the enrollment's current recorded usage would settle at — what WithdrawDeposit holds back.
- OID
- 040f01…bfaa:49
PendingChargeOf details
BalanceOf
func(enrollID int64) int64BalanceOf is an enrollment's deposited balance as the LEDGER holds it — including a not-yet-settled elapsed period's charge; net view: subtract PendingChargeOf.
- OID
- 040f01…bfaa:50
BalanceOf details
ChargeHeadroomOf
func(enrollID int64) int64ChargeHeadroomOf is how much MORE charge the current period could absorb before Record's deposit bound refuses: balance − pending charge.
- OID
- 040f01…bfaa:51
ChargeHeadroomOf details
MeterInfo
func(meterID int64) (provider .uverse.address, title string, unit string, unitPrice int64, periodBlocks int64, meterFeeBps int64, status string, lifetimeEnrollments int64)- OID
- 040f01…bfaa:52
MeterInfo details
ScheduleOf
func(meterID int64) (edges []int64, rates []int64)ScheduleOf returns a meter's schedule as its edge and rate slices.
- OID
- 040f01…bfaa:53
ScheduleOf details
EnrollInfo
func(enrollID int64) (meterID int64, consumer .uverse.address, provider .uverse.address, status string, startHeight int64, usage int64, usagePeriod int64, settledPeriods int64)- OID
- 040f01…bfaa:54
EnrollInfo details
ActiveEnrollID
func(meterID int64, consumer .uverse.address) (int64, bool)ActiveEnrollID resolves the caller-free (meter, consumer) index.
- OID
- 040f01…bfaa:55
ActiveEnrollID details
CurrentPeriodOf
func(enrollID int64) int64CurrentPeriodOf is the period index now open for an enrollment.
- OID
- 040f01…bfaa:56
CurrentPeriodOf details
Admin
func() .uverse.address- OID
- 040f01…bfaa:57
Admin details
PendingAdmin
func() .uverse.address- OID
- 040f01…bfaa:58
PendingAdmin details
FeeRecipient
func() .uverse.address- OID
- 040f01…bfaa:59
FeeRecipient details
FeeBps
func() int64- OID
- 040f01…bfaa:60
FeeBps details
NumMeters
func() int64- OID
- 040f01…bfaa:61
NumMeters details
NumEnrollments
func() int64- OID
- 040f01…bfaa:62
NumEnrollments details
UsersTotal
func() int64- OID
- 040f01…bfaa:63
UsersTotal details
FeesAccrued
func() int64- OID
- 040f01…bfaa:64
FeesAccrued details
Liabilities
func() int64- OID
- 040f01…bfaa:65
Liabilities details
ClaimableOf
func(a .uverse.address) int64- OID
- 040f01…bfaa:66
ClaimableOf details
Held
func() int64- OID
- 040f01…bfaa:67
Held details
Address
func() .uverse.address- OID
- 040f01…bfaa:68
Address details
Height
func() int64- OID
- 040f01…bfaa:69
Height details
currentPeriod
func(e *meters.enrollment) int64currentPeriod is the index of the period open at the chain head.
- OID
- 040f01…bfaa:70
currentPeriod details
chargeFor
func(e *meters.enrollment, usage int64) int64chargeFor prices usage units at the enrollment's copied terms.
- OID
- 040f01…bfaa:71
chargeFor details
settleElapsed
func(e *meters.enrollment)settleElapsed settles the usage accumulator if its period has closed, then re-anchors the accumulator on the current period. Exact because usage can only ever belong to one period: periods between usagePeriod and now had no recorded usage and so owe zero.
- OID
- 040f01…bfaa:72
settleElapsed details
settleUsage
func(e *meters.enrollment)settleUsage charges the accumulator where it stands and moves the funds: enrollment deposit -> provider claimable, protocol fee split at the enrollment's snapshotted bps. Record's deposit bound is what guarantees the withdrawal cannot fail; if that invariant were ever broken the ledger's own refusal aborts the whole transaction rather than under-settling.
- OID
- 040f01…bfaa:73
settleUsage details
mustGetMeter
func(id int64) *meters.meter- OID
- 040f01…bfaa:74
mustGetMeter details
mustGetEnrollment
func(id int64) *meters.enrollment- OID
- 040f01…bfaa:75
mustGetEnrollment details
enrollKey
func(id int64) stringenrollKey is the ledger account an enrollment's deposit lives under. It cannot collide with a provider's claimable account: addresses never start with '#'.
- OID
- 040f01…bfaa:76
enrollKey details
assertNoSend
func()assertNoSend refuses coins on every non-payable entrypoint. Reads the ORIGIN envelope, so a transaction that attached coins anywhere is refused even if an intermediary consumed them.
- OID
- 040f01…bfaa:77
assertNoSend details
counter
func(tree *v0.Tree, a .uverse.address) *int64counter returns the live-count cell for a, creating it at zero.
- OID
- 040f01…bfaa:78
counter details
decCounter
func(tree *v0.Tree, a .uverse.address)decCounter decrements a's live count and removes the cell at zero — the index must not accumulate dead keys (service\_registry's lesson).
- OID
- 040f01…bfaa:79
decCounter details
parseInt64List
func(s string, max int, what string) []int64parseInt64List parses a comma-separated int64 list, bounding the element count BEFORE materialising values so a thousand-element string dies on count, not memory (r/receivables' bounding argument). "" is the empty list.
- OID
- 040f01…bfaa:80
parseInt64List details
trimSpaces
func(s string) string- OID
- 040f01…bfaa:81
trimSpaces details
addChecked
func(a int64, b int64) (int64, bool)addChecked / mulChecked are int64 overflow-checked arithmetic. Written here rather than imported because they are two lines each and the house keeps its payment arithmetic visible at the call site.
- OID
- 040f01…bfaa:82
addChecked details
mulChecked
func(a int64, b int64) (int64, bool)- OID
- 040f01…bfaa:83
mulChecked details
padID
func(id int64) string- OID
- 040f01…bfaa:84
padID details
itoa
func(n int64) string- OID
- 040f01…bfaa:85
itoa details
Render
func(path string) stringRender shows the catalog at "", a meter at "meter/\<id>", an enrollment at "enroll/\<id>". Every user string is sanitized; every list is bounded by RenderLimit with the bound stated.
- OID
- 040f01…bfaa:86
Render details
renderHome
func() string- OID
- 040f01…bfaa:87
renderHome details
renderMeter
func(idStr string) string- OID
- 040f01…bfaa:88
renderMeter details
renderEnrollment
func(idStr string) string- OID
- 040f01…bfaa:89
renderEnrollment details
hasPrefix
func(s string, p string) bool- OID
- 040f01…bfaa:90