CARRY is one Anchor program, one keeper process and a static site. The program owns all state and money. The keeper only posts prints. The site reads the chain and the venues and builds transactions for your wallet.
flowchart TB
subgraph Solana
Pool[Pool PDA]
Vault[(USDC vault PDA)]
Fee[(Fee vault PDA)]
M1[Market PDAs]
Pos[Position PDAs]
LP[LP account PDAs]
end
Keeper -->|post_print| M1
Authority -->|create_market, update_pool| Pool
Wallet -->|open, close, settle, deposit, withdraw| Pool
Pool --- Vault
Pool --- Fee
linkStyle 0 stroke:#d1a148,stroke-width:3pxAccounts
| Account | Seeds | Size | Holds |
|---|---|---|---|
| Pool | ["pool"] | 261 B | Authority, keeper, fee settings, lp_cash, total_margin, trader_pnl, share supply |
| USDC vault | ["vault"] | token account | LP cash and every trader's margin |
| Fee vault | ["fee_vault"] | token account | Protocol share of fees until swept |
| Market | ["market", venue u8, coin [u8;8], maturity i64 LE] | 198 B | Schedule, risk parameters, anchor, cumulative index, net notional |
| Position | ["position", market, owner, id u32 LE] | 122 B | Side, notional, margin, fixed rate, entry period and index |
| LP account | ["lp", owner] | 65 B | Shares and any pending withdrawal |
Venue byte is 0 for Hyperliquid and 1 for Binance. The coin is up to eight uppercase ASCII letters or digits, zero padded. Because the venue, coin and maturity are the seeds, exactly one market exists for each series.
Invariants the tests assert
vault balance == lp_cash + total_marginafter every instruction that moves USDC.pool.trader_pnlequals the sum of every position's own accrual, recomputed from all positions after each test phase.- Every rounding goes against the trader: fixed rate up for payers and down for receivers, margin and fees up, trader value down.
The keeper
node keeper/keeper.ts run posts every finished period, in order, with the exact decimal rate from Hyperliquid fundingHistory and Binance fundingRate. node keeper/keeper.ts roll opens the next 28-day series for each launch market, signed by the pool authority, with an anchor equal to the EMA of the venue's last 60 days of funding.
Cost at launch: 75 prints a day across the four markets at about 8,000 compute units each, which is 0.000375 SOL a day in base fees.
The site
The landing and the app read funding history straight from the two venues' public APIs and read pool and market accounts from Solana. The app builds each transaction in your browser and your wallet signs it first. A trade is one instruction with your wallet as the only signer and no address lookup table.