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)
(posi.balanceOf(POSIStakingManagerAddress) + posi.balanceOf(POSIStakingManagerV2Address)
+posi.balanceOf(POSINFTMintProxyV1) + posi.balanceOf(POSINFTMintProxyV2) +
(posi.balanceOf(BUSDLP) + posi.balanceOf(BNBLP))*2)
*posiUSD