'how to track a tokens liquidity
I'm trying to build a single module to get the token's details however I get all the required data but do not get liquidity in the pool.
const ADDRESS = "0x26193c7fa4354ae49ec53ea2cebc513dc39a10aa";
async function run() {
const contract = new web3.eth.Contract(ABI, ADDRESS);
const name = await contract.methods.name().call();
console.log("name:", name);
const symbol = await contract.methods.symbol().call();
console.log("symbol:", symbol);
const decimals = await contract.methods.decimals().call();
console.log("decimals:", decimals);
const totalSupply = await contract.methods.totalSupply().call();
console.log("totalSupply:", totalSupply);
(async () => {
const tokenAddres = ADDRESS; // change this with the token addres that you want to know the
let bnbPrice = await calcBNBPrice() // query pancakeswap to get the price of BNB in USDT
console.log(`CURRENT BNB PRICE: ${bnbPrice}`);
// Them amount of tokens to sell. adjust this value based on you need, you can encounter errors with high supply tokens when this value is 1.
let tokens_to_sell = 1;
let priceInBnb = await calcSell(tokens_to_sell, tokenAddres) / tokens_to_sell;
// calculate TOKEN price in BNB
console.log('IN BNB : ' + priceInBnb + ' | Just convert it to USD ');
console.log(`IN USD: ${priceInBnb * bnbPrice}`);
[![enter image description here][1]][1]// convert the token price from BNB to USD based on the retrieved BNB value
})();
run();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
