Last active
May 23, 2021 09:58
-
-
Save bhavya2611/adc08388e2c57912e5908b78137b510b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getLpTokenReserves = async () => { | |
try { | |
const LpTokenContract = new web3.eth.Contract( | |
IUniswapV2Pair, | |
LP_TOKEN_ADDRESS | |
); | |
const totalReserves = await LpTokenContract.methods.getReserves().call(); | |
// For ETH/DOGE Pool totalReserves[0] = ETH Reserve and totalReserves[1] = DOGE Reserve | |
// For BNB/DOGE Pool totalReserves[0] = BNB Reserve and totalReserves[1] = DOGE Reserve | |
return [totalReserves[0], totalReserves[1]]; | |
} catch (e) { | |
console.log(e); | |
return [0,0]; | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment