art by the illustrious @kitvolta on X
In DeFi lending markets, one of the most critical parameters is the Loan-to-Value (LTV) ratio. This single number determines how much a user can borrow against their collateral, making it crucial for both protocol safety and capital efficiency. We’ve been working with Sentiment to make the calculation of LTV for lending protocols more automated, more verifiable, and more efficient to improve capital efficiency for on-chain lending protocols.
The Challenge: Dynamic Risk Management
Sentiment provides leveraged lending on Hyperliquid, where market conditions can change rapidly. Traditionally, LTV ratios were set through a very manual process that involved calculating risk parameters off-chain, proposing updates through governance, waiting for approval, and finally implementing changes. See here for an example of this.
This process introduces significant delays and inefficiencies. To account for the lag time, protocols often have to use conservative LTV values, sacrificing capital efficiency for safety. Additionally, the reliance on clunky governance processes creates counterparty risk – what if the updates aren’t processed in time during volatile periods?
Why Automate Risk?
At its core, DeFi lending is about balancing risk and efficiency. Too conservative with LTV ratios, and capital sits idle. Too aggressive, and the protocol risks insolvency. The holy grail would be a system that dynamically adjusts these parameters based on real market conditions - but doing this safely and verifiably has been a major challenge.
We realized that market volatility forecasting - a well-studied problem in traditional finance - could be adapted for on-chain LTV management if implemented correctly. This led us to explore GARCH models, which have a proven track record in volatility forecasting and are already used by some of the larger DeFi risk modelling firms. GARCH works particularly well for LTV calculations because it recognizes market “memory” – the tendency for volatile periods to cluster together. The model balances recent price changes with long-term trends, and its relative simplicity makes it robust, easy to interpret, and less prone to overfitting. The LTV is dynamically calculated as 1 - GARCH volatility estimate
. As market volatility increases, the LTV automatically decreases, protecting the protocol during turbulent periods.
The challenge wasn’t in implementing GARCH - it was making it fully verifiable and automated on-chain. Using EZKL’s zero-knowledge toolkit allowed us to bridge this gap. We implemented the GARCH model in PyTorch and compiled it into an equivalent zk-circuit that proves calculations are correct using EZKL. This means every LTV update comes with cryptographic proof that the calculations followed the intended model using on-chain data.
Technical Implementation
Our system’s architecture consists of two interconnected components on-chain that work together to ensure reliable, verifiable LTV calculations.
- The data aggregation layer utilizes oracles on Hyperliquid, taking price snapshots every 24 hours and storing historical data in a comptroller contract. This ensures a reliable stream of market data for our calculations.
- The verification layer, implemented through a deployed EZKL verifier contract, serves as the final bulwark of computational integrity. It ensures all inputs come from trusted on-chain sources and automatically rejects any invalid calculations, maintaining the system’s security guarantees.
Results and Impact
This automated system has transformed how Sentiment handles risk management. By enabling more frequent LTV updates, we’ve significantly improved capital efficiency while reducing governance overhead. The system’s ability to make dynamic adjustments based on real-time market conditions has enhanced their risk management capabilities, all while maintaining verifiable security.
Looking Forward
This implementation opens new possibilities for DeFi risk management. We envision future developments including more sophisticated volatility models, cross-asset correlation analysis, and automated stress testing. We’re also exploring ways to extend this approach to dynamic interest rate adjustments.
The key insight isn’t just automation – it’s creating systems that can adjust to market conditions while maintaining the trustless, verifiable nature that makes DeFi powerful. Through this work with Sentiment Protocol, we’ve demonstrated that it’s possible to achieve both flexibility and security in DeFi risk management.
For technical details and implementation specifics, check out our documentation and GitHub repositories.
- the Sentiment <> EZKL integration: https://github.com/zkonduit/protocol-v2-ezkl-integration:
- our docs: https://docs.ezkl.xyz/
- our repo: https://github.com/zkonduit/ezkl
- our Discord: https://discord.com/invite/mqgdwdSgzA