UNLIT

Integration

What a wallet, an explorer or another program can read and do. The program id is published after deploy.

Reading the fund

const [fund] = PublicKey.findProgramAddressSync([Buffer.from("fund")], PROGRAM_ID)
const vault = (mint: PublicKey) => PublicKey.findProgramAddressSync([Buffer.from("vault"), mint.toBuffer()], PROGRAM_ID)[0]
const [order] = PublicKey.findProgramAddressSync([Buffer.from("order")], PROGRAM_ID)
const [rules] = PublicKey.findProgramAddressSync([Buffer.from("rules")], PROGRAM_ID)

The Fund account holds the eight assets with their vaults and price accounts (Pyth for the crypto assets, Kamino Scope for the stocks and gold), the two route programs, the parameters, the pause flag, the high-water mark (high_water_pps), and the day's turnover (epoch_start_nav, epoch_traded_value). The value per share is the vaults valued at those prices divided by the share supply.

Reading a holder's balance

You cannot, unless you are the holder. A confidential share account exposes ElGamal ciphertexts for the pending and available balances and an authenticated-encryption copy only the holder's key opens.

Depositing from another program

deposit(amount, min_shares) takes the depositor's USDC account and their configured share account; the program mints and makes the confidential Deposit itself.

Watching the manager

Subscribe to the program's events:

EventFields
Depositeddepositor, amount, shares, nav_before, supply_before
Redeemedredeemer, shares, amounts (eight), supply_before
FeeAccruedfee_shares, nav, high_water_pps
DecisionRequestedvalues (eight), nav
OrderDecidedsell, buy, gap_bps, act, decisions
TradeExecutedsell, buy, sold, bought, value_in, value_out, route, epoch_traded_value
RulesScheduled, RulesSealed, RulesActivatedwhen the rule set changes

Price relay

GET /api/prices returns the eight assets in USD with a source field (jupiter, coingecko or cached). It never returns an error status: when every source fails and nothing is cached, prices is null. The program does not use it.