Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MorphoBalancesLib

Git Source

Title: MorphoBalancesLib

Library to compute expected Morpho balances including pending interest.

Mirrors Morpho Blue’s internal interest accrual logic for accurate view functions.

Constants

WAD

uint256 internal constant WAD = 1e18

Functions

expectedTotalSupplyAssets

Computes expected total supply assets including pending interest.

function expectedTotalSupplyAssets(
    IMorpho morpho,
    MarketParams memory marketParams
) internal view returns (uint256 expectedSupplyAssets);

Parameters

NameTypeDescription
morphoIMorphoMorpho Blue contract.
marketParamsMarketParamsMarket parameters.

Returns

NameTypeDescription
expectedSupplyAssetsuint256Total supply assets after pending interest accrual.

expectedSupplyAssets

Converts supply shares to expected assets including pending interest.

function expectedSupplyAssets(
    IMorpho morpho,
    MarketParams memory marketParams,
    uint256 shares
) internal view returns (uint256 assets);

Parameters

NameTypeDescription
morphoIMorphoMorpho Blue contract.
marketParamsMarketParamsMarket parameters.
sharesuint256Supply shares to convert.

Returns

NameTypeDescription
assetsuint256Expected asset amount.