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

updateIndexes

EXTERNAL ///

Updates the peer-to-peer indexes and pool indexes (only stored locally).

function updateIndexes(address _poolToken) external;

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market to update.

_getPoolIndexes

INTERNAL ///

Returns the current pool indexes.

function _getPoolIndexes(address _underlyingToken)
    internal
    view
    returns (uint256 poolSupplyIndex, uint256 poolBorrowIndex);

Parameters

NameTypeDescription
_underlyingTokenaddressThe address of the underlying token.

Returns

NameTypeDescription
poolSupplyIndexuint256The pool supply index.
poolBorrowIndexuint256The pool borrow index.

_computeP2PIndexes

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.PoolIndexes lastPoolIndexes;
    uint256 reserveFactor;
    uint256 p2pIndexCursor;
    Types.Delta delta;
}