For the complete documentation index, see llms.txt. This page is also available as Markdown.

SparkLend

Reports an account's per-reserve lending positions in SparkLend.

Reports an account's per-reserve lending positions in SparkLend. For each reserve it emits a supply/collateral leg (from the aToken balance) and a borrow leg (from variable debt). It enumerates reserves trustlessly from the SparkLend Protocol Data Provider, so it is a single fixed-scope contract.

  • Type: Plain adapter

  • protocolSubId: keccak256("spark-lend")

  • Source: SparkLendBalanceAdapter.sol


Positions returned

Up to two legs per reserve that is both a SparkLend reserve and registered on NAVCalculator:

Leg
PositionKind
isDebt
Description

Supply

Supplied

false

aToken balance when usageAsCollateralEnabled == false

Collateral

Collateral

false

aToken balance when usageAsCollateralEnabled == true

Borrow

Borrowed

true

Variable + legacy stable debt, summed — one Borrowed leg per reserve

SparkLend is an Aave V3 fork: new stable borrows are deprecated, but legacy stable debt can still persist, so the adapter sums variableDebt + stableDebt into the borrow leg. Dropping the stable portion would understate debt and overstate NAV. Reserves with zero supply and zero debt are skipped.

For the same reason, if the account borrows a reserve whose asset is unregistered on NAVCalculator, the adapter reports nothing at all rather than emitting collateral without its offsetting debt. The borrowed set comes from the user-configuration bitmap, falling back to a full reserve scan when it is unavailable. See Never report collateral without its debt.


Balance calculation

Flowchart of the SparkLend balance adapter: read calls derive position legs into PositionBalance entries.
SparkLend adapter — how the underlying balances reported to the NAV Calculator are derived.

Per reserve, the adapter reads getUserReserveData(asset, account) from the Protocol Data Provider:

The supply leg uses PositionKind.Collateral if asCollateral is true, else PositionKind.Supplied. The borrow leg is emitted with isDebt = true.

The auxiliary getAdapterBalanceForAsset / getAdapterBalances views return a single net supply − debt scalar per asset. The main NAV path, getAdapterPositions, keeps the legs separate.


Identity

  • positionId: abi.encode(address pool)pool is the SparkLend Pool resolved at construction; the reserve each leg refers to is carried in balanceAsset, not the positionId

  • positionKind: Supplied · Collateral · Borrowed


Constructor

Parameter
Description

dataProvider_

SparkLend Protocol Data Provider (must be a contract); source of the reserve list and per-user reserve data

navCalculator_

NAVCalculator address (must be a contract); source of the asset registry

The POOL address used in positionId is derived at construction from dataProvider_.ADDRESSES_PROVIDER().getPool().


Registration

Registered as a plain adapter with addBalanceAdapters([adapter]) (MANAGER-gated); removed with removeBalanceAdapters.

Last updated