Skip to content Search Apps Documentation Source Content 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.

assets state

Back to all declarations

RealmPath

untyped string

RealmPath is this realm's own path, used to build Render links.

Value

"/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/assets"

ExpenseCode

untyped string

The fixed chart. The codes follow r/books' convention, where an account's LEADING DIGIT fixes its kind: 1 asset, 2 liability, 3 equity, 4 revenue, 5 expense. A six-series code would be an invalid account under that convention, which is why the expense leg is 5500 and not the 6500 a textbook chart would use.

Value

"5500"

ExpenseName

untyped string

The fixed chart. The codes follow r/books' convention, where an account's LEADING DIGIT fixes its kind: 1 asset, 2 liability, 3 equity, 4 revenue, 5 expense. A six-series code would be an invalid account under that convention, which is why the expense leg is 5500 and not the 6500 a textbook chart would use.

Value

"Depreciation expense"

AccumCode

untyped string

The fixed chart. The codes follow r/books' convention, where an account's LEADING DIGIT fixes its kind: 1 asset, 2 liability, 3 equity, 4 revenue, 5 expense. A six-series code would be an invalid account under that convention, which is why the expense leg is 5500 and not the 6500 a textbook chart would use.

Value

"1590"

AccumName

untyped string

The fixed chart. The codes follow r/books' convention, where an account's LEADING DIGIT fixes its kind: 1 asset, 2 liability, 3 equity, 4 revenue, 5 expense. A six-series code would be an invalid account under that convention, which is why the expense leg is 5500 and not the 6500 a textbook chart would use.

Value

"Accumulated depreciation"

MaxAssetsPerRegister

untyped bigint

MaxAssetsPerRegister caps one owner's register. CrossFoot and Render both walk every asset, and this bound is what keeps those reads cheap for everyone.

Value

(64 <untyped> bigint)

MaxEntriesPerRegister

untyped bigint

MaxEntriesPerRegister caps one owner's journal, far below journal's MaxEntriesLimit of 1000000 because RederiveFromJournal is linear in the posting count and is a free read here. The bound is reachable and the arithmetic is worth stating: an asset posts at most one entry per completed period, so MaxAssetsPerRegister assets with MaxLife-period schedules could want 64\*1200 = 76800 entries. A register that fills refuses further charges rather than dropping history. There is deliberately no Archive — it would destroy the record the invariants are checked against — so the remedy is a second register under a second address, which is a real limitation and not a hidden one.

Value

(8192 <untyped> bigint)

MaxLabelLen

untyped bigint

MaxLabelLen bounds an asset's human label. Every label is a candidate for Render output.

Value

(64 <untyped> bigint)

MinPeriodBlocks

int64

MinPeriodBlocks is the shortest period an asset may use. Matches the floor payroll, budgets and reimbursements already use. A period of 0 is not a special case here — it is simply invalid, because an asset with no period has no schedule to derive anything from.

Value

100

RenderAssetLimit

untyped bigint

RenderAssetLimit caps how many assets one Render call tabulates.

Value

(25 <untyped> bigint)

register

type

register is one owner's asset register and the book its charges post to. The book is a POINTER and is never returned by any exported function — p/journal consumer obligation 4: a \*Book is a mutable handle, and handing one across a realm boundary would hand out the right to post.

Value

assets.register

asset

type

asset is one depreciable item.

Value

assets.asset

regs

*v0.Tree

regs maps an owner's address string to that owner's \*register.

Open
OID
01e607…9591:4
regs details

Inspect pointer

regCount

int

regCount is maintained alongside the tree so the index page never has to iterate it.

Value

1

refuseCoins

func()

