tradingstrategy-ai/web3-ethereum-defi

Aave position management code

miohtama opened this issue · 0 comments

This is an example task for those who look to work with the project in a professional role.

  • Write a function that opens a loan position in Aave v3 by depositing any Aave v3 reserve token and receives aToken back

This includes

  • The function can live in eth_defi.aave_v3.loan module
    - The module should be modelled similar as e.g. Uniswap v2 swap_with_slippage_protection and deploy_trading_pair
    - Function name: deposit_in_aave
    - Inputs: HotWallet instance (assumed loaded with USDC), aave_deposit_address, token_address, amount
    - Outputs: tx_hash
  • You must be able to demonstrate professional open source development best practices and behavior when submitting a Github pull request
  • The module must be sufficiently documented for autodoc according to the coding conventions
  • The code must be formatted to according to the coding conventions - there is is black that complains on open PRs if this is not the case
  • There must be integration test
    • See how the existing Aave functions are tested using pytest
    • If you cannot ramp up Aave environment in a unit test please use Anvil based Polygon mainnet fork for a test
    • The test can be called test_aave_deposit.py
    • A test case check that the 0) Hot wallet starts with USDC on Ethereum mainnet 1) deposit was correctly registered with the Aave reserves 2) you receive the corresponding Aave aUSDC token back in the wallet, with the correct amount
    • Because there is no automatic mechanism to fetch Aave reserves and addresses as a list, please use hardcoded and commented values as text fixtures for now for any Ethereum address, with links to their respective descriptions of what they are