Vibe
  • introduction
    • What is Vibe Launchpad?
    • Fees
  • protocol
    • Deployed Contracts
    • Contracts
      • Factory
      • FeeHandler
      • LPTokenHolder
    • Lottery Mechanism
    • Security
  • DISCLAIMER
    • Terms of Service
    • Privacy Policy
Powered by GitBook
On this page
  1. protocol
  2. Contracts

LPTokenHolder

The LPTokenHolder contract holds the Uniswap V2 LP tokens for tokens that have been launched.

The purpose of this contract is to allow the protocol admin to withdraw any excess liquidity accumulated in Uniswap V2 from fees, while ensuring that the initial liquidity from launch is never withdrawn.

The amount of LP tokens that can be withdrawn is calculated as follows:

  1. When the token is first launched:

lpOwned = pair.balanceOf(address(this))
lpTotal = pair.totalSupply()

currentLiquidity = sqrt(reserve0 * reserve1)
initialLiquidity = currentLiquidity * lpOwned / lpTotal
  1. To calculate the amount of LP tokens that can be withdrawn at any point in time:

lpOwned = pair.balanceOf(address(this))
lpTotal = pair.totalSupply()

currentLiquidity = sqrt(reserve0 * reserve1)
ownedLiquidity = currentLiquidity * lpOwned / lpTotal
lpToBurn = lpOwned * (ownedLiquidity - initialLiquidity) / ownedLiquidity

Public Functions

This contract does not have any public functions. Only the protocol admin should interact with this contract.

PreviousFeeHandlerNextLottery Mechanism

Last updated 5 months ago