> ## Documentation Index
> Fetch the complete documentation index at: https://docs.exponent.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Policy Builders

> Construct onchain policies that govern vault strategy execution

Policy builders are helper functions that construct `PolicyConfig` objects for common strategy execution scenarios. A policy must exist onchain before any strategy instruction can be executed by the vault.

## What is a Policy?

A `programInteraction` policy defines exactly which instructions the vault's smart account is permitted to execute. It is enforced onchain by the Squads program when `executeTransactionSync` is called.

A policy consists of:

* **`instructionsConstraints`** — a list of `InstructionConstraint` objects, each specifying:
  * `programId` — which program is allowed
  * `dataConstraints` — which instruction discriminators match (first 8 bytes of instruction data)
  * `accountConstraints` — which specific public keys must be present

## Adding a Policy to a Vault

Policies are added by the vault **manager** role:

```typescript theme={null}
import {
  ExponentVault,
  createKaminoDepositPolicy,
  KAMINO_MARKETS,
  KAMINO_RESERVES,
  KaminoMarket,
} from "@exponent-labs/exponent-sdk";
import { Connection, Transaction, sendAndConfirmTransaction } from "@solana/web3.js";

const connection = new Connection("https://api.mainnet-beta.solana.com");
const vault = await ExponentVault.load({ connection, address: vaultAddress });

const solReserve = KAMINO_RESERVES[KaminoMarket.MAIN]["SOL"].pubkey;
const mainMarket = KAMINO_MARKETS[KaminoMarket.MAIN];

// Build the policy config
const policyConfig = createKaminoDepositPolicy({
  allowedReserves: [solReserve],
  allowedLendingMarkets: [mainMarket],
});

// Add it to the vault — requires payer, squads program, policy seed, and transaction index
const ix = vault.ixAddPolicy({
  payer: managerWallet.publicKey,
  policyConfig,
  squadsProgram: squadsProgram,
  nextPolicySeed: nextPolicySeed,
  nextTransactionIndex: nextTransactionIndex,
});
const tx = new Transaction().add(ix);
await sendAndConfirmTransaction(connection, tx, [managerWallet]);
```

***

## Exponent Core Policy

`createCorePolicy` builds a policy that permits strip and merge operations on the Exponent Core program (`ExponentnaRg3CQbW6dqQNZKXp7gtZ9DGMp1cwC4HAS7`).

```typescript theme={null}
import { createCorePolicy } from "@exponent-labs/exponent-sdk";
import { PublicKey } from "@solana/web3.js";

const EXPONENT_VAULT = new PublicKey("...");

const policyConfig = createCorePolicy({
  allowedVaults: [EXPONENT_VAULT],
  actions: ["strip", "merge"],
});
```

### Parameters

| Parameter          | Type                 | Description                                                                              |
| ------------------ | -------------------- | ---------------------------------------------------------------------------------------- |
| `allowedVaults`    | `PublicKey[]`        | Optional. Exponent Core vault addresses to constrain                                     |
| `allowedSyMints`   | `PublicKey[]`        | Optional. SY mint public keys — use with `vaultsForSyMints`                              |
| `vaultsForSyMints` | `PublicKey[]`        | Optional. Vault addresses corresponding to each SY mint (same order as `allowedSyMints`) |
| `actions`          | `CorePolicyAction[]` | Which actions to allow: `"initializeYieldPosition"`, `"strip"`, `"merge"`                |
| `spendingLimits`   | `SpendingLimit[]`    | Optional. Spending limits                                                                |
| `threshold`        | `number`             | Optional. Number of signers required (default `1`)                                       |
| `timeLock`         | `number`             | Optional. Time lock in seconds (default `0`)                                             |

<Tip>
  You can constrain by vault address directly (`allowedVaults`) or by SY mint (`allowedSyMints` + `vaultsForSyMints`). If you omit both, any vault is allowed for the specified actions.
</Tip>

See [Core Instructions](/developer-strategy-vaults/exponent-core-instructions) for usage examples.

***

## Exponent CLMM Policy

