API reference
Program id 3EgkAd9FSZhofeh7MZVPk7QdSVKQUCuz8qyYQ2xabzdP, Anchor 0.30.1. Four instructions, one account type, two events.
create_feed
Create the one feed for a mint at PDA ["feed", mint].
| Account | Signer | Writable | Notes |
|---|---|---|---|
| payer | yes | yes | pays 0.0059 SOL rent |
| mint | an initialized SPL Token or Token-2022 mint | ||
| feed | yes | PDA ["feed", mint], created with init | |
| system_program |
Args: none. Fails with InvalidMint, or NumeraireHasNoFeed for wSOL. A second call for the same mint fails because the account exists.
add_venue
Attach a DEX pool that trades the feed's mint against wSOL or USDC.
| Account | Signer | Writable | Notes |
|---|---|---|---|
| feed | yes | ||
| pool | owned by one of the seven supported DEX programs | ||
| bridge | optional: the USDC feed; required for a USDC-quoted pool |
Args: none. Anyone may call it. A new venue starts with zero confirmed depth. When all 8 slots are taken, a venue can be replaced only if it is older than 3,000 slots and holds under 1% of the feed's confirmed depth. Emits VenueAdded.
Fails with UnsupportedVenue, VenueLayout, VenueMintMismatch, UnsupportedQuote, DuplicateVenue, VenueListFull, BridgeRequired.
update
Read every venue and fold the result into the feed. Permissionless.
| Account | Signer | Writable | Notes |
|---|---|---|---|
| feed | yes | ||
| bridge | optional: the USDC feed; required if the feed has a USDC-quoted pool | ||
| remaining | every stored venue in order: the pool, then its vaults or bin array (see Architecture) |
Args: none. The first update in a slot takes the slot's sample; later ones do nothing. Emits FeedUpdated.
Fails with VenueAccountsMismatch or BridgeRequired. A pool whose owner, layout or mints no longer match reads as no sample instead of failing.
read
Return the price, refusing if it is warming up, stale, or too uncertain for the caller.
| Account | Notes |
|---|---|
| feed | |
| quote_feed | optional: price in that feed's token instead of SOL (the USDC feed for dollars) |
| Arg | Type | Meaning |
|---|---|---|
max_age_slots | u64 | refuse if the feed was last updated more than this many slots ago |
max_conf_ticks | u32 | refuse if the band's half-width is wider than this |
Returns PriceView. Fails with NotLive, Stale, TooUncertain. 6,400 compute units.
PriceView
| Field | Type | Meaning |
|---|---|---|
steady_tick | i32 | the steady price as a tick |
spot_tick | i32 | the depth-weighted median right now |
conf_ticks | u32 | half-width of the band, in ticks |
price_q64 | u128 | the steady price as Q64.64 quote raw units per base raw unit |
depth | u64 | confirmed depth within 2%, lamports |
top_share_bps | u16 | largest pool's share of depth |
last_update_slot | u64 | the older of the two feeds when a quote feed is used |
base_decimals | u8 | the token's decimals |
quote_decimals | u8 | 9 for SOL, or the quote feed's mint decimals |
Feed
720 bytes. See Architecture for byte offsets.
| Field | Type | Meaning |
|---|---|---|
mint | Pubkey | the token this feed prices |
decimals, bump, venue_count | u8 | |
has_spot, steady_set | bool | the last update produced a spot; the steady price has been seeded |
created_slot, last_update_slot, credited_slots | u64 | credited slots count toward the 600-slot warm-up |
steady_x16 | i64 | steady tick x 65,536 |
spot_tick | i32 | |
conf_ticks | u32 | |
depth | u64 | |
top_share_bps | u16 | |
live_venues | u8 | venues that carried weight at the last update |
buckets | [Bucket; 3] | the last three 10-second buckets: id, lowest and highest spot |
venues | [Venue; 8] | pool, kind, base_is_first, quote, alive, added_slot, tick, depth, depth_ewma, weight |
Events
| Event | Fields |
|---|---|
FeedUpdated | mint, slot, steady_tick, spot_tick, conf_ticks, depth, live_venues |
VenueAdded | mint, pool, kind, replaced (optional pool) |
Constants
| Constant | Value | Meaning |
|---|---|---|
| MAX_VENUES | 8 | pools per feed |
| TAU_PRICE | 300 slots | steady price time constant |
| TAU_DEPTH | 1,500 slots | confirmed depth time constant |
| MAX_HOLD | 75 slots | the longest one sample is credited for |
| MAX_STEP_TICKS | 1,000 | clamp on one pull of the steady price |
| BUCKET_SLOTS | 25 | one bucket, about 10 seconds |
| WINDOW_BUCKETS | 3 | the window the steady price follows |
| LIVE_AFTER | 600 slots | warm-up |
| BRIDGE_MAX_AGE | 150 slots | the oldest USDC feed used to convert USDC pools |
| EVICT_SHARE_BPS | 100 | a venue under 1% of depth may be replaced |
| EVICT_MIN_AGE | 3,000 slots | and only once it is this old |
| REF_TRADE | 1 SOL | the trade whose impact is in the band |
Client helpers (sdk/jika.mjs)
| Export | Does |
|---|---|
feedAddress(mint) | the feed PDA |
createFeedIx, addVenueIx, updateIx, readIx | instruction builders |
decodeFeed, decodePriceView | account and return data decoders |
tickToPrice(tick, baseDecimals, quoteDecimals = 9) | a tick in whole-token units |
bandFraction(ticks) | 1.0001^ticks - 1 |