# Instructions

Every program instruction a desk signs, pays for, or depends on. For each one: who signs, the accounts in order, the arguments with units, what the program checks, what money moves, and which SDK builder emits it.

## How to read this page

- **Accounts** are listed in the exact order the instruction expects. **w** = writable. **s** = signer.
- **Arguments** are Borsh-encoded after an 8-byte discriminator, `sha256("global:<instruction name>")[0..8]`. Integers are little-endian. The SDK builders do this for you.
- **Compute** gives the SDK's recommended compute-unit limit where one exists. Prepend a `SetComputeUnitLimit` instruction with it, and simulate the whole transaction first. These are tested envelopes, not guarantees.
- **Errors** name the codes you are most likely to see. [Errors](https://docs.covr.markets/reference/program/errors.md) has the full list.

## Summary

| Instruction | Signer | SDK builder | Compute |
| --- | --- | --- | --- |
| [`register_maker_v3`](#register_maker_v3) | authority | `registerMakerV3` | none given |
| [`initialize_vault`](#initialize_vault) | authority | `initializeVault` | none given |
| [`set_premium_budget`](#set_premium_budget) | authority | `setPremiumBudget` | none given |
| [`deposit`](#deposit) | authority | `deposit` | none given |
| [`withdraw`](#withdraw) | authority | `withdraw` | none given |
| [`configure_maker`](#configure_maker) | authority | `configureMaker` | none given |
| [`initialize_exposure_v3`](#initialize_exposure_v3) | authority | `initializeExposureV3` | 200,000 |
| [`set_exposure_limit`](#set_exposure_limit) | authority | `setExposureLimit` | none given |
| [`initialize_mint_policy_v1`](#initialize_mint_policy_v1) | authority | `initializeMintPolicyV1` | none given |
| [`update_mint_policy_v1`](#update_mint_policy_v1) | authority | `updateMintPolicyV1` | none given |
| [`pause_mint_policy_v1`](#pause_mint_policy_v1) | authority or watcher | `pauseMintPolicyV1` | none given |
| [`bootstrap_mint_usage_v1`](#bootstrap_mint_usage_v1) | authority | `bootstrapMintUsageV1` | none given |
| [`create_market_v3`](#create_market_v3) | creator | `createMarketV3` | none given |
| [`create_restricted_market_v3`](#create_restricted_market_v3) | creator | `createRestrictedMarketV3` | 200,000 |
| [`set_market_v3_pause`](#set_market_v3_pause) | creator | **none** | none given |
| [`fill_v3`](#fill_v3) | writer (customer) | `fillV3` | 300,000 |
| [`exercise_v3`](#exercise_v3) | authority or operator | `exerciseV3Instructions` (recommended), `exerciseV3` | 400,000 |
| [`release_v3`](#release_v3) | anyone | `releaseV3Instructions` (recommended), `releaseV3` | 400,000 |
| [`early_close_v3`](#early_close_v3) | writer | **none** | none given |
| [`buy_position_v3`](#buy_position_v3) | writer (seller) | **none** | none given |
| [`fund_restricted_exercise_v3`](#fund_restricted_exercise_v3) | authority or operator | `fundRestrictedExerciseV3` | 200,000 |
| [`complete_pending_delivery_v3`](#complete_pending_delivery_v3) | anyone | `completePendingDeliveryV3` | 300,000 |
| [`cancel_pending_delivery_v3`](#cancel_pending_delivery_v3) | authority and writer | **none** | 300,000 |
| [`initialize_flash_exercise_policy_v1`](https://docs.covr.markets/concepts/flash-exercise.md#initialize_flash_exercise_policy_v1) | authority | **none** (planned) | none given |
| [`update_flash_exercise_policy_v1`, `disable_flash_exercise_policy_v1`](https://docs.covr.markets/concepts/flash-exercise.md#update_flash_exercise_policy_v1-and-disable_flash_exercise_policy_v1) | authority | **none** (planned) | none given |
| [`begin_flash_exercise_v3`](https://docs.covr.markets/concepts/flash-exercise.md#begin_flash_exercise_v3), [`finish_flash_exercise_v3`](https://docs.covr.markets/concepts/flash-exercise.md#finish_flash_exercise_v3) | authority or operator, plus a delegate | **none** (planned) | none given |
| [`init_payment_spend_ledger_v1`](#put-setup) | authority | **none** (not in 0.1.1) | none given |
| [`init_put_exposure_v1`, `set_put_exposure_limit_v1`](#put-setup) | authority | **none** (not in 0.1.1) | none given |
| [`init_mint_policy_v2`, `update_mint_policy_v2`](#put-setup) | authority | **none** (not in 0.1.1) | none given |
| [`pause_mint_policy_v2`](#put-setup) | authority or watcher | **none** (not in 0.1.1) | none given |
| [`init_put_asset_vault_v1`, `deposit_put_asset_v1`, `withdraw_put_asset_v1`](#put-setup) | authority | **none** (not in 0.1.1) | none given |
| [`init_flash_put_policy_v1`, `update_flash_put_policy_v1`, `disable_flash_put_policy_v1`](#put-setup) | authority | **none** (not in 0.1.1) | none given |
| [`init_mint_purchase_policy_v2`, `update_mint_purchase_policy_v2`](#put-setup) | authority | **none** (not in 0.1.1) | none given |
| [`create_market_v3x`, `set_market_v3x_pause`](#put-markets) | creator | **none** (not in 0.1.1) | none given |
| [`fill_put_v3`](#put-instructions) | writer (customer) | **none** (not in 0.1.1) | none given |
| [`exercise_put_v3`](#put-instructions) | authority or operator | **none** (not in 0.1.1) | none given |
| [`begin_flash_put_v3`, `finish_flash_put_v3`](#put-instructions) | authority or operator, plus a delegate | **none** (not in 0.1.1) | none given |
| [`release_put_v3`](#put-instructions) | anyone | **none** (not in 0.1.1) | none given |
| [`early_close_put_v3`, `transfer_position_v3x`, `close_position_v3x`](#put-instructions) | writer | **none** (not in 0.1.1) | none given |
| [`buy_put_position_v3`](#put-instructions) | writer (seller) | **none** (not in 0.1.1) | none given |

The put rows are the 25 instructions added on 4 November 2026. Desks cannot quote puts yet. See [Cash-secured puts](#cash-secured-puts).

## Money rules

These are the rules that decide where your USDC goes on a covered call. Each one is enforced by the program, not by covr's servers. Puts have their own rules: see [Put money rules](#put-money-rules).

**1. A fill needs only the premium in your vault.** At fill, the program moves the gross premium out of your vault: the customer gets `gross - fee`, and the market's fee owner gets `fee`. Nothing else leaves, and nothing is set aside for the strike.

**2. The strike is paid from your vault at exercise, unless you flash exercise.** `exercise_v3` moves the position's full `strike_usdc` from your vault to the writer, and the full `quantity_atoms` of collateral to a token account owned by your authority. Both legs succeed or the whole transaction reverts. A [flash exercise](https://docs.covr.markets/concepts/flash-exercise.md) instead pays the strike from the USDC your swap returns in the same transaction, and never debits your vault.

**3. If your vault cannot pay the strike, `exercise_v3` fails.** The program checks the vault balance before it moves anything and fails with `CustodyInvalidAmount` (7405). Nothing moves. You can top up and retry while the window is open. There is no partial exercise and no grace period.

**4. After the window, anyone can give the collateral back.** From `expiry + window` on, `release_v3` needs no signature from you. It returns all the locked collateral to the writer and closes the position as released. Your premium is not returned.

**5. The exercise window is short and fixed.** Every market has a window of 60 to 3,600 seconds after expiry. You can exercise when `expiry <= now < expiry + window`, by the Solana clock. Not before, not after.

**6. All positions on a market expire together.** Each position copies its market's `expiry` and `window` at fill time. Every position you hold on one market must be exercised inside the same window.

**7. Withdrawals do not look at your open positions.** `withdraw` moves any amount your vault holds to your authority's USDC account. The program does not stop you from withdrawing the USDC you need for upcoming exercises.

**8. The program does not read a price.** It lets you exercise at any spot price. Deciding whether to exercise is up to you.

> [!WARNING]
> Unless you flash exercise, keep each exercise's strike in the vault before its window opens. Set the compute-unit limit on every exercise transaction. If no exercise succeeds before the window closes, the call is lost: anyone can then release the collateral to the customer, and you get nothing back for the premium you paid.

## Setup and configuration

### register_maker_v3

Creates your Maker and its registration record, and binds your quote key to your Solana authority for good.

| | |
| --- | --- |
| Signer | Your Solana authority. It pays rent for both accounts. |
| SDK | [`signRegistrationGrant`](https://docs.covr.markets/reference/sdk/setup.md#signregistrationgrant), then [`registerMakerV3`](https://docs.covr.markets/reference/sdk/setup.md#registermakerv3). Returns `{ maker, origin, instruction }`. |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | w | s | Payer. Becomes `Maker.authority`. |
| 1 | maker | w | | Created. Seeds `"maker"`, quote key. |
| 2 | origin | w | | Created. Seeds `"maker-origin-v1"`, maker. |
| 3 | system program | | | |

| Name | Type | Description |
| --- | --- | --- |
| `eth_address` | `[u8; 20]` | Your quote key address. |
| `signature` | `[u8; 65]` | The quote key's EIP-712 signature over `Register(bytes32 authority)`, where `authority` is the 32 bytes of the signing Solana key. `r ‖ s ‖ v`, `v` 27 or 28, low `s`. |

**Checks.** The signature must recover to `eth_address` in the registration domain: `{ name: "SOL Covered Calls", version: "1", chainId: 2000000001, verifyingContract }`, where `verifyingContract` is the last 20 bytes of `keccak256("deployment-v2" ‖ DEPLOYMENT_ID ‖ PROGRAM_ID ‖ "registration-v3")`. Otherwise `BadSignature` (6000). The Maker must not exist yet.

**Effects.** Creates a 117-byte Maker with your authority, no operator and `min_nonce = 0`, and a 179-byte origin record. No instruction can change the authority or the quote key afterwards.

### initialize_vault

Creates your USDC vault and your PremiumBudget, disabled.

| | |
| --- | --- |
| Signer | authority (pays rent) |
| SDK | [`initializeVault`](https://docs.covr.markets/reference/sdk/setup.md#initializevault)`({ authority, maker })`. Returns `{ vault, premiumBudget, instruction }`. |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | w | s | Must equal `Maker.authority`. |
| 1 | maker | | | Your Maker. |
| 2 | mint | | | USDC. Must have 6 decimals. |
| 3 | vault | w | | Created. Seeds `"stable"`, maker, USDC. Token authority: the Maker PDA. |
| 4 | token program | | | SPL Token. |
| 5 | system program | | | |
| 6 | premium_budget | w | | Created. Seeds `"premium-budget"`, maker, USDC. |

No arguments. **Effects:** PremiumBudget starts at `limit = 0`, `spent = 0`, `enabled = false`: no premium cap.

### set_premium_budget

Sets your lifetime premium cap.

| | |
| --- | --- |
| Signer | authority |
| SDK | [`setPremiumBudget`](https://docs.covr.markets/reference/sdk/setup.md#setpremiumbudget)`({ authority, maker, enabled, limit })` |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | | s | Must equal `Maker.authority`. |
| 1 | maker | | | |
| 2 | stable | | | USDC mint (6 decimals). |
| 3 | premium_budget | w | | |

| Name | Type | Description |
| --- | --- | --- |
| `enabled` | `bool` | `false` removes the cap. |
| `limit` | `u64` | Cap on lifetime gross premium (fee included) across every mint and market, in USDC atoms. |

**Effects.** Replaces `enabled` and `limit`. `spent` never resets, so a `limit` below `spent` blocks every new fill until you raise it.

### deposit

Moves USDC from your authority's token account into your vault.

| | |
| --- | --- |
| Signer | authority |
| SDK | [`deposit`](https://docs.covr.markets/reference/sdk/setup.md#deposit)`({ authority, maker, source, amount })` |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | | s | Must equal `Maker.authority`. |
| 1 | maker | | | |
| 2 | mint | | | USDC (6 decimals). |
| 3 | vault | w | | Your USDC vault. |
| 4 | source | w | | A USDC token account owned by your authority. |
| 5 | token program | | | SPL Token. |

| Name | Type | Description |
| --- | --- | --- |
| `amount` | `u64` | USDC atoms. Must be above 0, else `InvalidAmount` (6002). |

### withdraw

Moves USDC from your vault to a USDC token account your authority owns. Only your authority can sign it; the operator cannot.

| | |
| --- | --- |
| Signer | authority |
| SDK | [`withdraw`](https://docs.covr.markets/reference/sdk/setup.md#withdraw)`({ authority, maker, destination, amount })`. Returns `{ vault, instruction }`. |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | | s | Must equal `Maker.authority`. |
| 1 | maker | | | |
| 2 | mint | | | USDC (6 decimals). |
| 3 | vault | w | | Your USDC vault. |
| 4 | destination | w | | A USDC token account owned by your authority. |
| 5 | token program | | | SPL Token. |

| Name | Type | Description |
| --- | --- | --- |
| `amount` | `u64` | USDC atoms. Must be above 0. |

**Checks.** Only the signer, the accounts and `amount > 0`. The program does not compare `amount` with the strike you owe on open positions: USDC you withdraw is no longer there to pay exercises. If the vault holds less than `amount`, the SPL Token program fails the transfer.

```ts
import { deriveMaker, withdraw } from '@covrfun/maker-sdk';

declare const makerEthAddress: string; // your quote key address
declare const authority: string;       // your Solana authority: the only key that can sign
declare const destination: string;     // a USDC token account owned by your authority

const { maker } = await deriveMaker(makerEthAddress);
const { instruction } = await withdraw({ authority, maker, destination, amount: 250_000_000n }); // 250 USDC
```

The instruction is the discriminator `b712469c946da122` followed by `amount` as a little-endian `u64`, with the six accounts above: the same accounts as `deposit`, with the destination in place of the source.

### configure_maker

Sets your operator and your nonce floor. Both fields are replaced every time.

| | |
| --- | --- |
| Signer | authority |
| SDK | [`configureMaker`](https://docs.covr.markets/reference/sdk/setup.md#configuremaker)`({ authority, makerEthAddress, operator, minNonce })`. Returns `{ maker, instruction }`. |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | | s | Must equal `Maker.authority`. |
| 1 | maker | w | | |

| Name | Type | Description |
| --- | --- | --- |
| `operator` | `Pubkey` | The new operator. Pass the current one to keep it. The zero key (`11111111111111111111111111111111`) removes it. |
| `min_nonce` | `u64` | The new nonce floor. Must be at least the current one, else `InvalidTerms` (6001). |

**Effects.** Raising `min_nonce` cancels every quote, early-close quote and sale quote you signed with a lower nonce. See [The nonce floor](https://docs.covr.markets/reference/program/accounts.md#the-nonce-floor).

### initialize_exposure_v3

Creates your Exposure account for one collateral mint.

| | |
| --- | --- |
| Signer | authority (pays rent) |
| SDK | [`initializeExposureV3`](https://docs.covr.markets/reference/sdk/setup.md#initializeexposurev3)`({ authority, makerEthAddress, collateral: { mint, program, decimals }, limitAtoms })` |
| Compute | 200,000 |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | w | s | Must equal `Maker.authority`. |
| 1 | maker | | | |
| 2 | collateral | | | The collateral mint. SPL Token or Token-2022. |
| 3 | exposure | w | | Created. Seeds `"exposure"`, maker, mint. |
| 4 | system program | | | |

| Name | Type | Description |
| --- | --- | --- |
| `limit` | `u64` | Cap on open collateral on this mint across all markets, in collateral atoms. |

**Errors.** `MakerFenceSchema` (7600) or `MakerFenceUnauthorized` (7602) if the Maker is not your canonical Maker account.

### set_exposure_limit

Changes the limit of an existing Exposure account.

| | |
| --- | --- |
| Signer | authority |
| SDK | [`setExposureLimit`](https://docs.covr.markets/reference/sdk/setup.md#setexposurelimit)`({ authority, makerEthAddress, collateral: { mint, program, decimals }, limitAtoms })`, the same input as `initializeExposureV3`. Returns `{ maker, exposure, instruction }`. It refuses Token-2022 collateral before building, because the program would refuse it on chain. |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | | s | Must equal `Maker.authority`. |
| 1 | maker | | | |
| 2 | collateral | | | The collateral mint. Must be an SPL Token mint (JitoSOL is). |
| 3 | exposure | w | | Seeds `"exposure"`, maker, mint. |

| Name | Type | Description |
| --- | --- | --- |
| `limit` | `u64` | New cap, in collateral atoms. |

**Effects.** Replaces `limit`. A limit below `active` blocks new fills on that mint. It never blocks an exit. Discriminator: `21859ba43e8e7723`.

### initialize_mint_policy_v1

Creates your MintPolicyV1 and MintUsageV1 for one collateral mint.

| | |
| --- | --- |
| Signer | authority (pays rent) |
| SDK | [`initializeMintPolicyV1`](https://docs.covr.markets/reference/sdk/setup.md#initializemintpolicyv1)`({ authority, maker, collateral, settings })`, with settings from [`mintPolicySettingsFor`](https://docs.covr.markets/reference/sdk/setup.md#mintpolicysettingsfor)`(decodedMarket, caps)`. Returns `{ policy, usage, instruction }`. |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | w | s | Must equal `Maker.authority`. |
| 1 | maker | | | |
| 2 | collateral | | | The collateral mint. |
| 3 | payment | | | USDC (6 decimals). |
| 4 | policy | w | | Created. Seeds `"mint-policy"`, maker, mint. |
| 5 | usage | w | | Created. Seeds `"mint-usage"`, maker, mint. |
| 6 | system program | | | |

The one argument, `settings`, is 130 bytes:

| Name | Type | Description |
| --- | --- | --- |
| `watcher` | `Pubkey` | Key that may pause this policy. Zero key for none. |
| `enabled` | `bool` | `false` blocks new fills on this mint. |
| `terms_id` | `[u8; 32]` | Market terms you accept. `ORDINARY_TERMS_ID` for ordinary markets. Not zero. |
| `profile_hash` | `[u8; 32]` | The `profile_hash` of the markets you will quote on this mint. Not zero. |
| `max_order_atoms` | `u64` | Largest single fill, collateral atoms. |
| `max_reserved_atoms` | `u64` | Cap on open collateral on this mint, collateral atoms. |
| `max_reserved_strike_usdc` | `u64` | Cap on total strike owed on open positions on this mint, USDC atoms. |
| `lifetime_premium_limit_enabled` | `bool` | Turns on the next field. |
| `lifetime_premium_limit_usdc` | `u64` | Cap on lifetime gross premium on this mint, USDC atoms. Must be 0 when disabled. |

**Checks.** `terms_id` and `profile_hash` not zero, and a disabled lifetime limit set to 0, else `MintPolicySettings` (6014). The program does not check that they match a real market. If they do not, every fill on this mint fails with `TokenLifecycleAccounting` (8302). Take both from a decoded market.

**Effects.** Policy `generation = 1`. Usage starts not bootstrapped: run `bootstrap_mint_usage_v1` next.

### update_mint_policy_v1

Replaces the settings of a mint policy.

| | |
| --- | --- |
| Signer | authority (the watcher cannot) |
| SDK | [`updateMintPolicyV1`](https://docs.covr.markets/reference/sdk/setup.md#updatemintpolicyv1)`({ authority, maker, collateral, expectedGeneration, settings })`. Returns `{ policy, usage, instruction }`. Take `expectedGeneration` and the current `settings` from [`decodeMintPolicy`](https://docs.covr.markets/reference/sdk/setup.md#decodemintpolicy). |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | | s | Must equal `Maker.authority`. |
| 1 | maker | | | |
| 2 | collateral | | | The collateral mint. Its token program and decimals must not have changed. |
| 3 | payment | | | USDC. |
| 4 | policy | w | | |
| 5 | usage | | | |

| Name | Type | Description |
| --- | --- | --- |
| `expected_generation` | `u64` | Must equal the policy's current `generation`, else `MintPolicyGeneration` (6012). |
| `settings` | `MintPolicySettingsV1` | Same 130-byte layout as above. |

**Effects.** Replaces all settings and adds 1 to `generation`. Open positions keep their terms. Discriminator: `5a58a12379e8aa18`.

### pause_mint_policy_v1

The fast, reversible brake. One small instruction stops every new fill on one collateral mint, including fills of quotes you already signed. Exits are not affected: you can still exercise, and anyone can still release.

| | |
| --- | --- |
| SDK | [`pauseMintPolicyV1`](https://docs.covr.markets/reference/sdk/setup.md#pausemintpolicyv1)`({ signer, maker, collateral, expectedGeneration })`. Returns `{ policy, instruction }`. Undo with [`updateMintPolicyV1`](https://docs.covr.markets/reference/sdk/setup.md#updatemintpolicyv1). |
| Who may sign | Your authority, **or** the policy's watcher key. Set a watcher in the policy settings to give a risk system a key that can pause but can change nothing else. Anyone else gets `MintPolicyUnauthorized` (6013). |
| Effect | Sets `enabled = false` and adds 1 to `generation`. Every later fill on that mint fails with `TokenLifecycleAccounting` (8302) and the log line `COVR_TOKEN_ACCOUNTING: Paused`. |
| Undo | `update_mint_policy_v1` with `enabled = true`. Only your authority can sign it, and it needs the new `generation`. |
| Still works when | The collateral mint is frozen or changed: the instruction does not read the mint. |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | | s | Your authority or the watcher. |
| 1 | maker | | | Your Maker. |
| 2 | policy | w | | Seeds `"mint-policy"`, maker, collateral mint. |

| Name | Type | Description |
| --- | --- | --- |
| `expected_generation` | `u64` | Must equal the policy's current `generation` (u64 at byte 204 of the policy account). Otherwise `MintPolicyGeneration` (6012). |

`expected_generation` makes each pause and update apply to the version you read. If another pause or update landed first, yours fails with 6012: re-read `generation` and resend. A pause of an already-paused policy still succeeds and adds 1 to `generation`.

```ts
import { createSolanaRpc } from '@solana/kit';
import {
  PROGRAM_ID, JITOSOL_MINT, TOKEN_PROGRAM,
  deriveMaker, deriveMintPolicy, decodeMintPolicy, pauseMintPolicyV1, updateMintPolicyV1,
} from '@covrfun/maker-sdk';

declare const makerEthAddress: string; // your quote key address
declare const authority: string;       // your authority (the policy records it)
declare const signer: string;          // your authority, or the policy's watcher key

const rpc = createSolanaRpc('https://<your rpc>');
const collateral = { mint: JITOSOL_MINT, program: TOKEN_PROGRAM, decimals: 9 };
const { maker } = await deriveMaker(makerEthAddress);
const { policy } = await deriveMintPolicy(maker, collateral.mint);

async function readPolicy() {
  const { value } = await rpc.getAccountInfo(policy, { commitment: 'confirmed', encoding: 'base64' }).send();
  if (!value || value.owner !== PROGRAM_ID) throw Error('mint policy not found');
  return decodeMintPolicy(policy, Buffer.from(value.data[0], 'base64'), { authority, maker, collateral });
}

// Brake: stop every new fill on JitoSOL.
const before = await readPolicy();
const pause = await pauseMintPolicyV1({
  signer, maker, collateral: collateral.mint, expectedGeneration: before.generation,
});

// Later, undo (authority only): same settings with enabled = true.
const paused = await readPolicy();
const resume = await updateMintPolicyV1({
  authority, maker, collateral: collateral.mint,
  expectedGeneration: paused.generation,
  settings: { ...paused.settings, enabled: true },
});
```

Read the policy at `confirmed` for speed: a stale `generation` only costs a retry (6012). The instruction is the discriminator `d84b57d2678c345f` followed by `expected_generation` as a little-endian `u64`, with the three accounts above. In raw bytes, `generation` is the `u64` at byte 204 of the policy account and `enabled` is byte 244.

### bootstrap_mint_usage_v1

Marks a new MintUsageV1 ready. Run it once per mint, after `initialize_mint_policy_v1`. Fills on that mint fail until it runs.

| | |
| --- | --- |
| Signer | authority |
| SDK | [`bootstrapMintUsageV1`](https://docs.covr.markets/reference/sdk/setup.md#bootstrapmintusagev1)`({ authority, makerEthAddress, collateral })` |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | | s | Must equal `Maker.authority`. |
| 1 | maker | | | |
| 2 | origin | | | Your MakerOriginV1. |
| 3 | policy | | | Seeds `"mint-policy"`, maker, mint. |
| 4 | usage | w | | Seeds `"mint-usage"`, maker, mint. |

No arguments. **Checks.** The origin must match your Maker and this deployment (`MakerOriginSchema` 8000, `MakerOriginIdentity` 8001). The usage must be untouched: not bootstrapped and every counter 0, else `MakerOriginState` (8002).

## Markets

### create_market_v3

Creates an ordinary market. Any wallet can create one.

> [!NOTE]
> A market you create is valid on chain, but covr does not show it to customers yet.

| | |
| --- | --- |
| Signer | creator (pays rent) |
| SDK | [`createMarketV3`](https://docs.covr.markets/reference/sdk/markets.md#createmarketv3)`(input)`. Returns `{ market, instruction }`. |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | creator | w | s | |
| 1 | market | w | | Created. Seeds `"market-v3"`, creator, salt. 376 bytes. |
| 2 | collateral | | | The collateral mint. |
| 3 | payment | | | USDC. |
| 4 | system program | | | |

| Name | Type | Description |
| --- | --- | --- |
| `salt` | `u64` | Any value. Makes the market address unique per creator. |
| `fee_owner` | `Pubkey` | Owner of the USDC account that receives the fee. Not the zero key. |
| `expiry` | `i64` | Unix seconds. 60 s to 90 days (7,776,000 s) after the chain clock at creation. |
| `window` | `u64` | Exercise window, seconds. 60 to 3,600. |
| `strike_e8` | `u64` | Strike, USD per whole token times 10^8. Above 0. |
| `max_quantity_atoms` | `u64` | Largest single fill, collateral atoms. Above 0. |
| `fee_bps` | `u16` | Fee on the gross premium, basis points. 0 to 1,000. |

**Checks.** Terms as above, else `MarketV3Terms` (8202). Payment must be USDC, else `MarketV3Identity` (8201). The collateral must be a plain 82-byte mint (no Token-2022 extensions), with no freeze authority, and not native SOL, else `MarketV3Unsupported` (8203).

**Effects.** Stores the terms, `terms_id = ORDINARY_TERMS_ID` and a `profile_hash` fingerprint of the mint. Nothing can change them later except `paused`.

### create_restricted_market_v3

Creates a restricted market (fund, then deliver). Same accounts and arguments as `create_market_v3`, plus one.

> [!NOTE]
> Restricted (tokenized-stock) markets are covr-only for now.

| Name | Type | Description |
| --- | --- | --- |
| `cancellation_timeout_seconds` | `u64` | Must be `604800` (7 days), else `RestrictedTerms` (8400). |

The collateral may have a freeze authority. **SDK:** [`createRestrictedMarketV3`](https://docs.covr.markets/reference/sdk/markets.md#createrestrictedmarketv3). **Compute:** 200,000.

### set_market_v3_pause

Pauses or resumes new fills on a market you created. **No SDK builder.** For a restricted market, use `set_restricted_market_v3_pause` with the same accounts.

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | creator | | s | Must equal `MarketV3.creator`. |
| 1 | market | w | | |

| Name | Type | Description |
| --- | --- | --- |
| `paused` | `bool` | `true` blocks new fills. Exercise and release still work. |

Discriminator: `42fb0be08d74cf2f`.

## Trading and settlement

### fill_v3

Opens a position from one of your signed quotes. **The customer signs and submits it**, not you. covr's gateway prepares it. Use the SDK builder to simulate or audit the exact instruction. For a restricted market the instruction is `fill_restricted_v3`, with one more argument.

| | |
| --- | --- |
| Signer | writer (the customer). Pays rent for the position and its collateral vault. |
| SDK | [`fillV3`](https://docs.covr.markets/reference/sdk/settlement.md#fillv3)`(input)`. Returns the amounts and `{ addresses, recommendedComputeUnitLimit, instruction }`. |
| Compute | 300,000 |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | writer | w | s | The customer. Must equal the `writer` in your signed quote. |
| 1 | market | | | MarketV3. |
| 2 | maker | | | Your Maker. |
| 3 | position | w | | Created. Seeds `"position"`, quote key, nonce. |
| 4 | collateral_vault | w | | Created. Seeds `"collateral"`, position. |
| 5 | collateral | | | Collateral mint. Must equal `market.collateral`. |
| 6 | payment | | | USDC. |
| 7 | writer_collateral | w | | Customer's collateral token account. |
| 8 | writer_payment | w | | Customer's USDC account. Receives `gross - fee`. |
| 9 | fee_tokens | w | | USDC account owned by `market.fee_owner`. Receives `fee`. |
| 10 | payment_vault | w | | Your USDC vault. Pays the gross premium. |
| 11 | collateral program | | | Must equal `market.collateral_program`. |
| 12 | payment program | | | SPL Token. |
| 13 | system program | | | |
| 14 | exposure | w | | Your Exposure for this mint. |
| 15 | premium_budget | w | | Your PremiumBudget. |
| 16 | policy | | | Your MintPolicyV1 for this mint. |
| 17 | usage | w | | Your MintUsageV1 for this mint. |
| 18 | origin | | | Your MakerOriginV1. |
| 19 | JitoSOL stake pool | | | Remaining account. Only on JitoSOL fills, and then required. |

| Name | Type | Description |
| --- | --- | --- |
| `auction_id` | `[u8; 32]` | The RFQ's auction id, as signed in your quote. Not zero. |
| `nonce` | `u64` | Your quote nonce. |
| `quantity_atoms` | `u64` | Collateral, in collateral atoms. |
| `price_e18` | `u128` | Your price: USDC per whole token, times 10^18. |
| `valid_until` | `i64` | Your quote's expiry, unix seconds. |
| `signature` | `[u8; 65]` | Your quote key's QuoteV2 signature in this market's quote domain. |
| `cancellation_timeout_seconds` | `u64` | `fill_restricted_v3` only. Must be `604800`. |

**Checks, in order.**

1. `auction_id` is not zero (`InvalidOrder` 6003).
2. The market is a canonical V3 market, and the collateral mint still has the profile it had at creation (8200 to 8203).
3. The Maker is your canonical Maker account (7600, 7602), and the origin account is its MakerOriginV1 (8700, 8701). There is exactly one remaining account on JitoSOL fills and none otherwise; a missing or extra account fails with 8800. On JitoSOL, that account must be the pinned stake pool, read-only, updated this epoch (`InvalidJitoPool` 6009), and the order must pass the [JitoSOL size cap](#jitosol-size-cap) (`JitoSolOrderLimit` 6008).
4. The payment mint is USDC (`TokenLifecycleIdentity` 8300).
5. The market is not paused. `now < expiry` and `now < valid_until <= expiry`. `nonce >= min_nonce` and `nonce != u64::MAX`. `0 < quantity_atoms <= max_quantity_atoms`. Otherwise `InvalidOrder` (6003).
6. Your exposure, budget, policy and usage accounts are the canonical ones for this mint (`TokenLifecycleIdentity` 8300, or a `MintPolicy` error 6010 to 6014).
7. `gross = quantity_atoms × price_e18 / 10^(decimals + 12)` and `strike = quantity_atoms × strike_e8 / 10^(decimals + 2)` are whole USDC atoms above 0 (`InvalidAmount` 6002).
8. The signature recovers to your quote key over QuoteV2, bound to this auction id and this writer (`BadSignature` 6000).
9. Your mint policy accepts it: bootstrapped, enabled, same `terms_id` and `profile_hash`, and every cap holds after the fill (`TokenLifecycleAccounting` 8302).
10. `exposure.active + quantity_atoms <= exposure.limit` (`ExposureLimit` 6006).
11. If the budget is enabled, `spent + gross <= limit` (`PremiumBudgetExceeded` 6007).

**Effects.**

- `quantity_atoms` of collateral: customer's account to the position's collateral vault.
- `gross - fee` USDC: your vault to the customer. `fee = floor(gross × fee_bps / 10000)`.
- `fee` USDC, if above 0: your vault to `fee_tokens`.
- Creates the PositionV3 with `state = 0` (open) and `strike_usdc = strike`.
- Adds to `usage` (reserved atoms, reserved strike, premium, fill count), `exposure.active` and `premium_budget.spent`.

If your vault holds less than the gross premium, the fill fails with `CustodyInvalidAmount` (7405) and nothing moves. A nonce that already opened a position fails because the position account exists.

#### JitoSOL size cap

One JitoSOL fill may be worth at most 50 SOL of stake-pool value. The same cap applies to `fill_v3` and to the put fill, `fill_put_v3`. The program reads two `u64` fields of the Jito stake pool account and requires, in exact integer math:

```text
quantity_atoms × total_lamports <= 50,000,000,000 × pool_token_supply
```

`total_lamports` is the u64 at byte 258 of the pool account and `pool_token_supply` the u64 at byte 266. The pool's `last_update_epoch` (u64 at byte 274) must equal the current epoch. The largest fill is therefore `floor(50,000,000,000 × pool_token_supply / total_lamports)` JitoSOL atoms. In JitoSOL, the cap is 50 divided by the pool rate (`total_lamports / pool_token_supply`, SOL per JitoSOL), so it shrinks as the rate rises. For illustration only, not a pool read: at a rate of 1.31 SOL per JitoSOL the cap would be about 38 JitoSOL.

The cap is per fill, not per desk or per market, and a market's `max_quantity_atoms` does not raise it. A larger fill fails with `JitoSolOrderLimit` (6008). Size your quotes from a fresh read of the pool. Before the 4 November 2026 upgrade the cap was 2 SOL.

### exercise_v3

Buys the collateral at the strike, inside the exercise window. Ordinary markets only.

| | |
| --- | --- |
| Signer | your authority or your operator |
| SDK | Recommended: [`exerciseV3Instructions`](https://docs.covr.markets/reference/sdk/settlement.md#exercisev3instructions)`({ market, position, authority, rentLamports, makerCollateral? })` returns the whole transaction. The bare instruction: [`exerciseV3`](https://docs.covr.markets/reference/sdk/settlement.md#exercisev3)`({ market, position, authority, writerCollateral, writerPayment, makerCollateral })`. |
| Compute | 400,000. Set it explicitly: the measured worst case is 277,316, above the default 200,000. |

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | authority | | s | `Maker.authority`, or `Maker.operator` if set. Otherwise `TokenLifecycleAuthority` (8304). |
| 1 | market | | | The position's MarketV3. |
| 2 | maker | | | Your Maker. |
| 3 | position | w | | The PositionV3. |
| 4 | collateral_vault | w | | The position's collateral vault. Closed by this instruction. |
| 5 | writer | | | Must equal `position.writer`. Not a signer. |
| 6 | collateral | | | Collateral mint. |
| 7 | writer_collateral | w | | A collateral token account owned by the writer. Receives any surplus and the vault's rent. |
| 8 | collateral program | | | |
| 9 | exposure | w | | Your Exposure for this mint. |
| 10 | usage | w | | Your MintUsageV1 for this mint. |
| 11 | payment | | | USDC. |
| 12 | payment_vault | w | | Your USDC vault. Pays the strike. |
| 13 | writer_payment | w | | A USDC account owned by the writer. Receives the strike. |
| 14 | maker_collateral | w | | A collateral token account owned by your **authority** (also when the operator signs). Receives the collateral. |
| 15 | payment program | | | SPL Token. |

No arguments. No remaining accounts.

**Checks.** The position, market, usage and exposure are canonical and match each other (`TokenLifecycleIdentity` 8300). The position is open and `expiry <= now < expiry + window` (`InvalidOrder` 6003). The vault holds at least `strike_usdc`, and the collateral vault at least `quantity_atoms` (`CustodyInvalidAmount` 7405). `writer_collateral`, `writer_payment` and `maker_collateral` have no delegate and no close authority other than their owner (`CustodyUnsafeRecipient` 7403).

**Effects.**

- `strike_usdc` USDC: your vault to `writer_payment`.
- `quantity_atoms` collateral: position vault to `maker_collateral`.
- Any extra collateral in the position vault, then the vault itself (closed): to the writer.
- Subtracts the position from `exposure.active` and `usage`. Sets `state = 2` (exercised).

The program does not create token accounts, and a writer could leave theirs unusable. `exerciseV3Instructions` handles this: it returns, in order, a `SetComputeUnitLimit` of 400,000, then a fresh USDC account and a fresh collateral account for the writer, then `exercise_v3` paying into them. The two accounts are created at addresses derived from your signer (`createWithSeed`), so only your signer can create them and the writer cannot block them. You pay their rent (`rentLamports` each, read from your RPC), and the writer keeps it. `makerCollateral` defaults to your authority's associated token account for the collateral, which must already exist. The SDK refuses your operator's associated token account, because the program pays only the authority's. Sign with `authority` as the only signer and fee payer.

```ts
import { createSolanaRpc } from '@solana/kit';
import { WRITER_ACCOUNT_SPACE, exerciseV3Instructions, releaseV3Instructions, type DecodedMarketV3, type PositionV3 } from '@covrfun/maker-sdk';

declare const market: DecodedMarketV3;  // decodeMarketV3 of the position's market
declare const position: PositionV3;     // decodePositionV3, status 'open'
declare const authority: string;        // your authority or operator: signer and fee payer

const rpc = createSolanaRpc('https://<your rpc>');
// Rent for one 165-byte token account. Read it, do not hard-code it: rent has changed before.
const rentLamports = await rpc
  .getMinimumBalanceForRentExemption(BigInt(WRITER_ACCOUNT_SPACE), { commitment: 'finalized' })
  .send();

const ex = await exerciseV3Instructions({ market, position, authority, rentLamports });
// ex.instructions: SetComputeUnitLimit(400,000), two fresh writer token accounts, exercise_v3.
// Put them in one transaction, in this order, with `authority` as the only signer.

const rel = await releaseV3Instructions({ market, position, payer: authority, rentLamports });
// rel.instructions: SetComputeUnitLimit(400,000), one fresh writer collateral account, release.
```

### release_v3

Returns the collateral to the writer after the exercise window. Anyone can send it. You get nothing back. For a restricted position that was never funded, the instruction is `release_restricted_v3`, with the same accounts.

| | |
| --- | --- |
| Signer | none required. Whoever pays the fee can send it. |
| SDK | Recommended: [`releaseV3Instructions`](https://docs.covr.markets/reference/sdk/settlement.md#releasev3instructions)`({ market, position, payer, rentLamports, collateralAccountSpace? })`: a `SetComputeUnitLimit` of 400,000, a fresh collateral account for the writer created by `payer`, then the release. `payer` signs alone. The bare instruction: [`releaseV3`](https://docs.covr.markets/reference/sdk/settlement.md#releasev3)`({ market, position, writerCollateral })`. Both pick `release_restricted_v3` for restricted markets. |
| Compute | 400,000 |

Accounts: the ten accounts at positions 1 to 10 of `exercise_v3`, in the same order (market, maker, position, collateral_vault, writer, collateral, writer_collateral, collateral program, exposure, usage). No arguments.

**Checks.** The position is open and `now >= expiry + window` (`InvalidOrder` 6003). The vault holds at least `quantity_atoms` (`CustodyInvalidAmount` 7405). `writer_collateral` must be a clean collateral token account owned by the writer: right mint and owner (Anchor 2014, 2015), no delegate, and no close authority other than the writer (`CustodyUnsafeRecipient` 7403). The program does not create it: `releaseV3Instructions` creates a fresh one in the same transaction.

**Effects.** All collateral in the position vault goes to `writer_collateral`. The vault is closed and its rent goes to `writer_collateral` too. Exposure and usage are freed. `state = 3` (released). No USDC moves.

`release_restricted_v3` returns whatever the vault holds, even if it is less than `quantity_atoms`. A funded (pending) restricted position can never be released.

### early_close_v3

Lets the writer close an open position before expiry by paying you a price you signed. The collateral goes back to the writer. **No SDK builder or signing helper.**

> [!NOTE]
> Not offered to desks yet: covr's gateway does not run early-close auctions for V3 positions, so no flow produces this instruction for an external maker today.

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | writer | w | s | Must equal `position.writer`. Pays the receipt rent. |
| 1 to 10 | delivery accounts | | | Same as `release_v3`. |
| 11 | payment | | | USDC. |
| 12 | writer_payment | w | | The writer's USDC account. Pays `amount_usdc`. |
| 13 | payment_vault | w | | Your USDC vault. Receives `amount_usdc`. |
| 14 | close_receipt | w | | Created. Seeds `"close-receipt"`, maker, close_nonce. |
| 15 | payment program | | | SPL Token. |
| 16 | system program | | | |

| Name | Type | Description |
| --- | --- | --- |
| `close_nonce` | `u64` | Your early-close nonce. Checked against `min_nonce`. Single use. |
| `amount_usdc` | `u64` | USDC atoms the writer pays you. Above 0. |
| `valid_until` | `i64` | Unix seconds. `now < valid_until <= expiry`. |
| `signature` | `[u8; 65]` | Your quote key's EIP-712 signature over `EarlyClose(bytes32 position,bytes32 owner,address maker,uint64 nonce,uint64 amount,uint64 validUntil,address usd)` in the market's quote domain. `owner` is the writer, `usd` is `USDC_ALIAS`. |

**Effects.** `amount_usdc` from the writer to your vault. All collateral back to the writer. Exposure and usage freed. `state = 4` (early closed). Your premium budget is not refunded.

### buy_position_v3

Lets the writer sell an open ordinary position to your desk at a price you signed. Your authority becomes the position's writer: it receives the strike if the original maker exercises, or the collateral at release. **No SDK builder or signing helper.**

> [!NOTE]
> Not offered to desks yet: covr's gateway does not run position-sale auctions for V3 positions, so no flow produces this instruction for an external maker today.

| # | Account | w | s | Notes |
| --- | --- | --- | --- | --- |
| 0 | seller | w | s | The current writer. |
| 1 | market | | | |
| 2 | original_maker | | | The Maker that sold the call. |
| 3 | position | w | | |
| 4 | buyer_maker | | | Your Maker. |
| 5 | buyer_origin | | | Your MakerOriginV1. |
| 6 | recipient | | | Your authority. Must be a plain wallet with no data. |
| 7 | collateral | | | |
| 8 | payment | | | USDC. |
| 9 | seller_payment | w | | Seller's USDC account. |
| 10 | buyer_payment_vault | w | | Your USDC vault. Pays `amount`. |
| 11 | buyer_budget | w | | Your PremiumBudget. |
| 12 | buyer_mint_policy | | | Your MintPolicyV1 for this mint. |
| 13 | purchase_policy | | | Your MintPurchasePolicyV1 (`initialize_mint_purchase_policy_v1`). |
| 14 | purchase_usage | w | | Your MintPurchaseUsageV1. |
| 15 | sale_receipt | w | | Created. Seeds `"sale-receipt"`, buyer maker, nonce. |
| 16 | payment program | | | |
| 17 | system program | | | |

| Name | Type | Description |
| --- | --- | --- |
| `nonce` | `u64` | Your sale nonce. Checked against your `min_nonce`. Single use. |
| `amount` | `u64` | USDC atoms you pay the seller. |
| `valid_until` | `i64` | `now < valid_until <= expiry + window`. The sale itself must happen before expiry, on a market that is not paused. |
| `auction_id` | `[u8; 32]` | Not zero. |
| `signature` | `[u8; 65]` | Your quote key's EIP-712 signature over `PositionSale(bytes32 auctionId,bytes32 position,bytes32 seller,bytes32 recipient,address maker,uint64 nonce,uint64 amount,uint64 validUntil,address usd)` in the market's quote domain. |

**Effects.** `amount` from your vault to the seller. Adds `amount` to your `premium_budget.spent` and purchase usage. Sets `position.writer` to your authority. The original maker's obligations do not change.

## Restricted settlement

> [!NOTE]
> Restricted markets are covr-only for now. These instructions are listed so your systems can recognise them.

### fund_restricted_exercise_v3

Step 1 of a restricted exercise. Moves the full strike from your vault into a per-position escrow, inside the exercise window.

| | |
| --- | --- |
| Signer | your authority or operator (pays the escrow rent; it goes back to your authority later) |
| SDK | [`fundRestrictedExerciseV3`](https://docs.covr.markets/reference/sdk/settlement.md#fundrestrictedexercisev3)`({ market, position, authority })` |
| Compute | 200,000 |

Accounts, in order: authority (w, s), market, maker, position (w), collateral_vault, collateral, collateral program, payment (USDC), payment_vault (w), strike_escrow (w, created, seeds `"strike-escrow-v3"`, position), usage (w), payment program, system program. No arguments.

**Checks.** Open, unfunded, and `expiry <= now < expiry + window` (`RestrictedTime` 8402, `RestrictedState` 8401). The collateral vault still holds the full quantity (`RestrictedImpaired` 8404). The vault holds the strike (`CustodyInvalidAmount` 7405).

**Effects.** `strike_usdc` from your vault to the escrow. `state = 1` (pending). `cancel_eligible_at = now + 604800`.

### complete_pending_delivery_v3

Step 2 of a restricted exercise. Anyone can send it once the strike is funded, also after the 7-day timeout, until a cancellation.

| | |
| --- | --- |
| Signer | any signer (`caller`) |
| SDK | [`completePendingDeliveryV3`](https://docs.covr.markets/reference/sdk/settlement.md#completependingdeliveryv3)`({ market, position, caller, writerCollateral, writerPayment, makerCollateral })` |
| Compute | 300,000 |

Accounts, in order: caller (s), the ten delivery accounts of `release_v3`, payment (USDC), strike_escrow (w), writer_payment (w), maker_collateral (w, owned by your authority), maker_authority (w, your authority, receives the escrow rent), payment program. No arguments.

**Effects.** The full escrow to the writer. `quantity_atoms` collateral to `maker_collateral`. Any extra collateral and the vault rent to the writer. `state = 2` (exercised). It fails as a whole if any transfer is blocked, for example by a frozen account.

### cancel_pending_delivery_v3

Undoes a funded restricted exercise that could not be delivered. Both parties must sign the same transaction, and only after `cancel_eligible_at`. **No SDK instruction builder.** The SDK encodes its argument with [`encodeCancellationRequestV1`](https://docs.covr.markets/reference/sdk/settlement.md#encodecancellationrequestv1).

Accounts, in order: maker_signer (w, s, your authority, never the operator), writer_signer (s), the ten delivery accounts, payment (USDC), strike_escrow (w), maker_payment (w, a USDC account owned by your authority), payment program. The one argument is the 288-byte `CancellationRequestV1`.

**Effects.** The full escrow back to `maker_payment`. The remaining collateral to the writer. The writer keeps the premium. `state = 5`. A request that does not bind the exact current amounts fails with `RestrictedApproval` (8403).

## Writer instructions that change your positions

The customer can also send these. You do not sign them, but they change what you see on chain.

| Instruction | Signer | Effect on your position |
| --- | --- | --- |
| `transfer_position_v3` | writer | Before expiry, changes `position.writer` to another plain wallet. The strike or released collateral then goes to the new writer. |
| `close_position_v3` | writer | Closes a settled (exercised, released or early-closed) position account to reclaim its rent. Needs your `min_nonce` above the position's nonce. |
| `close_restricted_position_v3` | writer | The same for restricted positions. |

## Cash-secured puts

Since the 4 November 2026 upgrade, the same program also runs cash-secured puts. In a put, the customer (the writer) locks the full strike in cash. Your desk pays the premium at fill. Inside the exercise window, your desk may sell the writer the asset at the strike and take the cash. Puts have their own instructions, maker accounts and quote domain, next to the call ones above.

> [!NOTE]
> **Desks cannot quote puts yet.** covr has offered puts to customers since 7 November 2026, and covr's own maker quotes every one of them. covr's gateway lists only that maker on its put markets, and the gateway endpoint open to desks does not send put RFQs. `@covrfun/maker-sdk` 0.1.1 has no put builders, decoders or signing helpers. This section gives the on-chain rules so you can judge the work. When desks can quote puts is to confirm with covr.

The full account lists and every check, in order, are on the Users pages: [Instructions > Cash-secured puts](https://docs.covr.markets/users/contract/instructions.md#cash-secured-puts) and [Accounts > Put accounts](https://docs.covr.markets/users/contract/accounts.md#put-accounts).

### Put money rules

Q is the quantity in asset atoms and d the asset's decimals (9 for JitoSOL). P is the market's payment token: a plain 6-decimal SPL Token mint, such as USDC. Every amount below is in atoms of P.

| Amount | Formula | Moves at fill |
| --- | --- | --- |
| T, the lock | `Q × strike_e8 / 10^(d+2)`, exact | From the customer into the position's strike escrow. Your vault pays none of it. |
| G, the gross premium | `Q × price_e18 / 10^(d+12)`, exact | From your vault for P: `G − F` to the customer, F to the market's fee owner. |
| F, the fee | `floor(G × fee_bps / 10,000)`, with `fee_bps` at most 1,000 | Part of G. |

1. **T and G must be whole atoms above zero.** Otherwise the fill fails with `InvalidAmount` (6002). These are the same formulas as for calls.
2. **The lock moves first.** At fill, T goes from the customer to an escrow owned by the position (seeds `"strike-escrow-v3"`, position). The escrow must then hold exactly T, or the fill fails with `PutEscrow` (9209). Then your vault pays G. If your vault holds less than G, the fill fails with `CustodyInvalidAmount` (7405) and nothing moves.
3. **Exercise is your choice, inside the window.** From `expiry` until `expiry + window`, your authority or operator can send `exercise_put_v3`. T moves from the escrow to your vault for P. Exactly Q of the asset moves from your put asset vault to the customer. If your put asset vault holds less than Q, the exercise fails with `CustodyInvalidAmount` (7405) and nothing moves. With a flash put policy you can instead buy the asset with T inside the same transaction (`begin_flash_put_v3`, then `finish_flash_put_v3`).
4. **After the window, anyone can return the cash.** From `expiry + window`, `release_put_v3` needs no signature from you. The whole escrow goes back to the customer. Your premium is not returned.
5. **Early close is paid out of the escrow.** Before expiry, the customer can end a put for an amount A that your quote key signed, with `0 < A <= T`. A moves from the escrow to your vault for P, and the rest of the escrow goes back to the customer.
6. **Nothing in your put asset vault is reserved.** `withdraw_put_asset_v1` does not look at your open puts, just as `withdraw` does not for your USDC vault.
7. **The program reads no price.** It lets you exercise at any spot price.
8. **Calls and puts share one nonce space.** A put position has the same address seeds as a call position: `"position"`, quote key, nonce. One nonce opens at most one position of either kind. Raising `min_nonce` with `configure_maker` cancels your put quotes too.

**What a put fill checks against your accounts.** Your put exposure must stay within its limit: `active + Q <= limit` (`ExposureLimit` 6006). If your premium budget for P is enabled, `spent + G <= limit` (`PremiumBudgetExceeded` 6007). For a payment token other than USDC, your spend ledger's parts must add up exactly to that budget's `spent` (`PaymentSpendBalance` 9212). Your put mint policy must be enabled, match the market's terms and profile, and hold every cap after the fill (`TokenLifecycleAccounting` 8302). It must also have approved the payment mint as the mint is now: if the mint changed since your last `update_mint_policy_v2`, the fill fails with `PaymentProfile` (9204). The fill also passes the [JitoSOL size cap](#jitosol-size-cap) on JitoSOL.

### Put quotes

The program checks your quote key's `QuoteV2` signature in the put market's own EIP-712 domain. Its `verifyingContract` commits to the literal `"market-v3:ordinary-put"`, the market address and every immutable market field. The signed quote has `isPut = true`. Its `usd` and `collateralAsset` are both the payment token's 20-byte alias, and `assetAddress` is the asset's alias. A call quote can never open a put. The SDK's [`quoteDomain`](https://docs.covr.markets/reference/sdk/markets.md#quotedomain) and [`buildQuote`](https://docs.covr.markets/reference/sdk/quoting.md#buildquote) build call quotes only.

### Put setup

What a desk would create to quote puts on one asset A paid in one payment token P. Your authority signs every step and pays the rent. None of these steps has an SDK builder in 0.1.1.

| Step | Instruction | Creates or changes | Notes |
| --- | --- | --- | --- |
| 1 | `initialize_vault` and `deposit`, with mint P | Your vault for P (seeds `"stable"`, Maker, P) and its PremiumBudget (`"premium-budget"`, Maker, P) | For USDC, skip this: your existing USDC vault and budget serve calls and puts. P must be a 6-decimal SPL Token mint. |
| 2 | `init_payment_spend_ledger_v1` | PaymentSpendLedgerV1, seeds `"payment-spend-v1"`, Maker, P | Needs the PremiumBudget for P. It starts from that budget's current `spent`. Your Maker must come from `register_maker_v3`, else `MakerOriginState` (8002). |
| 3 | `init_put_exposure_v1(limit)` | PutExposureV1, seeds `"put-exposure-v1"`, Maker, A | Cap on asset atoms you owe on open puts, across every payment token. Change it with `set_put_exposure_limit_v1(limit)`. A limit below `active` blocks new fills, never an exit. |
| 4 | `init_mint_policy_v2(kind, settings)` | MintPolicyV2 and MintUsageV2, seeds `"mint-policy-v2"` and `"mint-usage-v2"`, then Maker, A, P and the kind byte `2` | `kind` must be `2` (put), else `KindNotEnabled` (9202) for 0 or `KindInvalid` (9203). The policy is born disabled: `settings.enabled` must be `false`, else `MintPolicySettings` (6014). The usage account is ready at once: there is no bootstrap step. |
| 5 | `update_mint_policy_v2(expected_generation, settings)` with `enabled = true` | The policy | The only way to enable it. Each update also re-approves the payment mint as it is now. Brake: `pause_mint_policy_v2(expected_generation)`, signed by your authority or the policy's watcher. |
| 6 | `init_put_asset_vault_v1`, then `deposit_put_asset_v1(amount)` | Your put asset vault: a token account of A at seeds `"put-asset-v1"`, Maker, A, whose token authority is your Maker | Holds the asset you deliver at a funded exercise. Take it out with `withdraw_put_asset_v1(amount)`. Only your authority can deposit or withdraw, never your operator. A must be a plain 82-byte mint with no freeze authority, not native SOL. |
| 7, optional | `init_flash_put_policy_v1(settings)`, then `update_flash_put_policy_v1(expected_generation, settings)` to enable | FlashPutPolicyV1, seeds `"flash-put-policy-v1"`, Maker, A, P | Lets you exercise by flash. Needs your put asset vault to exist first, else `PutAssetSource` (9210). Born disabled. Admitted pairs: JitoSOL with USDC, and JitoSOL with USDT. Turn it off with `disable_flash_put_policy_v1`. |
| optional | `init_mint_purchase_policy_v2(max_order_payment_atoms, lifetime_purchase_payment_atoms)`, `update_mint_purchase_policy_v2(...)` | MintPurchasePolicyV2 and MintPurchaseUsageV2 | Only to buy put positions with `buy_put_position_v3`. Born disabled. |

The policy `settings` argument is 131 bytes:

| Name | Type | Description |
| --- | --- | --- |
| `watcher` | `Pubkey` | Key that may only pause this policy. Zero key for none. |
| `enabled` | `bool` | Must be `false` in `init_mint_policy_v2`. `false` blocks new put fills on this asset and payment token. |
| `terms_id` | `[u8; 32]` | Must be the put terms id `0xd474a4f04d59f2d78a41ed2e5a392671a4f07c46c03c5457eda24d3b6842da78`, which is `sha256("COVR:ORDINARY-ATOMIC-PUT:1\0")`. Else `MintPolicySettings` (6014). |
| `profile_hash` | `[u8; 32]` | The `profile_hash` of the put markets you will quote. Not zero. A mismatch fails every fill with `TokenLifecycleAccounting` (8302). |
| `max_order_atoms` | `u64` | Largest single put, in asset atoms. |
| `max_reserved_atoms` | `u64` | Cap on asset atoms owed on open puts. |
| `max_reserved_strike_payment_atoms` | `u64` | Cap on cash locked in your open puts, in atoms of P. |
| `lifetime_premium_limit_enabled` | `bool` | Turns on the next field. |
| `lifetime_premium_limit_payment_atoms` | `u64` | Cap on lifetime gross premium, in atoms of P. Must be 0 when disabled. |
| `put_backing` | `u8` | How you say you will deliver: 1 from your put asset vault, 2 by flash, 3 either. Anything else fails with `PutBacking` (9207). In this build no fill or exit reads it. |

### Put markets

`create_market_v3x(kind, salt, fee_owner, expiry, window, strike_e8, max_quantity_atoms, fee_bps)` creates a put market. Any wallet can create one. Its accounts are creator (w, s), market (w, created at seeds `"market-v3"`, creator, salt), the asset mint, the payment mint P, and the system program. The arguments follow `create_market_v3`, plus `kind`, which must be `2`.

The rules match ordinary markets, with these differences. P must be a plain 6-decimal SPL Token mint: 82 bytes, initialized, not native SOL, and not the asset itself, else `PaymentProfile` (9204) or `MarketV3Terms` (8202). P may have freeze and mint authorities. The asset follows the ordinary rule: a plain 82-byte mint with no freeze authority, not native SOL, else `MarketV3Unsupported` (8203). The market is the same 376-byte MarketV3, with `settlement_mode = 2` and the put terms id. `set_market_v3x_pause(paused)` pauses it; only the creator can sign.

> [!NOTE]
> SDK 0.1.1's [`decodeMarketV3`](https://docs.covr.markets/reference/sdk/markets.md#decodemarketv3) refuses a put market with `maker-sdk: unknown settlement mode 2`. Skip such markets if you scan every MarketV3 account.

### Put instructions

| Instruction | Signer | What it does |
| --- | --- | --- |
| `create_market_v3x` | creator | Creates a put market. |
| `set_market_v3x_pause` | creator | Pauses or resumes new fills on that market. Exits still work. |
| `init_payment_spend_ledger_v1` | authority | Creates your spend ledger for a payment token. |
| `init_put_exposure_v1` | authority | Creates your put exposure cap for an asset. |
| `set_put_exposure_limit_v1` | authority | Changes that cap. |
| `init_mint_policy_v2` | authority | Creates your put mint policy and usage for an asset and payment token, disabled. |
| `update_mint_policy_v2` | authority | Replaces the policy settings. The only way to enable the policy. |
| `pause_mint_policy_v2` | authority or watcher | Disables the policy. Exits are not affected. |
| `init_mint_purchase_policy_v2` | authority | Creates your put purchase policy and usage, disabled. |
| `update_mint_purchase_policy_v2` | authority | Replaces the purchase policy settings. |
| `init_put_asset_vault_v1` | authority | Creates your put asset vault for an asset. |
| `deposit_put_asset_v1` | authority | Moves the asset from your authority's token account into that vault. |
| `withdraw_put_asset_v1` | authority | Moves the asset out of that vault to your authority's token account. |
| `init_flash_put_policy_v1` | authority | Creates your flash put policy for an asset and payment token, disabled. |
| `update_flash_put_policy_v1` | authority | Replaces its settings and re-approves it for your current authority. The only way to enable it. |
| `disable_flash_put_policy_v1` | authority | Disables it. |
| `fill_put_v3` | writer (customer) | Opens a put from your signed quote: locks T, pays G. |
| `exercise_put_v3` | authority or operator | Funded exercise: takes T, delivers Q from your put asset vault. |
| `begin_flash_put_v3` | authority or operator, plus a delegate | Starts a flash exercise: moves exactly T from the escrow to a temporary account for your swap. |
| `finish_flash_put_v3` | none required | Ends it in the same transaction: exactly Q to the writer, the surplus asset to your put asset vault, unspent cash to your vault for P. |
| `release_put_v3` | anyone | After the window, returns the whole escrow to the writer. |
| `early_close_put_v3` | writer | Before expiry, ends the put for an amount you signed, paid from the escrow. |
| `transfer_position_v3x` | writer | Before expiry, hands the put to another plain wallet. |
| `buy_put_position_v3` | writer (seller) | Sells an open put to a desk at a price that desk signed. The desk's authority becomes the writer. |
| `close_position_v3x` | writer | Closes a settled put position account to reclaim its rent. Needs your `min_nonce` above its nonce. |

## Instruction discriminators

The first 8 bytes of instruction data. Use them to spot covr instructions in a transaction.

| Instruction | Discriminator (hex) |
| --- | --- |
| `register_maker_v3` | `b5b1c1a3398ea508` |
| `initialize_vault` | `30bfa32c47813fa4` |
| `set_premium_budget` | `75cac6670c00f00f` |
| `deposit` | `f223c68952e1f2b6` |
| `withdraw` | `b712469c946da122` |
| `configure_maker` | `c00d3bd40740b4fb` |
| `initialize_exposure_v3` | `1e47e8dcbdc1f0f6` |
| `set_exposure_limit` | `21859ba43e8e7723` |
| `initialize_mint_policy_v1` | `1301b4a0b1a6fb46` |
| `update_mint_policy_v1` | `5a58a12379e8aa18` |
| `pause_mint_policy_v1` | `d84b57d2678c345f` |
| `bootstrap_mint_usage_v1` | `980ccc7983962bad` |
| `create_market_v3` | `de141f3ec83b924e` |
| `create_restricted_market_v3` | `febc0aa61ada956b` |
| `set_market_v3_pause` | `42fb0be08d74cf2f` |
| `fill_v3` | `07aeccf9e765bb35` |
| `fill_restricted_v3` | `2e41135430d467ed` |
| `exercise_v3` | `1512034972d6645f` |
| `release_v3` | `819397b4f29f4897` |
| `release_restricted_v3` | `b98bfe918774a47e` |
| `early_close_v3` | `12c6def3250a3149` |
| `buy_position_v3` | `a3e54011892f7b92` |
| `fund_restricted_exercise_v3` | `177b5118031c80c9` |
| `complete_pending_delivery_v3` | `e95dfae6a23e6f1c` |
| `cancel_pending_delivery_v3` | `d42e1cc0f772a695` |
| `initialize_flash_exercise_policy_v1` | `da39c082cee99aa7` |
| `update_flash_exercise_policy_v1` | `9d9e65e0df48bce5` |
| `disable_flash_exercise_policy_v1` | `b8d4f9405728b881` |
| `begin_flash_exercise_v3` | `21607f587d0e3628` |
| `finish_flash_exercise_v3` | `0f8709e6f3c10a17` |
| `create_market_v3x` | `8a901e6ce0fc1123` |
| `set_market_v3x_pause` | `233865b9156d4c28` |
| `init_payment_spend_ledger_v1` | `86ffd848653cfb46` |
| `init_put_exposure_v1` | `3889531cae2be63a` |
| `set_put_exposure_limit_v1` | `daf91cf9443c2771` |
| `init_mint_policy_v2` | `df87f81e7f0ba9f6` |
| `update_mint_policy_v2` | `5ea25df417297997` |
| `pause_mint_policy_v2` | `ab9731236134dd88` |
| `init_mint_purchase_policy_v2` | `3242fbec5402b3a4` |
| `update_mint_purchase_policy_v2` | `3ec51cc10e104c33` |
| `init_put_asset_vault_v1` | `4b0ab00e22de7a35` |
| `deposit_put_asset_v1` | `89e6fdcc00742575` |
| `withdraw_put_asset_v1` | `a178909d0002f448` |
| `init_flash_put_policy_v1` | `83d99a7effb71153` |
| `update_flash_put_policy_v1` | `acbfeb92d88dac6d` |
| `disable_flash_put_policy_v1` | `c6f5dfa5b79b49f9` |
| `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` |

---

Source: https://docs.covr.markets/reference/program/instructions · Part of covr Docs, https://docs.covr.markets/llms.txt
