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.
| Argument | Type |
|---|
params | PoolParams |
| Account | Signer | Writable |
|---|
authority | yes | yes |
pool | | yes |
usdc_mint | | |
vault | | yes |
fee_vault | | yes |
treasury | | |
buyback | | |
program | | |
program_data | | |
token_program | | |
system_program | | |
update_pool
Changes pool-level settings: keeper, fees, burn share, cooldown, grace, treasury and buyback.
| Argument | Type |
|---|
params | PoolParams |
| Account | Signer | Writable |
|---|
authority | yes | |
pool | | yes |
treasury | | |
buyback | | |
set_paused
Pauses or resumes new positions and deposits. Exits, settlement, liquidation and withdrawals keep working.
| Account | Signer | Writable |
|---|
authority | yes | |
pool | | yes |
propose_authority
First step of the two-step authority handover.
| Argument | Type |
|---|
new_authority | pubkey |
| Account | Signer | Writable |
|---|
authority | yes | |
pool | | yes |
accept_authority
Second step; signed by the proposed authority.
| Account | Signer | Writable |
|---|
new_authority | yes | |
pool | | yes |
create_market
Opens one series for (venue, coin, maturity) with its risk parameters and starting anchor.
| Argument | Type |
|---|
venue | Venue |
coin | {"array": ["u8", 8]} |
maturity | i64 |
params | MarketParams |
| Account | Signer | Writable |
|---|
authority | yes | yes |
pool | | yes |
market | | yes |
system_program | | |
post_print
Posts the realized funding of the next unprinted period. source_ts must equal that period's end.
| Argument | Type |
|---|
source_ts | i64 |
rate | i64 |
| Account | Signer | Writable |
|---|
keeper | yes | |
pool | | yes |
market | | yes |
open_position
Opens a position against the pool. Pays margin + fee; fails if the quote is worse than limit_rate.
| Argument | Type |
|---|
id | u32 |
side | Side |
notional | u64 |
margin | u64 |
limit_rate | i64 |
| Account | Signer | Writable |
|---|
owner | yes | yes |
pool | | yes |
market | | yes |
position | | yes |
owner_usdc | | yes |
vault | | yes |
fee_vault | | yes |
token_program | | |
system_program | | |
add_margin
Adds USDC margin to an open position.
| Account | Signer | Writable |
|---|
owner | yes | |
pool | | yes |
position | | yes |
owner_usdc | | yes |
vault | | yes |
token_program | | |
close_position
Closes early at the exit quote for the remaining tenor, or after maturity at what accrued.
| Argument | Type |
|---|
limit_rate | i64 |
| Account | Signer | Writable |
|---|
caller | yes | |
owner | | yes |
pool | | yes |
market | | yes |
position | | yes |
owner_usdc | | yes |
vault | | yes |
fee_vault | | yes |
token_program | | |
settle_position
Settles a position once its market is fully printed or expired. Anyone may call; the owner is paid.
| Account | Signer | Writable |
|---|
caller | yes | |
owner | | yes |
pool | | yes |
market | | yes |
position | | yes |
owner_usdc | | yes |
vault | | yes |
fee_vault | | yes |
token_program | | |
liquidate
Closes a position below maintenance margin at the anchor; the liquidator receives a capped reward.
| Account | Signer | Writable |
|---|
exit | | |
liquidator_usdc | | yes |
deposit
Deposits USDC for pool shares. Remaining accounts are every active market, sorted by address.
| Account | Signer | Writable |
|---|
owner | yes | yes |
pool | | yes |
lp | | yes |
owner_usdc | | yes |
vault | | yes |
token_program | | |
system_program | | |
request_withdraw
Locks shares for withdrawal and starts the cooldown.
| Account | Signer | Writable |
|---|
owner | yes | |
pool | | |
lp | | yes |
withdraw
Completes a withdrawal after the cooldown at the share price at that moment.
| Account | Signer | Writable |
|---|
owner | yes | yes |
pool | | yes |
lp | | yes |
owner_usdc | | yes |
vault | | yes |
token_program | | |
sweep_fees
Moves the fee vault to the stored treasury and buyback accounts by burn_share_bps.
| Account | Signer | Writable |
|---|
pool | | |
fee_vault | | yes |
treasury | | yes |
buyback | | yes |
token_program | | |
close_market
Closes a finished market with no open positions; rent goes back to its creator.
| Account | Signer | Writable |
|---|
pool | | yes |
market | | yes |
creator | | yes |
Accounts
| Account | Fields |
|---|
LpAccount | owner, shares, pending_shares, unlock_ts, bump |
Market | venue, 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 |
Pool | authority, 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 |
Position | owner, market, id, side, notional, margin, fixed_rate, entry_period, entry_cum, bump |