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.
Asked
Active
Viewed 28 times
0
-
You'll need an oracle to provide the price. – Ismael Oct 10 '21 at 17:46
-
How do i go about this oracle thing? Sorry if i'm asking too much. – Benjamin Oct 10 '21 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 https://ethereum.stackexchange.com/questions/85178/what-is-a-blockchain-oracle. – Ismael Oct 11 '21 at 00:59
-
Yeah it does but how does one implement an oracle. – Benjamin Oct 11 '21 at 10:28
-
1Half 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 https://docs.chain.link/docs/get-the-latest-price/ – Foxxxey Oct 11 '21 at 21:06