I’m checking the price of a coin on Polygon:
https://deep-index.moralis.io/api/v2/erc20/0xdab35042e63e93cc8556c9bae482e5415b5ac4b1/price?chain=polygon&to_block=19733018
Here’s the response:
{
"nativePrice": {
"value": "45052026303068763650",
"decimals": 18,
"name": "Matic Token",
"symbol": "MATIC"
},
"usdPrice": 148918.39841653185,
"exchangeAddress": "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32",
"exchangeName": "Quickswap"
}
So the API says the value is ~$148k when the correct value is around $0.04 according to CoinGecko:
I have three questions:
- What’s up with this wrong price? I checked the pair reserves and it looks like there’s plenty of liquidity on quickswap.
- Can I change the exchange from quickswap to something else on polygon? The way you have multiple exchanges on eth?
- How do I interpret the the nativePrice “value”: “45052026303068763650” in the response? How do I convert this string into a number that makes sense? How do I reconcile this number against the usd price? For example, I tried nativePrice.value / 10^18 * usd price of matic as of that block == usd price. But this equation did not work.