Typed struct for Aave V3 getUserAccountData response.
Wraps the 6 raw uint256 values returned by the Pool contract into
named fields with Decimal.t() values, converted via Onchain.Aave.Math.
Fields
| Field | Math | Aave Meaning |
|---|---|---|
total_collateral_base | to_usd/1 (10^8) | Total collateral in base currency (USD) |
total_debt_base | to_usd/1 (10^8) | Total debt in base currency (USD) |
available_borrows_base | to_usd/1 (10^8) | Remaining borrowing power in base currency |
current_liquidation_threshold | to_ltv/1 (10^4) | Weighted avg liquidation threshold (0..1) |
ltv | to_ltv/1 (10^4) | Weighted avg loan-to-value ratio (0..1) |
health_factor | to_health_factor/1 (10^18) | Position health (> 1 = safe) |
API Functions
| Function | Arity | Description | Param Kinds |
|---|---|---|---|
from_raw | 1 | Convert raw uint256 list from getUserAccountData into a typed struct. | raw: exchange_data |
Summary
Functions
Convert raw uint256 list from getUserAccountData into a typed struct.
Types
Functions
Convert raw uint256 list from getUserAccountData into a typed struct.
Parameters
raw- 6-element list of integers: [collateral, debt, available_borrows, liq_threshold, ltv, health_factor] (exchange_data)
Returns
%UserAccountData{} with Decimal fields (struct)
# descripex:contract
%{
params: %{
raw: %{
description: "6-element list of integers: [collateral, debt, available_borrows, liq_threshold, ltv, health_factor]",
source: "Onchain.Aave.Pool.get_user_account_data/2",
kind: :exchange_data
}
},
returns: %{
type: :struct,
description: "%UserAccountData{} with Decimal fields"
}
}