Position Exchange
  • Position Exchange Introduction
  • Getting started
    • Create a wallet
    • Get BEP20 Tokens
  • Business and Partnerships
    • Community Leaders Referral Program
  • Position Token (POSI)
    • What is POSI?
    • A Deflationary Token
      • Buy back and Burn
      • Anti-whale
      • Harvest Lock up
    • RFI Technology
    • Buy POSI
    • POSI Tokenomics
    • How is the TVL Calculated?
  • Products
    • Perpetual Trading Protocol
      • Perpetuals basics
        • Why Can't I Place a Futures Order?
        • Order type
        • Leverage for Perpetual Futures Contracts
        • Mark Price in Perpetual Futures Contracts
        • Funding rates
      • Beginner's guide
        • Connect your Wallet
        • Open Position
          • Open Limit Order
          • Open Market Order
        • Adjust Margin
          • Add Margin
          • Remove Margin
        • Set TP/SL
        • Close Position
          • Close Market
          • Close Limit
        • Position Exchange's Futures Transaction Fees
        • Trading Perpetuals
        • How to adjust the Leverage
        • Funding rate
        • Crypto Perpetuals
      • Perpetuals Specs
        • Smart Contract Reverted Error Code
      • Futures Referral
        • Futures Referral for Referrer
        • Futures Referral for Referee
      • Futures Task
    • DEX 2.0
      • Spot Trade 2.0 User Guideline
      • Concentrated Liquidity
        • Initialize a new pool
        • Add and Remove Liquidity
        • Shift range
        • Increase Decrease Liquidity
      • DEX Referral Rules
      • Incentives Programs
        • Position Exchange DEX Airdrop Introduction
        • DEX Airdrop Referral Rules
        • Lucky Fee
        • How to join Pancake Migrate Airdrop
        • How to join the Liquidity Providers Incentive Program
        • How to join the Lucky Fee Program
        • Reward Distribution Schedule
    • Exchange
      • Token Swaps
      • How to trade
      • Liquidity pools
      • How to Add/Remove liquidity
    • Position Bonds (Crypto Bonds)
    • Position P2P Bond
      • Sale rules
      • User's guide
        • How to issue a bond
        • How to purchase a bond
        • How to manage a bond - For issuers
        • How to claim assets when Bond's liquidated/matured - For holders
      • Liquidation
      • Policy
      • FAQs
    • Farming
      • How to use farms
    • Staking
    • NFTs
      • How to Cast & Stake NFTs
    • Referral System
    • Vaults
    • Gain Grid
      • Getting Started with Gain Grid
      • Volatility Interest
      • Gain Grid Frequently Asked Questions (FAQs)
      • Gain Grid Referral Program
      • Gain Grid Terms and Conditions
    • 📱Mobile App
    • Migration
      • Farms/Pools Migration Guideline
      • Vesting Schedule
      • New Staking Contracts
  • Whitepaper
  • Security
    • Audits
    • Privacy Policy
  • Others
    • Contracts
    • Social Accounts
  • Governance
    • What is Position Exchange Governance?
  • Roadmap
    • Position Exchange & Development Plan
  • Community
    • Reports (Bugs, Feedback, Suggestions)
    • Frequently Asked Questions (F.A.Q)
  • Events
    • POSI Twitter Lottery
Powered by GitBook
On this page

Was this helpful?

  1. Position Token (POSI)

How is the TVL Calculated?

How is the TVL on the homepage of Position Exchange calculated?

Here is the code:

stakedAmountInNaivePoolPOSI, err := s.evmAdapter.GetPOSIBalance(constants.POSIStakingManagerAddress)
if err != nil {
	return err
}
stakedAmountInNaivePoolPOSIV2, err := s.evmAdapter.GetPOSIBalance(constants.POSIStakingManagerV2Address)
if err != nil {
	return err
}
stakedAmountInNFTPoolsPOSI, err := s.getStakedAmountInNFTPoolsPOSI()
if err != nil {
	return err
}
stakedAmountInLPPairFarmsPOSI, err := s.getStakedAmountInLPPairFarmsPOSI()
if err != nil {
	return err
}
USDPriceOfPOSI, err := s.redisAdapter.GetUSDPrice(ctx, constants.PositionExchangeContractAddress)
if err != nil {
	return err
}

// stakedAmountInLPPairFarmsPOSI multiply 2 because LP value in USD is the same for the other token
// based on x.y = k formula
totalUSDValueLocked := stakedAmountInLPPairFarmsPOSI.Mul(decimal.NewFromInt(2)).Add(*stakedAmountInNaivePoolPOSI).Add(*stakedAmountInNaivePoolPOSIV2).Add(*stakedAmountInNFTPoolsPOSI).Mul(*USDPriceOfPOSI)
return s.redisAdapter.SetStatistics(ctx,
	constants.PositionExchangeContractAddress,
	constants.StatisticsTotalValueLockedFieldName,
	&totalUSDValueLocked)

Explain:

(posi.balanceOf(POSIStakingManagerAddress) + posi.balanceOf(POSIStakingManagerV2Address)

+posi.balanceOf(POSINFTMintProxyV1) + posi.balanceOf(POSINFTMintProxyV2) +

(posi.balanceOf(BUSDLP) + posi.balanceOf(BNBLP))*2)

*posiUSD

Where:

Variable
Value

POSIStakingManagerAddress

0x0c54b0b7d61de871db47c3ad3f69feb0f2c8db0b

POSIStakingManagerV2Address

0xB02de8F384613d0aa2521B188b55c4D006dDB2D1

POSINFTMintProxyV1

0x0Fb07a8527f45d7625Ab6486718910ce44a608b5

POSINFTMintProxyV2

0xd8b6E267a0A46E13047056F105787dB9aFFb4b9a

BUSDLP

0x00222D964a2077301309809Ab3bf56485C126A9C

BNBLP

0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c

Let's verify by yourself!

PreviousPOSI TokenomicsNextPerpetual Trading Protocol

Last updated 2 years ago

Was this helpful?