refuseCoins panics if a user call arrives carrying coins. This realm has no withdrawal path, so accepted coins would be stranded permanently. The guard is on IsUserCall rather than IsUser deliberately: OriginSend is only meaningful for a direct MsgCall, and the MsgRun ephemeral can consume the envelope before forwarding control, so IsUser would be the wrong predicate. The IsCurrent() check is a separate concern and is not about coins: this is a non-crossing helper reading identity off a realm PARAMETER, which is the designation-forgery shape (security.md Class 2) whether or not a caller exercising it exists today. It is a no-op at every call site here — each is a crossing entrypoint forwarding its OWN first cur, runtime-current by construction — and is kept because this realm is IMMUTABLE after addpkg, so a call site added later cannot be made safe later. p/coinio guards the same shape in Receive, Payout and Sweep; this is that house precedent applied. No count of the call sites is written down, per CLAUDE.md § 4a.

Open
OID
01e607…9591:7
refuseCoins details

Inspect func

mustOwnRegister

func() *assets.register

mustOwnRegister returns the CALLER'S register, and there is no variant that returns anyone else's. Every mutating entrypoint goes through this, so ownership is implicit in the call. "Ownership is never a parameter" is what this comment used to conclude, and it is true of the SIGNATURE and was never true of the realm VALUE: the owner is derived from cur, so an uncurrent cur IS an ownership parameter. That is the same Class 2 shape refuseCoins carries above and the more consequential half of it, because this is the function that decides who owns the register rather than one that only refuses coins. The guard is a no-op today for the same reason, kept for the same reason, and its call sites are likewise not counted here. See AUDIT.md.

Open
OID
01e607…9591:9
mustOwnRegister details

Inspect func

reg

func(owner .uverse.address) (*assets.register, bool)

