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(), stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(), stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
baseLTVAsCollateral: '4000', baseLTVAsCollateral: '4000',
liquidationThreshold: '4500', liquidationThreshold: '5500',
liquidationBonus: '11500', liquidationBonus: '11500',
borrowingEnabled: true, borrowingEnabled: true,
stableBorrowRateEnabled: true, stableBorrowRateEnabled: true,

View File

@ -3,8 +3,6 @@ import {
ONE_YEAR, ONE_YEAR,
RAY, RAY,
MAX_UINT_AMOUNT, MAX_UINT_AMOUNT,
OPTIMAL_UTILIZATION_RATE,
EXCESS_UTILIZATION_RATE,
PERCENTAGE_FACTOR, PERCENTAGE_FACTOR,
} from '../../../helpers/constants'; } from '../../../helpers/constants';
import { import {
@ -1210,6 +1208,7 @@ export const calcExpectedInterestRates = (
): BigNumber[] => { ): BigNumber[] => {
const { reservesParams } = configuration; const { reservesParams } = configuration;
const reserveIndex = Object.keys(reservesParams).findIndex((value) => value === reserveSymbol); const reserveIndex = Object.keys(reservesParams).findIndex((value) => value === reserveSymbol);
const [, reserveConfiguration] = (Object.entries(reservesParams) as [string, IReserveParams][])[ const [, reserveConfiguration] = (Object.entries(reservesParams) as [string, IReserveParams][])[
reserveIndex reserveIndex
@ -1218,10 +1217,12 @@ export const calcExpectedInterestRates = (
let stableBorrowRate: BigNumber = marketStableRate; let stableBorrowRate: BigNumber = marketStableRate;
let variableBorrowRate: BigNumber = new BigNumber(reserveConfiguration.baseVariableBorrowRate); 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 const excessUtilizationRateRatio = utilizationRate
.minus(OPTIMAL_UTILIZATION_RATE) .minus(reserveConfiguration.optimalUtilizationRate)
.rayDiv(EXCESS_UTILIZATION_RATE); .rayDiv(excessRate);
stableBorrowRate = stableBorrowRate stableBorrowRate = stableBorrowRate
.plus(reserveConfiguration.stableRateSlope1) .plus(reserveConfiguration.stableRateSlope1)
@ -1237,13 +1238,13 @@ export const calcExpectedInterestRates = (
} else { } else {
stableBorrowRate = stableBorrowRate.plus( stableBorrowRate = stableBorrowRate.plus(
new BigNumber(reserveConfiguration.stableRateSlope1).rayMul( new BigNumber(reserveConfiguration.stableRateSlope1).rayMul(
utilizationRate.rayDiv(new BigNumber(OPTIMAL_UTILIZATION_RATE)) utilizationRate.rayDiv(new BigNumber(optimalRate))
) )
); );
variableBorrowRate = variableBorrowRate.plus( variableBorrowRate = variableBorrowRate.plus(
utilizationRate utilizationRate
.rayDiv(OPTIMAL_UTILIZATION_RATE) .rayDiv(optimalRate)
.rayMul(new BigNumber(reserveConfiguration.variableRateSlope1)) .rayMul(new BigNumber(reserveConfiguration.variableRateSlope1))
); );
} }