AaveV3

You can import the AaveV3 environment by running:

run.py
env = AAVEv3Env(
  chain=Chain.ETHEREUM,
  date_range=(start_time, end_time),
  agents=[agent1],
  backend_type="local",
  market_impact="default",
)

It is recommended to read the AaveV3 whitepaper first.


Supported Tokens

At the moment, we suport the following tokens:

ChainsBackend TypesAssetStart Date

Ethereum Mainnet - ethereum

forked

WBTC - Wrapped Bitcoin

2023-02-17 17:50:00 UTC

USDC - USD Coin

2023-02-17 17:50:00 UTC

WETH - Wrapped Ethereum

2023-02-17 17:50:00 UTC

USDT - Tether

2023-02-17 17:50:00 UTC

DAI - Dai Stablecoin

2023-02-17 17:50:00 UTC

UNI - Uniswap Token

2023-07-01 15:10:00 UTC

BAL - Balancer Token

2023-05-06 07:15:00 UTC

We start indexing Aave's Pool smart contract from 2023-01-14 12:45:00 UTC onwards. So in order to perform actions on AaveV3 environment, the start date must be greater than this.

We start indexing the price of assets from the given start dates. So from those dates onwards, you can retrieve the price of that asset.


Observations

An observation refers to the information that the agent receives from the environment at every block.
With AAVE, the most interesting observation is probably an agent's health factor.

The methods within AaveV3Observation can be found here.


Actions

Actions are the means through which the agent interacts with the environment to achieve goals.

In general, there are 5 actions you can perform on the Aave V3 environment:

  • SUPPLY: Supplying collateral.
  • BORROW: Borrowing a token from the pool.
  • WITHDRAW: Withdrawing collateral.
  • REPAY: Repay borrowed token.
  • LIQUIDATION: Execute a liquidation on a position that slipped below a health factor of 1.0.

At the moment, we don't yet support Flash Loans.


Example

example.py
agent = DummyAgent(initial_portfolio={"USDC": Decimal(11_000)})
env = AAVEv3Env(
  chain=Chain.ETHEREUM,
  date_range=(start_time, end_time),
  agents=[agent],
  backend_type="forked",
  market_impact="default",
)
 
actions = [
  AAVEv3Supply(
      agent=agent,
      token="USDC",
      amount=Decimal(10_000),
  ),
  AAVEv3WithdrawAll(agent=agent, token="USDC"),
]
 
for action in actions:
  env.step(actions=[action])