InterestRatesModel
Functions
computeGrowthFactors
Computes and returns the new supply/borrow growth factors associated to the given market's pool & peer-to-peer indexes.
function computeGrowthFactors(
uint256 _newPoolSupplyIndex,
uint256 _newPoolBorrowIndex,
Types.PoolIndexes memory _lastPoolIndexes,
uint256 _p2pIndexCursor,
uint256 _reserveFactor
) internal pure returns (GrowthFactors memory growthFactors);
Parameters
Name | Type | Description |
---|---|---|
_newPoolSupplyIndex | uint256 | The current pool supply index. |
_newPoolBorrowIndex | uint256 | The current pool borrow index. |
_lastPoolIndexes | Types.PoolIndexes | The last stored pool indexes. |
_p2pIndexCursor | uint256 | The peer-to-peer index cursor for the given market. |
_reserveFactor | uint256 | The reserve factor of the given market. |
Returns
Name | Type | Description |
---|---|---|
growthFactors | GrowthFactors | The market's indexes growth factors (in ray). |
computeP2PIndex
Computes and returns the new peer-to-peer supply/borrow index of a market given its parameters.
function computeP2PIndex(P2PIndexComputeParams memory _params) internal pure returns (uint256 newP2PIndex);
Parameters
Name | Type | Description |
---|---|---|
_params | P2PIndexComputeParams | The computation parameters. |
Returns
Name | Type | Description |
---|---|---|
newP2PIndex | uint256 | The updated peer-to-peer index (in ray). |
computeP2PSupplyRatePerYear
Computes and returns the peer-to-peer supply rate per year of a market given its parameters.
function computeP2PSupplyRatePerYear(P2PRateComputeParams memory _params)
internal
pure
returns (uint256 p2pSupplyRate);
Parameters
Name | Type | Description |
---|---|---|
_params | P2PRateComputeParams | The computation parameters. |
Returns
Name | Type | Description |
---|---|---|
p2pSupplyRate | uint256 | The peer-to-peer supply rate per year (in ray). |
computeP2PBorrowRatePerYear
Computes and returns the peer-to-peer borrow rate per year of a market given its parameters.
function computeP2PBorrowRatePerYear(P2PRateComputeParams memory _params)
internal
pure
returns (uint256 p2pBorrowRate);
Parameters
Name | Type | Description |
---|---|---|
_params | P2PRateComputeParams | The computation parameters. |
Returns
Name | Type | Description |
---|---|---|
p2pBorrowRate | uint256 | The peer-to-peer borrow rate per year (in ray). |
Structs
GrowthFactors
STRUCTS ///
struct GrowthFactors {
uint256 poolSupplyGrowthFactor;
uint256 poolBorrowGrowthFactor;
uint256 p2pSupplyGrowthFactor;
uint256 p2pBorrowGrowthFactor;
}
P2PIndexComputeParams
struct P2PIndexComputeParams {
uint256 poolGrowthFactor;
uint256 p2pGrowthFactor;
uint256 lastPoolIndex;
uint256 lastP2PIndex;
uint256 p2pDelta;
uint256 p2pAmount;
}
P2PRateComputeParams
struct P2PRateComputeParams {
uint256 poolSupplyRatePerYear;
uint256 poolBorrowRatePerYear;
uint256 poolIndex;
uint256 p2pIndex;
uint256 p2pDelta;
uint256 p2pAmount;
uint256 p2pIndexCursor;
uint256 reserveFactor;
}