SmartLTV — A Smart Contract to Calculate LTV Ratios is LIVE on Testnet

B.Protocol’s Risk Oracle first use case, a smart contract formula that automatically calculates Loan-To-Value ratios, is now live on testnet.

Eitan Katchka
B.Protocol
5 min readJul 21, 2023

--

Today we are happy to launch the first testnet version of B.Protocol’s Risk Oracle. The first use case of the oracle is SmartLTV — a smart contract that calculates recommended Loan-To-Value ratios fully on-chain, based on risk-related data feeds.

Current economic risk management processes in DeFi are often subject to human biases and politics, leading to inefficiencies and potential vulnerabilities. This situation presents real challenges when determining a collateral asset’s Loan-To-Value (LTV) ratio while trying to strike the right balance between default risk and a lending platform’s usability.

The new SmartLTV contract is built upon B.Protocol’s Risk Oracle and a smart contract formula that was developed by RiskDAO.

The oracle deployment includes a data layer contract that is operated and maintained by relayers (in testnet only one relayer) who feed risk-related data such as average market volatility and DEX liquidity.

The SmartLTV deployment includes a solidity implementation to calculate LTV values according to the data the oracle layer provides.

High-Level architecture of SmartLTV and Risk Oracle

We also launched a front end to visualize how the calculation is done, and to automatically generate a solidity code that interacts with the data oracle, and outputs a recommended LTV value.

About the formula

RiskDAO’s SmartLTV is a smart contract formula, that offers a simplified yet robust method for LTV ratio calculations. The SmartLTV UI that is launched today showcases the formula’s capabilities and enables users to calculate LTV ratios based on quantitative data, minimizing the human factor in the process.

SmartLTV Formula

The formula takes into account the following market parameters where:

  • σ is the price volatility between the collateral and debt asset (normalized to the base asset price).
  • β is the liquidation bonus.
  • ℓ is the available dex liquidity with a slippage of β.
  • d is the borrowing cap of the debt asset.
  • c is a confidence level factor (CLF). The higher c is, the odds for insolvency are decreasing.

The Confidence Level Factor (CLF) is a single constant parameter that aims to represent all the implicit and explicit assumptions made within any risk assessment framework through a single numeric value.

SmartLTV Widget

The Smart LTV widget enables users to set the parameters to calculate a desirable LTV for an asset —

SmartLTV Widget

The formula fetches two parameters directly from the Risk Oracle feeds — the asset’s DEX liquidity and the asset’s volatility.

A disclaimer should be placed, as the Risk Oracle is currently using testnet data, and as such, the data and the formula results using it should not be considered valid for any production-level products and may result in severe financial losses.

In addition to the fetched data feeds, a user is required to set the following parameters:

  • Debt Asset — currently available assets are WETH, WBTC, and USDC.
  • Time Frame — 7 / 30 / 180 / 365 days to be selected
  • Liquidation Bonus — the percentage of price impact (slippage) the liquidators will be willing to absorb during a liquidation.
  • Borrow Cap — the maximum amount that can be borrowed against the asset, denominated in $m.
  • Confidence Level Factor (CLF) — A constant representing all of the implicit and explicit risk assumptions made within the risk framework. Expressed as a single numeric value.

The Smart LTV formula will calculate and present the recommended LTV ratio according to the set parameters and the market data.

Alternatively, a user can input a desirable LTV to calculate the CLF, representing the risk appetite of the user. In this way the CLFs can be used to compare the differences between confidence levels (or risk exposure) a market has towards different assets.

It should be noted that higher confidence levels demonstrate assumptions of lower chances for insolvency, meaning it is assumed the asset could go through liquidation without accruing bad debt. This means that given all other factors are equal, the higher the CLF — the lower the calculated LTV will be.

Code Generator

Below the widget, we provide a code generator — any changes a user will make in the formula parameters will provide an adjusted code snippet. Once the Risk Oracle data will be verified as trustworthy and run on mainnet, this code could be used to set LTVs in an automated way within a platform’s smart contract.

Risk oracle

With the Smart LTV UI and its underlying formula, DeFi participants can adopt a more neutral, transparent, and automated approach to economic risk management. By highlighting the formula’s ability to leverage quantitative data for LTV ratio calculations, users can gain confidence in its accuracy and neutrality, enabling them to make well-informed decisions as well as for the ecosystem to scale its economic risk management to long(er) tail assets, permissionless markets and more.

In recent months B.Protocol has been working on its new Risk Oracle — a new DeFi primitive providing on-chain risk related data feeds that smart contracts can use. Smart LTV is the first solution putting these data feeds into action, calculating LTV ratios.

You can track an asset’s liquidity and volatility data on the new UI through graphs and tables, but more importantly, you can find the smart contract to call for this data.

The Risk Oracle in its current status is still run on testnet in a centralized manner and as such is used at this stage as a proof of concept to gather feedback from the community. We plan on gradually decentralizing it with a vast support of validators, implementing a staking and slashing mechanism to maintain the integrity of the data provided. Reach out if you would like to be whitelisted for the initial batch of validators.

Currently, the Risk Oracle supports a short list of assets, to be expended down the road. Again, reach out if you have any requests about specific assets you would like to see supported.

About B.Protocol

B.Protocol is setting standards for DeFi risk management. Its community of risk-aware DeFi players is building open protocols for risk mitigation and assessment which are governed by the BPRO token.
Join the community Discord for discussions, and follow us on Twitter for updates -

Website, Twitter, Discord, GitHub

About RiskDAO

Risk DAO is a service DAO focused on providing a new, open-source risk assessment framework, associated audits, and dashboards to stress test, monitor, and manage risk in DeFi lending and borrowing protocols as well as L1 and L2 networks.

Website | Twitter | Discord

--

--