Fetch Pool Token Ratio
Retrieve the current token price ratio for a existing pool.
Code Overview
The code below demonstrates one of the methods for retrieving the current price ratio of two tokens of an existing liquidity pool, which is needed to calculate the precise amounts required for each token when establishing a new liquidity position. The token ratio allows you to calculate the amount needed for the other token.
⛽ No gas cost
Hedera's EVM chain ID can be retrieved from https://chainlist.org.
The pool address, token addresses, token decimal places, and the fee tier can be retrieved from SaucerSwap's REST API. Refer to Fetch all pools (V2) for details.
Last updated