I am trying to wrap my head around. I understand the concept of x*y=k vol. when we are calculating this we can get the price but there’s also an exchange price, say eth. That means the pool will have 2 eth prices (?) one from the pool, one from the cex. Do we assume that there’s always arbitrage? If so, why do examples always pull in external prices?
1 Answer
It just depends on what you're trying to do. A lot of time you can just use the pool price as your oracle, but there are some issues if you don't use a twap (flash loans) and even if you do, you need a lot of liquidity or you'll be subject to manipulation. If the majority of the liquidity is on a cex however, it makes it much more robust to just grab price. Of course, then you may have oracle risk, but its really a design decision you'll have to make in your smart contracts.