API reference

Every instruction, account and field.

Every instruction of the CARRY program, in the order a deployment uses them. Arguments and accounts come straight from the IDL. Rates are per period scaled by 1e12; amounts are USDC base units.

initialize

Creates the pool and its two vaults. Only the program upgrade authority may call it.

ArgumentType
paramsPoolParams
AccountSignerWritable
authorityyesyes
poolyes
usdc_mint
vaultyes
fee_vaultyes
treasury
buyback
program
program_data
token_program
system_program

update_pool

Changes pool-level settings: keeper, fees, burn share, cooldown, grace, treasury and buyback.

ArgumentType
paramsPoolParams
AccountSignerWritable
authorityyes
poolyes
treasury
buyback

set_paused

Pauses or resumes new positions and deposits. Exits, settlement, liquidation and withdrawals keep working.

ArgumentType
pausedbool
AccountSignerWritable
authorityyes
poolyes

propose_authority

First step of the two-step authority handover.

ArgumentType
new_authoritypubkey
AccountSignerWritable
authorityyes
poolyes

accept_authority

Second step; signed by the proposed authority.

AccountSignerWritable
new_authorityyes
poolyes

create_market

Opens one series for (venue, coin, maturity) with its risk parameters and starting anchor.

ArgumentType
venueVenue
coin{"array": ["u8", 8]}
maturityi64
paramsMarketParams
AccountSignerWritable
authorityyesyes
poolyes
marketyes
system_program

post_print

Posts the realized funding of the next unprinted period. source_ts must equal that period's end.

ArgumentType
source_tsi64
ratei64
AccountSignerWritable
keeperyes
poolyes
marketyes

open_position

Opens a position against the pool. Pays margin + fee; fails if the quote is worse than limit_rate.

ArgumentType
idu32
sideSide
notionalu64
marginu64
limit_ratei64
AccountSignerWritable
owneryesyes
poolyes
marketyes
positionyes
owner_usdcyes
vaultyes
fee_vaultyes
token_program
system_program

add_margin

Adds USDC margin to an open position.

ArgumentType
amountu64
AccountSignerWritable
owneryes
poolyes
positionyes
owner_usdcyes
vaultyes
token_program

close_position

Closes early at the exit quote for the remaining tenor, or after maturity at what accrued.

ArgumentType
limit_ratei64
AccountSignerWritable
calleryes
owneryes
poolyes
marketyes
positionyes
owner_usdcyes
vaultyes
fee_vaultyes
token_program

settle_position

Settles a position once its market is fully printed or expired. Anyone may call; the owner is paid.

AccountSignerWritable
calleryes
owneryes
poolyes
marketyes
positionyes
owner_usdcyes
vaultyes
fee_vaultyes
token_program

liquidate

Closes a position below maintenance margin at the anchor; the liquidator receives a capped reward.

AccountSignerWritable
exit
liquidator_usdcyes

deposit

Deposits USDC for pool shares. Remaining accounts are every active market, sorted by address.

ArgumentType
amountu64
AccountSignerWritable
owneryesyes
poolyes
lpyes
owner_usdcyes
vaultyes
token_program
system_program

request_withdraw

Locks shares for withdrawal and starts the cooldown.

ArgumentType
sharesu64
AccountSignerWritable
owneryes
pool
lpyes

withdraw

Completes a withdrawal after the cooldown at the share price at that moment.

AccountSignerWritable
owneryesyes
poolyes
lpyes
owner_usdcyes
vaultyes
token_program

sweep_fees

Moves the fee vault to the stored treasury and buyback accounts by burn_share_bps.

AccountSignerWritable
pool
fee_vaultyes
treasuryyes
buybackyes
token_program

close_market

Closes a finished market with no open positions; rent goes back to its creator.

AccountSignerWritable
poolyes
marketyes
creatoryes

Accounts

AccountFields
LpAccountowner, shares, pending_shares, unlock_ts, bump
Marketvenue, coin, maturity, open_ts, period_secs, total_periods, next_period, buffer_periods, rate_cap, skew, spread, cap_share_bps, ema_alpha, anchor, last_rate, last_source_ts, cum_index, net_notional, fixed_sum, open_positions, creator, bump
Poolauthority, pending_authority, keeper, usdc_mint, treasury, buyback, protocol_fee_bps, burn_share_bps, liquidation_reward_bps, cooldown_secs, settle_grace_secs, paused, active_markets, lp_cash, total_margin, total_shares, trader_pnl, bump, vault_bump, fee_vault_bump
Positionowner, market, id, side, notional, margin, fixed_rate, entry_period, entry_cum, bump