Does anyone have an idea why the pancakeswap API returns 0 as a token price for token that in fact does have a token price?
https://api.pancakeswap.info/api/v2/tokens/0x65ad6a2288b2dd23e466226397c8f5d1794e58fc
Also...has anyone ever been in touch with their support?
Apr 7, 2022, 12:08 PM
you can use coingecko api instead
Apr 7, 2022, 1:41 PM
Dunno but if you check the token on Poocoin it has a 25 dollar unlocked liquidity pool so seems a scam token anyway
Apr 7, 2022, 1:41 PM
I know. But that's not the point.
I want to know how much this token is worth on that particular exchange, not on coingecko
I want to know how much this token is worth on that particular exchange, not on coingecko
Apr 7, 2022, 1:42 PM
try ask in their tg
Apr 7, 2022, 1:46 PM
Maybe their API ignores pairs with low liquidity, I'm not sure. The most direct way to fetch a price of a token in a pair on PCS is to call getReserves() on the pair contract, then do the arithmetic from that
Apr 7, 2022, 2:06 PM
depends what you mean by frontrunning
Apr 7, 2022, 2:12 PM
I assume he means the usual sense of issuing a transaction like a swap that frontruns another existing high slippage swap on the mempool
Best way to prevent it is for users to use sensible slippage settings. If it's for other use cases, you can look into the flashbots API to help prevent things like this
also, if you're importing the json, then referencing the "interface" property of the returned object, you probably don't need to JSON.parse it at that point? Not sure
Apr 7, 2022, 3:52 PM