Onchain.Aave.UiPoolDataProvider (onchain_aave v0.2.0)

Copy Markdown View Source

High-level Aave V3 UiPoolDataProvider read operations.

Composes Address, Contracts, ABI, RPC, and type structs into single-call functions that return typed structs. Consumers don't need to manually encode ABI calls, make RPC requests, and decode responses.

Contract

Calls the UiPoolDataProvider contract (registered as :ui_pool_data_provider in Contracts), passing the PoolAddressesProvider address (:pool_addresses_provider) as a parameter.

Error Format

Errors pass through from the underlying module that failed:

SourceError Shape
Onchain.Aave.Contracts.address/2{:error, {:unsupported_network, network}}
Onchain.ABI.encode_call/2{:error, {:encode_error, reason}}
Onchain.RPC.eth_call/3{:error, {:rpc_error, map}}
Onchain.ABI.decode_response/2{:error, {:decode_error, reason}}
Onchain.Address.validate/1{:error, {:invalid_address, input}}

Functions

FunctionPurpose
get_reserves_list/1List of reserve token addresses
get_reserves_list!/1Same, raises on error
get_reserves_data/1Per-reserve data + base currency info
get_reserves_data!/1Same, raises on error
get_user_reserves_data/2Per-user reserve balances
get_user_reserves_data!/2Same, raises on error

API Functions

FunctionArityDescriptionParam Kinds
get_user_reserves_data!2Fetch per-user reserve balances and e-mode category. Raises on error.user_address: value, opts: value
get_user_reserves_data2Fetch per-user reserve balances and e-mode category.user_address: value, opts: value
get_reserves_data!1Fetch per-reserve aggregated data and base currency info. Raises on error.opts: value
get_reserves_data1Fetch per-reserve aggregated data and base currency info.opts: value
get_reserves_list!1Fetch the list of reserve token addresses. Raises on error.opts: value
get_reserves_list1Fetch the list of reserve token addresses from the Aave V3 pool.opts: value

Summary

Functions

Fetch per-reserve aggregated data and base currency info.

Fetch per-reserve aggregated data and base currency info. Raises on error.

Fetch the list of reserve token addresses from the Aave V3 pool.

Fetch the list of reserve token addresses. Raises on error.

Fetch per-user reserve balances and e-mode category.

Fetch per-user reserve balances and e-mode category. Raises on error.

Functions

get_reserves_data(opts \\ [])

@spec get_reserves_data(keyword()) ::
  {:ok,
   {[Onchain.Aave.Types.AggregatedReserveData.t()],
    Onchain.Aave.Types.BaseCurrencyInfo.t()}}
  | {:error, term()}

Fetch per-reserve aggregated data and base currency info.

Parameters

  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Tuple of reserve data list and base currency info ({:ok, {[AggregatedReserveData.t()], BaseCurrencyInfo.t()}} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, {[AggregatedReserveData.t()], BaseCurrencyInfo.t()}} | {:error, term()}",
    description: "Tuple of reserve data list and base currency info"
  }
}

get_reserves_data!(opts \\ [])

Fetch per-reserve aggregated data and base currency info. Raises on error.

Parameters

  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Tuple of reserve data list and base currency info ({[AggregatedReserveData.t()], BaseCurrencyInfo.t()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    }
  },
  returns: %{
    type: "{[AggregatedReserveData.t()], BaseCurrencyInfo.t()}",
    description: "Tuple of reserve data list and base currency info"
  }
}

get_reserves_list(opts \\ [])

@spec get_reserves_list(keyword()) :: {:ok, [String.t()]} | {:error, term()}

Fetch the list of reserve token addresses from the Aave V3 pool.

Parameters

  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

List of checksummed reserve token addresses ({:ok, [String.t()]} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, [String.t()]} | {:error, term()}",
    description: "List of checksummed reserve token addresses"
  }
}

get_reserves_list!(opts \\ [])

@spec get_reserves_list!(keyword()) :: [String.t()]

Fetch the list of reserve token addresses. Raises on error.

Parameters

  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

List of checksummed reserve token addresses ([String.t()])

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    }
  },
  returns: %{
    type: "[String.t()]",
    description: "List of checksummed reserve token addresses"
  }
}

get_user_reserves_data(user_address, opts \\ [])

@spec get_user_reserves_data(
  String.t() | binary(),
  keyword()
) ::
  {:ok, {[Onchain.Aave.Types.UserReserveData.t()], non_neg_integer()}}
  | {:error, term()}

Fetch per-user reserve balances and e-mode category.

Parameters

  • user_address - User address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Tuple of user reserve data list and e-mode category ID ({:ok, {[UserReserveData.t()], non_neg_integer()}} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    user_address: %{
      description: "User address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, {[UserReserveData.t()], non_neg_integer()}} | {:error, term()}",
    description: "Tuple of user reserve data list and e-mode category ID"
  }
}

get_user_reserves_data!(user_address, opts \\ [])

@spec get_user_reserves_data!(
  String.t() | binary(),
  keyword()
) :: {[Onchain.Aave.Types.UserReserveData.t()], non_neg_integer()}

Fetch per-user reserve balances and e-mode category. Raises on error.

Parameters

  • user_address - User address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Tuple of user reserve data list and e-mode category ID ({[UserReserveData.t()], non_neg_integer()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    user_address: %{
      description: "User address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{[UserReserveData.t()], non_neg_integer()}",
    description: "Tuple of user reserve data list and e-mode category ID"
  }
}