covr.Docs

Guides

Register and fund

Set up your maker on chain. Your Solana authority signs every step and pays the rent. Do this once.

Before you start:

  • You registered in the Quickstart (step 1).
  • Your authority holds about 0.02 SOL for rent and fees.
  • Your authority's USDC associated token account holds what you want to deposit.
  • You have one covr JitoSOL market address, from a dry-run RFQ.

The steps

#StepBuilderWhy
1RegistersignRegistrationGrant + registerMakerV3Links your quote key to your authority, permanently. Done in the Quickstart.
2VaultinitializeVaultYour USDC vault and premium budget.
3ExposureinitializeExposureV3Cap on open JitoSOL across all markets.
4Mint policymintPolicySettingsFor + initializeMintPolicyV1Caps per fill and on open strike.
5BootstrapbootstrapMintUsageV1Fills on JitoSOL fail until this runs.
6Budget (optional)setPremiumBudgetLifetime cap on premium paid.
7DepositdepositUSDC into the vault.
8JitoSOL account@solana-program/tokenWhere exercised JitoSOL lands. Owned by your authority.

Send one step at a time. Each send waits for finalized before the next.

Environment

The setup script reuses keys.ts and send.ts from the Quickstart and reads:

VariableMeaning
AUTHORITY_KEYPAIRPath to your authority keypair JSON
MAKER_QUOTE_KEYYour quote key (only its address is used here)
RPC_URLhttps://<your rpc>
RPC_WS_URLwss://<your rpc>. Used to confirm transactions.
MARKETAny covr JitoSOL market address, from a dry-run RFQ
WATCHERA hot Solana key that may pause your mint policy. See Cancel quotes.

Deposits come from your authority's USDC associated token account.

Steps 2 to 8

Save as setup.ts and run it with npx tsx setup.ts. The amounts are examples. Each step creates an account once: if a later step fails, comment out the steps that already landed before you run it again. Pick your own limits. All amounts are in atoms, the token's smallest unit: 1 JitoSOL is 10^9 atoms and 1 USDC is 10^6 atoms.

ts
import {
  JITOSOL_MINT, PROGRAM_ID, TOKEN_PROGRAM, USDC_MINT,
  initializeVault, initializeExposureV3, decodeMarketV3, mintPolicySettingsFor,
  initializeMintPolicyV1, bootstrapMintUsageV1, setPremiumBudget, deposit, decodeMaker, deriveMaker,
} from '@covrfun/maker-sdk';
import { createSolanaRpc, address } from '@solana/kit';
import { findAssociatedTokenPda, getCreateAssociatedTokenIdempotentInstructionAsync } from '@solana-program/token';
import { authority, quoteSigner } from './keys.ts';
import { send } from './send.ts';

const rpc = createSolanaRpc(process.env.RPC_URL!);
const makerEthAddress = quoteSigner.address;
const anyJitoSolMarket = process.env.MARKET!;  // a covr JitoSOL market, from an RFQ in your dry run
const watcher = process.env.WATCHER;           // a hot key that may pause your mint policy
if (!watcher) throw Error('WATCHER is required: a hot key that can pause this policy (changing it later needs an authority-signed updateMintPolicyV1)');
const [usdcSource] = await findAssociatedTokenPda({      // your authority's USDC account
  owner: authority.address, mint: address(USDC_MINT), tokenProgram: address(TOKEN_PROGRAM),
});
const { maker } = await deriveMaker(makerEthAddress);
const jitoSol = { mint: JITOSOL_MINT, program: TOKEN_PROGRAM, decimals: 9 };

// 2. USDC vault. Its premium budget starts disabled, which means no cap.
const { vault, instruction: openVault } = await initializeVault({ authority: authority.address, maker });
await send(authority, openVault);

// 3. Exposure: cap on open JitoSOL atoms across all markets (here 5 JitoSOL).
const { instruction: exposure } = await initializeExposureV3({
  authority: authority.address, makerEthAddress, collateral: jitoSol, limitAtoms: 5_000_000_000n,
});
await send(authority, exposure);

// 4. Mint policy, bound to the terms of any JitoSOL market.
const acct = await rpc.getAccountInfo(address(anyJitoSolMarket), { commitment: 'finalized', encoding: 'base64' }).send();
if (!acct.value || acct.value.owner !== PROGRAM_ID) throw Error('not a covr market');
const market = await decodeMarketV3(anyJitoSolMarket, Buffer.from(acct.value.data[0], 'base64'));
const settings = mintPolicySettingsFor(market, {
  watcher,
  maxOrderAtoms: 1_000_000_000n,         // 1 JitoSOL per fill
  maxReservedAtoms: 5_000_000_000n,      // 5 JitoSOL open at once
  maxReservedStrikeUsdc: 1_000_000_000n, // 1,000 USDC of strikes open at once
});
const { instruction: policy } = await initializeMintPolicyV1({
  authority: authority.address, maker, collateral: JITOSOL_MINT, settings,
});
await send(authority, policy);

// 5. Bootstrap usage. Fills on this mint fail until this runs.
const { instruction: bootstrap } = await bootstrapMintUsageV1({
  authority: authority.address, makerEthAddress, collateral: JITOSOL_MINT,
});
await send(authority, bootstrap);

// 6. Optional: lifetime cap on gross premium paid (here 500 USDC).
const { instruction: budget } = await setPremiumBudget({
  authority: authority.address, maker, enabled: true, limit: 500_000_000n,
});
await send(authority, budget);

// 7. Fund the vault (here 1,000 USDC).
const { instruction: fund } = await deposit({ authority: authority.address, maker, source: usdcSource, amount: 1_000_000_000n });
await send(authority, fund);

// 8. Your JitoSOL token account, owned by the authority. Exercise delivers here.
await send(authority, await getCreateAssociatedTokenIdempotentInstructionAsync({
  payer: authority, owner: authority.address, mint: address(JITOSOL_MINT),
}));

// Check: read your Maker account back.
const makerAcct = await rpc.getAccountInfo(maker, { commitment: 'finalized', encoding: 'base64' }).send();
if (!makerAcct.value || makerAcct.value.owner !== PROGRAM_ID) throw Error('maker account missing');
const decoded = await decodeMaker(maker, Buffer.from(makerAcct.value.data[0], 'base64'), makerEthAddress);
console.log({ maker, vault, minNonce: decoded.minNonce, authority: decoded.authority });

Why the mint policy needs a market

A mint policy is bound to two values that every covr JitoSOL market shares:

  • the terms id, which names the settlement rules (ordinary markets all share one);
  • the profile hash, a fingerprint of the JitoSOL mint and its settings.

mintPolicySettingsFor copies both from the market you pass. Any covr JitoSOL market works.

Check your setup

  • decodeMaker returns your authority and minNonce 0.
  • Your vault holds the USDC you deposited.

Your desk is now ready for practice mode.

Next