0

So I have a contract address of an ERC20 token and I have direct access to a full node. I want to determine the price of that token in ETH without making any external API calls and just by using my own full node.

How do I go about doing that?

Can I just divide the amount of ETH owned by the contract to the amount of tokens minted?

1
  • 1
    The price is not a global constant, it can vary from one exchange to another (CEX or DEX), including between versions of the same exchange or different pools of the same tokens pair. Here the documentation of how to get the qotes in UniswapV3, using their SDK.
    – Rafael
    Feb 19, 2023 at 18:01

1 Answer 1

1

I think you can't do it, as Rafael say that depend of the Router address of ERC20 Token you need call the price with a web3 files like Javascrypt. pretty easy to get current price of token ask if you want an example ..

Just replace url of endpoint with your own node url

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.