covr.Docs

Guides

Cancel quotes

You have two brakes. Use the pause first. Use the nonce floor when you also need old quotes dead for good.

BrakeWho can pull itEffectUndo
Pause the mint policyYour authority, or the policy's watcher keyEvery fill on JitoSOL fails at once, for every quoteYes: updateMintPolicyV1 with enabled true (authority only)
Raise min_nonceYour authority onlyEvery quote with a lower nonce can never fillNo. The floor only goes up.

The gateway has no withdrawal route for desks. These on-chain brakes are how you stop.

When to use them

  • Your pricing went wrong.
  • Your quote key may be exposed: see If your quote key leaks. Raising the floor is not enough there.
  • The market moved sharply and you want nothing outstanding.

A quote the gateway admits is valid for at most 60 seconds anyway. The brakes are for when you cannot wait 60 seconds.

Pause the mint policy

The pause is fast and reversible. It can be signed by a watcher: a hot key you name in the policy settings, so your cold authority does not need to be online. Set one with mintPolicySettingsFor(market, { watcher, … }) at setup, or later with an authority-signed updateMintPolicyV1.

Read the policy's current generation first: the pause applies only to the version you read. If another update lands first, re-read and resend.

It signs with one key, your watcher or your authority, using signer.ts from Fills and exercise. Save as pause.ts:

ts
import { JITOSOL_MINT, PROGRAM_ID, TOKEN_PROGRAM, decodeMintPolicy, deriveMaker, deriveMintPolicy, pauseMintPolicyV1 } from '@covrfun/maker-sdk';
import { createSolanaRpc } from '@solana/kit';
import { signer } from './signer.ts'; // your watcher (or your authority)
import { send } from './send.ts';

const rpc = createSolanaRpc(process.env.RPC_URL!);
const makerEthAddress = process.env.MAKER_ETH_ADDRESS!; // your quote key's 0x address
const makerAuthority = process.env.MAKER_AUTHORITY!;    // your authority's address
const { maker } = await deriveMaker(makerEthAddress);
const { policy } = await deriveMintPolicy(maker, JITOSOL_MINT);

// Read the policy's current generation: the pause applies only to the version you read.
// 'confirmed' is fine here: a stale generation only fails with MintPolicyGeneration (6012).
const { value } = await rpc.getAccountInfo(policy, { commitment: 'confirmed', encoding: 'base64' }).send();
if (!value || value.owner !== PROGRAM_ID) throw Error('mint policy missing');
const current = await decodeMintPolicy(policy, Buffer.from(value.data[0], 'base64'), {
  authority: makerAuthority, maker,
  collateral: { mint: JITOSOL_MINT, program: TOKEN_PROGRAM, decimals: 9 },
});

const { instruction } = await pauseMintPolicyV1({
  signer: signer.address, maker, collateral: JITOSOL_MINT, expectedGeneration: current.generation,
});
console.log('paused', await send(signer, instruction));
sh
SIGNER_KEYPAIR=./watcher.json MAKER_ETH_ADDRESS=0x<quote key address> MAKER_AUTHORITY=<authority address> \
RPC_URL=https://<your rpc> RPC_WS_URL=wss://<your rpc> npx tsx pause.ts

To resume, your authority sends updateMintPolicyV1 with the same settings and enabled: true.

Raise the nonce floor

Raising min_nonce cancels every quote below the new floor, permanently. Only your authority can do it.

Stop your bot (or pause the policy) first. Otherwise a quote signed while you raise the floor can land above it and stay live. Save this as cancel.ts next to keys.ts and send.ts, and run it with NEXT_NONCE=<next nonce from your journal> plus your usual key and RPC variables. configureMaker sets both the operator and the floor, so read the current operator first and pass it back.

ts
import { PROGRAM_ID, configureMaker, decodeMaker, deriveMaker } from '@covrfun/maker-sdk';
import { createSolanaRpc } from '@solana/kit';
import { authority, quoteSigner } from './keys.ts'; // only the authority can call configureMaker
import { send } from './send.ts';

// The next nonce your journal would hand out. Stop your bot (or pause the policy) before reading it.
const nextJournalNonce = BigInt(process.env.NEXT_NONCE!);
const makerEthAddress = quoteSigner.address;

const rpc = createSolanaRpc(process.env.RPC_URL!);
const { maker } = await deriveMaker(makerEthAddress);

// Read the current operator and floor: configureMaker replaces BOTH.
const { value } = await rpc.getAccountInfo(maker, { commitment: 'finalized', encoding: 'base64' }).send();
if (!value || value.owner !== PROGRAM_ID) throw Error('maker account missing');
const current = await decodeMaker(maker, Buffer.from(value.data[0], 'base64'), makerEthAddress);

// Every nonce your journal ever handed out is below nextJournalNonce.
// Raising the floor to it cancels all of them.
const minNonce = nextJournalNonce > current.minNonce ? nextJournalNonce : current.minNonce;
const { instruction } = await configureMaker({
  authority: authority.address,
  makerEthAddress,
  operator: current.operator, // keep the operator; the zero key would revoke it
  minNonce,
});
console.log('floor raised to', minNonce, await send(authority, instruction));

Set the floor to the next nonce your journal would hand out. That cancels everything you have signed and leaves you free to keep quoting, unless your quote key leaked.

Caution

Do not set the floor to 2^64 − 1 unless you are retiring a leaked key (If your quote key leaks). It retires this quote key forever: no quote can ever fill again, and the key can never be registered again. To stop for now, pause the mint policy instead.

After a raise

  1. Sign new quotes only at or above the new floor. The example bot re-reads the floor every 5 seconds and moves its counter up.
  2. A quote below the floor may have filled before the raise landed. Keep its cash held until you check its position account. See Fills and exercise.