InterestRatesManager
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
Name | Type | Description |
---|---|---|
_poolToken | address | The 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
Name | Type | Description |
---|---|---|
_underlyingToken | address | The address of the underlying token. |
Returns
Name | Type | Description |
---|---|---|
poolSupplyIndex | uint256 | The pool supply index. |
poolBorrowIndex | uint256 | The 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
Name | Type | Description |
---|---|---|
_params | Params | Computation parameters. |
Returns
Name | Type | Description |
---|---|---|
newP2PSupplyIndex | uint256 | The updated p2pSupplyIndex. |
newP2PBorrowIndex | uint256 | The 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;
}