# 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](https://docs.covr.markets/quickstart.md#4-register-your-maker) (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

| # | Step | Builder | Why |
| --- | --- | --- | --- |
| 1 | Register | `signRegistrationGrant` + `registerMakerV3` | Links your quote key to your authority, permanently. Done in the Quickstart. |
| 2 | Vault | `initializeVault` | Your USDC vault and premium budget. |
| 3 | Exposure | `initializeExposureV3` | Cap on open JitoSOL across all markets. |
| 4 | Mint policy | `mintPolicySettingsFor` + `initializeMintPolicyV1` | Caps per fill and on open strike. |
| 5 | Bootstrap | `bootstrapMintUsageV1` | Fills on JitoSOL fail until this runs. |
| 6 | Budget (optional) | `setPremiumBudget` | Lifetime cap on premium paid. |
| 7 | Deposit | `deposit` | USDC into the vault. |
| 8 | JitoSOL account | `@solana-program/token` | Where 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](https://docs.covr.markets/quickstart.md#4-register-your-maker) and reads:

| Variable | Meaning |
| --- | --- |
| `AUTHORITY_KEYPAIR` | Path to your authority keypair JSON |
| `MAKER_QUOTE_KEY` | Your quote key (only its address is used here) |
| `RPC_URL` | `https://<your rpc>` |
| `RPC_WS_URL` | `wss://<your rpc>`. Used to confirm transactions. |
| `MARKET` | Any covr JitoSOL market address, from a dry-run RFQ |
| `WATCHER` | A hot Solana key that may pause your mint policy. See [Cancel quotes](https://docs.covr.markets/guides/cancel-quotes.md). |

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

- [Cancel quotes](https://docs.covr.markets/guides/cancel-quotes.md): know how to stop before you start.
- [Run the example bot](https://docs.covr.markets/guides/run-the-example-bot.md) live, in practice mode.

---

Source: https://docs.covr.markets/guides/register-and-fund · Part of covr Docs, https://docs.covr.markets/llms.txt
