0

I am trying to implement Chainlink's price feed in my contract. I've learned that when using the USD pair, it always uses 8 as the decimal. I am curious as to why 8 is used instead of 18, is there a special reason for it?

mingg
  • 1
  • 1

1 Answers1

0

We can check the decimals function for decimals and description function for pairs in the chainlink contract.

Example for ETH/USD, it's 8 decimals:--https://etherscan.io/address/0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419#readContract

For BUSD/ETH,it's 18 decimals:-- https://etherscan.io/address/0x614715d2Af89E6EC99A233818275142cE88d1Cfd#readContract

  • Price feeds use 8 decimals when returning fiat values (ex: USD) and 18 when returning token values (ex: ETH) – Richard G Jan 20 '23 at 14:54