aave_v3.deployment

Documentation for eth_defi.aave_v3.deployment Python module.

Aave v3 deployments.

Functions

fetch_deployment(web3, pool_address, ...[, ...])

Construct Aave v3 deployment based on on-chain data.

Classes

AaveV3Deployment

Describe Aave v3 deployment.

AaveV3ReserveConfiguration

AaveV3ReserveConfiguration(decimals, ltv, liquidation_threshold, liquidation_bonus, reserve_factor, usage_as_collateral_enabled, borrowing_enabled, stable_borrow_rate_enabled, is_active, is_frozen)

AaveV3UserData

AaveV3UserData(total_collateral_base, total_debt_base, available_borrows_base, current_liquidation_threshold, ltv, health_factor)

class AaveV3ReserveConfiguration

Bases: NamedTuple

AaveV3ReserveConfiguration(decimals, ltv, liquidation_threshold, liquidation_bonus, reserve_factor, usage_as_collateral_enabled, borrowing_enabled, stable_borrow_rate_enabled, is_active, is_frozen)

Create new instance of AaveV3ReserveConfiguration(decimals, ltv, liquidation_threshold, liquidation_bonus, reserve_factor, usage_as_collateral_enabled, borrowing_enabled, stable_borrow_rate_enabled, is_active, is_frozen)

decimals: int

Asset decimals

ltv: int

Loan to Value of the reserve

liquidation_threshold: int

Liquidation threshold of the reserve

liquidation_bonus: int

Liquidation bonus of the reserve

reserve_factor: int

Reserve factor

usage_as_collateral_enabled: bool

Asset can be used as collateral

borrowing_enabled: bool

Borrowing is enabled

stable_borrow_rate_enabled: bool

Stable rate borrowing enabled

is_active: bool

Reserve is active

is_frozen: bool

Reserve is frozen

static __new__(_cls, decimals, ltv, liquidation_threshold, liquidation_bonus, reserve_factor, usage_as_collateral_enabled, borrowing_enabled, stable_borrow_rate_enabled, is_active, is_frozen)

Create new instance of AaveV3ReserveConfiguration(decimals, ltv, liquidation_threshold, liquidation_bonus, reserve_factor, usage_as_collateral_enabled, borrowing_enabled, stable_borrow_rate_enabled, is_active, is_frozen)

Parameters
  • decimals (int) –

  • ltv (int) –

  • liquidation_threshold (int) –

  • liquidation_bonus (int) –

  • reserve_factor (int) –

  • usage_as_collateral_enabled (bool) –

  • borrowing_enabled (bool) –

  • stable_borrow_rate_enabled (bool) –

  • is_active (bool) –

  • is_frozen (bool) –

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

class AaveV3UserData

Bases: NamedTuple

AaveV3UserData(total_collateral_base, total_debt_base, available_borrows_base, current_liquidation_threshold, ltv, health_factor)

Create new instance of AaveV3UserData(total_collateral_base, total_debt_base, available_borrows_base, current_liquidation_threshold, ltv, health_factor)

total_collateral_base: int

The total collateral of the user in the base currency used by the price feed

total_debt_base: int

The total debt of the user in the base currency used by the price feed

available_borrows_base: int

The borrowing power left of the user in the base currency used by the price feed

current_liquidation_threshold: int

The liquidation threshold of the user

ltv: int

The loan to value of the user

health_factor: int

The current health factor of the user

static __new__(_cls, total_collateral_base, total_debt_base, available_borrows_base, current_liquidation_threshold, ltv, health_factor)

Create new instance of AaveV3UserData(total_collateral_base, total_debt_base, available_borrows_base, current_liquidation_threshold, ltv, health_factor)

Parameters
  • total_collateral_base (int) –

  • total_debt_base (int) –

  • available_borrows_base (int) –

  • current_liquidation_threshold (int) –

  • ltv (int) –

  • health_factor (int) –

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

class AaveV3Deployment

Bases: object

Describe Aave v3 deployment.

web3: web3.main.Web3

The Web3 instance for which all the contracts here are bound

pool: web3.contract.contract.Contract

Aave v3 pool contract proxy

data_provider: web3.contract.contract.Contract

AaveProtocolDataProvider contract

oracle: web3.contract.contract.Contract

AaveOracle contract

ausdc: eth_defi.token.TokenDetails | None = None

aUSDC

get_reserve_configuration_data(token_address)

Returns reserve configuration data.

Parameters

token_address (eth_typing.evm.HexAddress) –

Return type

eth_defi.aave_v3.deployment.AaveV3ReserveConfiguration

get_price(token_address)

Returns asset latest price using Aave oracle.

Parameters

token_address (eth_typing.evm.HexAddress) –

Return type

int

get_user_data(user_address)

Returns the user account data across all the reserves.

Parameters

user_address (eth_typing.evm.HexAddress) –

Return type

eth_defi.aave_v3.deployment.AaveV3UserData

__init__(web3, pool, data_provider, oracle, ausdc=None)
Parameters
  • web3 (web3.main.Web3) –

  • pool (web3.contract.contract.Contract) –

  • data_provider (web3.contract.contract.Contract) –

  • oracle (web3.contract.contract.Contract) –

  • ausdc (eth_defi.token.TokenDetails | None) –

Return type

None

fetch_deployment(web3, pool_address, data_provider_address, oracle_address, ausdc_address=None)

Construct Aave v3 deployment based on on-chain data.

Returns

Data class representing Aave v3 exchange deployment

Parameters
Return type

eth_defi.aave_v3.deployment.AaveV3Deployment