Contract reference

For integrators. Calls are alkanes cellpacks [block, tx, opcode, args...]. An AlkaneId argument is two words, block then tx. View results are little-endian u128 words, 16 bytes each with no framing; an empty result means "no such thing". Read views with metashrew_view("simulate", ...). USD and prices are 1e8 fixed point and times are unix seconds.

"admin" means the pool's SABLITAL-ADMIN token must be among the incoming alkanes, "SIGIL" the SABLITAL-SIGIL, and "holder" the stream's NFT. Tokens sent in for authorization come back in the same call.

Payroll pool

opnameargswho
0Initializetoken, stream_template, orbital_template, pricebookdeployer; mints ADMIN + SIGIL
1Depositnone (send the token in)anyone
2Withdrawamountadmin; at most balance − debt
3CreateStreamstart, interval, initial_usd, usd_per_tick, budget_usd, cancelable, min_price, max_diesel_per_tick, twap_window, cap, name, symboladmin; returns the stream NFT, data = stream id
4Authorizestream, capadmin; cap ≥ drawn + debt, 0 = unlimited
5Revokestreamadmin; booked debt stays drawable
6Drawamountauthorized stream only (caller)
7SigilSweeptoken, amount (0 = all)SIGIL
8SigilRepointpricebookSIGIL; for streams created afterwards
opviewreturns
10GetBalancebalance
11GetTokenblock ‖ tx
12GetAuthTokenadmin token block ‖ tx
13GetStreamCountcount
14GetStream(index)block ‖ tx
15GetAllowance(stream)active ‖ cap ‖ drawn ‖ debt
16GetDebttotal debt
17GetConfigstream_template ‖ orbital_template ‖ pricebook block ‖ tx
18GetSigilblock ‖ tx

Payroll stream

Created by a pool's CreateStream; never deploy one by hand.

opnameargswho
1Settlemax_ticks (0 = default 4)anyone
2Claimnoneholder; settles, then pays
3Cancelnoneadmin; cancelable streams only
4Extendadd_usdadmin
5Amendusd_per_tick, interval, next_tick_time (0 = keep), budget_usdadmin
6Bonususdadmin
7Advanceusdadmin
8SigilSweeptoken, amount (0 = all)SIGIL; freezes the stream
9Collectnoneholder; no external calls
30SigilRepointpricebookSIGIL
opviewreturns
10GetConfigpool, pricebook, admin, token (2 words each) ‖ start ‖ interval ‖ initial_usd ‖ usd_per_tick ‖ budget_usd ‖ cancelable ‖ min_price ‖ max_diesel_per_tick ‖ twap_window ‖ base_k ‖ base_time ‖ base_usd ‖ sigil (2 words)
11GetTick(k)time ‖ height ‖ price ‖ usd ‖ diesel ‖ flags
12GetTotalsusd_vested ‖ diesel_vested ‖ diesel_drawn ‖ diesel_claimed ‖ usd_scheduled ‖ advance_outstanding ‖ bonus_usd
13GetProgressticks_settled ‖ ticks_due_unsettled ‖ next_tick_time ‖ scheduled_usd_remaining ‖ canceled ‖ end_time ‖ swept
14GetOrbitalNFT block ‖ tx
15IsCanceled0 or 1
16GetPoolblock ‖ tx
17GetGrantCountcount
18GetGrant(i)time ‖ height ‖ price ‖ usd ‖ diesel ‖ kind (1 bonus, 2 advance)
99 / 100GetName / GetSymbolstring

Tick flags are a bitfield: 1 gap, 2 late, 4 interpolated.

Schedule arithmetic

Tick 0 is at start and pays initial_usd. After an Amend, tick base_k + j is at base_time + j·interval and pays usd_per_tick. Scheduled USD never exceeds budget_usd, so the last tick is clipped. An outstanding advance is recovered from each tick's gross USD before conversion. DIESEL for a tick is floor(usd · 1e8 / max(price, min_price)), capped at max_diesel_per_tick when that is set.

Pricebook

One per oracle feed (DIESEL/USD: TUNDRACLE 4:9010, key 3).

opnameargsreturns
0Initializeoracle, key, max_stale (blocks)none
1Recordnone1 if a new oracle write was recorded
2RecordAndQuotet0, step, nas PricesAtTimes, after recording
10PriceAtheightprice ‖ entry_height ‖ status ‖ flags
11PricesAtTimest0, step, n (≤ 64)n × (price ‖ height ‖ status ‖ flags)
12GetEntryindexoracle_height ‖ price ‖ updates ‖ gap
13GetCountnoneentries
14GetSourcenoneoracle block ‖ tx ‖ key ‖ max_stale ‖ observed_height
15HeightAttimeheight ‖ status ‖ flags
16GetAnchorindexheight ‖ time
17GetAnchorCountnoneanchors
18TwapAttime, windowtwap ‖ status ‖ flags
19TwapsAtTimest0, step, n, windown × (twap ‖ status ‖ flags)

Status: 0 ok, 1 not yet knowable (record later), 2 stale (waiting for the next oracle write).

Vest controller

Template 4:1792; each vest is its own instance.

opnameargswho
0Initializevesting_token, orbital_template, start, cliff, duration, initial_unlock_bps, cancelable, name, symboldeployer; mints the admin NFT
1Seednone (send the token in)anyone
2CreatePositionsquantities (witness: u32 count, then count × u128)admin
3Claimnoneholder
4Cancelposition_idadmin
5WithdrawExcessnoneadmin
opviewreturns
10GetVested(position)amount
11GetClaimed(position)amount
12GetWithdrawable(position)amount
13GetQuantity(position)amount
14GetPositionOf(orbital)position id, or u128::MAX
15GetCountpositions
16GetChild(index)orbital block ‖ tx
17GetSchedulestart ‖ cliff ‖ duration ‖ initial_unlock_bps
18GetTotalsdeposited ‖ committed ‖ claimed
19GetVestingTokenblock ‖ tx
20IsCanceled(position)0 or 1
21GetCancelable0 or 1
99 / 100GetName / GetSymbolstring