Fixed configuration parameters

This commit is contained in:
The3D 2020-11-30 12:49:31 +01:00
parent ae0414eb23
commit 59d5c3a6a9
2 changed files with 9 additions and 8 deletions

View File

@ -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,

View File

@ -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))
);
}