Lens

Git Source

Inherits: MarketsLens

Author: Morpho Labs.

This contract exposes an API to query on-chain data related to the Morpho Protocol, its markets and its users.

Functions

constructor

CONSTRUCTOR ///

Constructs the contract.

constructor(address _morpho) LensStorage(_morpho);

Parameters

NameTypeDescription
_morphoaddressThe address of the main Morpho contract.

getTotalSupply

EXTERNAL ///

Computes and returns the total distribution of supply through Morpho, using virtually updated indexes.

function getTotalSupply()
    external
    view
    returns (uint256 p2pSupplyAmount, uint256 poolSupplyAmount, uint256 totalSupplyAmount);

Returns

NameTypeDescription
p2pSupplyAmountuint256The total supplied amount matched peer-to-peer, subtracting the supply delta (in ETH).
poolSupplyAmountuint256The total supplied amount on the underlying pool, adding the supply delta (in ETH).
totalSupplyAmountuint256The total amount supplied through Morpho (in ETH).

getTotalBorrow

Computes and returns the total distribution of borrows through Morpho, using virtually updated indexes.

function getTotalBorrow()
    external
    view
    returns (uint256 p2pBorrowAmount, uint256 poolBorrowAmount, uint256 totalBorrowAmount);

Returns

NameTypeDescription
p2pBorrowAmountuint256The total borrowed amount matched peer-to-peer, subtracting the borrow delta (in ETH).
poolBorrowAmountuint256The total borrowed amount on the underlying pool, adding the borrow delta (in ETH).
totalBorrowAmountuint256The total amount borrowed through Morpho (in ETH).