`createClmmPolicy` builds a policy that permits all CLMM operations on the Exponent CLMM program (`XPC1MM4dYACDfykNuXYZ5una2DsMDWL24CrYubCvarC`) — including providing liquidity, trading PT/YT, and claiming farm emissions.

```typescript theme={null}
import { createClmmPolicy } from "@exponent-labs/exponent-sdk";
import { PublicKey } from "@solana/web3.js";

const CLMM_MARKET = new PublicKey("...");

const policyConfig = createClmmPolicy({
  allowedMarkets: [CLMM_MARKET],
});
```

### Parameters

| Parameter        | Type          | Description                                                                  |
| ---------------- | ------------- | ---------------------------------------------------------------------------- |
| `allowedMarkets` | `PublicKey[]` | Optional. CLMM MarketThree addresses to constrain — omit to allow any market |
| `threshold`      | `number`      | Optional. Number of signers required (default `1`)                           |
| `timeLock`       | `number`      | Optional. Time lock in seconds (default `0`)                                 |

<Tip>
  Omitting `allowedMarkets` permits CLMM operations on any market. Specify market addresses to restrict the vault to specific pools.
</Tip>

See [CLMM Instructions](/developer-strategy-vaults/exponent-clmm-instructions) for usage examples.

***

## AMM Swap Policies

`createMarketTwoTradePtPolicy`, `createMarketTwoBuyYtPolicy`, and `createMarketTwoSellYtPolicy` build policies that authorize the corresponding swap operations on Market Two AMM markets through the `exponent_core` program. All three accept the same parameters; choose the builder that matches the swap direction the vault should be allowed to execute.

```typescript theme={null}
import {
  createMarketTwoTradePtPolicy,
  createMarketTwoBuyYtPolicy,
  createMarketTwoSellYtPolicy,
} from "@exponent-labs/exponent-sdk";
import { PublicKey } from "@solana/web3.js";

const SY_MINT = new PublicKey("...");

const tradePtPolicy = createMarketTwoTradePtPolicy({ allowedSyMints: [SY_MINT] });
const buyYtPolicy   = createMarketTwoBuyYtPolicy({ allowedSyMints: [SY_MINT] });
const sellYtPolicy  = createMarketTwoSellYtPolicy({ allowedSyMints: [SY_MINT] });
```

### Parameters

| Parameter        | Type          | Description                                                                                       |
| ---------------- | ------------- | ------------------------------------------------------------------------------------------------- |
| `allowedMarkets` | `PublicKey[]` | Optional. Market Two PDAs to constrain — omit to allow any matching market                        |
| `allowedSyMints` | `PublicKey[]` | Optional. Whitelist by underlying SY mint — every Market Two whose `mint_sy` matches is permitted |

<Tip>
  Pass `allowedSyMints` to authorize any Market Two whose underlying SY mint matches; pass `allowedMarkets` to pin specific market PDAs; pass both to combine the two constraints.
</Tip>

