How to calculate the token price of already deployed ERC20 tokens


I am creating a smart contract, so inside that I have to pass the token in contract and the value of ether will be calculate on behalf of token price please help. i want to make crypto to crypto smart contract where i need to sell erc20 token and on buyer side i need to calculate the price which i have to send to seller.

1 Like

Hey @love_chawda! I’m not sure I fully understood your use case, but if you’re looking into getting the market price of a token into your contracts, you’re in for one very difficult problem. What you are looking for is an oracle that will tell you the price of the token based on data from exchanges. My suggestion would be to ask around in the Chainlink or Provable communities, who specialize in these kind of problems!