MorphoBalancesLib
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
| Name | Type | Description |
|---|---|---|
morpho | IMorpho | Morpho Blue contract. |
marketParams | MarketParams | Market parameters. |
Returns
| Name | Type | Description |
|---|---|---|
expectedSupplyAssets | uint256 | Total 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
| Name | Type | Description |
|---|---|---|
morpho | IMorpho | Morpho Blue contract. |
marketParams | MarketParams | Market parameters. |
shares | uint256 | Supply shares to convert. |
Returns
| Name | Type | Description |
|---|---|---|
assets | uint256 | Expected asset amount. |