Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

vaultRemoveLiquidity

Burn vault shares to schedule a withdrawal. The corresponding cash is unlocked after the vault cooldown period.

The release value is computed as effectiveEquity × (sharesToBurn / effectiveSupply) at burn time, but the USD is not credited immediately — a cooldown is enforced to prevent LPs from front-running known losses. See protocol book: perps/5-vault §3.

Signature

function vaultRemoveLiquidity(
  client: Client<Signer>,
  parameters: {
    sender: Address
    sharesToBurn: string
  },
): Promise<{ hash: Uint8Array } & TxData>

Example

import { createSignerClient, createTransport, testnet, PrivateKeySigner } from "@left-curve/sdk"
import type { Address } from "@left-curve/sdk"
 
const client = createSignerClient({
  chain: testnet,
  transport: createTransport(),
  signer: PrivateKeySigner.fromMnemonic(process.env.DANGO_MNEMONIC!),
})
const sender: Address = "0x1234567890abcdef1234567890abcdef12345678"
 
await client.vaultRemoveLiquidity({ sender, sharesToBurn: "1000000" })

Parameters

senderAddress. The withdrawer.

sharesToBurnstring. Vault shares to burn, base units (uint128).

Returns

{ hash: Uint8Array } & TxData — see broadcastTxSync.

Notes

  • The actual cash release happens after PerpsParam.vaultCooldownPeriod and surfaces as a PerpsUnlock entry on the user's state.
  • Withdrawals revert if the vault's effectiveEquity is non-positive.
  • Total concurrent unlocks per user are capped at PerpsParam.maxUnlocks.

See also