Summary
In this chapter, we have explored the potential risks of the price oracle and how price manipulation drains out the assets from crypto loan systems. Then, we discussed the price oracle approach proposed in the Uniswap v2 whitepaper. The approach can be used to build a manipulation-resistant oracle by generating TWAPs. After that, we implemented the PriceOracleV2
smart contract with the SMA strategy using moving windows. In the end, we discussed how to deploy, maintain, and verify the PriceOracleV2
smart contract we have built in this chapter.
By facilitating the price oracle that we built in this chapter, the crypto loan will be more secure and robust from price manipulation. In the next chapter, we will complete the crypto loan application by implementing the frontend of the system.