getPairAddress

All ERC20 tokens on our protocol are valued in their DEX paired currency.

In order to properly value all ERC20 tokens, we need to get the correct pair address and pair address decimal.

Neon Protocol developed a core helper function to the getUnderlyingValue function which assists in fetching the pair address of any ERC20 token from DEX-es.

getPairAddressZK function accepts any ERC20 address and relies on the following Uniswap Protocol functions:

  • IUniswapV2Factory

  • getPair

To get the pair address of the provided token address.

Support for pair addresses is limited to only:

  • WETH

  • USDT

  • USDC

Providing any ERC20 token does not return a pair address matching the above pairs will result in the getPairAddressZK returning the error: "TokenValue: token is not paired with WETH, USDT, or USDC"

getPairAddressZK returns the pairAddress and pairedCurrency addresses, as a default redundant check.

Last updated