InterestRatesModel

Git Source

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.LastPoolIndexes memory _lastPoolIndexes,
    uint256 _p2pIndexCursor,
    uint256 _reserveFactor
) internal pure returns (GrowthFactors memory growthFactors);

Parameters

NameTypeDescription
_newPoolSupplyIndexuint256The current pool supply index.
_newPoolBorrowIndexuint256The current pool borrow index.
_lastPoolIndexesTypes.LastPoolIndexesThe last stored pool indexes.
_p2pIndexCursoruint256The peer-to-peer index cursor for the given market.
_reserveFactoruint256The reserve factor of the given market.

Returns

NameTypeDescription
growthFactorsGrowthFactorsThe market's indexes growth factors (in wad).

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

NameTypeDescription
_paramsP2PIndexComputeParamsThe computation parameters.

Returns

NameTypeDescription
newP2PIndexuint256The updated peer-to-peer index (in wad).

computeP2PSupplyRatePerBlock

Computes and returns the peer-to-peer supply rate per block of a market given its parameters.

function computeP2PSupplyRatePerBlock(P2PRateComputeParams memory _params)
    internal
    pure
    returns (uint256 p2pSupplyRate);

Parameters

NameTypeDescription
_paramsP2PRateComputeParamsThe computation parameters.

Returns

NameTypeDescription
p2pSupplyRateuint256The peer-to-peer supply rate per block (in wad).

computeP2PBorrowRatePerBlock

Computes and returns the peer-to-peer borrow rate per block of a market given its parameters.

function computeP2PBorrowRatePerBlock(P2PRateComputeParams memory _params)
    internal
    pure
    returns (uint256 p2pBorrowRate);

Parameters

NameTypeDescription
_paramsP2PRateComputeParamsThe computation parameters.

Returns

NameTypeDescription
p2pBorrowRateuint256The peer-to-peer borrow rate per block (in wad).

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 poolRate;
    uint256 p2pRate;
    uint256 poolIndex;
    uint256 p2pIndex;
    uint256 p2pDelta;
    uint256 p2pAmount;
    uint16 reserveFactor;
}