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].

AccountSignerWritableNotes
payeryesyespays 0.0059 SOL rent
mintan initialized SPL Token or Token-2022 mint
feedyesPDA ["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.

AccountSignerWritableNotes
feedyes
poolowned by one of the seven supported DEX programs
bridgeoptional: 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.

AccountSignerWritableNotes
feedyes
bridgeoptional: the USDC feed; required if the feed has a USDC-quoted pool
remainingevery 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.

AccountNotes
feed
quote_feedoptional: price in that feed's token instead of SOL (the USDC feed for dollars)
ArgTypeMeaning
max_age_slotsu64refuse if the feed was last updated more than this many slots ago
max_conf_ticksu32refuse if the band's half-width is wider than this

Returns PriceView. Fails with NotLive, Stale, TooUncertain. 6,400 compute units.

PriceView

FieldTypeMeaning
steady_ticki32the steady price as a tick
spot_ticki32the depth-weighted median right now
conf_ticksu32half-width of the band, in ticks
price_q64u128the steady price as Q64.64 quote raw units per base raw unit
depthu64confirmed depth within 2%, lamports
top_share_bpsu16largest pool's share of depth
last_update_slotu64the older of the two feeds when a quote feed is used
base_decimalsu8the token's decimals
quote_decimalsu89 for SOL, or the quote feed's mint decimals

Feed

720 bytes. See Architecture for byte offsets.

FieldTypeMeaning
mintPubkeythe token this feed prices
decimals, bump, venue_countu8
has_spot, steady_setboolthe last update produced a spot; the steady price has been seeded
created_slot, last_update_slot, credited_slotsu64credited slots count toward the 600-slot warm-up
steady_x16i64steady tick x 65,536
spot_ticki32
conf_ticksu32
depthu64
top_share_bpsu16
live_venuesu8venues 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

EventFields
FeedUpdatedmint, slot, steady_tick, spot_tick, conf_ticks, depth, live_venues
VenueAddedmint, pool, kind, replaced (optional pool)

Constants

ConstantValueMeaning
MAX_VENUES8pools per feed
TAU_PRICE300 slotssteady price time constant
TAU_DEPTH1,500 slotsconfirmed depth time constant
MAX_HOLD75 slotsthe longest one sample is credited for
MAX_STEP_TICKS1,000clamp on one pull of the steady price
BUCKET_SLOTS25one bucket, about 10 seconds
WINDOW_BUCKETS3the window the steady price follows
LIVE_AFTER600 slotswarm-up
BRIDGE_MAX_AGE150 slotsthe oldest USDC feed used to convert USDC pools
EVICT_SHARE_BPS100a venue under 1% of depth may be replaced
EVICT_MIN_AGE3,000 slotsand only once it is this old
REF_TRADE1 SOLthe trade whose impact is in the band

Client helpers (sdk/jika.mjs)

ExportDoes
feedAddress(mint)the feed PDA
createFeedIx, addVenueIx, updateIx, readIxinstruction builders
decodeFeed, decodePriceViewaccount and return data decoders
tickToPrice(tick, baseDecimals, quoteDecimals = 9)a tick in whole-token units
bandFraction(ticks)1.0001^ticks - 1
NextError reference