Hello. I'm building infrastructure for a blockchain game where users can spend ERC20 tokens to buy tickets whose prices are $0.25, $0.5, $1, etc. For that, I need to get ERC20 token current price in stablecoin. What is the most secure way to do that?

Right now I get reserves from UniswapV2 pair and do calculations:
UniswapV2Pair.getReserves()

Is it a secure way to get the price of a token? I think it's vulnerable to flash load attacks, am I right? Should Chainlink price feed oracle be used instead?

Mar 24, 2022, 9:06 AM

© 2024 Draquery.com All rights reserved.