DeFi Risk Tools
Demo versions of internal tooling I built to make our lending vault curation and risk assessments more scalable.
The Problem
Vault curators have to regularly evaluate risk and make allocation decisions. I built internal tools that make it easier for any team member to follow the risk framework and make sound allocation decisions.
Neither tool replaces judgment. The tools serve as helpers during different steps in the risk management process.
The Approach
Lending Optimizer Tool
→ Link
Risk assessment is used as an input to the tool. The optimizer then shows the outcome in terms of allocation decisions. That also allows for easy experimentation with a vault’s risk parameters to show how they translate into vault APY (policy cost).
What it answers
Given a capital balance and a set of exposure limits, where should funds be allocated right now.
How it works
The tool pulls real-time market data from lending protocols including Morpho, Euler, and Aave. Users set risk and optimization parameters to determine allocations. The optimizer fills capital from highest to lowest yield while controlling for risk exposure limits. An alternative version used risk-discounted APYs for optimization.
Constraints:
- Max weight: Share of the portfolio the vault is willing to allocate to a single market.
- Max market share (and max utilization): Share of a market’s total supply the vault is willing to take on. Lower values mean the vault prioritizes liquidity.
- Group budget: Combined allocation cap across markets sharing a tag, for example BTC exposure across similar collateral (e.g. WBTC and cbBTC) can be capped together rather than only one position at a time.
- Risk budget: Combined cap for each risk group (with risk scored from A to D, with scoring done outside of the tool).
Morpho Market Checker
→ Link
Market analytics for Morpho markets, Morpho vaults and MetaVaults allocating to multiple markets and vaults. The use case is to get an initial overview of market risk for lenders.
What it answers
- Risk metrics like borrow and supply HHI (Herfindahl–Hirschman index), Liquidity, and liquidation risk of borrowers.
- Liquidation risk is calculated based on user-set value loss scenarios (probability & amount of loss in the collateral vs the debt asset) and returns expected liquidation volume. The results can feed into a DEX liquidity model (not part of the tool) to calculate potential bad debt scenarios for lenders.
- Collateral exposure of a vault across markets and vaults, and a market-based risk score.
How it works
The tool pulls real-time market data from Morpho. Users set loss scenarios for collateral assets based on their own risk assessment (not part of the tool) to calculate liquidation risk.