> ## 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.

# Policies and proposal actions

> Shared policy contracts, governance encoding, execution accounts, and signer synchronization.

Use these contracts to configure and encode policies and proposals. Installation and voting workflows remain in [Configure policies](https://docs.exponent.finance/developer-strategy-vaults/configure-policies.md) and [Propose a vault change](https://docs.exponent.finance/developer-strategy-vaults/typescript/governance/overview.md).

## Policy configuration

Protocol-specific configuration belongs in the [integration guides](https://docs.exponent.finance/developer-strategy-vaults/supported-integrations.md). For generic constraints, import these helpers from `@exponent-labs/exponent-sdk`:

| Helper | Input and result |
| - | - |
| `createProgramInteractionPolicy` | `{ instructionsConstraints, accountIndex?, threshold?, timeLock? }` → `PolicyConfig`. Defaults: index `0`, threshold `1`, timelock `0`, no start/expiration. |
| `createInstructionConstraint` | `{ programId, accountConstraints?, dataConstraints? }` → instruction constraint. Constraint arrays default to empty. |
| `createAccountConstraint(index, allowedKeys)` | Restrict one inner instruction account to listed public keys. |
| `createAccountDataConstraint(index, constraints)` | Restrict data in one inner instruction account. Optional account `owner` adds ownership validation. |
| `createDiscriminatorConstraint(bytes)` | Equality against supplied bytes at instruction-data offset `0n`; accepts `Buffer` or `number[]`. |

Leave `spendingLimits` unset for vault policies. A policy must use threshold `1`, smart-account index `0`, nonempty instruction constraints, and the required vault post-validation configuration. `vault.toCodamaPolicyConfig(config)` converts helper output and supplies that configuration. A generic constraint does not bypass supported-protocol or position validation.

```typescript theme={null}
import {
  createProgramInteractionPolicy, createInstructionConstraint,
  createAccountConstraint, createDiscriminatorConstraint,
} from "@exponent-labs/exponent-sdk";

const policyConfig = createProgramInteractionPolicy({
  instructionsConstraints: [createInstructionConstraint({
    programId: targetProgramId,
    accountConstraints: [createAccountConstraint(targetAccountIndex, [allowedAccount])],
    dataConstraints: [createDiscriminatorConstraint(instructionDiscriminator)],
  })],
});
```

Data constraints contain `dataOffset: bigint`, `operator`, and `dataValue`. Operators are `Equals`, `NotEquals`, `GreaterThan`, `GreaterThanOrEqualTo`, `LessThan`, or `LessThanOrEqualTo`. Values use one of `{ u8 }`, `{ u16Le }`, `{ u32Le }`, `{ u64Le: bigint }`, `{ u128Le: bigint }`, or `{ u8Slice: number[] }`.

Omitted account/data constraints widen access. If an account constraint supplies both keys and nonempty account-data constraints, conversion chooses the data constraints; do not assume both apply.

### Wire configuration

`toCodamaPolicyConfig` produces this Borsh field order:

| Field | Wire type and units |
| - | - |
| `payload` | `PolicyCreationPayload`; only the supported ProgramInteraction payload is accepted. |
| `threshold` | `u16`; must be `1`. |
| `time_lock` | `u32` seconds. |
| `start_timestamp` | `Option<i64>` Unix seconds. |
| `expiration` | `Option<PolicyExpirationArgs>`; `Timestamp(i64)` (tag `0`) or `SettingsState` (tag `1`). |

## Policy methods

All return `TransactionInstruction` objects.

| Method | Required inputs |
| - | - |
| `ixAddPolicy` / `ixWrapperAddPolicy` | `payer`, `policyConfig`, `squadsProgram`, `nextPolicySeed`, `nextTransactionIndex`. |
| `ixRemovePolicy` / `ixWrapperRemovePolicy` | `payer`, `manager`, `policySeed`, `squadsProgram`, `nextTransactionIndex`. |
| `ixWrapperUpdatePolicy` | Removal inputs plus `policyConfig`. No `ixUpdatePolicy` high-level method in this SDK. |

Direct changes require manager/curator authority, **zero AUM**, fresh stored AUM, and an unblocked NAV/AUM circuit breaker. `payer` signs; removal/update also require `manager` when distinct. New policies authorize current managers and allocators. Updates preserve existing policy signers. Foundational seeds `1` and `2` cannot be removed.

### Read Squads settings

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

const account = await connection.getAccountInfo(vault.state.squadsSettings);
if (!account) throw new Error("Squads settings not found");
const settings = deserializeSquadsSettingsAccount({
  data: account.data, owner: account.owner.toBase58(),
});
const nextPolicySeed = BigInt(settings.policy_seed?.toString() ?? "0") + 1n;
const nextTransactionIndex = BigInt(settings.transaction_index.toString()) + 1n;
```

The stored seed is the last used seed. Read immediately before construction; competing Squads settings transactions require rebuilding.

## Proposal actions

`ProposalAction` has three root variants. Import the type, `vaultSettingsAction`, and `proposalActionsCodec` from the SDK root. Use an object literal for the outer enum:

```typescript theme={null}
import { type ProposalAction, vaultSettingsAction } from "@exponent-labs/exponent-sdk";

const actions: ProposalAction[] = [{
  __kind: "VaultSettingsAction",
  fields: [[vaultSettingsAction("SetManagementFee", { managementFeeBps: 10_000n })]],
}];
```

| Variant | Encoding |
| - | - |
| `VaultSettingsAction` | `{ __kind: "VaultSettingsAction", fields: [settingsActions] }`. |
| `PositionUpdate` | `{ __kind: "PositionUpdate", fields: [update] }`; must be the **only root action** in the proposal. |
| `PolicyAction` | `{ __kind: "PolicyAction", fields: [action] }`. Nested Add: `{ __kind: "Add", fields: [vault.toCodamaPolicyConfig(config)] }`; Update: `{ __kind: "Update", policySeed, policyConfig }`; Remove: `{ __kind: "Remove", policySeed }`. |

The Borsh root tags are `0`, `1`, and `2` respectively. `proposalActionsCodec` encodes/decodes the action vector stored in the proposal account. Compare decoded or encoded stored actions before executing a script built for a particular change.

### Draft and activation builders

These root-exported constructors return `TransactionInstruction`; their last argument is the program ID.

| Constructor | Arguments and authority |
| - | - |
| `createInitProposalInstruction(accounts, { proposalId }, programId)` | Manager signer plus payer signer, vault, proposal PDA, System Program. ID is `nextProposalId`; seeds are `["proposal", vault, u64le(id)]`. |
| `createAppendProposalActionsInstruction(accounts, { actions }, programId)` | Same accounts; appends a nonempty chunk to Draft. Payer funds growth. |
| `createActivateProposalInstruction(accounts, { votingPeriodSeconds, timelockSeconds }, programId)` | Manager, vault, LP mint, proposal, event authority, program. `null` selects vault defaults. Freezes actions, supply/rejection snapshots, and timers. |
| `createFinalizeProposalInstruction(accounts, programId)` | Any payer signer, vault, proposal, event authority, program. Voting must have ended; records approval or rejection. |
| `createCancelProposalInstruction(accounts, programId)` | Manager authority, vault, proposal, event authority, program. Draft/Active/Approved only; Approved with opt-out votes cannot be cancelled. |

See [Voting and opting out](https://docs.exponent.finance/developer-strategy-vaults/typescript/governance/voting.md) for LP-holder builders and their SDK account-order correction.

### Execute a policy proposal

`createExecuteProposalInstruction(accounts, programId)` returns one instruction. Supply payer, vault, proposal, Squads settings/program, Exponent prices, System Program, event authority, and program. Append remaining accounts in this order:

1. All settings-action validation prefixes, in settings-action order. See [settings accounts](https://docs.exponent.finance/developer-strategy-vaults/typescript/admin-operations/manage-vault-settings.md#additional-accounts).
2. One writable trio for each policy action, in policy-action order: Squads settings transaction, Squads proposal, Squads policy.
3. Existing-position valuation accounts. A sole `PositionUpdate` instead uses its update-specific prefix before valuation accounts.

Derive policy trios from current Squads counters at **execution**, using `SquadsPDA` from `@exponent-labs/exponent-vaults-pda`. Every policy action consumes the next transaction index; every Add also consumes the next policy seed. Update/Remove use their stored seed. Appending actions reserves no counter values.

Execution requires Approved status, `executableAt` reached, **zero pending-withdrawal LP**, fresh AUM, and no NAV/AUM circuit breaker. Any vault role can execute during the first 24 hours after `executableAt`; afterward any signer can. The timelock runs from voting end. The [proposal example](https://docs.exponent.finance/developer-strategy-vaults/examples/propose-vault-change.md) includes action-specific execution accounts.

### Inspect an installed policy

Use root `deriveSquadsPolicyPda(settings, policySeed)` and `deserializeSquadsPolicyAccount` from the public `/vault-inspection` subpath. For direct additions use the construction seed; for proposals use the seed assigned at execution. Inspect constraints and actual signer lists after changes.

## Synchronize signers

| Method | Result |
| - | - |
| `await ixSyncPolicyAuthority({ authority, policy, payer? })` | `{ policy, policySeed, transactionIndex, instruction }`. Payer defaults to authority. |
| `await ixSyncAllPolicyAuthorities({ authority, payer? })` | `{ instructions, skipped }`; each skipped entry includes policy, seed, reason, and message. |

A manager or allocator signs as authority; a distinct payer also signs. Synchronization requires fresh AUM and an unblocked circuit breaker. Role changes do not update installed policy signers automatically.

Bulk instructions consume consecutive Squads transaction indices; submit in order. Independently built single-policy syncs can collide. Reload/rebuild after a competing settings transaction. Policies without an authority template, including vault-only foundational policies, can be skipped; reasons are `MissingPolicyAccount`, `InvalidPolicyAccount`, and `NoAuthorityPermissionTemplate`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.