InterestRatesManager

Git Source

Inherits: IInterestRatesManager, MorphoStorage

Author: Morpho Labs.

Smart contract handling the computation of indexes used for peer-to-peer interactions.

This contract inherits from MorphoStorage so that Morpho can delegate calls to this contract.

Functions

updateP2PIndexes

EXTERNAL ///

Updates the peer-to-peer indexes.

function updateP2PIndexes(address _poolToken) external;

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market to update.

_computeP2PIndexes

INTERNAL ///

Computes and returns new peer-to-peer indexes.

function _computeP2PIndexes(Params memory _params)
    internal
    pure
    returns (uint256 newP2PSupplyIndex, uint256 newP2PBorrowIndex);

Parameters

NameTypeDescription
_paramsParamsComputation parameters.

Returns

NameTypeDescription
newP2PSupplyIndexuint256The updated p2pSupplyIndex.
newP2PBorrowIndexuint256The updated p2pBorrowIndex.

Events

P2PIndexesUpdated

EVENTS ///

Emitted when the peer-to-peer indexes of a market are updated.

event P2PIndexesUpdated(
    address indexed _poolToken,
    uint256 _p2pSupplyIndex,
    uint256 _p2pBorrowIndex,
    uint256 _poolSupplyIndex,
    uint256 _poolBorrowIndex
);

Structs

Params

STRUCTS ///

struct Params {
    uint256 lastP2PSupplyIndex;
    uint256 lastP2PBorrowIndex;
    uint256 poolSupplyIndex;
    uint256 poolBorrowIndex;
    Types.LastPoolIndexes lastPoolIndexes;
    uint256 reserveFactor;
    uint256 p2pIndexCursor;
    Types.Delta delta;
}