reg looks an owner's register up. avl's Get returns a bare \`any\` and signals absence with nil, so the nil test IS the lookup result and not a defensive extra — every value this realm stores is a non-nil pointer.

Open
OID
01e607…9591:10
reg details

Inspect func

mustReg

func(owner .uverse.address) *assets.register
Open
OID
01e607…9591:11
mustReg details

Inspect func

mustAsset

func(r *assets.register, id uint64) *assets.asset
Open
OID
01e607…9591:12
mustAsset details

Inspect func

idKey

func(id uint64) string

idKey encodes an id so that avl's lexical key order matches numeric id order — the same encoding p/journal uses for entry ids, and for the same reason: without it, Render would list asset 10 before asset 2. 20 digits covers math.MaxUint64.

Open
OID
01e607…9591:13
idKey details

Inspect func

zeros

untyped string

Value

"00000000000000000000"

checkPeriod

func(periodBlocks int64)
Open
OID
01e607…9591:15
checkPeriod details

Inspect func

OpenRegister

func()

OpenRegister creates the caller's register and opens its two accounts. It panics if the caller already has one. The chart is opened HERE rather than on demand, and the book is created with a cap of exactly two accounts. Both facts are load-bearing: they are why this realm is its book's only writer and why the CrossFoot identity is exact rather than approximate.

Open
OID
01e607…9591:16
OpenRegister details

Inspect func

Place

func(label string, cost int64, salvage int64, life int32, periodBlocks int64) uint64

Place records a straight-line asset placed in service at the current height, and returns its id. Nothing is posted: at placement zero periods have completed, so the charge is zero and a zero posting is not a valid journal entry. The first charge becomes bookable at placedAt + periodBlocks.

Open
OID
01e607…9591:17
Place details

Inspect func

PlaceDeclining

func(label string, cost int64, salvage int64, life int32, num int64, den int64, periodBlocks int64) uint64

PlaceDeclining records a declining-balance asset charging num/den of the remaining carrying amount each period. Double-declining over a 10-period life is num=2, den=10. Two properties of that method are inherited from p/depreciation and are visible in this realm's numbers, so they are repeated here. The final period absorbs whatever remains above salvage, so the last charge can be much larger than the one before it. And a schedule whose per-period charge truncates to zero (cost\*num \< den) never depreciates until that final period — [Due](#Due) reads 0 for its whole life, which is the schedule behaving as specified and not a stuck register.

Open
OID
01e607…9591:18
PlaceDeclining details

Inspect func

place

func(r *assets.register, label string, s depreciation.Schedule, periodBlocks int64) uint64
Open
OID
01e607…9591:19
place details

Inspect func

BookThrough

func(id uint64) int32

BookThrough posts the depreciation charge for every period that has completed since this asset was last booked, and returns the period the asset is now booked through. It is IDEMPOTENT: calling it twice in one block, or twice in one period, posts once. Calling it after skipping ten periods posts the whole span as one entry, for the same total a caller who ran it every period would have reached — p/depreciation's Charge telescopes exactly, so booking cadence cannot change the total booked. A ZERO charge advances the mark and posts nothing. That is not a shortcut: journal rejects a posting of zero (ErrInvalidAmount), while a degenerate declining schedule legitimately charges zero, and the invariant is preserved exactly because AccumulatedAt is equal at both marks in precisely that case. Panics if the asset is retired, or if the book is full.

Open
OID
01e607…9591:20
BookThrough details

Inspect func

Retire

func(id uint64) int64

Retire books the asset through the current period and then stops it permanently. It returns the final amount posted, which may be zero. The booking is not optional and not separable: see the package doc. After this call the asset accrues nothing, BookThrough on it panics, and every historical charge stands. An asset already at or past the end of its life still retires cleanly — CarryingAt clamps at Salvage from Life onwards, so the final charge is whatever had not yet been booked and is zero if nothing had. IT PANICS IF THE BOOK IS FULL AND A CHARGE IS DUE, AND THAT REFUSAL IS PERMANENT. The booking is not separable, journal's Post is fail-closed before it writes, and a panic reverts the whole transaction — so an asset with an unbooked charge on a register that has reached MaxEntriesPerRegister can never be retired. BookThrough's identical panic is harmless (the charge simply stays unbooked and can be booked later if the book ever has room, which it never will, there being no archive); this one strands the asset permanently in the live state. It is reachable, and the arithmetic is the same one MaxEntriesPerRegister carries: about seven MaxLife assets booked period-by-period fill the book. The remedy is the same one the entry cap already has — a second register under a second address — and it has to be arranged BEFORE the book fills, which is why Capacity is exported and why the register page prints the entry headroom. Making Retire freeze without booking would be the obvious alternative and is refused: it would forfeit a charge that was genuinely incurred, which is the one thing this realm exists not to do.

Open
OID
01e607…9591:21
Retire details

Inspect func

bookSpan

func(r *assets.register, a *assets.asset, n int32)

bookSpan posts the charge for (a.booked, n] and advances the mark. It is the only writer of a.amount and a.booked, and the only caller of Post — which is what makes CrossFoot an exact identity rather than a heuristic.

Open
OID
01e607…9591:22
bookSpan details

Inspect func

elapsed

func(a *assets.asset) int32

elapsed is the whole periods completed for an asset at the current height. Periods cannot fail here: period is at least MinPeriodBlocks (> 0), the current height is never below placedAt because placedAt was the height at placement and heights do not decrease, and the quotient of two chain heights cannot exceed maxInt32. The error is still read and panicked on rather than discarded, because every one of those three facts is an argument and not a check.

Open
OID
01e607…9591:23
elapsed details

Inspect func

HasRegister

func(owner .uverse.address) bool

HasRegister reports whether an address has a register.

Open
OID
01e607…9591:24
HasRegister details

Inspect func

Registers

func() int

Registers is how many registers exist. There is deliberately no way to enumerate them or to aggregate across them: such a total would be the sum of every stranger's self-reported cost figures.

Open
OID
01e607…9591:25
Registers details

Inspect func

OpenedAt

func(owner .uverse.address) int64

OpenedAt is the height a register was created.

Open
OID
01e607…9591:26
OpenedAt details

Inspect func

AssetCount

func(owner .uverse.address) int

AssetCount is how many assets a register holds, retired ones included.

Open
OID
01e607…9591:27
AssetCount details

Inspect func

Height

func() int64

Height is the chain height this realm dates entries and periods with. Exposed so a caller can predict what BookThrough will book.

Open
OID
01e607…9591:28
Height details

Inspect func

AssetInfo

func(owner .uverse.address, id uint64) (label string, cost int64, salvage int64, life int32, method string, rateNum int64, rateDen int64, placedAt int64, periodBlocks int64, bookedThrough int32, bookedAmount int64, retired bool, retiredAt int64)

AssetInfo reports an asset's whole stored state in one read. method is "straight-line" or "declining-balance"; rateNum and rateDen are 0 for a straight-line asset.

Open
OID
01e607…9591:29
AssetInfo details

Inspect func

Label

func(owner .uverse.address, id uint64) string

Label is an asset's label.

Open
OID
01e607…9591:30
Label details

Inspect func

BookedThrough

func(owner .uverse.address, id uint64) int32

BookedThrough is the high-water mark: the whole periods already charged.

Open
OID
01e607…9591:31
BookedThrough details

Inspect func

BookedAmount

func(owner .uverse.address, id uint64) int64

BookedAmount is the cumulative expense posted for one asset.

Open
OID
01e607…9591:32
BookedAmount details

Inspect func

PeriodsElapsed

func(owner .uverse.address, id uint64) int32

PeriodsElapsed is the whole periods completed for an asset at the current height, whether or not they have been booked. For a retired asset this keeps increasing while BookedThrough does not, which is the intended difference and is why both are exported.

Open
OID
01e607…9591:33
PeriodsElapsed details

Inspect func

Due

func(owner .uverse.address, id uint64) int64

Due is the charge BookThrough would post for an asset right now. It is 0 for a retired asset, for an asset with no newly-completed period, and for a degenerate declining schedule that has not reached its final period.

Open
OID
01e607…9591:34
Due details

Inspect func

CarryingAt

func(owner .uverse.address, id uint64, n int32) int64

CarryingAt is an asset's carrying amount after n whole periods: Cost at n \<= 0, Salvage at every n >= Life. It reads the SCHEDULE and is independent of what has been booked.

Open
OID
01e607…9591:35
CarryingAt details

Inspect func

AccumulatedAt

func(owner .uverse.address, id uint64, n int32) int64

AccumulatedAt is Cost - CarryingAt(n): what the contra-asset balance for one asset SHOULD be once period n is booked.

Open
OID
01e607…9591:36
AccumulatedAt details

Inspect func

FullyDepreciatedAt

func(owner .uverse.address, id uint64) int64

FullyDepreciatedAt is the height at which an asset first carries only its salvage value: placedAt + Life\*periodBlocks. Validated at placement, so it cannot fail afterwards.

Open
OID
01e607…9591:37
FullyDepreciatedAt details

Inspect func

IsRetired

func(owner .uverse.address, id uint64) bool

IsRetired reports whether an asset has been retired.

Open
OID
01e607…9591:38
IsRetired details

Inspect func

Balance

func(owner .uverse.address, code string) (int64, bool)

Balance is an account's balance in its NORMAL direction. For 1590 that is debit-normal and so reads negative; [AccumulatedCredit](#AccumulatedCredit) is the figure a reader of a contra-asset wants.

Open
OID
01e607…9591:39
Balance details

Inspect func

RawBalance

func(owner .uverse.address, code string) (int64, bool)

RawBalance is an account's Debits - Credits, with no normal-direction adjustment.

Open
OID
01e607…9591:40
RawBalance details

Inspect func

AccountKind

func(owner .uverse.address, code string) (string, bool)

AccountKind is an account's kind as a word: "asset" for 1590, "expense" for 5500. The second result is false for a code this chart does not hold. It exists because the chart's kinds are otherwise unobservable from outside. Both accounts are debit-normal, so neither [Balance](#Balance) nor [Equation](#Equation) can distinguish them, and the package doc's claim that 1590 is a contra-ASSET rather than a second expense account would be an assertion in a comment with nothing behind it. Opening 1590 as an Expense instead would leave every other read in this file identical.

Open
OID
01e607…9591:41
AccountKind details

Inspect func

AccumulatedCredit

func(owner .uverse.address) int64

AccumulatedCredit is the POSITIVE accumulated-depreciation figure: the credit balance of 1590, i.e. -RawDelta.

Open
OID
01e607…9591:42
AccumulatedCredit details

Inspect func

ExpenseDebit

func(owner .uverse.address) int64

ExpenseDebit is the total depreciation expense recognised: the debit balance of 5500.

Open
OID
01e607…9591:43
ExpenseDebit details

Inspect func

EntryCount

func(owner .uverse.address) int

EntryCount is how many entries a register's book holds.

Open
OID
01e607…9591:44
EntryCount details

Inspect func

Capacity

func(owner .uverse.address) (assetsLeft int, entriesLeft int)

Capacity reports how many more assets and entries a register can take.

Open
OID
01e607…9591:45
Capacity details

Inspect func

Totals

func(owner .uverse.address) (debits int64, credits int64)

Totals is the book's total debits and credits. They are equal after every charge, because every entry is a matched pair.

Open
OID
01e607…9591:46
Totals details

Inspect func

IsBalanced

func(owner .uverse.address) bool

IsBalanced reports whether the book's debits equal its credits.

Open
OID
01e607…9591:47
IsBalanced details

Inspect func

Equation

func(owner .uverse.address) (debitNormal int64, creditNormal int64, offsets bool)

Equation is the accounting equation: debit-normal against credit-normal. Both sides offset at 0 for this chart, because the only entry is an expense debit against a contra-ASSET credit — both legs are debit-normal accounts, so the expense adds and the contra subtracts.

Open
OID
01e607…9591:48
Equation details

Inspect func

Rederive

func(owner .uverse.address) (debits int64, credits int64, agrees bool)

Rederive re-walks every posting in the book and reports whether the account totals agree with the journal. It is a FREE read, unlike r/books' owner-only equivalent. The divergence is deliberate: this realm's claim is that its postings follow from its stored schedules, and a claim only the owner can check is not worth making. The cost is linear in the posting count, which is what MaxEntriesPerRegister bounds.

Open
OID
01e607…9591:49
Rederive details

Inspect func

Invariant

func(owner .uverse.address, id uint64) (booked int64, derived int64, agrees bool)

Invariant is the per-asset derivation check: bookedAmount == schedule.AccumulatedAt(bookedThrough) It returns the two figures and whether they agree. A false here means the realm posted an amount its own schedule does not imply, which no code path in this realm can produce — which is exactly why it is worth exporting: the claim is checkable by a third party rather than asserted in a comment.

Open
OID
01e607…9591:50
Invariant details

Inspect func

CrossFoot

func(owner .uverse.address) (sumAssets int64, accumulated int64, agrees bool)

CrossFoot is the register-wide check: the sum of every asset's booked amount against the credit balance of 1590. The identity is EXACT, not approximate, and the reason is structural: this realm exposes no general posting entrypoint, so it is its book's only writer and bookSpan is the only code that posts. Adding a general Post would destroy this check, which is the cost of adding one. retired assets are included: their charges were really incurred and the 1590 credit they produced does not disappear when the asset stops.

Open
OID
01e607…9591:51
CrossFoot details

Inspect func

Render

func(path string) string

Render shows the realm index at "/" and one owner's register at "/\<address>".

Open
OID
01e607…9591:52
Render details

Inspect func

renderRegister

func(owner .uverse.address) string
Open
OID
01e607…9591:54
renderRegister details

Inspect func

cell

func(s string) string

cell renders a caller-supplied string into a table cell. A blank value would collapse the column, so it is shown as a dash.

Open
OID
01e607…9591:55
cell details

Inspect func
RealmPath : untyped string ="/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/assets"
ExpenseCode : untyped string ="5500"
ExpenseName : untyped string ="Depreciation expense"
AccumCode : untyped string ="1590"
AccumName : untyped string ="Accumulated depreciation"
MaxAssetsPerRegister : untyped bigint =(64 <untyped> bigint)
MaxEntriesPerRegister : untyped bigint =(8192 <untyped> bigint)
MaxLabelLen : untyped bigint =(64 <untyped> bigint)
MinPeriodBlocks : int64 =100
RenderAssetLimit : untyped bigint =(25 <untyped> bigint)
register : type =assets.register
asset : type =assets.asset
regs : *v0.Tree Inspect
regCount : int =1
refuseCoins : func() Inspect
mustOwnRegister : func() *assets.register Inspect
reg : func(owner .uverse.address) (*assets.register, bool) Inspect
mustReg : func(owner .uverse.address) *assets.register Inspect
mustAsset : func(r *assets.register, id uint64) *assets.asset Inspect
idKey : func(id uint64) string Inspect
zeros : untyped string ="00000000000000000000"
checkLabel : func(label string) Inspect
checkPeriod : func(periodBlocks int64) Inspect
OpenRegister : func() Inspect
Place : func(label string, cost int64, salvage int64, life int32, periodBlocks int64) uint64 Inspect
PlaceDeclining : func(label string, cost int64, salvage int64, life int32, num int64, den int64, periodBlocks int64) uint64 Inspect
place : func(r *assets.register, label string, s depreciation.Schedule, periodBlocks int64) uint64 Inspect
BookThrough : func(id uint64) int32 Inspect
Retire : func(id uint64) int64 Inspect
bookSpan : func(r *assets.register, a *assets.asset, n int32) Inspect
elapsed : func(a *assets.asset) int32 Inspect
HasRegister : func(owner .uverse.address) bool Inspect
Registers : func() int Inspect
OpenedAt : func(owner .uverse.address) int64 Inspect
AssetCount : func(owner .uverse.address) int Inspect
Height : func() int64 Inspect
AssetInfo : func(owner .uverse.address, id uint64) (label string, cost int64, salvage int64, life int32, method string, rateNum int64, rateDen int64, placedAt int64, periodBlocks int64, bookedThrough int32, bookedAmount int64, retired bool, retiredAt int64) Inspect
Label : func(owner .uverse.address, id uint64) string Inspect
BookedThrough : func(owner .uverse.address, id uint64) int32 Inspect
BookedAmount : func(owner .uverse.address, id uint64) int64 Inspect
PeriodsElapsed : func(owner .uverse.address, id uint64) int32 Inspect
Due : func(owner .uverse.address, id uint64) int64 Inspect
CarryingAt : func(owner .uverse.address, id uint64, n int32) int64 Inspect
AccumulatedAt : func(owner .uverse.address, id uint64, n int32) int64 Inspect
FullyDepreciatedAt : func(owner .uverse.address, id uint64) int64 Inspect
IsRetired : func(owner .uverse.address, id uint64) bool Inspect
Balance : func(owner .uverse.address, code string) (int64, bool) Inspect
RawBalance : func(owner .uverse.address, code string) (int64, bool) Inspect
AccountKind : func(owner .uverse.address, code string) (string, bool) Inspect
AccumulatedCredit : func(owner .uverse.address) int64 Inspect
ExpenseDebit : func(owner .uverse.address) int64 Inspect
EntryCount : func(owner .uverse.address) int Inspect
Capacity : func(owner .uverse.address) (assetsLeft int, entriesLeft int) Inspect
Totals : func(owner .uverse.address) (debits int64, credits int64) Inspect
IsBalanced : func(owner .uverse.address) bool Inspect
Equation : func(owner .uverse.address) (debitNormal int64, creditNormal int64, offsets bool) Inspect
Rederive : func(owner .uverse.address) (debits int64, credits int64, agrees bool) Inspect
Invariant : func(owner .uverse.address, id uint64) (booked int64, derived int64, agrees bool) Inspect
CrossFoot : func(owner .uverse.address) (sumAssets int64, accumulated int64, agrees bool) Inspect
Render : func(path string) string Inspect
renderIndex : func() string Inspect
renderRegister : func(owner .uverse.address) string Inspect
cell : func(s string) string Inspect
yesno : func(b bool) string Inspect