Skip to main content
Use these contracts to configure and encode policies and proposals. Installation and voting workflows remain in Configure policies and Propose a vault change.

Policy configuration

Protocol-specific configuration belongs in the integration guides. For generic constraints, import these helpers from @exponent-labs/exponent-sdk: 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.
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:

Policy methods

All return TransactionInstruction objects. 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

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:
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. See Voting and opting out 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.
  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 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

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.