Skip to main content

Overview

It’s common to want to know what underlying tokens a BEX LP token represents. This documentation explains how to query this information directly from the BEX contract and LP tokens.

Querying the BEX contract and LP tokens

The BEX contract can provide the exact number of tokens in a pool. By querying this information and calculating your share of the pool, you can determine your underlying token balances.

Step-by-step process

  1. Query the BEX contract for pool tokens and balances
  2. Calculate your pool share
  3. Calculate your underlying token balances

Pseudocode

Special considerations

Stable pools

For stable pools in BEX:
  1. Use getActualSupply() instead of totalSupply() to get the correct pool supply
  2. If you’ve staked your LP tokens, calculate your total LP token balance as:

Example: Querying BERA/HONEY pool

Let’s say you want to know your underlying BERA and HONEY balances for a BERA/HONEY pool: In this example, your 100 LP tokens represent 100 BERA and 1000 HONEY.