RealmPath
untyped stringRealmPath is this realm's own path, used to build Render links.
Value
"/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/assets"
ExpenseCode
untyped stringThe 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 stringThe 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 stringThe 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 stringThe 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 bigintMaxAssetsPerRegister 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 bigintMaxEntriesPerRegister 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 bigintMaxLabelLen bounds an asset's human label. Every label is a candidate for Render output.
Value
(64 <untyped> bigint)
MinPeriodBlocks
int64MinPeriodBlocks 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 bigintRenderAssetLimit caps how many assets one Render call tabulates.
Value
(25 <untyped> bigint)
register
typeregister 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
typeasset is one depreciable item.
Value
assets.asset
regs
*v0.Treeregs maps an owner's address string to that owner's \*register.
- OID
- 01e607…9591:4
regs details
regCount
intregCount 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.
- OID
- 01e607…9591:7
refuseCoins details
mustOwnRegister
func() *assets.registermustOwnRegister 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.
- OID
- 01e607…9591:9
mustOwnRegister details
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.
- OID
- 01e607…9591:10
reg details
mustReg
func(owner .uverse.address) *assets.register- OID
- 01e607…9591:11
mustReg details
mustAsset
func(r *assets.register, id uint64) *assets.asset- OID
- 01e607…9591:12
mustAsset details
idKey
func(id uint64) stringidKey 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.
- OID
- 01e607…9591:13
idKey details
zeros
untyped stringValue
"00000000000000000000"
checkLabel
func(label string)- OID
- 01e607…9591:14
checkLabel details
checkPeriod
func(periodBlocks int64)- OID
- 01e607…9591:15
checkPeriod details
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.
- OID
- 01e607…9591:16
OpenRegister details
Place
func(label string, cost int64, salvage int64, life int32, periodBlocks int64) uint64Place 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.
- OID
- 01e607…9591:17
Place details
PlaceDeclining
func(label string, cost int64, salvage int64, life int32, num int64, den int64, periodBlocks int64) uint64PlaceDeclining 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.
- OID
- 01e607…9591:18
PlaceDeclining details
place
func(r *assets.register, label string, s depreciation.Schedule, periodBlocks int64) uint64- OID
- 01e607…9591:19
place details
BookThrough
func(id uint64) int32BookThrough 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.
- OID
- 01e607…9591:20
BookThrough details
Retire
func(id uint64) int64Retire 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.
- OID
- 01e607…9591:21
Retire details
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.
- OID
- 01e607…9591:22
bookSpan details
elapsed
func(a *assets.asset) int32elapsed 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.
- OID
- 01e607…9591:23
elapsed details
HasRegister
func(owner .uverse.address) boolHasRegister reports whether an address has a register.
- OID
- 01e607…9591:24
HasRegister details
Registers
func() intRegisters 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.
- OID
- 01e607…9591:25
Registers details
OpenedAt
func(owner .uverse.address) int64OpenedAt is the height a register was created.
- OID
- 01e607…9591:26
OpenedAt details
AssetCount
func(owner .uverse.address) intAssetCount is how many assets a register holds, retired ones included.
- OID
- 01e607…9591:27
AssetCount details
Height
func() int64Height is the chain height this realm dates entries and periods with. Exposed so a caller can predict what BookThrough will book.
- OID
- 01e607…9591:28
Height details
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.
- OID
- 01e607…9591:29
AssetInfo details
Label
func(owner .uverse.address, id uint64) stringLabel is an asset's label.
- OID
- 01e607…9591:30
Label details
BookedThrough
func(owner .uverse.address, id uint64) int32BookedThrough is the high-water mark: the whole periods already charged.
- OID
- 01e607…9591:31
BookedThrough details
BookedAmount
func(owner .uverse.address, id uint64) int64BookedAmount is the cumulative expense posted for one asset.
- OID
- 01e607…9591:32
BookedAmount details
PeriodsElapsed
func(owner .uverse.address, id uint64) int32PeriodsElapsed 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.
- OID
- 01e607…9591:33
PeriodsElapsed details
Due
func(owner .uverse.address, id uint64) int64Due 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.
- OID
- 01e607…9591:34
Due details
CarryingAt
func(owner .uverse.address, id uint64, n int32) int64CarryingAt 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.
- OID
- 01e607…9591:35
CarryingAt details
AccumulatedAt
func(owner .uverse.address, id uint64, n int32) int64AccumulatedAt is Cost - CarryingAt(n): what the contra-asset balance for one asset SHOULD be once period n is booked.
- OID
- 01e607…9591:36
AccumulatedAt details
FullyDepreciatedAt
func(owner .uverse.address, id uint64) int64FullyDepreciatedAt is the height at which an asset first carries only its salvage value: placedAt + Life\*periodBlocks. Validated at placement, so it cannot fail afterwards.
- OID
- 01e607…9591:37
FullyDepreciatedAt details
IsRetired
func(owner .uverse.address, id uint64) boolIsRetired reports whether an asset has been retired.
- OID
- 01e607…9591:38
IsRetired details
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.
- OID
- 01e607…9591:39
Balance details
RawBalance
func(owner .uverse.address, code string) (int64, bool)RawBalance is an account's Debits - Credits, with no normal-direction adjustment.
- OID
- 01e607…9591:40
RawBalance details
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.
- OID
- 01e607…9591:41
AccountKind details
AccumulatedCredit
func(owner .uverse.address) int64AccumulatedCredit is the POSITIVE accumulated-depreciation figure: the credit balance of 1590, i.e. -RawDelta.
- OID
- 01e607…9591:42
AccumulatedCredit details
ExpenseDebit
func(owner .uverse.address) int64ExpenseDebit is the total depreciation expense recognised: the debit balance of 5500.
- OID
- 01e607…9591:43
ExpenseDebit details
EntryCount
func(owner .uverse.address) intEntryCount is how many entries a register's book holds.
- OID
- 01e607…9591:44
EntryCount details
Capacity
func(owner .uverse.address) (assetsLeft int, entriesLeft int)Capacity reports how many more assets and entries a register can take.
- OID
- 01e607…9591:45
Capacity details
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.
- OID
- 01e607…9591:46
Totals details
IsBalanced
func(owner .uverse.address) boolIsBalanced reports whether the book's debits equal its credits.
- OID
- 01e607…9591:47
IsBalanced details
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.
- OID
- 01e607…9591:48
Equation details
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.
- OID
- 01e607…9591:49
Rederive details
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.
- OID
- 01e607…9591:50
Invariant details
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.
- OID
- 01e607…9591:51
CrossFoot details
Render
func(path string) stringRender shows the realm index at "/" and one owner's register at "/\<address>".
- OID
- 01e607…9591:52
Render details
renderIndex
func() string- OID
- 01e607…9591:53
renderIndex details
renderRegister
func(owner .uverse.address) string- OID
- 01e607…9591:54
renderRegister details
cell
func(s string) stringcell renders a caller-supplied string into a table cell. A blank value would collapse the column, so it is shown as a dash.
- OID
- 01e607…9591:55
cell details
yesno
func(b bool) string- OID
- 01e607…9591:56