From 59d5c3a6a9be5a8148a81dccb9e54039394affc2 Mon Sep 17 00:00:00 2001 From: The3D Date: Mon, 30 Nov 2020 12:49:31 +0100 Subject: [PATCH] Fixed configuration parameters --- markets/aave/reservesConfigs.ts | 2 +- test/helpers/utils/calculations.ts | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/markets/aave/reservesConfigs.ts b/markets/aave/reservesConfigs.ts index 7e6686eb..be7487d0 100644 --- a/markets/aave/reservesConfigs.ts +++ b/markets/aave/reservesConfigs.ts @@ -316,7 +316,7 @@ export const strategyYFI: IReserveParams = { stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(), stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), baseLTVAsCollateral: '4000', - liquidationThreshold: '4500', + liquidationThreshold: '5500', liquidationBonus: '11500', borrowingEnabled: true, stableBorrowRateEnabled: true, diff --git a/test/helpers/utils/calculations.ts b/test/helpers/utils/calculations.ts index db923176..512741dd 100644 --- a/test/helpers/utils/calculations.ts +++ b/test/helpers/utils/calculations.ts @@ -3,8 +3,6 @@ import { ONE_YEAR, RAY, MAX_UINT_AMOUNT, - OPTIMAL_UTILIZATION_RATE, - EXCESS_UTILIZATION_RATE, PERCENTAGE_FACTOR, } from '../../../helpers/constants'; import { @@ -1210,6 +1208,7 @@ export const calcExpectedInterestRates = ( ): BigNumber[] => { const { reservesParams } = configuration; + const reserveIndex = Object.keys(reservesParams).findIndex((value) => value === reserveSymbol); const [, reserveConfiguration] = (Object.entries(reservesParams) as [string, IReserveParams][])[ reserveIndex @@ -1218,10 +1217,12 @@ export const calcExpectedInterestRates = ( let stableBorrowRate: BigNumber = marketStableRate; let variableBorrowRate: BigNumber = new BigNumber(reserveConfiguration.baseVariableBorrowRate); - if (utilizationRate.gt(OPTIMAL_UTILIZATION_RATE)) { + const optimalRate = new BigNumber(reserveConfiguration.optimalUtilizationRate); + const excessRate = new BigNumber(RAY).minus(optimalRate); + if (utilizationRate.gt(optimalRate)) { const excessUtilizationRateRatio = utilizationRate - .minus(OPTIMAL_UTILIZATION_RATE) - .rayDiv(EXCESS_UTILIZATION_RATE); + .minus(reserveConfiguration.optimalUtilizationRate) + .rayDiv(excessRate); stableBorrowRate = stableBorrowRate .plus(reserveConfiguration.stableRateSlope1) @@ -1237,13 +1238,13 @@ export const calcExpectedInterestRates = ( } else { stableBorrowRate = stableBorrowRate.plus( new BigNumber(reserveConfiguration.stableRateSlope1).rayMul( - utilizationRate.rayDiv(new BigNumber(OPTIMAL_UTILIZATION_RATE)) + utilizationRate.rayDiv(new BigNumber(optimalRate)) ) ); variableBorrowRate = variableBorrowRate.plus( utilizationRate - .rayDiv(OPTIMAL_UTILIZATION_RATE) + .rayDiv(optimalRate) .rayMul(new BigNumber(reserveConfiguration.variableRateSlope1)) ); }