At Gauntlet, we use agent-based simulations to evaluate the economic security of blockchain protocols. We have worked with the Aave team in parameter optimization for V2, which includes loan-to-value ratio (LTV), liquidation threshold, and liquidation incentive values for various assets. The main purpose of this post is to provide some color into the work we have been doing with the Aave team, as well as motivate the framework for high-level analysis that we will continue to perform. We purposely exclude the rigorous definitions and methodology for our simulations in this post, but that will be available in a formal report to be released shortly. With that said, we hope to illuminate and spark discussion about overall market and systemic risk within the Aave protocol.
The main tool used for assessing market and system risk in Aave is agent-based simulation. Such simulations can accurately assess how well liquidations are handled under stressful scenarios, such as Black Thursday. Our simulation platform allows data scientists to directly stress test agent models (models of user behavior) against the real EVM bytecode that is used on mainnet. By stress testing against actual contract code, we reduce the surface area for false negative safety results.
To construct models of borrower, supplier, and liquidator behavior, we first analyze on-chain and market data. Using these models, we run Monte Carlo simulations of different users competing and interacting with the protocol to assess safety. Our methodology for stress testing DeFi protocols was established in our analyses of Compound and THORChain. For our analysis of Aave, we significantly improved the models used for analyzing borrower behavior in Compound. These model improvements allow us to handle cross-margining and better reflect multi-collateral borrowing behavior. This allows us to stress test the protocol’s safety under liquidity duress and more accurately handle the wide variety of assets utilized within Aave.
Key Simulation Inputs
Our simulations focus on stress-testing the protocol under extreme market conditions, including high volatility, low liquidity, and high gas congestion. The main levers available to the protocol to mitigate risk during these conditions are loan-to-value (LTV) ratio, liquidation threshold, and liquidation incentive. We also utilize these variables to help define and guide agent logic within the system. Our simulations allow for the isolation of specific changes to each of these values per asset.
This variable helps to define our borrower and lender logic. As we change LTV per asset, it changes the amount that can be borrowed against a particular collateral. For each asset, we also define how borrower behavior will change based on LTV changes.
The difference between the LTV and liquidation threshold of a particular asset is the minimum buffer for an adverse price movement that a loan can withstand. Changing liquidation threshold alters the amount of time that borrowers have to resupply collateral to maintain healthy loans.
This variable helps to define our liquidator agent logic. The main consideration for liquidators is balancing the slippage, trading fees, and transaction fees against the liquidation incentive. This provides the framework for defining optimal liquidator behavior.
Asset Volatility and Correlation
Historical data about price movements defines the price trajectories used in our simulations, but it also impacts how our liquidators behave. Changing liquidator behavior in times of high volatility and low liquidity can give insight to systemic risk. Another key aspect of our simulations is understanding asset correlation and its effects on protocol health. This is the correlation matrix of the assets on the Aave protocol over the from December 2020 to January 2021:
In our simulations, we are using correlated multi-asset geometric Brownian motion models for each of the asset price trajectories.
Another key aspect of understanding how Aave will perform under high stress situations is network congestion. We add gas price and transaction delay implications by building gas distribution curves on three month trailing data, and use random samples in our liquidator logic. In addition, we fit expected transaction delay times to liquidation calls.
There are idiosyncratic risks for each asset that might be missed through general market statistics including volatility and liquidity. In addition to considering these general risks, we monitor borrow and lend behavior on a per asset level. Specifically, one metric is borrow usage rate per asset which can be defined as:
where U is the utilization ratio of each user:
This particular metric provides information about how aggressively suppliers of a specific asset borrow against their supply. At the time of this post, the total size of the V2 protocol is still less than 20% of V1, so we are currently utilizing V1 user behavior for our simulations, but this should change over time:
Key Simulation Outputs
The following metrics are a few ways that we monitor overall protocol health and safety throughout our simulations. These metrics guide how we make suggestions for the previously stated key protocol variables.
The main output used to determine overall protocol market risk is account insolvencies. Whenever an account holds more debt, or borrowed assets, than collateral, or supplied assets, the account can be considered to be insolvent. On the protocol level, we monitor the gross and net insolvent value of all assets. Because many users of Aave hold multi-asset debt as well as multi-asset collateral, we also look at the gross and net insolvent value per asset by using pro rata attributions of the insolvent debt.
One main mechanic that the Aave protocol utilizes to maintain the overall health of the protocol is liquidations. The total liquidated value and total liquidatable debt are valuable metrics. However, another important output is “adverse liquidations”. As explained in the OpenZeppelin audit of Aave [H08] Counterproductive incentives, there exist regimes where liquidations do not improve the overall health of a specific loan, but rather push it towards insolvency. During simulation runs, we track the changes to the volume and frequency of adverse liquidations, as well as the clustering of liquidations in terms of size. Increases in adverse liquidations places more onus on users to resupply collateral. Although insolvency statistics may not increase throughout some simulations, these metrics shed light into some hidden systemic risks.
As previously mentioned, we have been working with the Aave team on working with parameter suggestions that can balance protocol safety and capital efficiency. In particular, two of the major suggestions that we made were decreasing risk limits on YFI and increasing risk limits on WBTC. In this particular set of simulation results, we do a sweep of LTV and liquidation threshold changes for YFI against various volatilities. For each of the parameter and volatility settings, we run 15 simulations with differing realized price trajectories and gas prices. In these simulations, we also shifted borrower behavior based on LTV and liquidation threshold changes. Below are plots of the total collateralization of the protocol, the net insolvent value of the protocol, and the net insolvent value of just YFI for the varying initial conditions for on-chain borrower data and market data from November 2020:
The volatility scalar is a multiplier applied to each of the asset volatilities used to generate correlated price trajectories. The risky asset borrow scalar is a multiplier that directly changes the reserve configurations for a particular asset (in this case YFI), as well as directly changing borrower behavior. The overall health of the protocol is maintained even when we increase the annualized volatility an order of magnitude larger than the trailing one month data at the time, which can be seen in the net insolvency value of around 1%. However, when analyzing just accounts holding YFI, there was substantial insolvency risk at extremely high volatility settings. This guided suggestions in lowering the liquidation threshold for YFI in Aave V2. In addition, note the transitions of the total collateralization of the entire protocol at the end of each set of simulation. As the borrow scalar increases, it follows that total collateralization should decrease at the beginning of each simulation. As volatility increases, there is a non-linear relationship with total collateralization. This is a result of the dependence of our liquidator logic on choice of collateral and liquidation value on market conditions. More specifically, there were particular LINK positions that were liquidatable more quickly in high volatility settings. When those liquidations happen more quickly, the removal of these risky positions leads to a higher collateralization value at the end of certain simulations, but as volatility continues to increase, the calculated slippage and market impact in our liquidator logic results in decisions to not liquidate these positions.
A similar set of simulations were run across WBTC LTV and liquidation threshold values. Total collateralization and net insolvency values were similar, but the WBTC net insolvency values were lower and more importantly, the impact of increasing LTV and liquidation threshold on insolvency was low:
Parameter optimization is an on-going process. An important consideration for our liquidator logic is asset volatility and liquidity, and our simulations are run using the most recent market data. Given the increase in trading volume of YFI and lower market impact of large trades, the insolvency metric for YFI has decreased substantially in January 2021:
The report analyzing the protocol will be published in the near future and will formalize our findings in the context of protocol market risks and safety. As more data is available for V2, we will continue to fine-tune our simulations to changes in user behavior in the new protocol. In the future, we hope that our simulations can guide parameter changes to the Aave protocol by providing valuable insights into economic risks. Thanks for taking time to read and please feel free to leave feedback.
Report covering V1 and V2 can be found here: Gauntlet