13

Implementing a Price Oracle for Crypto Loans

In the previous chapter, you learned that the decentralized crypto loan smart contacts rely heavily on token prices and that the prices help maintain the balance between liquidity for collaterals and borrowed assets. Inaccurate price information may lead to the loss of assets, affecting liquidity and resulting in inadequate funds for borrowing and withdrawal. Even worse, the attackers can drain all the funds by manipulating the price utilized by the crypto loan system. Building a reliable and manipulation-resistant price oracle is essential for a crypto loan system.

A price oracle is a source of truth for token prices that can be accessed by smart contracts running on the blockchain. The price ...

Get Building Full Stack DeFi Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.