See [Exponent Core Instructions](/developer-strategy-vaults/exponent-core-instructions#amm-market-two-swaps) for usage examples.

***

## Exponent Orderbook Policy

`createOrderbookPolicy` builds a policy that permits interacting with the [Exponent Orderbook](/developer-orderbook/overview) program (`XPBookgQTN2p8Yw1C2La35XkPMmZTCEYH77AdReVvK1`).

```typescript theme={null}
import { createOrderbookPolicy } from "@exponent-labs/exponent-sdk";
import { PublicKey } from "@solana/web3.js";

const SY_MINT = new PublicKey("...");

const policyConfig = createOrderbookPolicy({
  allowedSyMints: [SY_MINT],
  actions: ["postOffer", "marketOffer", "removeOffer", "withdrawFunds"],
});
```

### Parameters

| Parameter        | Type                      | Description                                                                                |
| ---------------- | ------------------------- | ------------------------------------------------------------------------------------------ |
| `allowedSyMints` | `PublicKey[]`             | SY mint public keys that are allowed                                                       |
| `actions`        | `OrderbookPolicyAction[]` | Which actions to allow: `"postOffer"`, `"marketOffer"`, `"removeOffer"`, `"withdrawFunds"` |
| `spendingLimits` | `SpendingLimit[]`         | Optional. Spending limits                                                                  |
| `threshold`      | `number`                  | Optional. Number of signers required (default `1`)                                         |
| `timeLock`       | `number`                  | Optional. Time lock in seconds (default `0`)                                               |

See [Orderbook Instructions](/developer-strategy-vaults/exponent-orderbook-instructions) for usage examples.

***

## Kamino Lend Policies

### Deposit Policy

`createKaminoDepositPolicy` builds a policy that permits calling `depositReserveLiquidityAndObligationCollateral` on the Kamino Lending program.

```typescript theme={null}
import { createKaminoDepositPolicy } from "@exponent-labs/exponent-sdk";

const policyConfig = createKaminoDepositPolicy({
  allowedReserves: [solReserve],
  allowedLendingMarkets: [mainMarket],
});
```

### Parameters

| Parameter               | Type          | Description                                   |
| ----------------------- | ------------- | --------------------------------------------- |
| `allowedReserves`       | `PublicKey[]` | Reserve public keys that can receive deposits |
| `allowedLendingMarkets` | `PublicKey[]` | Optional. Lending market public keys          |

### Withdraw Policy

`createKaminoWithdrawPolicy` builds a policy that permits calling `withdrawObligationCollateralAndRedeemReserveCollateral` on the Kamino Lending program.

```typescript theme={null}
import { createKaminoWithdrawPolicy } from "@exponent-labs/exponent-sdk";

const policyConfig = createKaminoWithdrawPolicy({
  allowedReserves: [solReserve],
  allowedLendingMarkets: [mainMarket],
});
```

### Parameters

| Parameter               | Type          | Description                                       |
| ----------------------- | ------------- | ------------------------------------------------- |
| `allowedReserves`       | `PublicKey[]` | Reserve public keys allowed as withdrawal sources |
| `allowedLendingMarkets` | `PublicKey[]` | Optional. Lending market public keys              |

### Borrow Policy

`createKaminoBorrowPolicy` builds a policy that permits calling `borrowObligationLiquidity` on the Kamino Lending program.

```typescript theme={null}
import { createKaminoBorrowPolicy } from "@exponent-labs/exponent-sdk";

const policyConfig = createKaminoBorrowPolicy({
  allowedReserves: [solReserve],
  allowedLendingMarkets: [mainMarket],
});
```

### Parameters

| Parameter               | Type          | Description                               |
| ----------------------- | ------------- | ----------------------------------------- |
| `allowedReserves`       | `PublicKey[]` | Reserve public keys allowed for borrowing |
| `allowedLendingMarkets` | `PublicKey[]` | Optional. Lending market public keys      |

### Repay Policy

`createKaminoRepayPolicy` builds a policy that permits calling `repayObligationLiquidity` on the Kamino Lending program.

```typescript theme={null}
import { createKaminoRepayPolicy } from "@exponent-labs/exponent-sdk";

const policyConfig = createKaminoRepayPolicy({
  allowedReserves: [solReserve],
  allowedLendingMarkets: [mainMarket],
});
```

### Parameters

| Parameter               | Type          | Description                               |
| ----------------------- | ------------- | ----------------------------------------- |
| `allowedReserves`       | `PublicKey[]` | Reserve public keys allowed for repayment |
| `allowedLendingMarkets` | `PublicKey[]` | Optional. Lending market public keys      |

### Full Access Policy

`createKaminoFullAccessPolicy` creates a single policy covering multiple Kamino actions. This is useful when a strategy requires deposit, withdraw, borrow, and repay on the same reserves.

```typescript theme={null}
import {
  createKaminoFullAccessPolicy,
  KAMINO_MARKETS,
  KAMINO_RESERVES,
  KaminoMarket,
} from "@exponent-labs/exponent-sdk";

const solReserve = KAMINO_RESERVES[KaminoMarket.MAIN]["SOL"].pubkey;
const usdcReserve = KAMINO_RESERVES[KaminoMarket.MAIN]["USDC"].pubkey;
const mainMarket = KAMINO_MARKETS[KaminoMarket.MAIN];

const policyConfig = createKaminoFullAccessPolicy({
  allowedReserves: [solReserve, usdcReserve],
  allowedActions: ["deposit", "withdraw", "borrow", "repay"],
  allowedLendingMarkets: [mainMarket],
});
```

### Parameters

| Parameter               | Type                                                    | Description                                           |
| ----------------------- | ------------------------------------------------------- | ----------------------------------------------------- |
| `allowedReserves`       | `PublicKey[]`                                           | Reserve public keys allowed for all specified actions |
| `allowedActions`        | `Array<"deposit" \| "withdraw" \| "borrow" \| "repay">` | Which Kamino actions to permit                        |
| `allowedLendingMarkets` | `PublicKey[]`                                           | Optional. Lending market public keys                  |

<Tip>
  Using a combined policy simplifies vault administration when a strategy requires multiple operations on the same reserves. The allocator passes the same `policyPda` to all Kamino calls.
</Tip>

### Unified Kamino Policy

`createKaminoPolicy` is a unified API that supports both `allowedReserves` and `allowedDepositMints` as optional constraints. This provides finer-grained control than `createKaminoFullAccessPolicy` — you can constrain by the liquidity mint in addition to (or instead of) the reserve address.

```typescript theme={null}
import {
  createKaminoPolicy,
  KAMINO_MARKETS,
  KAMINO_RESERVES,
  KaminoMarket,
} from "@exponent-labs/exponent-sdk";

const usdcMint = KAMINO_RESERVES[KaminoMarket.MAIN]["USDC"].mint;
const mainMarket = KAMINO_MARKETS[KaminoMarket.MAIN];

const policyConfig = createKaminoPolicy({
  allowedDepositMints: [usdcMint],
  actions: ["deposit", "withdraw"],
  allowedLendingMarkets: [mainMarket],
});
```

### Parameters

| Parameter               | Type                   | Description                                                              |
| ----------------------- | ---------------------- | ------------------------------------------------------------------------ |
| `allowedReserves`       | `PublicKey[]`          | Optional. Reserve public keys to constrain                               |
| `allowedDepositMints`   | `PublicKey[]`          | Optional. Liquidity mint public keys to constrain                        |
| `actions`               | `KaminoPolicyAction[]` | Which actions to allow: `"deposit"`, `"withdraw"`, `"borrow"`, `"repay"` |
| `allowedLendingMarkets` | `PublicKey[]`          | Optional. Lending market public keys                                     |
| `spendingLimits`        | `SpendingLimit[]`      | Optional. Spending limits                                                |
| `threshold`             | `number`               | Optional. Number of signers required (default `1`)                       |
| `timeLock`              | `number`               | Optional. Time lock in seconds (default `0`)                             |

<Tip>
  Both `allowedReserves` and `allowedDepositMints` are optional. Omit both to allow any reserve and mint for the specified actions.
</Tip>

See [Kamino Lend Instructions](/developer-strategy-vaults/kamino-instructions) for usage examples.

***

<a id="kamino-vault-policy" />

## Kamino Vault policy

`createKaminoVaultPolicy` builds a policy for direct Kamino Vault deposits and withdrawals.

```typescript theme={null}
import { createKaminoVaultPolicy } from "@exponent-labs/exponent-sdk";
import { PublicKey } from "@solana/web3.js";

const kaminoVault = new PublicKey("...");
const depositMint = new PublicKey("...");

const policyConfig = createKaminoVaultPolicy({
  allowedVaults: [kaminoVault],
  allowedDepositMints: [depositMint],
  actions: ["deposit", "withdraw"],
});
```

### Parameters

| Parameter             | Type                        | Description                                         |
| --------------------- | --------------------------- | --------------------------------------------------- |
| `allowedVaults`       | `PublicKey[]`               | Optional. Kamino Vault addresses to constrain       |
| `allowedDepositMints` | `PublicKey[]`               | Optional. Deposit token mints to constrain          |
| `actions`             | `KaminoVaultPolicyAction[]` | Which actions to allow: `"deposit"` or `"withdraw"` |
| `spendingLimits`      | `SpendingLimit[]`           | Optional. Spending limits                           |
| `threshold`           | `number`                    | Optional. Number of signers required (default `1`)  |
| `timeLock`            | `number`                    | Optional. Time lock in seconds (default `0`)        |

See [Kamino Vault Instructions](/developer-strategy-vaults/kamino-vault-instructions) for usage examples.

***

<a id="kamino-farm-policy" />

## Kamino Farm policy

`createKaminoFarmPolicy` builds a policy for direct and delegated Kamino Farm actions.

```typescript theme={null}
import { createKaminoFarmPolicy } from "@exponent-labs/exponent-sdk";
import { PublicKey } from "@solana/web3.js";

const farmState = new PublicKey("...");
const underlyingMint = new PublicKey("...");
const rewardMint = new PublicKey("...");

const policyConfig = createKaminoFarmPolicy({
  allowedFarmStates: [farmState],
  allowedUnderlyingMints: [underlyingMint],
  allowedRewardMints: [rewardMint],
  actions: [
    "initializeUser",
    "stake",
    "unstake",
    "withdrawUnstakedDeposits",
    "harvestReward",
  ],
});
```

### Parameters

| Parameter                | Type                       | Description                                                                                                            |
| ------------------------ | -------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `allowedFarmStates`      | `PublicKey[]`              | Optional. Kamino Farm state addresses to constrain                                                                     |
| `allowedUnderlyingMints` | `PublicKey[]`              | Optional. Underlying token mints to constrain for `stake`                                                              |
| `allowedRewardMints`     | `PublicKey[]`              | Optional. Reward token mints to constrain for `harvestReward`                                                          |
| `actions`                | `KaminoFarmPolicyAction[]` | Which actions to allow: `"initializeUser"`, `"stake"`, `"unstake"`, `"withdrawUnstakedDeposits"`, or `"harvestReward"` |
| `spendingLimits`         | `SpendingLimit[]`          | Optional. Spending limits                                                                                              |
| `threshold`              | `number`                   | Optional. Number of signers required (default `1`)                                                                     |
| `timeLock`               | `number`                   | Optional. Time lock in seconds (default `0`)                                                                           |

See [Kamino Farm Instructions](/developer-strategy-vaults/kamino-farm-instructions) for usage examples.

***

## Jupiter Lend Earn Policy

`createJupiterEarnPolicy` builds a policy that authorizes a chosen subset of [Jupiter Lend Earn](https://jup.ag/lend) jlToken operations on the Jupiter Lend Earn program (`jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9`).

```typescript theme={null}
import { createJupiterEarnPolicy } from "@exponent-labs/exponent-sdk";
import { PublicKey } from "@solana/web3.js";

const USDC_MINT = new PublicKey("...");

const policyConfig = createJupiterEarnPolicy({
  actions: ["deposit", "withdraw"],
  allowedUnderlyingMints: [USDC_MINT],
});
```

### Parameters

| Parameter                | Type                        | Description                                                                                                                                                                        |
| ------------------------ | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `actions`                | `JupiterEarnPolicyAction[]` | Required. Subset of `"deposit"`, `"depositWithMinAmountOut"`, `"mint"`, `"mintWithMaxAssets"`, `"withdraw"`, `"withdrawWithMaxSharesBurn"`, `"redeem"`, `"redeemWithMinAmountOut"` |
| `allowedUnderlyingMints` | `PublicKey[]`               | Optional. Whitelist by underlying token mint                                                                                                                                       |
| `allowedJlTokenMints`    | `PublicKey[]`               | Optional. Whitelist by jlToken receipt mint                                                                                                                                        |
| `spendingLimits`         | `SpendingLimit[]`           | Optional. Spending limits                                                                                                                                                          |
| `threshold`              | `number`                    | Optional. Number of signers required (default `1`)                                                                                                                                 |
| `timeLock`               | `number`                    | Optional. Time lock in seconds (default `0`)                                                                                                                                       |

See [Jupiter Lend Earn Instructions](/developer-strategy-vaults/jupiter-lend-earn-instructions) for usage examples.

***

## Jupiter Lend Borrow Policy

`createJupiterBorrowPolicy` builds a policy that authorizes a chosen subset of [Jupiter Lend Borrow](https://jup.ag/lend) lifecycle and operate actions on the Jupiter Lend Borrow program (`jupr81YtYssSyPt8jbnGuiWon5f6x9TcDEFxYe3Bdzi`). Operate actions encode signed `newCol` / `newDebt` deltas — the policy enforces the correct signs for each named action so a `borrowDebt` policy cannot execute a `repayDebt` instruction (and vice versa).

```typescript theme={null}
import { createJupiterBorrowPolicy } from "@exponent-labs/exponent-sdk";
import { PublicKey } from "@solana/web3.js";

const COLLATERAL_MINT = new PublicKey("...");
const DEBT_MINT = new PublicKey("...");

const policyConfig = createJupiterBorrowPolicy({
  actions: ["initPosition", "depositAndBorrow", "repayAndWithdraw"],
  allowedSupplyMints: [COLLATERAL_MINT],
  allowedBorrowMints: [DEBT_MINT],
  allowedVaultIds: [1],
});
```

### Parameters

| Parameter            | Type                          | Description                                                                                                                                                                                                |
| -------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `actions`            | `JupiterBorrowPolicyAction[]` | Required. Subset of `"initPosition"`, `"depositCollateral"`, `"borrowDebt"`, `"repayDebt"`, `"withdrawCollateral"`, `"depositAndBorrow"`, `"repayAndWithdraw"`, `"depositAndRepay"`, `"withdrawAndBorrow"` |
| `allowedMints`       | `PublicKey[]`                 | Optional. Mint whitelist applied to both supply and borrow when side-specific lists are not supplied                                                                                                       |
| `allowedSupplyMints` | `PublicKey[]`                 | Optional. Whitelist for the collateral (supply) mint                                                                                                                                                       |
| `allowedBorrowMints` | `PublicKey[]`                 | Optional. Whitelist for the debt (borrow) mint                                                                                                                                                             |
| `allowedVaultIds`    | `number[]`                    | Optional. Constrain `initPosition` to specific Jupiter borrow vault ids                                                                                                                                    |
| `spendingLimits`     | `SpendingLimit[]`             | Optional. Spending limits                                                                                                                                                                                  |
| `threshold`          | `number`                      | Optional. Number of signers required (default `1`)                                                                                                                                                         |
| `timeLock`           | `number`                      | Optional. Time lock in seconds (default `0`)                                                                                                                                                               |

<Tip>
  For callers writing custom data-constrained policies on top of Jupiter Borrow operate instructions, the SDK exports `createJupiterBorrowSignedDeltaConstraints(offset, delta)` — the same helper this policy builder uses to encode `"increase"` / `"decrease"` / `"unchanged"` constraints on signed i128 fields.
</Tip>

See [Jupiter Lend Borrow Instructions](/developer-strategy-vaults/jupiter-lend-borrow-instructions) for usage examples.

***

<a id="orca-whirlpool-policy" />

## Orca Whirlpool policy

`createOrcaWhirlpoolPolicy` builds a policy that permits vault-managed Orca Whirlpool V2 and token-extension instructions.

```typescript theme={null}
import { createOrcaWhirlpoolPolicy } from "@exponent-labs/exponent-sdk";
import { PublicKey } from "@solana/web3.js";

const USDC_MINT = new PublicKey("...");
const SOL_MINT = new PublicKey("...");

const policyConfig = createOrcaWhirlpoolPolicy({
  actions: [
    "openPositionWithTokenExtensions",
    "increaseLiquidityV2",
    "increaseLiquidityByTokenAmountsV2",
    "decreaseLiquidityV2",
    "collectFeesV2",
    "collectRewardV2",
    "closePositionWithTokenExtensions",
    "swapV2",
  ],
  allowedMints: [USDC_MINT, SOL_MINT],
});
```

### Parameters

| Parameter      | Type                          | Description                                                                                                                                                                                                                                   |
| -------------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `actions`      | `OrcaWhirlpoolPolicyAction[]` | Optional. Subset of `"openPositionWithTokenExtensions"`, `"increaseLiquidityV2"`, `"increaseLiquidityByTokenAmountsV2"`, `"decreaseLiquidityV2"`, `"collectFeesV2"`, `"collectRewardV2"`, `"closePositionWithTokenExtensions"`, or `"swapV2"` |
| `allowedMints` | `PublicKey[]`                 | Token mints allowed for the Whirlpool action                                                                                                                                                                                                  |
| `threshold`    | `number`                      | Optional. Number of signers required (default `1`)                                                                                                                                                                                            |
| `timeLock`     | `number`                      | Optional. Time lock in seconds (default `0`)                                                                                                                                                                                                  |
| `accountIndex` | `number`                      | Optional. Squads account index used by the policy                                                                                                                                                                                             |

<Note>
  Close-position instructions are not constrained by a Whirlpool account because the Orca close instruction has no Whirlpool account. The hook requires the position to be tracked and the authority and receiver to be the Squads vault.
</Note>

See [Orca Whirlpool Instructions](/developer-strategy-vaults/orca-whirlpool-instructions) for usage examples.

***

## Loopscale Policy

`createLoopscalePolicy` builds a policy that constrains lender-side strategy actions and borrower-side loan actions on the Loopscale program (`1oopBoJG58DgkUVKkEzKgyG9dvRmpgeEm1AVjoHkF78`).

```typescript theme={null}
import { createLoopscalePolicy } from "@exponent-labs/exponent-sdk";

const strategyPolicy = createLoopscalePolicy({
  actions: ["createStrategy", "depositStrategy", "withdrawStrategy", "closeStrategy", "updateStrategy"],
});

const loanPolicy = createLoopscalePolicy({
  actions: [
    "createLoan",
    "depositCollateral",
    "borrowPrincipal",
    "repayPrincipal",
    "withdrawCollateral",
    "closeLoan",
    "updateWeightMatrix",
    "refinanceLedger",
  ],
});
```

### Parameters

| Parameter      | Type                      | Description                                                          |
| -------------- | ------------------------- | -------------------------------------------------------------------- |
| `actions`      | `LoopscalePolicyAction[]` | Optional. Loopscale actions to allow. Omit to allow all actions      |
| `allowedMints` | `PublicKey[]`             | Optional. Mints to constrain for actions that include a mint account |
| `threshold`    | `number`                  | Optional. Number of signers required (default `1`)                   |
| `timeLock`     | `number`                  | Optional. Time lock in seconds (default `0`)                         |

See [Loopscale Instructions](/developer-strategy-vaults/loopscale-instructions) for usage examples.

***

## Titan Swap Policy

`createTitanSwapPolicy` builds a policy that permits calling `SwapRouteV2` on the Titan program (`T1TANpTeScyeqVzzgNViGDNrkQ6qHz9KrSBS4aNXvGT`).

```typescript theme={null}
import { createTitanSwapPolicy } from "@exponent-labs/exponent-sdk";
import { PublicKey } from "@solana/web3.js";

const USDC_MINT = new PublicKey("...");
const SOL_MINT = new PublicKey("...");

const policyConfig = createTitanSwapPolicy({
  allowedMints: [USDC_MINT, SOL_MINT],
});
```

### Parameters

| Parameter      | Type          | Description                                                                 |
| -------------- | ------------- | --------------------------------------------------------------------------- |
| `allowedMints` | `PublicKey[]` | Optional. Token mints to constrain — applies to both input and output mints |
| `threshold`    | `number`      | Optional. Number of signers required (default `1`)                          |
| `timeLock`     | `number`      | Optional. Time lock in seconds (default `0`)                                |

<Tip>
  The `allowedMints` constraint applies to both the input mint and the output mint of the swap. Omitting it permits swaps between any tokens.
</Tip>

See [Titan Instructions](/developer-strategy-vaults/titan-dex-instructions) for usage examples.
