Borrow
Moves
One transaction that moves funds between cash, Save and Orca: begin, up to nine steps, end. Either all of it lands healthy or none of it happens.
The shape of a move
begin(nonce, mode 0, end index)
adapter step 1
adapter step 2
… up to nine steps
end(nonce, withdraw USDC, withdraw SOL)begin reads the transaction's own instruction list and refuses to start unless a Yoke end with the same nonce sits at the stated index, with exactly the same accounts. Every instruction between them must be a Yoke adapter step with that nonce and those accounts: no token transfers, no other programs, no second begin. Every Yoke instruction in a move must be top-level, so no other program can call into the middle of it.
end pays out any withdrawal, values the whole account, and requires health of 1.10 or more. If any step or the final check fails, Solana reverts the transaction and nothing in it happened.
Steps
| Step | In the app | Amount | Limits you set |
|---|---|---|---|
| 0 | Deposit into Save | USDC to deposit | Fewest receipts to accept |
| 1 | Redeem from Save | Receipts to redeem | Least USDC to accept |
| 2 | Add Orca liquidity | LP tokens to mint | Most USDC and most SOL to spend |
| 3 | Remove Orca liquidity | LP tokens to burn | Least USDC and least SOL to accept |
After each call into Save or Orca, the adapter checks how much actually arrived in or left the account's token accounts against those limits. A step that lands outside them fails with error 704, and the whole move reverts.
The app lets you enter Save and Orca steps in USDC and converts them at the targets' current state, with a slippage limit of 0.1%, 0.5% or 1%. Orca deposits take USDC and SOL in the pool's ratio, so the account needs SOL beside the USDC; the app shows how much SOL each deposit pairs with.
Withdrawals
end can send USDC and SOL from the account to the owner's wallet. In the app these are the Send USDC to wallet and Send SOL to wallet steps; they always happen last, after every adapter step, and the 1.10 check runs after they leave. Sending SOL never changes health, because SOL counts for nothing.
Simulation
The app rebuilds and simulates the move against the chain every time a step or amount changes. The account picture shows a dashed outline of where the move would leave it. If the program would reject it, the reason appears in words before you sign, naming the step that failed.
Size and compute
Every move lists all four token accounts and all sixteen Save and Orca accounts, because end values the whole account. Moves are version 0 transactions and use the deployment's address lookup table to fit Solana's 1,232-byte limit. A move with a Save deposit and an Orca deposit uses about 391,000 compute units; the app asks for 1,000,000.
Modes
The same begin … end frame serves three purposes, set by begin's mode:
| Mode | Who | Steps allowed | What end does |
|---|---|---|---|
| 0, move | Owner | All four | Optional withdrawals, then requires 1.10 |
| 1, close | Owner | Redeem and remove only | Requires no receipts left, repays the debt in full, returns everything |
| 2, liquidation | Anyone, below 1.00 | Redeem and remove only | Repays the pool, pays the liquidator 5% of the repayment |
See Closing and release and Liquidations.