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
sender — Address. The withdrawer.
sharesToBurn — string. Vault shares to burn, base units (uint128).
Returns
{ hash: Uint8Array } & TxData — see broadcastTxSync.
Notes
- The actual cash release happens after
PerpsParam.vaultCooldownPeriodand surfaces as aPerpsUnlockentry on the user's state. - Withdrawals revert if the vault's
effectiveEquityis non-positive. - Total concurrent unlocks per user are capped at
PerpsParam.maxUnlocks.