πŸ“‹Oracles

A P2P lending smart contract needs to know the asset prices, in order to allow the lender to liquidate the borrower, if asset prices change, and loan ratio becomes unhealthy.

To allow this, we are utilizing our own decentralized oracle solution (https://preprod.cardanoscan.io/address/60f5007de2dc6f1c482369a6daca1cb4cd2153b55d03d8a34caa5f1bc6)

Every 30 minutes, an off-chain agent fetches token prices from reputable sources (CMC, Coingecko), validates and compares them, and issues these prices to the blockchain. Each separate token is defined by a separate UTXO, and information regarding price and its validity can be found in the Datum. UTXO also contains a unique NFT for validation. Any smart contract can use this oracle free of charge, by consuming the needed token UTXO as a reference input in their smart contract.

Even though a transaction to write oracle prices to the blockchain is performed in a centralized manner, we can call this oracle decentralized. The reason is that any consumer can manually check the price beforehand, if their chosen token oracle UTXO contains a correct price, and only then use it to interact with P2P lending smart contract. Because the blockchain is immutable, this UTXO is guaranteed to provide the exact price witnessed by the consumer.

At the moment this is a temporary solution, because there are no oracles on the Cardano ecosystem, which are capable of providing multiple Cardano native token prices, except for ADA. Once they become available, as we are already using oracle utilizing reference inputs, it will be easy to switch.

Our lending smart contract architecture allows using an array of different oracle providers. One oracle can be used for a lent asset, and the other for collateral asset on the same transaction.

We are currently adding a capability for P2P lending smart contract to utilize Orcfax (https://orcfax.io) oracle for ADA price feed.

Last updated