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

Morpho Markets

One immutable meta-adapter that reports an account's positions on any Morpho Blue market — collateral, loan supply, and loan borrow.

One immutable meta-adapter that reports an account's positions on any Morpho Blue market — collateral, loan supply, and loan borrow. Which markets it queries is a governed instance set on the NAV Calculator; the adapter itself holds no per-market state.

  • Type: Meta-adapter

  • protocolSubId: keccak256("morpho-markets")

  • Instance key: the Morpho marketId (bytes32), used directly — not an address

  • Source: MorphoMarketsMetaBalanceAdapter.sol


Positions returned

Up to three legs per market, each emitted only when its amount is > 0:

Leg
PositionKind
isDebt
Description

Collateral

Collateral

false

Posted collateral, in the collateral token

Loan supply

Supplied

false

Supplied loan token (credit)

Loan borrow

Borrowed

true

Borrowed loan token (debt)

The market's collateral and loan tokens come from MORPHO.idToMarketParams(marketId). A credit leg is skipped if its asset is unregistered in NAVCalculator or excluded by assetFilter. If the account has borrowed and the loan token is unregistered, the market reports nothing at all — collateral included — rather than emitting collateral without its offsetting debt, which would over-report NAV. See Never report collateral without its debt.


Balance calculation

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

Collateral is read raw from the account position:

Loan legs use Morpho's expectedMarketBalances (interest accrued to the current block), then pro-rate by shares:

Each is guarded by non-zero total shares and non-zero account shares.


Identity

  • positionId: abi.encode(bytes32 marketId) — the raw marketId (all three legs of a market share it)

  • positionKind: Collateral · Supplied · Borrowed

There is no labels field on the position. The adapter implements positionLabels(positionId), which returns ["Market", "<collateral>/<loan>"] from the market's on-chain token symbols — surfaced only by the verbose reads (getAccountPositionsVerbose / getAccountNavVerbose); the full breadcrumb is [protocolName, ...labels].

For a marketId with no market on this chain the leaf is dropped, giving the bare ["Market"] category. This matters because Morpho's params getter is a plain mapping read: an unknown id returns an all-zero struct rather than reverting, both symbol reads would then fail open to "?", and the adapter would answer ["Market", "?/?"] — a confident breadcrumb byte-identical to a real market whose tokens both have unreadable symbols. Existence is checked against the invariant Morpho itself enforces at market creation, rather than inferred from the params: a market with no loan token is creatable, and an idle market legitimately has no collateral token, so neither is a property the protocol guarantees.


Constructor

Parameter
Description

morpho_

Morpho Blue singleton contract (must be a contract)

navCalculator_

NAV Calculator contract (asset registry + instance set)


Registration

Meta-adapter. Register once and seed its markets with addMetaBalanceAdapter(adapter, instances), then adjust with addMetaInstances(adapter, instances) / removeMetaInstances(adapter, instances) (MANAGER-gated). Each instance coordinate is a raw bytes32 marketId (not an address widened to bytes32). Adding a new market is a config call — no new deploy. A malformed coordinate is isolated per-instance by the adapter's fan-out.

Last updated