verbs_examples.aave.sim#

In this example we consider the interaction between Aave and Uniswap via the following agents:

  • A Uniswap Agent that trades between a Uniswap pool and an external market, modelled by a Geometric Brownian Motion, in order to make a profit.

  • Several Borrow Agents that borrow from an Aave v3 pool.

  • A Liquidation Agent that liquidated those positions from the Borrow agents that are in distress (that is, that their Health Factors are < 1) as long as the liquidation is profitable for the liquidation agent.

We consider the following:

  • Uniswap v3 pool for WETH and DAI with fee 3000.

  • Borrow agents borrow DAI and deposit WETH as collateral.

  • The price of the risky asset (WETH) in terms of the stablecoin (DAI) in the external market is modelled by a GBM.

  • The price of Uniswap follows the price in the external market. The Uniswap agent allows that by making the right trade in each step so that the new Uniswap price is the same as the price in the external market.

  • The liquidator agent checks whether a liquidation is profitable before making the liquidation call.

Notes

Profitability is checked by the following accountability:

  • They check the amount of collateral that they would get by liquidating a fraction of a loan.

  • They check the price of the trade in Uniswap necessary to close the short position in the debt asset.

  • If they get a profit after closing their short position in the debt asset, then they make the transaction.

References

  1. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4540333

Functions

init_cache

Generate a simulation request cache

runner

Aave simulation runner