Developers

Program

Instructions, accounts, statuses and errors of the Tack Solana program.

Tack is an Anchor program on Solana. Its address on the cluster you are using is in GET /status and in the app's network panel; GET /contract returns the IDL the service was built against, with its SHA-256.

Instructions

InstructionWho signsWhat it does
initialize_marketanyone, who pays rentValidates the configuration, reads Phoenix once, and creates the market, its vault and its creator's venue if needed. The signer is the market's admin.
create_listing(market_index, authority, config)the creator, who pays rentCreates a listing: a schedule of maturities, the terms they open with and the authority that may change them.
configure_listing(config)the listing's authorityReplaces the schedule and terms. Markets already open keep their terms.
propose_listing_authority(authority)the listing's authorityNames a successor. Nothing changes hands until the successor accepts; a new proposal replaces the last.
accept_listing_authoritythe proposed successorTakes the listing over.
list_market(maturity)anyone, who pays rentOpens a maturity the listing's schedule calls for now, on the listing's terms, with the listing as the market's admin.
checkpoint(sequence)anyone, who pays rentPublishes Phoenix's next funding record as checkpoint sequence. Finalizes the market at the record that starts at maturity.
create_order(id, notional, fixed_rate, maker_long, collateral)the makerPosts a whole-lot quote and moves its collateral to the vault.
cancel_orderthe makerReturns an open quote's collateral and marks it cancelled.
take_order(collateral)the takerFills a quote whole and opens a position with both sides' collateral; both legs start at the next funding record.
settleanyoneApplies up to eight checkpoints to a position, in order, with maintenance checks.
liquidateanyoneSettles to the latest checkpoint, then closes the position if a side is below maintenance.
top_up(amount)either sideSettles, then adds collateral to the signer's side.
withdraweither sidePays the signer's balance from a closed position, once.
finalize_frozenanyoneCloses a market at its last verified checkpoint when its source has failed past the freeze grace.

settle, liquidate and top_up take the checkpoints they apply as remaining accounts. Every instruction that touches a position also takes the market's venue account.

Accounts

AccountAddressHolds
MarketPDA("market", index u16, maturity i64, admin)Configuration, reference price, latest source reading, sequence, open interest, liabilities.
VaultPDA("vault", market)The market's USDC, an SPL Token account with the market as authority.
VenuePDA("venue", index u16, admin)SOL exposure of every open position across the maturities one creator opens; a listing's markets share the listing's venue.
OrderPDA("order", market, maker, id u64)A quote: maker, side, notional, fixed rate, collateral, status.
SwapPDA("swap", order)A position: both sides and balances, notional, rate, start time and total, last settled checkpoint and result, status.
FundingCheckpointPDA("checkpoint", market, sequence u64)One Phoenix funding record: cumulative funding and the start of its interval.
ListingPDA("listing", index u16, creator)A schedule (anchor, interval, lead, count), the terms its markets open with, its authority and any proposed successor.

Integers in seeds are little-endian. Quote and position accounts are never closed: they stay as the record of what happened.

A market's admin is its creator: the signer of initialize_market, or the listing for a market opened with list_market. The address includes it, so a market someone else opens at the same maturity never takes the address of the one Tack lists. Tack's listing is governed by TACK holders; see TACK token.

Errors

ErrorMeaning
ArithmeticChecked arithmetic overflowed, or a time or price was invalid.
InvalidConfigThe market or listing configuration is outside the program's bounds.
InvalidSourceThe account is not Phoenix's PerpAssetMap, or its SOL slot's layout, units, funding interval, period or clamp changed.
SourceStalePhoenix's accumulator or index price is older than maxAge, or dated in the future.
SourceTimePhoenix's interval or total is inconsistent with what the market saw.
MarketFrozenThe market is frozen.
SourceNotFrozenThe source is healthy or the freeze grace has not passed.
InvalidMintThe mint is not canonical six-decimal USDC.
MarketClosedThe maturity has passed, or its last funding interval has begun so a fill would start at maturity.
InvalidOrderThe notional is under 1 USDC, or the rate is over the cap or off the tick.
MarginCollateral is under the initial margin.
OrderClosedThe quote is filled or cancelled.
SelfTradeThe taker is the maker.
OpenInterestCapThe fill would pass the open-interest cap.
UnauthorizedThe signer is not the quote's maker, a side of the position, the listing's authority, or its proposed successor.
SwapClosedThe position has already closed.
HealthyThe position is above maintenance; nothing to liquidate.
SwapOpenCollateral stays locked while the position is open.
NothingToWithdrawThe signer's balance is already withdrawn.
VaultInvariantThe vault holds less than the market owes; no USDC leaves.
CheckpointRequiredPhoenix has a record the market has not published, or the position is not caught up.
CheckpointSequenceA checkpoint is missing, out of order, or from another market.
MissedFundingIntervalPhoenix moved more than one interval past the market; close it as frozen after the grace.
NotScheduledThe listing's schedule does not open this maturity now.
SourceRolloverPhoenix has not started the current funding interval yet; a market opens once it has, seconds after the hour.

Addresses

Address
USDC mintEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
SPL Token programTokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
Associated Token programATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
Phoenix programEtrnLzgbS7nMMy5fbD42kXiUzGg8XQzJ972Xtk1cjWih
Phoenix PerpAssetMap2nHGAaEw3D5dd4hVueaUNoygkQFmoeKqRQWnSPqSMFUC
Phoenix SOL market71Si24E4uc3oCaPbPZTozC1ptSNNqygjjebxSmErSsC2
SPL Governance programGovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw