How to get the native token price

How do I get the USD price of Matic, the native token on Polygon?
Do I have to hardcode an address? Or can the same code be used for any supported chain?

Thanks

You will have to get the price for wrapped matic, same for bnb and eth: wbnb and weth.

3 Likes