Replaced borrows with debt in comments and the InterestRateStrategy contract

This commit is contained in:
The3D 2020-11-23 18:52:52 +01:00
parent 4629dcd194
commit eecb0b4fef
5 changed files with 14 additions and 14 deletions

View File

@ -108,16 +108,16 @@ contract ATokensAndRatesHelper is Ownable {
} }
} }
function enableBorrowingOnReserves(address[] calldata tokens, bool[] calldata stableBorrows) function enableBorrowingOnReserves(address[] calldata tokens, bool[] calldata stableBorrowingEnabled)
external external
onlyOwner onlyOwner
{ {
require(stableBorrows.length == tokens.length); require(stableBorrowingEnabled.length == tokens.length);
for (uint256 i = 0; i < tokens.length; i++) { for (uint256 i = 0; i < tokens.length; i++) {
LendingPoolConfigurator(poolConfigurator).enableBorrowingOnReserve( LendingPoolConfigurator(poolConfigurator).enableBorrowingOnReserve(
tokens[i], tokens[i],
stableBorrows[i] stableBorrowingEnabled[i]
); );
} }
} }

View File

@ -97,7 +97,7 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy {
} }
struct CalcInterestRatesLocalVars { struct CalcInterestRatesLocalVars {
uint256 totalBorrows; uint256 totalDebt;
uint256 currentVariableBorrowRate; uint256 currentVariableBorrowRate;
uint256 currentStableBorrowRate; uint256 currentStableBorrowRate;
uint256 currentLiquidityRate; uint256 currentLiquidityRate;
@ -133,15 +133,15 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy {
{ {
CalcInterestRatesLocalVars memory vars; CalcInterestRatesLocalVars memory vars;
vars.totalBorrows = totalStableDebt.add(totalVariableDebt); vars.totalDebt = totalStableDebt.add(totalVariableDebt);
vars.currentVariableBorrowRate = 0; vars.currentVariableBorrowRate = 0;
vars.currentStableBorrowRate = 0; vars.currentStableBorrowRate = 0;
vars.currentLiquidityRate = 0; vars.currentLiquidityRate = 0;
uint256 utilizationRate = uint256 utilizationRate =
vars.totalBorrows == 0 vars.totalDebt == 0
? 0 ? 0
: vars.totalBorrows.rayDiv(availableLiquidity.add(vars.totalBorrows)); : vars.totalDebt.rayDiv(availableLiquidity.add(vars.totalDebt));
vars.currentStableBorrowRate = ILendingRateOracle(addressesProvider.getLendingRateOracle()) vars.currentStableBorrowRate = ILendingRateOracle(addressesProvider.getLendingRateOracle())
.getMarketBorrowRate(reserve); .getMarketBorrowRate(reserve);
@ -184,7 +184,7 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy {
} }
/** /**
* @dev Calculates the overall borrow rate as the weighted average between the total variable borrows and total stable borrows * @dev Calculates the overall borrow rate as the weighted average between the total variable debt and total stable debt
* @param totalStableDebt The total borrowed from the reserve a stable rate * @param totalStableDebt The total borrowed from the reserve a stable rate
* @param totalVariableDebt The total borrowed from the reserve at a variable rate * @param totalVariableDebt The total borrowed from the reserve at a variable rate
* @param currentVariableBorrowRate The current variable borrow rate of the reserve * @param currentVariableBorrowRate The current variable borrow rate of the reserve
@ -197,16 +197,16 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy {
uint256 currentVariableBorrowRate, uint256 currentVariableBorrowRate,
uint256 currentAverageStableBorrowRate uint256 currentAverageStableBorrowRate
) internal pure returns (uint256) { ) internal pure returns (uint256) {
uint256 totalBorrows = totalStableDebt.add(totalVariableDebt); uint256 totalDebt = totalStableDebt.add(totalVariableDebt);
if (totalBorrows == 0) return 0; if (totalDebt == 0) return 0;
uint256 weightedVariableRate = totalVariableDebt.wadToRay().rayMul(currentVariableBorrowRate); uint256 weightedVariableRate = totalVariableDebt.wadToRay().rayMul(currentVariableBorrowRate);
uint256 weightedStableRate = totalStableDebt.wadToRay().rayMul(currentAverageStableBorrowRate); uint256 weightedStableRate = totalStableDebt.wadToRay().rayMul(currentAverageStableBorrowRate);
uint256 overallBorrowRate = uint256 overallBorrowRate =
weightedVariableRate.add(weightedStableRate).rayDiv(totalBorrows.wadToRay()); weightedVariableRate.add(weightedStableRate).rayDiv(totalDebt.wadToRay());
return overallBorrowRate; return overallBorrowRate;
} }

View File

@ -234,7 +234,7 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken {
} }
/** /**
* @dev Returns the scaled total supply of the variable debt token. Represents sum(borrows/index) * @dev Returns the scaled total supply of the variable debt token. Represents sum(debt/index)
* @return the scaled total supply * @return the scaled total supply
**/ **/
function scaledTotalSupply() public view virtual override returns (uint256) { function scaledTotalSupply() public view virtual override returns (uint256) {

View File

@ -112,7 +112,7 @@ contract VariableDebtToken is DebtTokenBase, IVariableDebtToken {
} }
/** /**
* @dev Returns the scaled total supply of the variable debt token. Represents sum(borrows/index) * @dev Returns the scaled total supply of the variable debt token. Represents sum(debt/index)
* @return the scaled total supply * @return the scaled total supply
**/ **/
function scaledTotalSupply() public view virtual override returns (uint256) { function scaledTotalSupply() public view virtual override returns (uint256) {

View File

@ -19,7 +19,7 @@ interface IScaledBalanceToken {
function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256); function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);
/** /**
* @dev Returns the scaled total supply of the variable debt token. Represents sum(borrows/index) * @dev Returns the scaled total supply of the variable debt token. Represents sum(debt/index)
* @return the scaled total supply * @return the scaled total supply
**/ **/
function scaledTotalSupply() external view returns (uint256); function scaledTotalSupply() external view returns (uint256);