Skip to content

Commit

Permalink
Configure addresses for other AAVE supported chains (#146)
Browse files Browse the repository at this point in the history
* Fix typo in aave reserves snapshot function name

* Configure addresses for other AAVE supported chains
  • Loading branch information
plamut authored Aug 10, 2023
1 parent 93dcae0 commit 11413af
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
42 changes: 39 additions & 3 deletions eth_defi/aave_v3/reserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,47 @@
#:
#:
_addresses = {
# Ethereum
1: {
"PoolAddressProvider": "0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e",
"UiPoolDataProviderV3": "0x91c0eA31b49B69Ea18607702c5d9aC360bf3dE7d",
},

# Polygon
137: {
"PoolAddressProvider": "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb",
"UiPoolDataProviderV3": "0xC69728f11E9E6127733751c8410432913123acf1",
}
},

# Binance Smarrt Chain mainnet (not supported by AAVE v3)
# 56: {
# "PoolAddressProvider": "",
# "UiPoolDataProviderV3": "",
# },

# Avalanche C-chain
43114: {
"PoolAddressProvider": "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb",
"UiPoolDataProviderV3": "0xF71DBe0FAEF1473ffC607d4c555dfF0aEaDb878d",
},

# Arbitrum One
42161: {
"PoolAddressProvider": "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb",
"UiPoolDataProviderV3": "0x145dE30c929a065582da84Cf96F88460dB9745A7",
},

# Ethereum Classic (not supported by AAVE v3)
# 61: {
# "PoolAddressProvider": "",
# "UiPoolDataProviderV3": "",
# },

# Ganache test chain (not supported by AAVE v3)
# 1337: {
# "PoolAddressProvider": "",
# "UiPoolDataProviderV3": "",
# },
}


Expand Down Expand Up @@ -244,7 +280,7 @@ def fetch_reserve_data(
return aggregated_reserve_data_decoded, base_currency_info_decoded


def fetch_aave_reserves_snapshop(web3: Web3, block_identifier=None) -> JSONSerialisableReserveData:
def fetch_aave_reserves_snapshot(web3: Web3, block_identifier=None) -> JSONSerialisableReserveData:
"""Get a snapshot of all data of Aave reserves at a certain point of time.
See :py:class:`JSONSerialisableReserveData` for notes on how to transform the output
Expand All @@ -255,7 +291,7 @@ def fetch_aave_reserves_snapshop(web3: Web3, block_identifier=None) -> JSONSeria
.. code-block:: python
# Read Polygon Aave v3 reserves data at current block
snapshot = fetch_aave_reserves_snapshop(web3)
snapshot = fetch_aave_reserves_snapshot(web3)
Example output:
Expand Down
4 changes: 2 additions & 2 deletions tests/aave_v3/test_aave_v3_reserve_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from web3 import Web3, HTTPProvider

from eth_defi.aave_v3.reserve import HelperContracts, get_helper_contracts, fetch_reserves, fetch_reserve_data
from eth_defi.aave_v3.reserve import fetch_aave_reserves_snapshop
from eth_defi.aave_v3.reserve import fetch_aave_reserves_snapshot
from eth_defi.chain import install_chain_middleware, install_retry_middleware


Expand Down Expand Up @@ -58,7 +58,7 @@ def test_aave_v3_fetch_reserve_snapshot(
):
"""Get the reserve data snapshot."""

snapshot = fetch_aave_reserves_snapshop(web3)
snapshot = fetch_aave_reserves_snapshot(web3)
assert snapshot["chain_id"] == 137
assert snapshot["timestamp"] > 0
assert snapshot["block_number"] > 0
Expand Down

0 comments on commit 11413af

Please sign in to comment.