Skip to main content

Voting on Proposals

LP holders participate in governance by staking their LP tokens to vote on active proposals. See ActionProposal for how the voting model works.

Stake Vote

createStakeVoteInstruction

Stakes LP tokens to cast a vote on an active proposal. The voter chooses either Reject (block the proposal) or OptOut (don’t block, but queue LP for withdrawal if it passes).
import { createStakeVoteInstruction, VoteChoice } from "@exponent-labs/exponent-sdk/client/vaults";

const ix = createStakeVoteInstruction(
  {
    voter: wallet.publicKey,
    vault: vaultAddress,
    proposal: proposalAddress,
    voteAccount: voteAccountPda,
    tokenLpSrc: voterLpTokenAccount,
    tokenLpEscrow: vaultLpEscrow,
    mintLp: vaultMintLp,
    tokenProgram: TOKEN_PROGRAM_ID,
    systemProgram: SystemProgram.programId,
  },
  {
    voteChoice: VoteChoice.Reject,
    lpAmount: 1_000_000n,
  },
);

Accounts

NameSignerWritableDescription
voterYesYesThe LP holder casting the vote
vaultNoNoThe vault account
proposalNoYesThe active proposal
voteAccountNoYesVote account PDA (created if needed)
tokenLpSrcNoYesVoter’s LP token account
tokenLpEscrowNoYesVault LP escrow
mintLpNoNoVault LP mint
tokenProgramNoNoSPL Token program
systemProgramNoNoSystem program

Args

NameTypeDescription
voteChoiceVoteChoiceReject or OptOut
lpAmountu64Amount of LP tokens to stake as voting weight

Unstake Vote

createUnstakeVoteInstruction

Unstakes LP tokens after the voting period has ended. Returns staked LP to the voter.
import { createUnstakeVoteInstruction } from "@exponent-labs/exponent-sdk/client/vaults";

const ix = createUnstakeVoteInstruction({
  voter: wallet.publicKey,
  vault: vaultAddress,
  proposal: proposalAddress,
  voteAccount: voteAccountPda,
  tokenLpDst: voterLpTokenAccount,
  tokenLpEscrow: vaultLpEscrow,
  mintLp: vaultMintLp,
  tokenProgram: TOKEN_PROGRAM_ID,
});

Accounts

NameSignerWritableDescription
voterYesYesThe original voter
vaultNoNoThe vault account
proposalNoNoThe finalized proposal
voteAccountNoYesVote account to close
tokenLpDstNoYesDestination for returned LP tokens
tokenLpEscrowNoYesVault LP escrow
mintLpNoNoVault LP mint
tokenProgramNoNoSPL Token program

Args

None.
Unstaking is only possible after the proposal has been finalized (either approved or rejected). If you voted OptOut and the proposal passed, your LP is automatically queued for withdrawal instead of being returned.