🧙‍♂️Liquidation oracle

Lending is one of the most important financial tools in the money market. However, when getting paid back is at risk, liquidation ensures maximum efficiency and security. In TradFi, the Lender triggers the liquidation under the supervision of a third-party entity. However, in DeFi, where a third party should not exist, it must be replaced with a decentralized entity such as a price or liquidation oracle. Thanks to the decentralized and autonomous oracle, smart contracts can foresee what loan positions are due for liquidation.

The Lenfi Liquidation Oracle is a viable solution that approves liquidations when the collateral value falls below a certain level. Moreover, the process triggers only when the Lender burns their NFT bond. Ultimately, the bond remains on-chain, adding an extra layer of safety.

How does it work?

In a sense, the liquidation oracle validation works as a minting script. The Smart Contract allows loan liquidation only when the Lender mints a unique token with the policy provided by the Borrower. The Borrower then decides which oracle to use (which PolicyID to inquire at the time of liquidation) by adding a minting policy script to Datum at the time of the loan request creation.

The Lender, seeing the chosen liquidation oracle, decides whether to provide the loan or not. No one can change the liquidation policy after the loan request creation.

The 9-node Lenfi Liquidation Oracle

The 9-Node Lenfi Oracle is a default oracle minting script used in the dApp beta version. Each node is subject to change in case of failure or mal performance in data representation.

The Oracle on-chain consensus is as follows:

  • At least five nodes have to witness the transaction.

The off-chain Oracle consensus signs a transaction only after meeting the following prerequisites:

  • The collateral ratio is below the collateral factor

  • Oracle fee is paid to oracle wallet

  • The remaining collateral is paid back to the Borrower

All nine nodes must comply with general criteria like flawless reputation and recognition within the Cardano community. Lenfi will not apply fixed-period usage for any of the nodes. Failing to respond to signing requests or providing inaccurate data will result in not receiving any fees and a replacement. The Oracle will confirm the liquidation only after the transaction fee is sent to the oracle fee wallet. Each oracle node will receive an equal fee slice every two weeks.

The fee distribution plan can be subject to changes upon passing a proposal in the Lenfi DAO.

3-Node Lenfi Oracle: How it works (Technical)

Each node runner must run REST API accessible by the Lenfi backend instance. The liquidation request consists of a transaction CBOR, while the oracle response consists of a witness CBOR.

Each Node's witness is added to the liquidation transaction to mint a Liquidation NFT. If all three signatures agree - the minting script allows the minting of an NFT. Hence, the validator allows the loan liquidation.

Oracle validation points

The Oracle's responsibility is to perform objective and fair liquidation verification. The Node is responsible for:

  • Verifying that the Health Factor doesn’t fall below a ratio of 1;

  • Validating an adequate Collateral reimbursement;

  • Returning the remaining (if any) Collateral to the Borrower;

  • Make sure that the remaining Collateral is locked correctly on liquidation.hs

You can read more about our Liquidation Oracle solution here.

Last updated