0

I'm building a dapp, i'm trying to get the erc20 token price in usd from my smart contract how do i go about this? this is very necessary as smart contracts cannot read from outside networks. I don't want my users to be impacted by price change in the token.

5
  • You'll need an oracle to provide the price.
    – Ismael
    Oct 10, 2021 at 17:46
  • How do i go about this oracle thing? Sorry if i'm asking too much.
    – Benjamin
    Oct 10, 2021 at 20:12
  • If it is a well known token you can use Chainlink, otherwise you have to implement your own oracle. For other details check this question ethereum.stackexchange.com/questions/85178/….
    – Ismael
    Oct 11, 2021 at 0:59
  • Yeah it does but how does one implement an oracle.
    – Benjamin
    Oct 11, 2021 at 10:28
  • 1
    Half the job of a computer scientist is doing research, you should try doing that. Choose an oracle (chainlink is the most commonly used), and find out how to implement it by yourself ( i think this should be a good starting point docs.chain.link/docs/get-the-latest-price
    – Foxxxey
    Oct 11, 2021 at 21:06

0