Users: contract design
Instructions
Every instruction that opens, changes or settles a user's position, for covered calls and for cash-secured puts. For each one: who signs, the accounts in order, every check the program runs, exactly which tokens move, the state change and the errors.
#How to read this page
- You are the writer: the wallet that sold the option and owns the position.
- Accounts are listed in the exact order the instruction expects. w means writable. s means it must sign.
- Anchor checks run first. Before any handler code runs, the framework checks each account's type, address seeds, owner and the constraints listed in the tables. Then the handler runs the checks in the order shown. The first check that fails decides the error you see.
- One transaction, all or nothing. If any check or any token transfer fails, the transaction fails and Solana rolls back its effects: no token moves and no account state changes. A failed transaction that was submitted and processed can still charge its SOL network fee to the fee payer.
- Error codes are covr's program codes unless marked otherwise. The error table at the end lists them all.
#Symbols
| Symbol | Meaning | Unit |
|---|
| Q | Quantity of the asset in the position (quantity_atoms) | asset atoms |
| T | Strike amount (strike_usdc) | payment-token atoms (6 decimals) |
| G | Gross premium the maker pays | payment-token atoms |
| F | Market fee taken from G | payment-token atoms |
| d | Decimals of the asset mint (9 for JitoSOL) | |
#How amounts are computed
The same formulas apply to every product. T and G must each come out as a whole number of atoms above zero, or the fill is refused with InvalidAmount (6002). T and G are never rounded. The fee rounds down to a whole atom of the payment token, so any fraction stays with you. The only other rounding is the flash exercise floor, which rounds up and protects the maker (see begin_flash_exercise_v3).
| Amount | Formula |
|---|
| T | Q × strike_e8 / 10^(d+2), exact |
| G | Q × price_e18 / 10^(d+12), exact |
| F | floor(G × fee_bps / 10,000), rounded down to a whole atom, with fee_bps at most 1,000 |
| Paid to you at fill | G − F |
Example, with round illustrative numbers only. A market on JitoSOL (d = 9) with a $220 strike stores strike_e8 = 22,000,000,000. A maker quotes 2 USDC per JitoSOL, so price_e18 = 2 × 10^18. The market fee is 1,000 bps in this example.
| Q = 1,000,000,000 (1 JitoSOL) | Q = 1,000,000,001 |
|---|
| T | 220,000,000 atoms (220 USDC) | 220,000,000.22: not whole, refused |
| G | 2,000,000 atoms (2 USDC) | 2,000,000.002: not whole, refused |
| F | 200,000 atoms (0.2 USDC) | |
| Paid to you | 1,800,000 atoms (1.8 USDC) | Nothing. The fill fails with 6002 and no tokens move. |
#Summary
Puts are part of the same program as calls. They use their own instructions, their own record mode and their own signing domain.
Note
covr's app prepares fill_v3 to open a covered call and release_v3 to unlock it, and fill_put_v3 and release_put_v3 for a cash-secured put. You sign each one in your wallet. A release needs no signature from you: you can send it, or anyone else can, and it pays only the position's writer. covr's app does not offer early close, transfer or sale for current positions, and covr's quote service does not collect early-close or sale quotes for them. The program still accepts these instructions from your own wallet, with a maker's signed quote where one is needed.
This page covers positions opened by fill_v3, fill_restricted_v3 and fill_put_v3. Positions in the program's original 130-byte format have their own instructions, listed in Position lifecycle. On 21 October 2026 none of them was open.
#Covered calls
You lock Q of the asset. The maker pays you the premium now. At expiry the maker may buy your asset for T.
#fill_v3
Opens a covered call from a maker's signed quote. You sign and send it. covr's server prepares it for you.
| |
|---|
| Signer | You. You pay the rent for the position account (652 bytes) and its collateral vault. |
| Arguments | auction_id: [u8; 32], nonce: u64, quantity_atoms: u64 (Q), price_e18: u128, valid_until: i64, signature: [u8; 65] |
| Discriminator | 07aeccf9e765bb35 |
| # | Account | w | s | Why |
|---|
| 0 | writer | w | s | You. Pays rent and is the source of the asset. |
| 1 | market | | | The market. Its terms set strike, expiry, window, fee and limits. |
| 2 | maker | | | The quoting maker's account. |
| 3 | position | w | | Created. Address: seeds "position", maker quote-key address, nonce. |
| 4 | collateral_vault | w | | Created. Token account for the asset at seeds "collateral", position. Its owner is the position address, not covr. |
| 5 | collateral | | | Asset mint. Must equal the market's asset (Anchor 2012). |
| 6 | payment | | | USDC mint. Pinned address (Anchor 2012). |
| 7 | writer_collateral | w | | Your asset account. Debited Q. Must be yours and of the asset mint (Anchor 2015, 2014). |
| 8 | writer_payment | w | | Your USDC account. Receives G − F. Must be yours (Anchor 2015). |
| 9 | fee_tokens | w | | USDC account owned by the market's fee owner. Receives F (8300 otherwise). |
| 10 | payment_vault | w | | The maker's USDC vault, seeds "stable", maker, USDC. Pays G. |
| 11 | collateral program | | | Must equal the market's token program (Anchor 2012). |
| 12 | payment program | | | SPL Token (Anchor 2012). |
| 13 | system program | | | |
| 14 | exposure | w | | The maker's exposure counter for this asset. |
| 15 | premium_budget | w | | The maker's premium budget. |
| 16 | policy | | | The maker's mint policy for this asset. |
| 17 | usage | w | | The maker's usage counters for this asset. |
| 18 | origin | | | The maker's registration or migration record. |
| extra | Jito stake pool | | | JitoSOL fills only, required, read-only. A maker that migrated from older records may add one read-only holds record after it. |
Checks, in order.
auction_id is not zero. Else InvalidOrder (6003).
- The market is a canonical covered-call market: owned by the program, 376 bytes, at its own address, USDC payment, valid terms. Else 8200, 8201, 8202 or 8203.
- The asset mint still has the profile the market recorded at creation: a plain 82-byte mint, no freeze authority, same fingerprint and decimals. Else
MarketV3Identity (8201) or MarketV3Unsupported (8203).
- The maker account is canonical (7600, 7602) and its origin record belongs to it and to this deployment (8700, 8701). The extra accounts match the rule above (8800). On JitoSOL: the pool account is the Jito stake pool, read-only, and updated this epoch (
InvalidJitoPool 6009), and the fill is worth at most 50 SOL of pool value (JitoSolOrderLimit 6008).
- The USDC mint is a plain 6-decimal SPL Token mint. Else 8300.
- The market is not paused,
now < expiry, now < valid_until <= expiry, nonce >= maker.min_nonce, nonce != u64::MAX, and 0 < Q <= max_quantity_atoms. Else InvalidOrder (6003).
- The maker's exposure, budget, policy and usage accounts are current and at their canonical addresses (8300), and the policy and usage belong to this maker, its owner key and this asset (6010, 6011, 6012, 6014, 8300).
- T and G are exact and above zero. Else
InvalidAmount (6002).
- The maker's quote signature recovers to the maker's quote key over
QuoteV2, in this market's signing domain, bound to this auction_id and to your wallet. Else BadSignature (6000).
- The maker's own policy accepts the fill: enabled, same terms and asset fingerprint as the market, and every cap still holds after the fill. Else
TokenLifecycleAccounting (8302) or MakerMigrationLimit (8704).
exposure.active + Q <= exposure.limit. Else ExposureLimit (6006).
- If the maker's premium budget is on,
spent + G <= limit. Else PremiumBudgetExceeded (6007).
- The new position record is valid. Else 8301.
Token movements. Each transfer is checked before it runs: the destination must belong to the intended party, have no delegate and no close authority other than its owner, and not be frozen. The source must hold enough.
| Amount | From | To | Signed by |
|---|
| Q asset | your writer_collateral | the position's collateral_vault | you |
| G − F USDC | the maker's payment_vault | your writer_payment | the program, for the maker vault |
| F USDC, if above zero | the maker's payment_vault | fee_tokens | the program, for the maker vault |
State change. A new position in state OPEN (0). It records you as writer, the maker, the market, the asset and payment mints, Q, G, T, opened_at = now, and the market's expiry and window. The maker's usage, exposure and budget counters go up by Q, T and G. See Accounts for every field.
Errors. 6000, 6002, 6003, 6006, 6007, 6008, 6009, 6010 to 6014, 7400 to 7406, 7600, 7602, 8200 to 8203, 8300, 8301, 8302, 8700, 8701, 8704, 8800. If the maker's vault holds less than G, or your account holds less than Q, the fill fails with CustodyInvalidAmount (7405). If that maker already used this nonce, the position address exists and the System program refuses to create it again.
#exercise_v3
The maker buys your asset at the strike. Ordinary covered-call markets only.
| |
|---|
| Signer | The maker's owner key or its registered operator. You do not sign. |
| Arguments | none |
| Discriminator | 1512034972d6645f |
| # | Account | w | s | Why |
|---|
| 0 | authority | | s | Maker owner key or operator. Else 8304. |
| 1 | market | | | The position's market. |
| 2 | maker | | | The position's maker. |
| 3 | position | w | | State changes to exercised. |
| 4 | collateral_vault | w | | Pays Q, then is closed. |
| 5 | writer | | | Must equal the position's current writer. Not a signer. |
| 6 | collateral | | | Asset mint. |
| 7 | writer_collateral | w | | Your asset account. Receives any extra asset in the vault and the vault's rent. Must be yours (Anchor 2015). |
| 8 | collateral program | | | |
| 9 | exposure | w | | Maker counter, reduced by Q. |
| 10 | usage | w | | Maker counters, reduced. |
| 11 | payment | | | USDC mint (Anchor 2012). |
| 12 | payment_vault | w | | The maker's USDC vault. Pays T. |
| 13 | writer_payment | w | | A USDC account owned by you. Receives T. Else 8300. |
| 14 | maker_collateral | w | | An asset account owned by the maker's owner key (also when the operator signs). Receives Q. Else 8300. |
| 15 | payment program | | | SPL Token. |
Checks, in order.
- No extra accounts. Else 8300.
- The market is canonical (8200 to 8203). The position is the canonical record of this maker (else Solana's
InvalidAccountData). Every stored term matches the market and the accounts passed: covered-call mode, terms, mints, programs, decimals, expiry, window and writer (8300). The maker's exposure and usage accounts are current (8300). writer_collateral has no delegate and no close authority other than you (CustodyUnsafeRecipient 7403). The position is open (6003).
- The signer is the maker's owner key or its current operator. Else
TokenLifecycleAuthority (8304).
expiry <= now < expiry + window. Else InvalidOrder (6003).
- The USDC mint is a plain 6-decimal mint. Else 8300.
- The vault holds at least Q. Else
CustodyInvalidAmount (7405).
- The maker's usage counters accept the close-out. Else 8302.
Token movements.
| Amount | From | To |
|---|
| T USDC | the maker's payment_vault | your writer_payment |
| Q asset | the position's collateral_vault | the maker owner's maker_collateral |
| any asset above Q in the vault | collateral_vault | your writer_collateral |
| the vault's rent (SOL) | collateral_vault, closed | your writer_collateral |
The vault must be empty before it closes. Else TokenLifecycleTransfer (8303).
State change. OPEN to EXERCISED (2). The maker's exposure goes down by Q and its usage by Q and T.
Errors. 6003, 7400 to 7406, 8200 to 8203, 8300, 8302, 8303, 8304, InvalidAccountData. If the maker's vault holds less than T, exercise fails with 7405 and no tokens move. The maker can top up and retry while the window is open. There is no partial exercise. No price oracle is read: exercising is the maker's choice, at the fixed strike.
#Flash exercise of a covered call
A flash exercise settles a covered call without the maker paying the strike up front. In one transaction, the maker borrows your locked asset from the position, sells it through any swap route, pays you exactly T from the proceeds, and keeps the rest. Two instructions bracket the swap: begin_flash_exercise_v3 and finish_flash_exercise_v3. Your result is the same as an ordinary exercise: T in USDC and any extra asset back.
#The atomicity rule
begin_flash_exercise_v3 and finish_flash_exercise_v3 must be in the same transaction, called directly (not from another program). Else FlashNotTopLevel (9100).
finish must be the last instruction of the transaction. begin must come before it. Both carry their own positions in the transaction (begin_index, finish_index) and each checks them. Else FlashPairing (9102).
- Both instructions check each other's exact data and full account list, and the Instructions sysvar must be the real one (9101). A missing, moved, duplicated or altered
finish makes begin fail.
- The transaction holds exactly one covr pair. No other instruction may call covr or even list covr's program as an account. Else 9102.
- No instruction between them may touch a protected account, as program, signer, writable or read-only: your wallet, your token accounts, the position, its vault, the market, the maker, its vault, its counters, its policy, the flash context, the maker's owner key or operator, or covr's program. Else
FlashProtectedAccount (9103).
- During the transaction the position is in a transient
FLASH state. Every other instruction refuses that state. The state can never be saved: if any step fails, Solana rolls back every effect of the transaction, including the lock, the collateral moved by begin, the approval and every token transfer. Your asset is back in its vault and the position is open. A failed transaction that was processed still charges its SOL network fee to whoever sent it.
#begin_flash_exercise_v3
| |
|---|
| Signers | The maker's owner key or operator (pays the temporary rent), and a temporary delegate key. |
| Arguments | begin_index: u16, finish_index: u16, expected_policy_generation: u64, min_payment_atoms: u64 |
| Discriminator | 21607f587d0e3628 (instruction data is 28 bytes) |
| # | Account | w | s | Why |
|---|
| 0 | authority | w | s | Maker owner key or operator. Pays, and later gets back, all temporary rent. |
| 1 | delegate | | s | Temporary key allowed to spend exactly Q of the isolated asset. |
| 2 to 11 | market, maker, position (w), collateral_vault (w), writer, collateral, writer_collateral (w), collateral program, exposure (w), usage (w) | | | Same as exercise_v3 accounts 1 to 10. |
| 12 | payment_mint | | | USDC (Anchor 2012). |
| 13 | maker_payment_vault | w | | The maker's USDC vault. |
| 14 | writer_payment | w | | Your USDC account. Receives T at finish. |
| 15 | maker_collateral | w | | Asset account of the maker's owner key. |
| 16 | policy | | | The maker's flash policy for this asset and USDC. |
| 17 | context | w | | Created. Seeds "flash-context-v1", position. 464 bytes. |
| 18 | input | w | | Created. Temporary asset account, seeds "flash-input-v1", position. |
| 19 | output | w | | Created. Temporary USDC account, seeds "flash-output-v1", position. |
| 20 | payment program | | | SPL Token. |
| 21 | system program | | | |
| 22 | instructions | | | The Instructions sysvar. |
Checks, in order.
- The pairing rules above (9100 to 9103).
- The same position checks as
exercise_v3 step 2.
- The signer is the maker's owner key or current operator (8304).
expiry <= now < expiry + window and the position is open (6003).
- The USDC mint is plain with 6 decimals (8300).
- The maker's flash policy: at its canonical address (
FlashPolicySchema 9104), set by the current owner key (FlashPolicyOwner 9105), enabled (FlashPolicyDisabled 9106), at the expected generation (FlashPolicyGeneration 9107), for an admitted pair that matches the position (FlashPairUnsupported 9110), within the policy's size caps (FlashPolicyLimit 9109). The only admitted pair is JitoSOL with USDC.
min_payment_atoms is at least the policy floor max(T + A, ceil(Q × R / 10^d)), where A and R are the maker's minimum surplus and minimum price settings (FlashFloorBelowPolicy 9112, FlashFloorArithmetic 9111). The price term rounds up. R is a price bound the maker configures, not an oracle, and it does not decide whether to exercise. This floor only protects the maker. You get T whatever the swap pays.
- Your
writer_payment is a USDC account you own, not frozen, not native, with no delegate and no close authority other than you. maker_collateral is an asset account of the maker's owner key. Else FlashRecipient (9116).
- The delegate signed and is none of the protected keys, the input or the output. Else
FlashDelegate (9114).
- The vault holds at least Q (7405).
Token movements.
| Amount | From | To |
|---|
| Q asset | the position's collateral_vault | the temporary input, owned by the flash context |
| (approval) | | the delegate may spend at most Q from input, and nothing else |
State change. OPEN to FLASH (6), only inside this transaction. The context records the position's exact bytes, the bound accounts, T, Q, the floor and the starting balances.
#Between begin and finish
The maker's swap instructions run here. They can use the delegate to spend up to Q of the asset from input, and must put USDC into output. What they spend can go to outside accounts, such as swap pools: the program fixes only the final recipients that finish pays. They cannot touch any protected account.
#finish_flash_exercise_v3
| |
|---|
| Signer | None required by the program. The rent payer must be the key that signed begin. |
| Arguments | begin_index: u16, finish_index: u16 |
| Discriminator | 0f8709e6f3c10a17 (instruction data is 12 bytes) |
| # | Account | w | s | Why |
|---|
| 0 | rent_payer | w | | The begin signer. Gets back all temporary rent. |
| 1 to 10 | market, maker, position (w), collateral_vault (w), writer, collateral, writer_collateral (w), collateral program, exposure (w), usage (w) | | | As in begin. |
| 11 | payment_mint | | | USDC. |
| 12 | maker_payment_vault | w | | Receives the maker's share. |
| 13 | writer_payment | w | | Your USDC account. Receives T. |
| 14 | maker_collateral | w | | Receives any asset the swap did not use. |
| 15 | context | w | | Closed. |
| 16 | input | w | | Closed. |
| 17 | output | w | | Closed. |
| 18 | payment program | | | SPL Token. |
| 19 | instructions | | | The Instructions sysvar. |
| 20 | event authority | | | For the settlement receipt event. |
| 21 | covr program | | | For the settlement receipt event. |
Checks, in order.
- The pairing rules (9100 to 9103), with
begin's data rebuilt from the context.
- The context is the canonical one for this position, and every account equals what
begin bound: rent payer, writer, your two accounts, the maker's accounts, input and output (FlashContext 9117).
- The position is in
FLASH and its bytes, read as open, equal what begin saw. So no term, account or writer changed in between (FlashPositionState 9118).
- Input and output are still owned by the context, with the right mints and no close authority. The output has no delegate (
FlashEndpoint 9115).
- New USDC in
output (D) is at least the floor set at begin. Else FlashPaymentBelowFloor (9113).
Token movements.
| Amount | From | To |
|---|
| exactly T USDC | output | your writer_payment |
D − T USDC, plus any USDC that was in output before | output | the maker's maker_payment_vault |
any asset left in input | input | maker_collateral |
| any asset left in the position vault | collateral_vault | your writer_collateral |
| the vault's rent (SOL) | collateral_vault, closed | your writer_collateral |
| rent of input, output and context (SOL) | closed | the rent payer |
State change. FLASH to EXERCISED (2). The maker's exposure and usage change exactly as for exercise_v3. The program logs a PositionExercised event and a FlashExerciseSettled receipt.
Errors. 6003, 7400 to 7406, 8200 to 8203, 8300, 8302, 8303, 8304, 9100 to 9118, InvalidAccountData.
#release_v3
Returns your asset after the exercise window if the maker did not exercise.
| |
|---|
| Signer | None required. Anyone can send it and pay the fee, including you. covr's app prepares it for you to sign, and covr's keeper can send it on its own when covr turns its auto-release on (to confirm with covr). Whoever sends it, the asset can only go to the position's current writer. |
| Arguments | none |
| Discriminator | 819397b4f29f4897 |
Accounts: the ten accounts exercise_v3 lists at positions 1 to 10, in the same order: market, maker, position (w), collateral_vault (w), writer, collateral, writer_collateral (w), collateral program, exposure (w), usage (w).
Checks, in order.
- No extra accounts (8300).
- The same position checks as
exercise_v3 step 2, including a clean writer_collateral owned by the current writer (Anchor 2015, 7403).
- The position is open and
now >= expiry + window. Else InvalidOrder (6003).
- The vault holds at least Q (7405).
- The maker's usage counters accept the close-out (8302).
Token movements.
| Amount | From | To |
|---|
| everything in the vault (Q, plus any extra) | collateral_vault | your writer_collateral |
| the vault's rent (SOL) | collateral_vault, closed | your writer_collateral |
No USDC moves. You keep the premium.
State change. OPEN to RELEASED (3). Release reads no pause flag, no maker policy and no budget, so maker settings cannot block it.
Errors. 6003, 7400 to 7406, 8200 to 8203, 8300, 8302, 8303, Anchor 2014 and 2015, InvalidAccountData.
#early_close_v3
Lets you end an open covered call before expiry. You pay the maker a buyback price it signed, and get your asset back.
| |
|---|
| Signer | You, the current writer. You pay rent for a small close receipt (121 bytes). |
| Arguments | close_nonce: u64, amount_usdc: u64, valid_until: i64, signature: [u8; 65] |
| Discriminator | 12c6def3250a3149 |
| # | Account | w | s | Why |
|---|
| 0 | writer | w | s | You. Pays amount_usdc and the receipt rent. |
| 1 to 10 | market, maker, position (w), collateral_vault (w), writer, collateral, writer_collateral (w), collateral program, exposure (w), usage (w) | | | As in release_v3. |
| 11 | payment | | | USDC (Anchor 2012). |
| 12 | writer_payment | w | | Your USDC account. Pays amount_usdc (Anchor 2015). |
| 13 | payment_vault | w | | The original maker's USDC vault. Receives amount_usdc. |
| 14 | close_receipt | w | | Created at seeds "close-receipt", maker, close_nonce. Never closed, so a close nonce works once. |
| 15 | payment program | | | SPL Token. |
| 16 | system program | | | |
Checks, in order.
- No extra accounts (8300).
- The same position checks as
exercise_v3 step 2.
- The signer is the position's current writer. Else
TokenLifecycleAuthority (8304).
- The position is open and
opened_at <= now < expiry. Else InvalidOrder (6003).
amount_usdc > 0. Else InvalidAmount (6002).
now < valid_until <= expiry, close_nonce >= maker.min_nonce, close_nonce != u64::MAX. Else 6003.
- The USDC mint is plain with 6 decimals (8300).
- The original maker's quote key signed
EarlyClose(position, owner, maker, nonce, amount, validUntil, usd) in this market's domain, with you as owner. Else BadSignature (6000).
- The vault holds at least Q (7405).
- The maker's usage counters accept the close-out (8302).
Token movements.
| Amount | From | To | Signed by |
|---|
amount_usdc | your writer_payment | the maker's payment_vault | you |
| everything in the vault | collateral_vault | your writer_collateral | the program |
| the vault's rent (SOL) | collateral_vault, closed | your writer_collateral | the program |
State change. OPEN to EARLY_CLOSED (4). A permanent close receipt records the maker, position, you, the nonce and the amount. You keep the premium you were paid.
Errors. 6000, 6002, 6003, 7400 to 7406, 8200 to 8203, 8300, 8302, 8303, 8304, InvalidAccountData. A reused close nonce fails because its receipt already exists.
#transfer_position_v3
Hands an open covered call to another wallet. Everything the position later pays goes to the new writer.
| |
|---|
| Signer | You, the current writer. The recipient does not sign. |
| Arguments | none |
| Discriminator | 5f31db262b67749a |
| # | Account | w | s | Why |
|---|
| 0 | writer | | s | You. |
| 1 | maker | | | The position's maker. |
| 2 | position | w | | Its writer field changes. |
| 3 | recipient | | | A plain system wallet: owned by the System program (Anchor 3011), not executable, no data (6004). |
Checks, in order.
- No extra accounts (8300).
- The position is the canonical record of this maker (
InvalidAccountData).
- It is a covered-call record with the ordinary terms. Else
TokenLifecycleTerms (8301).
- The signer is the current writer. Else
Unauthorized (6004).
- The position is open,
opened_at <= now < expiry, and the recipient is not zero and not you. Else InvalidOrder (6003).
Token movements. None.
State change. The position's writer becomes the recipient. Nothing else changes: maker, amounts, terms, vault and counters stay as they were. Early-close and sale quotes signed for you no longer work, because they name you.
Errors. 6003, 6004, 8300, 8301, Anchor 3011, InvalidAccountData.
#buy_position_v3
Sells your open covered call to a maker's desk for a price that desk signed. The buying desk's owner key becomes the writer. The original maker's obligations do not change.
| |
|---|
| Signer | You, the seller and current writer. You pay rent for a sale receipt (153 bytes). |
| Arguments | nonce: u64, amount: u64, valid_until: i64, auction_id: [u8; 32], signature: [u8; 65] |
| Discriminator | a3e54011892f7b92 |
| # | Account | w | s | Why |
|---|
| 0 | seller | w | s | You. |
| 1 | market | | | |
| 2 | original_maker | | | The maker that sold you the premium. |
| 3 | position | w | | Its writer changes. |
| 4 | buyer_maker | | | The buying desk. |
| 5 | buyer_origin | | | The buying desk's registration record. |
| 6 | recipient | | | Must be the buying desk's owner key (Anchor 2012), a plain wallet (6004). |
| 7 | collateral | | | Asset mint. |
| 8 | payment | | | USDC. |
| 9 | seller_payment | w | | Your USDC account. Receives amount (Anchor 2015). |
| 10 | buyer_payment_vault | w | | The buying desk's USDC vault. Pays amount. |
| 11 | buyer_budget | w | | The buying desk's premium budget. |
| 12 | buyer_mint_policy | | | The buying desk's mint policy. |
| 13 | purchase_policy | | | The buying desk's purchase policy. |
| 14 | purchase_usage | w | | The buying desk's purchase counters. |
| 15 | sale_receipt | w | | Created at seeds "sale-receipt", buyer maker, nonce. Never closed. |
| 16 | payment program | | | SPL Token. |
| 17 | system program | | | |
Checks, in order.
- No extra accounts (8300).
- The market is canonical and its asset mint unchanged (8200 to 8203).
- The position is the canonical record of the original maker (
InvalidAccountData).
- The buying desk's registration is valid (7600, 7602, 8002, 8700, 8701), and its purchase accounts are its own, current and canonical (6010 to 6013, 8302).
- The position is an ordinary covered call whose terms match the market, and its T still equals the strike formula. Else
TokenLifecycleTerms (8301).
- You are the current writer. Else
Unauthorized (6004).
- The position is open,
opened_at <= now < expiry, and the recipient is not zero and not you. Else 6003.
amount > 0. Else 6002.
- The market is not paused,
auction_id is not zero, now < valid_until <= expiry + window, nonce >= buyer.min_nonce and nonce != u64::MAX. Else 6003.
- The USDC mint is plain with 6 decimals, and the buyer's budget is current (8300). If the buyer's budget is on,
spent + amount <= limit (6007).
- The buying desk's quote key signed
PositionSale(auctionId, position, seller, recipient, maker, nonce, amount, validUntil, usd) in this market's domain. Else 6000.
- The buying desk's purchase policy accepts the amount (8302, 8704).
Token movements.
| Amount | From | To |
|---|
amount USDC | the buying desk's buyer_payment_vault | your seller_payment |
State change. The position's writer becomes the buying desk's owner key. Your asset stays in the vault, now owed to the new writer. You keep the premium and the sale price.
Errors. 6000, 6002, 6003, 6004, 6007, 6010 to 6013, 7400 to 7406, 7600, 7602, 8002, 8200 to 8203, 8300, 8301, 8302, 8700, 8701, 8704, Anchor 2012 and 2015, InvalidAccountData.
#close_position_v3
Deletes a settled position account and returns its rent to a wallet you choose. Optional. It never moves tokens.
| |
|---|
| Signer | You, the current writer. |
| Arguments | snapshot: Vec<u8>: the position account's exact current 652 bytes. |
| Discriminator | e3674bd89d761355 |
| # | Account | w | s | Why |
|---|
| 0 | writer | | s | You. |
| 1 | maker | | | The position's maker. |
| 2 | position | w | | Closed. |
| 3 | refund | w | | A plain system wallet you choose. Receives the position's rent. Not executable, no data (6004). |
Checks, in order.
- No extra accounts (8300).
- Called directly by the transaction, not from another program. Else 6003.
- The position is the canonical record of this maker (
InvalidAccountData). The signer is its writer (Solana MissingRequiredSignature).
- The position is settled, and the maker's nonce floor is strictly above the position's nonce. Else
InvalidAccountData.
- It is an ordinary covered call in state exercised, released or early-closed. Else 8301.
snapshot is 652 bytes and equals the account's current bytes. Else InvalidTerms (6001).
Token movements. None. Only the position account's SOL rent moves, to refund.
State change. The position account is deleted. Its exact bytes stay in the transaction record through snapshot. The nonce cannot be used again: a new fill needs nonce >= min_nonce, and the floor is already above it.
You can close only after the maker raises its nonce floor past your position's nonce. The program does not do that for you, and covr's maker does not do it yet, so today the position's rent stays in the account.
Errors. 6001, 6003, 6004, 8300, 8301, Anchor 3011, InvalidAccountData, MissingRequiredSignature.
#Cash-secured puts
You lock T of a stablecoin. The maker pays you the premium now. At expiry the maker may sell you Q of the asset for your T.
Each put market fixes one payment token: a plain 6-decimal SPL Token mint, not native SOL, not the asset itself. Freeze and mint authorities on the payment token are allowed. The premium, the fee and T are all in that token.
#fill_put_v3
Opens a cash-secured put from a maker's signed quote. You sign and send it.
| |
|---|
| Signer | You. You pay rent for the position account (652 bytes) and its strike escrow. |
| Arguments | auction_id: [u8; 32], nonce: u64, quantity_atoms: u64 (Q), price_e18: u128, valid_until: i64, signature: [u8; 65] |
| Discriminator | 7f01bf82e91395ff |
| # | Account | w | s | Why |
|---|
| 0 | writer | w | s | You. Pays T and the rent. |
| 1 | market | | | The put market. |
| 2 | maker | | | The quoting maker. |
| 3 | position | w | | Created at seeds "position", maker quote-key address, nonce. |
| 4 | strike_escrow | w | | Created. Payment-token account at seeds "strike-escrow-v3", position. Owned by the position address. |
| 5 | collateral | | | The asset mint. Must equal the market's asset (Anchor 2012). |
| 6 | payment | | | The market's payment token (Anchor 2012). |
| 7 | writer_payment | w | | Your payment-token account. Pays T and receives G − F (Anchor 2015). |
| 8 | fee_tokens | w | | Payment-token account of the market's fee owner. Receives F (8300 otherwise). |
| 9 | payment_vault | w | | The maker's vault for this payment token. Pays G. |
| 10 | payment program | | | SPL Token. |
| 11 | system program | | | |
| 12 | put_exposure | w | | The maker's put exposure for this asset. |
| 13 | premium_budget | w | | The maker's budget for this payment token. |
| 14 | ledger | w | | The maker's spend ledger for this payment token. |
| 15 | policy | | | The maker's put policy for this asset and payment token. |
| 16 | usage | w | | The maker's put usage counters. |
| 17 | origin | | | The maker's registration record. |
| extra | Jito stake pool | | | JitoSOL only, required, read-only. No other extra account is allowed. |
Checks, in order.
- Exactly one extra account on JitoSOL, none otherwise (8300).
auction_id is not zero (6003).
- The market is a canonical put market (
PositionKind 9200, AccountingVersion 9201, KindNotEnabled 9202, PaymentProfile 9204, 8200 to 8203). The asset mint still matches its recorded profile (8201, 8203). The payment mint is a plain 6-decimal mint (9204).
- The maker's registration is valid (7600, 7602, 8700, 8701). On JitoSOL: the pool is read-only (6009), canonical and updated this epoch (6009), and the size cap holds (6008).
- The market is not paused,
now < expiry, now < valid_until <= expiry, the nonce is at or above the maker's floor and not u64::MAX, and 0 < Q <= max_quantity_atoms. Else 6003.
- The maker's put exposure, budget, ledger, policy and usage are current and canonical (8300).
- The policy is a put policy of this maker and owner key, for this exact asset and payment token, and its recorded payment-token fingerprint still matches the mint (6010, 6011, 6012, 6014, 9200, 9204, 9207).
- The maker's spend ledger is its own and balanced with its budget (
PaymentSpendLedger 9211, PaymentSpendBalance 9212).
- T and G are exact and above zero (6002).
- The maker's quote signature is valid in this put market's domain, bound to
auction_id and your wallet (6000). Put quotes use their own domain and set isPut to true, so a call quote can never open a put.
- The maker's policy accepts the fill (8302).
- Exposure, budget and ledger limits (6006, 6007, 9212).
- The new record is a valid put record (8301).
Token movements. Your T moves first.
| Amount | From | To | Signed by |
|---|
| T payment token | your writer_payment | the position's strike_escrow | you |
| G − F | the maker's payment_vault | your writer_payment | the program, for the maker vault |
| F, if above zero | the maker's payment_vault | fee_tokens | the program, for the maker vault |
After the first leg the escrow must hold exactly T. Else PutEscrow (9209).
State change. A new put position in state OPEN (0), with record mode 2 (put). It records the same fields as a covered call, with T held in the escrow. The maker's put exposure, budget, ledger and usage go up.
Errors. 6000, 6002, 6003, 6006 to 6014, 7400 to 7406, 7600, 7602, 8200 to 8203, 8300, 8301, 8302, 8700, 8701, 9200 to 9212.
#exercise_put_v3
The maker sells you Q of the asset for your T.
| |
|---|
| Signer | The maker's owner key or operator. You do not sign. |
| Arguments | none |
| Discriminator | 8cad659b89ebc94c |
| # | Account | w | s | Why |
|---|
| 0 | authority | | s | Maker owner key or operator (8304). |
| 1 | market | | | |
| 2 | maker | | | |
| 3 | position | w | | |
| 4 | strike_escrow | w | | Pays T, then is closed. |
| 5 | writer | | | Must equal the current writer. |
| 6 | payment_mint | | | |
| 7 | writer_payment | w | | Your payment-token account. Gets any extra in the escrow and the escrow's rent (Anchor 2014, 2015). |
| 8 | payment program | | | SPL Token. |
| 9 | put_exposure | w | | Maker counter. |
| 10 | usage | w | | Maker counters. |
| 11 | maker_payment_vault | w | | The maker's vault for this payment token. Receives T. |
| 12 | collateral_mint | | | The asset mint. |
| 13 | put_asset_vault | w | | The maker's asset vault, seeds "put-asset-v1", maker, asset. Pays Q. |
| 14 | writer_collateral | w | | Your asset account. Receives Q. |
| 15 | collateral program | | | |
Checks, in order.
- No extra accounts (8300).
- Shared put exit checks: canonical put market (9200 and 82xx), canonical put record of this maker (
InvalidAccountData, 9201 to 9206), every stored term matches the market and accounts (8300), exposure and usage current and canonical (8300), your payment account clean (7403), the escrow holds at least T (9209), the position is open (6003).
- The signer is the maker's owner key or current operator (8304).
expiry <= now < expiry + window (6003).
- The asset mint and program match the record (8300).
put_asset_vault is the maker's canonical asset vault for this asset (PutAssetSource 9210) and holds at least Q (7405).
writer_collateral is an asset account you own (8300).
- The maker's usage counters accept the close-out (8302).
Token movements.
| Amount | From | To |
|---|
| T | strike_escrow | the maker's maker_payment_vault |
| Q asset | the maker's put_asset_vault | your writer_collateral |
| any payment token above T in the escrow | strike_escrow | your writer_payment |
| the escrow's rent (SOL) | strike_escrow, closed | your writer_payment |
State change. OPEN to EXERCISED (2). If the maker's asset vault is short, exercise fails and no tokens move. After the window, release_put_v3 can return your T. No price oracle is read: exercising is the maker's choice, at the fixed strike.
Errors. 6003, 7400 to 7406, 8200 to 8203, 8300, 8302, 8304, 9200 to 9206, 9209, 9210, InvalidAccountData.
#Flash exercise of a put
A flash put exercise lets the maker settle without holding the asset first. In one transaction it takes your escrowed T, buys the asset through any swap route, gives you exactly Q, and keeps what is left. The pair begin_flash_put_v3 and finish_flash_put_v3 follows the same atomicity rule as a covered call: one transaction, called directly, finish last, one covr pair, protected accounts untouched by the swap, and a transient FLASH state that can never be saved.
#begin_flash_put_v3
| |
|---|
| Signers | The maker's owner key or operator (pays temporary rent), and a temporary delegate key. |
| Arguments | begin_index: u16, finish_index: u16, expected_policy_generation: u64, min_asset_atoms: u64 |
| Discriminator | d5fa8381e189dfd2 |
| # | Account | w | s | Why |
|---|
| 0 | authority | w | s | Maker owner key or operator. |
| 1 | delegate | | s | May spend exactly T of the isolated payment token. |
| 2 to 11 | market, maker, position (w), strike_escrow (w), writer, payment_mint, writer_payment (w), payment program, put_exposure (w), usage (w) | | | Same as exercise_put_v3 accounts 1 to 10. |
| 12 | collateral_mint | | | Asset mint. |
| 13 | maker_payment_vault | w | | The maker's payment-token vault. |
| 14 | writer_collateral | w | | Your asset account. Receives Q at finish. |
| 15 | put_asset_vault | w | | The maker's asset vault. |
| 16 | policy | | | The maker's flash put policy. |
| 17 | context | w | | Created, seeds "flash-context-v1", position. |
| 18 | input | w | | Created. Temporary payment-token account. |
| 19 | output | w | | Created. Temporary asset account. |
| 20 | collateral program | | | |
| 21 | system program | | | |
| 22 | instructions | | | The Instructions sysvar. |
Checks, in order. Pairing (9100 to 9103). Shared put exit checks. Signer is the owner key or operator (8304). Exercise window and open state (6003). The flash put policy is canonical (FlashPutPolicySchema 9214), set by the current owner key (9215), enabled (9216), at the expected generation (9217), for an admitted pair matching the record (FlashPutPairUnsupported 9220), within caps (9219). min_asset_atoms is at least max(Q + A, ceil(T × 10^d / R)), where A is the maker's minimum asset surplus and R its maximum price (9222, 9221). The price term rounds up, and R is the maker's own bound, not an oracle. The asset mint and program match (8300). Your writer_collateral is an asset account you own, not frozen, not native, no delegate, no foreign close authority (FlashPutRecipient 9225). put_asset_vault is the maker's canonical asset vault (9225). The delegate signed and aliases nothing protected (9114). The escrow holds at least T (9209). Admitted pairs: JitoSOL with USDC, and JitoSOL with USDT.
Token movements. Exactly T from strike_escrow to the temporary input. The delegate is approved for at most T on input. The swap route may send what it spends to outside accounts; finish fixes the final recipients. State change: OPEN to FLASH, only inside this transaction.
#finish_flash_put_v3
| |
|---|
| Signer | None required. The rent payer must be the begin signer. |
| Arguments | begin_index: u16, finish_index: u16 |
| Discriminator | cb9240382921972b |
Accounts, in order: rent_payer (w), the ten put delivery accounts, collateral_mint, maker_payment_vault (w), writer_collateral (w), put_asset_vault (w), context (w, closed), input (w, closed), output (w, closed), collateral program, instructions sysvar, event authority, covr program.
Checks, in order. Pairing (9100 to 9103). Context and every bound account (FlashPutContext 9226). The record is in FLASH and unchanged since begin (9118). Temporary accounts still owned by the context, right mints, no close authority (FlashPutEndpoint 9224). New asset in output (D) is at least the floor. Else FlashPutAssetBelowFloor (9223).
Token movements.
| Amount | From | To |
|---|
| exactly Q asset | output | your writer_collateral |
D − Q asset, plus any asset in output before | output | the maker's put_asset_vault |
payment token left in input | input | the maker's maker_payment_vault |
| any payment token left in the escrow | strike_escrow | your writer_payment |
| the escrow's rent (SOL) | strike_escrow, closed | your writer_payment |
| rent of input, output and context | closed | the rent payer |
State change. FLASH to EXERCISED (2), with the same accounting as exercise_put_v3.
Errors (both). 6003, 7400 to 7406, 8200 to 8203, 8300, 8302, 8304, 9100 to 9103, 9114, 9118, 9200 to 9206, 9209, 9214 to 9226, InvalidAccountData.
#release_put_v3
Returns your T after the exercise window if the maker did not exercise.
| |
|---|
| Signer | None required. Anyone can send it, including you. covr's app prepares it for you to sign. The escrow can only go to the position's current writer. |
| Arguments | none |
| Discriminator | d66549ed3717d52f |
Accounts, in order: market, maker, position (w), strike_escrow (w), writer, payment_mint, writer_payment (w), payment program, put_exposure (w), usage (w).
Checks, in order. No extra accounts (8300). Shared put exit checks, including a clean payment account owned by the current writer (Anchor 2015, 7403) and an escrow holding at least T (9209). The position is open and now >= expiry + window (6003). Usage counters (8302).
Token movements. Everything in the escrow goes to your writer_payment. The escrow is closed and its rent goes to your writer_payment. You keep the premium.
The escrow is the source of this transfer. If the payment token's issuer has frozen it, the program refuses the transfer (7400) and release fails until the issuer thaws the escrow. Choosing a different writer_payment does not help.
State change. OPEN to RELEASED (3). Release reads no pause, policy, budget or ledger.
Errors. 6003, 7400 to 7406, 8200 to 8203, 8300, 8302, 9200 to 9206, 9209, Anchor 2014 and 2015, InvalidAccountData.
#early_close_put_v3
Lets you end an open put before expiry for a buyback price the maker signed. The price comes out of your escrow. You pay nothing in.
| |
|---|
| Signer | You, the current writer. You pay rent for the close receipt. |
| Arguments | close_nonce: u64, amount_payment_atoms: u64 (A), valid_until: i64, signature: [u8; 65] |
| Discriminator | 105f11beb59f3f9a |
Accounts, in order: writer (w, s), the ten put delivery accounts, maker_payment_vault (w), close_receipt (w, created at seeds "close-receipt", maker, close_nonce), system program.
Checks, in order.
- No extra accounts (8300). Shared put exit checks.
- The signer is the current writer (8304).
- The position is open and
opened_at <= now < expiry (6003).
0 < A <= T. Else InvalidAmount (6002).
now < valid_until <= expiry, close_nonce >= maker.min_nonce, not u64::MAX (6003).
- The original maker's quote key signed
EarlyClose in this put market's domain, with you as owner (6000).
- Usage counters (8302).
Token movements.
| Amount | From | To |
|---|
| A | strike_escrow | the maker's maker_payment_vault |
| the rest of the escrow | strike_escrow | your writer_payment |
| the escrow's rent (SOL) | strike_escrow, closed | your writer_payment |
State change. OPEN to EARLY_CLOSED (4). A permanent close receipt. You keep the premium.
Errors. 6000, 6002, 6003, 7400 to 7406, 8200 to 8203, 8300, 8302, 8304, 9200 to 9206, 9209, InvalidAccountData.
#transfer_position_v3x
Hands an open put to another wallet. Same accounts, signer and timing as transfer_position_v3: writer (s), maker, position (w), recipient.
Checks, in order. No extra accounts (8300). Canonical put record (InvalidAccountData, 9201 to 9206). The signer is the current writer (6004). Open, opened_at <= now < expiry, recipient not zero and not you (6003). Recipient a plain wallet (Anchor 3011, 6004).
Effect. The writer changes. The escrow, amounts and maker counters do not. Discriminator 08d70c994e0913e8.
#buy_put_position_v3
Sells your open put to a maker's desk for a price it signed. Like buy_position_v3, with the put market's payment token and the buyer's put accounts.
Accounts, in order: seller (w, s), market, original_maker, position (w), buyer_maker, buyer_origin, recipient (the buyer's owner key, a plain wallet), collateral, payment, seller_payment (w), buyer_payment_vault (w), buyer_budget (w), buyer_ledger (w), buyer_mint_policy, purchase_policy, purchase_usage (w), sale_receipt (w, created), payment program, system program. Arguments: nonce, amount, valid_until, auction_id, signature. Discriminator 2407be4b3786b19e.
Checks, in order. No extra accounts (8300). Canonical put market, unchanged asset, plain payment token (9200, 9204, 82xx). Canonical put record (InvalidAccountData). Buyer registration (7600, 7602, 8700, 8701). Buyer purchase accounts its own, for this asset, payment token and put kind (PurchasePolicyForeign 9208, 6010 to 6013). Record terms match the market and strike formula (8301). You are the writer (6004). Open, before expiry, recipient not you (6003). amount > 0 (6002). Market not paused, auction id set, now < valid_until <= expiry + window, nonce at or above the buyer's floor (6003). Buyer budget (8300, 6007) and ledger (9211, 9212). PositionSale signature in the put domain (6000). Buyer purchase policy (8302).
Token movements. amount from the buyer's vault to your seller_payment. State change. The writer becomes the buyer's owner key. The escrow and the original maker's obligation do not change.
#close_position_v3x
Deletes a settled put position account and returns its rent. Same accounts, argument and rules as close_position_v3: top level only, signer is the writer, state exercised, released or early-closed, maker nonce floor strictly above the position's nonce, exact 652-byte snapshot. Discriminator 85ad600c71c38c32.
#Tokenized-stock calls
Covered calls on tokenized stocks use restricted settlement: the maker first moves the full strike into an escrow, then delivery completes. If delivery stays blocked, both sides can cancel together after seven days. These positions cannot be closed early, transferred, sold or flash-exercised.
covr may list tokenized-stock markets. Their rules are below.
The asset may be a plain 82-byte mint with a freeze authority, or a Token-2022 stock mint with one fixed set of extensions that includes a permanent delegate and a pause switch held by the issuer. The issuer can therefore move or freeze tokens in the position's vault. The program then returns whatever is left and reports the shortfall.
| Instruction | Signer | When | Effect |
|---|
fill_restricted_v3 (2e41135430d467ed) | You | Before expiry | Same accounts and checks as fill_v3, on a restricted market, plus the argument cancellation_timeout_seconds, which must be 604,800 and match the market's terms (RestrictedTerms 8400). Uses the restricted signing domain. Position opens in mode 1. |
fund_restricted_exercise_v3 (177b5118031c80c9) | Maker owner key or operator | Inside the exercise window | Moves exactly T from the maker's vault into a new escrow at seeds "strike-escrow-v3", position. State OPEN to PENDING (1). Sets funded_at = now and cancel_eligible_at = now + 604,800. |
complete_pending_delivery_v3 (e95dfae6a23e6f1c) | Anyone | Any time after funding, until a cancel | The whole escrow to you, Q asset to the maker's owner key, any extra asset and the vault rent to you, escrow rent to the maker's owner key. State EXERCISED (2). |
cancel_pending_delivery_v3 (d42e1cc0f772a695) | Both: the maker's owner key and you | After cancel_eligible_at | The whole escrow back to the maker, the whole vault back to you. You keep the premium. State BILATERALLY_CANCELED (5). |
release_restricted_v3 (b98bfe918774a47e) | Anyone | After the exercise window, only if never funded | Whatever the vault holds goes to you. State RELEASED (3). |
close_restricted_position_v3 (3f470697ff5ea278) | You | After settlement | As close_position_v3, for states exercised, released or canceled. |
#fund_restricted_exercise_v3
Accounts, in order: authority (w, s, pays the escrow rent), market, maker, position (w), collateral_vault, collateral, collateral program, payment (USDC), payment_vault (w), strike_escrow (w, created), usage (w), payment program, system program. No arguments.
Checks, in order. No extra accounts (8300). Restricted market and record, timeout matches the market (8200 to 8203, 8400, 8300, InvalidAccountData). Signer is the maker's owner key or operator (8304). USDC plain (8300). Vault address matches the record (8300). Position open and unfunded (RestrictedState 8401). expiry <= now < expiry + window (RestrictedTime 8402). Vault still holds at least Q (RestrictedImpaired 8404). Escrow empty and at its canonical address (RestrictedEscrow 8405). Usage counters (8302). After the transfer, the escrow holds exactly T (8405).
Token movements. T USDC from the maker's vault to the escrow. Once funded, the position can no longer be released: only completion or a joint cancel can end it.
#complete_pending_delivery_v3
Accounts, in order: caller (s), the ten accounts of release_v3, payment (USDC), strike_escrow (w), writer_payment (w, USDC owned by you, else 8300), maker_collateral (w, owned by the maker's owner key, else 8300), maker_authority (w, the maker's owner key, receives the escrow rent, else 8300), payment program. No arguments.
Checks, in order. No extra accounts (8300). Restricted record and market (82xx, 8400, 8300), writer matches (8300), exposure canonical (8300), writer_collateral clean (7403). USDC plain and escrow address (8300). State PENDING (8401). now >= funded_at (8402). Escrow holds at least T (8405). Vault holds at least Q (8404). Usage counters (8302).
Token movements.
| Amount | From | To |
|---|
| everything in the escrow (T plus any extra) | strike_escrow | your writer_payment |
| escrow rent (SOL) | escrow, closed | the maker's owner key |
| Q asset | collateral_vault | maker_collateral |
| any asset above Q, then the vault rent | collateral_vault, closed | your writer_collateral |
Full delivery only. If any leg is blocked, for example by a frozen account, the whole transaction fails and can be retried later.
#cancel_pending_delivery_v3
The bilateral cancel. Both of you must sign the same transaction.
Accounts, in order: maker_signer (w, s, the maker's owner key, never the operator; receives the escrow rent), writer_signer (s, you), the ten accounts of release_v3, payment (USDC), strike_escrow (w), maker_payment (w, a USDC account of the maker's owner key, else 8300), payment program.
The argument is a 288-byte CancellationRequestV1: genesis_hash, program, terms_id, position, maker, writer, intent_generation, refund_strike_usdc, return_collateral_atoms, payment_destination, collateral_destination, valid_until.
Checks, in order.
- No extra accounts (8300). Restricted record and market checks, and a clean
writer_collateral (7403).
- The two signers are the position's maker owner key and its current writer. Else Solana
MissingRequiredSignature.
- USDC plain and escrow address (8300).
- State
PENDING (8401) and now >= cancel_eligible_at (8402).
- The request names this program, network, terms, position, maker and writer, the current funding round, a refund equal to T, a
valid_until in the future, two different non-zero destinations that are not protected accounts, and a return_collateral_atoms no higher than what the vault holds. Else RestrictedApproval (8403).
- The escrow holds at least T (8405).
- The signers and destinations equal the request, and the destinations are owned by the maker's owner key and by you. Else 8403.
- Usage counters (8302).
Token movements. The whole escrow to maker_payment, escrow rent to the maker signer. The whole current vault to your writer_collateral, vault rent too. You keep the premium.
#release_restricted_v3
Same accounts as release_v3. Checks: restricted record and market, clean writer_collateral, state OPEN (never funded), now >= expiry + window (8401, 8402). It returns whatever the vault holds, even if an issuer action left less than Q, and closes the vault.
#Maker and market settings that touch your position
You never sign these, but they decide whether a fill or a sale can happen. The market pause, mint policies, exposure limit and premium budget never block an exercise, a release, an early close, a transfer or a close. Two settings do reach other paths. The nonce floor cancels early-close and sale quotes signed below it, and a settled position's account can be closed only once the floor is above its nonce. The flash policy decides whether flash exercise can run; ordinary exercise and release do not read it. See Admin and upgrade powers.
| Setting | Who | What it blocks |
|---|
Market pause (set_market_v3_pause, set_restricted_market_v3_pause, set_market_v3x_pause) | The market's creator | New fills and sales to a desk on that market |
| Mint policy pause or update | The maker's owner key, or its watcher for a pause | New fills by that maker on that asset |
Nonce floor (configure_maker) | The maker's owner key | Every quote, early-close quote and sale quote that maker signed below the new floor. Until it is raised above a settled position's nonce, closing that position's account. |
| Exposure limit, premium budget | The maker's owner key | New fills by that maker |
Flash policy (update_flash_exercise_policy_v1, disable_flash_exercise_policy_v1, update_flash_put_policy_v1, disable_flash_put_policy_v1) | The maker's owner key | Flash exercise of that maker's positions. Not ordinary exercise or release. |
#Errors
The program has one error list. Anchor numbers covr's errors from 6000. A failed transaction shows the code in hex in its last log line, for example custom program error: 0x1773 for 6003, and the name in an Anchor log line. Some errors add a reason line just above it, starting COVR_TOKEN_ACCOUNTING:, COVR_TOKEN_CUSTODY:, COVR_RESTRICTED: or COVR_MINT_PURCHASE:.
#Quote, order and limits
| Code | Hex | Name | What it means for you |
|---|
| 6000 | 0x1770 | BadSignature | The maker's signature does not match this market, your wallet, the auction, the amounts or the nonce. |
| 6001 | 0x1771 | InvalidTerms | A close snapshot is not the account's exact current bytes. |
| 6002 | 0x1772 | InvalidAmount | A premium or strike is not a whole number of atoms, or an amount is zero, or a put buyback exceeds T. |
| 6003 | 0x1773 | InvalidOrder | Wrong time or state: market paused, past expiry, quote expired, nonce below the maker's floor, size out of range, outside the exercise window, release before the deadline, or the position is not open. |
| 6004 | 0x1774 | Unauthorized | You are not the current writer, or a recipient or refund wallet is not a plain wallet. |
| 6006 | 0x1776 | ExposureLimit | The maker's exposure limit for this asset is full. |
| 6007 | 0x1777 | PremiumBudgetExceeded | The maker's premium budget is spent. |
| 6008 | 0x1778 | JitoSolOrderLimit | One JitoSOL fill is worth more than 50 SOL of stake-pool value. |
| 6009 | 0x1779 | InvalidJitoPool | The Jito stake pool account is wrong, writable, or not yet updated this epoch. |
| 6010 | 0x177a | MintPolicyIdentity | A maker policy or usage account does not belong to this maker, asset or payment token. |
| 6011 | 0x177b | MintPolicySchema | A maker policy or usage account has the wrong size or version. |
| 6012 | 0x177c | MintPolicyGeneration | A maker policy generation is zero or stale. |
| 6013 | 0x177d | MintPolicyUnauthorized | A maker policy was signed by the wrong key. |
| 6014 | 0x177e | MintPolicySettings | A maker policy has invalid settings. |
#Token custody
Every token movement runs a check first. If the check fails, the transaction fails and no tokens move.
| Code | Hex | Name | What it means for you |
|---|
| 7400 | 0x1ce8 | CustodyInvalidAccount | A token account is frozen, not initialized, or has the wrong mint or owner. |
| 7401 | 0x1ce9 | CustodyUnsupportedCapability | A token account uses a feature the program does not support, such as wrapped SOL. |
| 7402 | 0x1cea | CustodyUnauthorized | The transfer authority is not the expected signer or program address. |
| 7403 | 0x1ceb | CustodyUnsafeRecipient | A receiving account has a delegate, or a close authority other than its owner. Use a clean account. |
| 7404 | 0x1cec | CustodyUnsafeSource | A program-held source account has a delegate or a foreign close authority. |
| 7405 | 0x1ced | CustodyInvalidAmount | A source holds too little (you at fill, the maker at fill or exercise), or an amount is zero. |
| 7406 | 0x1cee | CustodyPostTransferMismatch | A transfer did not change the balances by exactly the amount. |
#Maker identity
| Code | Hex | Name | What it means for you |
|---|
| 7600 | 0x1db0 | MakerFenceSchema | The maker account is malformed. |
| 7602 | 0x1db2 | MakerFenceUnauthorized | The maker account is not at its canonical address. |
| 8002 | 0x1f42 | MakerOriginState | The buying desk is not set up for purchases. |
| 8700 | 0x21fc | MakerMigrationSchema | The maker's origin record is the wrong kind of account. |
| 8701 | 0x21fd | MakerMigrationIdentity | The maker's origin record belongs to another maker or deployment. |
| 8703 | 0x21ff | MakerMigrationTotals | A maker counter would overflow. |
| 8704 | 0x2200 | MakerMigrationLimit | A maker cap, counting the maker's earlier history, would be exceeded. |
| 8800 | 0x2260 | MakerMigrationHoldsSchema | Wrong number of extra accounts on a covered-call fill, for example a JitoSOL fill without the stake pool. |
#Markets and positions
| Code | Hex | Name | What it means for you |
|---|
| 8200 | 0x2008 | MarketV3Schema | The market account is not a market of the expected kind. |
| 8201 | 0x2009 | MarketV3Identity | The market is not at its own address, or its asset mint changed since creation. New fills on it stay closed. |
| 8202 | 0x200a | MarketV3Terms | The market's terms are invalid. |
| 8203 | 0x200b | MarketV3Unsupported | The asset mint is of a kind the market type does not accept. |
| 8300 | 0x206c | TokenLifecycleIdentity | An account does not match the position or market: wrong writer, mint, token program, vault, counter, or an extra account. |
| 8301 | 0x206d | TokenLifecycleTerms | The position's kind or terms do not allow this action. |
| 8302 | 0x206e | TokenLifecycleAccounting | The maker's policy refused a fill or purchase (reason: Unbootstrapped, Paused, Terms or Limit), or a counter is inconsistent. |
| 8303 | 0x206f | TokenLifecycleTransfer | A vault was not empty when it was about to close. |
| 8304 | 0x2070 | TokenLifecycleAuthority | The signer is not the maker's owner key or operator (exercise), or not the current writer (early close). |
#Tokenized-stock settlement
| Code | Hex | Name | What it means for you |
|---|
| 8400 | 0x20d0 | RestrictedTerms | The cancellation timeout or terms do not match the market. |
| 8401 | 0x20d1 | RestrictedState | The position's state does not allow this step. |
| 8402 | 0x20d2 | RestrictedTime | Outside the funding window, or before the cancel date. |
| 8403 | 0x20d3 | RestrictedApproval | The cancel request does not bind both of you to the exact current amounts and accounts. |
| 8404 | 0x20d4 | RestrictedImpaired | The vault holds less than Q, so funding or delivery is refused. |
| 8405 | 0x20d5 | RestrictedEscrow | The strike escrow is not exactly funded or not where it should be. |
#Flash exercise
| Code | Hex | Name | What it means for you |
|---|
| 9100 | 0x238c | FlashNotTopLevel | A flash instruction was called from another program. |
| 9101 | 0x238d | FlashInstructionsSysvar | The Instructions sysvar is not the real one. |
| 9102 | 0x238e | FlashPairing | Begin and finish are not one exact pair with finish last, or another covr instruction is present. |
| 9103 | 0x238f | FlashProtectedAccount | A swap instruction touched a protected account. |
| 9104 | 0x2390 | FlashPolicySchema | The maker's flash policy is not at its canonical address. |
| 9105 | 0x2391 | FlashPolicyOwner | The flash policy was not set by the maker's current owner key. |
| 9106 | 0x2392 | FlashPolicyDisabled | The maker turned flash exercise off. |
| 9107 | 0x2393 | FlashPolicyGeneration | The flash policy changed since the maker read it. |
| 9108 | 0x2394 | FlashPolicySettings | Invalid flash policy settings. |
| 9109 | 0x2395 | FlashPolicyLimit | Q or T is above the maker's flash caps. |
| 9110 | 0x2396 | FlashPairUnsupported | The asset and payment pair is not admitted for flash exercise. |
| 9111 | 0x2397 | FlashFloorArithmetic | The floor calculation overflowed. |
| 9112 | 0x2398 | FlashFloorBelowPolicy | The maker's attempt floor is below its own policy floor. |
| 9113 | 0x2399 | FlashPaymentBelowFloor | The swap paid less than the floor. The transaction fails and its instruction effects roll back. |
| 9114 | 0x239a | FlashDelegate | The temporary key did not sign or reuses a protected key. |
| 9115 | 0x239b | FlashEndpoint | A temporary account was changed in a forbidden way. |
| 9116 | 0x239c | FlashRecipient | Your USDC account, or the maker's asset account, is not a clean account of the right owner. |
| 9117 | 0x239d | FlashContext | Finish does not match what begin recorded. |
| 9118 | 0x239e | FlashPositionState | The position is not in its flash state, or its bytes changed since begin. |
#Puts
| Code | Hex | Name | What it means for you |
|---|
| 9200 | 0x23f0 | PositionKind | The market, record or policy is not the kind this instruction accepts. |
| 9201 | 0x23f1 | AccountingVersion | A covered-call USDC record or market was sent to a put instruction. |
| 9202 | 0x23f2 | KindNotEnabled | Calls are not enabled on the put-style instructions. |
| 9203 | 0x23f3 | KindInvalid | The kind byte is not call or put. |
| 9204 | 0x23f4 | PaymentProfile | The payment token is not a plain 6-decimal token, or it changed since the maker set its policy. |
| 9205 | 0x23f5 | PutFunding | A put record carries funding fields it must not have. |
| 9206 | 0x23f6 | PutState | A put record is in a state puts never use. |
| 9207 | 0x23f7 | PutBacking | The maker's put policy has an invalid backing setting. |
| 9208 | 0x23f8 | PurchasePolicyForeign | A buyer's purchase accounts are for another desk, asset, payment token or kind. |
| 9209 | 0x23f9 | PutEscrow | The strike escrow does not hold exactly T at fill, or holds less than T at an exit. |
| 9210 | 0x23fa | PutAssetSource | The asset source is not the maker's put asset vault. |
| 9211 | 0x23fb | PaymentSpendLedger | The maker's spend ledger is missing, foreign or malformed. |
| 9212 | 0x23fc | PaymentSpendBalance | The maker's budget and ledger disagree, or a ledger counter would overflow. |
| 9213 | 0x23fd | OriginRequired | A call opening in a non-USDC token needs a newly registered maker. |
| 9214 | 0x23fe | FlashPutPolicySchema | The maker's flash put policy is not at its canonical address. |
| 9215 | 0x23ff | FlashPutPolicyOwner | The flash put policy was not set by the maker's current owner key. |
| 9216 | 0x2400 | FlashPutPolicyDisabled | The maker turned flash put exercise off. |
| 9217 | 0x2401 | FlashPutPolicyGeneration | The flash put policy changed since the maker read it. |
| 9218 | 0x2402 | FlashPutPolicySettings | Invalid flash put policy settings. |
| 9219 | 0x2403 | FlashPutPolicyLimit | Q or T is above the maker's flash put caps. |
| 9220 | 0x2404 | FlashPutPairUnsupported | The pair is not admitted for flash put exercise. |
| 9221 | 0x2405 | FlashPutFloorArithmetic | The floor calculation overflowed. |
| 9222 | 0x2406 | FlashPutFloorBelowPolicy | The maker's attempt floor is below its own policy floor. |
| 9223 | 0x2407 | FlashPutAssetBelowFloor | The swap delivered less asset than the floor. The transaction fails and its instruction effects roll back. |
| 9224 | 0x2408 | FlashPutEndpoint | A temporary account was changed in a forbidden way. |
| 9225 | 0x2409 | FlashPutRecipient | Your asset account, or the maker's asset vault, is not a clean account of the right owner. |
| 9226 | 0x240a | FlashPutContext | Finish does not match what begin recorded. |
#Errors from Solana, Anchor and the token program
| Code | From | What it means for you |
|---|
InvalidAccountData | Solana | The position is not the canonical, valid record of this maker; or, for a close, it is not settled or the maker's nonce floor is not yet above its nonce. |
MissingRequiredSignature | Solana | A close was signed by someone other than the writer, or a bilateral cancel lacks one of the two parties. |
| 0, "already in use" | System program | An account the instruction creates already exists: that maker nonce, close nonce or sale nonce was used. |
| 2012 | Anchor ConstraintAddress | A mint, program or recipient is not the one required. |
| 2014, 2015 | Anchor ConstraintTokenMint, ConstraintTokenOwner | A token account has the wrong mint, or is not owned by the right wallet. |
| 3011 | Anchor AccountNotSystemOwned | A recipient or refund account is not a plain wallet. |
| 3012 | Anchor AccountNotInitialized | An account the instruction reads does not exist yet. |
#Discriminators
The first 8 bytes of instruction data, sha256("global:<name>")[0..8]. Use them to recognise covr instructions in an explorer.
| Instruction | Discriminator (hex) |
|---|
fill_v3 | 07aeccf9e765bb35 |
exercise_v3 | 1512034972d6645f |
begin_flash_exercise_v3 | 21607f587d0e3628 |
finish_flash_exercise_v3 | 0f8709e6f3c10a17 |
release_v3 | 819397b4f29f4897 |
early_close_v3 | 12c6def3250a3149 |
transfer_position_v3 | 5f31db262b67749a |
buy_position_v3 | a3e54011892f7b92 |
close_position_v3 | e3674bd89d761355 |
fill_put_v3 | 7f01bf82e91395ff |
exercise_put_v3 | 8cad659b89ebc94c |
begin_flash_put_v3 | d5fa8381e189dfd2 |
finish_flash_put_v3 | cb9240382921972b |
release_put_v3 | d66549ed3717d52f |
early_close_put_v3 | 105f11beb59f3f9a |
transfer_position_v3x | 08d70c994e0913e8 |
buy_put_position_v3 | 2407be4b3786b19e |
close_position_v3x | 85ad600c71c38c32 |
fill_restricted_v3 | 2e41135430d467ed |
fund_restricted_exercise_v3 | 177b5118031c80c9 |
complete_pending_delivery_v3 | e95dfae6a23e6f1c |
cancel_pending_delivery_v3 | d42e1cc0f772a695 |
release_restricted_v3 | b98bfe918774a47e |
close_restricted_position_v3 | 3f470697ff5ea278 |