MarketsLens
Inherits: RatesLens
Author: Morpho Labs.
Intermediary layer exposing endpoints to query live data related to the Morpho Protocol markets.
Functions
isMarketCreated
EXTERNAL ///
Checks if a market is created.
function isMarketCreated(address _poolToken) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | true if the market is created and not paused, otherwise false. |
isMarketCreatedAndNotPaused
Deprecated.
function isMarketCreatedAndNotPaused(address) external pure returns (bool);
isMarketCreatedAndNotPausedNorPartiallyPaused
Deprecated.
function isMarketCreatedAndNotPausedNorPartiallyPaused(address) external pure returns (bool);
getAllMarkets
Returns all created markets.
function getAllMarkets() external view returns (address[] memory marketsCreated);
Returns
Name | Type | Description |
---|---|---|
marketsCreated | address[] | The list of market addresses. |
getMainMarketData
For a given market, returns the average supply/borrow rates and amounts of underlying asset supplied and borrowed through Morpho, on the underlying pool and matched peer-to-peer.
The returned values are not updated.
function getMainMarketData(address _poolToken)
external
view
returns (
uint256 avgSupplyRatePerBlock,
uint256 avgBorrowRatePerBlock,
uint256 p2pSupplyAmount,
uint256 p2pBorrowAmount,
uint256 poolSupplyAmount,
uint256 poolBorrowAmount
);
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market of which to get main data. |
Returns
Name | Type | Description |
---|---|---|
avgSupplyRatePerBlock | uint256 | The average supply rate experienced on the given market. |
avgBorrowRatePerBlock | uint256 | The average borrow rate experienced on the given market. |
p2pSupplyAmount | uint256 | The total supplied amount matched peer-to-peer, subtracting the supply delta (in underlying). |
p2pBorrowAmount | uint256 | The total borrowed amount matched peer-to-peer, subtracting the borrow delta (in underlying). |
poolSupplyAmount | uint256 | The total supplied amount on the underlying pool, adding the supply delta (in underlying). |
poolBorrowAmount | uint256 | The total borrowed amount on the underlying pool, adding the borrow delta (in underlying). |
getAdvancedMarketData
Returns non-updated indexes, the block at which they were last updated and the total deltas of a given market.
function getAdvancedMarketData(address _poolToken)
external
view
returns (Types.Indexes memory indexes, uint32 lastUpdateBlockNumber, uint256 p2pSupplyDelta, uint256 p2pBorrowDelta);
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market of which to get advanced data. |
Returns
Name | Type | Description |
---|---|---|
indexes | Types.Indexes | The given market's virtually updated indexes. |
lastUpdateBlockNumber | uint32 | The block number at which pool indexes were last updated. |
p2pSupplyDelta | uint256 | The total supply delta (in underlying). |
p2pBorrowDelta | uint256 | The total borrow delta (in underlying). |
getMarketConfiguration
Returns the given market's configuration.
function getMarketConfiguration(address _poolToken)
external
view
returns (
address underlying,
bool isCreated,
bool p2pDisabled,
bool isPaused,
bool isPartiallyPaused,
uint16 reserveFactor,
uint16 p2pIndexCursor,
uint256 collateralFactor
);
Returns
Name | Type | Description |
---|---|---|
underlying | address | The underlying token address. |
isCreated | bool | Whether the market is created or not. |
p2pDisabled | bool | Whether the peer-to-peer market is enabled or not. |
isPaused | bool | Deprecated. |
isPartiallyPaused | bool | Deprecated. |
reserveFactor | uint16 | The reserve factor applied to this market. |
p2pIndexCursor | uint16 | The p2p index cursor applied to this market. |
collateralFactor | uint256 | The pool collateral factor also used by Morpho. |
getMarketPauseStatus
Returns the given market's pause statuses.
function getMarketPauseStatus(address _poolToken) external view returns (Types.MarketPauseStatus memory);
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market of which to get pause statuses. |
Returns
Name | Type | Description |
---|---|---|
<none> | Types.MarketPauseStatus | The market status struct. |
getTotalMarketSupply
PUBLIC ///
Computes and returns the total distribution of supply for a given market, using virtually updated indexes.
function getTotalMarketSupply(address _poolToken)
public
view
returns (uint256 p2pSupplyAmount, uint256 poolSupplyAmount);
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to check. |
Returns
Name | Type | Description |
---|---|---|
p2pSupplyAmount | uint256 | The total supplied amount matched peer-to-peer, subtracting the supply delta (in underlying). |
poolSupplyAmount | uint256 | The total supplied amount on the underlying pool, adding the supply delta (in underlying). |
getTotalMarketBorrow
Computes and returns the total distribution of borrows for a given market, using virtually updated indexes.
function getTotalMarketBorrow(address _poolToken)
public
view
returns (uint256 p2pBorrowAmount, uint256 poolBorrowAmount);
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to check. |
Returns
Name | Type | Description |
---|---|---|
p2pBorrowAmount | uint256 | The total borrowed amount matched peer-to-peer, subtracting the borrow delta (in underlying). |
poolBorrowAmount | uint256 | The total borrowed amount on the underlying pool, adding the borrow delta (in underlying). |