V3LPVault4626

The V3LPVault4626 is the core component of Peridot's PancakeSwap Boosted Markets. It wraps a Concentrated Liquidity (CL) position (NFT) from PancakeSwap V3 into a fungible ERC-20 token (Vault Share) that can be used as collateral.

🛠️ Key User Functions

depositDual(DepositParams calldata params)

The primary way to mint vault shares. Since V3 positions consist of two tokens (e.g., USDC and AUSD), users must supply both in the correct ratio.

  • Parameters (DepositParams struct):

    • amount0Desired, amount1Desired: Amounts of tokens to supply.

    • amount0Min, amount1Min: Slippage protection.

    • receiver: Address receiving the shares.

    • deadline: Timestamp expiration.

  • Returns: uint256 shares (Amount of vault shares minted).

withdrawDual(WithdrawParams calldata params)

The primary way to burn shares and retrieve underlying assets.

  • Parameters (WithdrawParams struct):

    • shares: Amount of shares to burn.

    • amount0Min, amount1Min: Slippage protection for withdrawals.

    • receiver: Address receiving the withdrawn tokens.

  • Returns: amount0, amount1 (Amounts of tokens returned).

⚙️ Mechanics

Auto-Compounding

The vault has a harvestAndCompound() function (callable by a keeper or owner) that:

  1. Collects accrued trading fees from the V3 pool.

  2. Optionally swaps rewards if needed.

  3. Re-adds the fees as new liquidity into the existing position.

Pricing & Security

  • TWAP: The vault relies on a V3LPVaultOracle that checks Time-Weighted Average Prices to ensure the LP position value isn't manipulated via flash loans.

  • Deviation Checks: Prevents deposits/withdrawals if the spot price deviates too far from the TWAP.

Inflation Protection

To prevent "donation attacks," the vault enforces a minimum "Dead Seed" balance. A small amount of shares must be permanently locked at the dead address (0x...dEaD) before users can deposit.

Last updated