fix-refactor: Refactored tests with new getCaps function, fixed contract supplyCap mask

This commit is contained in:
Hadrien Charlanes 2021-04-30 16:48:09 +02:00
parent f624783a36
commit 6a0d27c0de
10 changed files with 109 additions and 56 deletions

View File

@ -8,7 +8,6 @@ import {PercentageMath} from '../libraries/math/PercentageMath.sol';
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
import {ILendingRateOracle} from '../../interfaces/ILendingRateOracle.sol';
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
import 'hardhat/console.sol';
/**
* @title DefaultReserveInterestRateStrategy contract

View File

@ -20,7 +20,7 @@ library ReserveConfiguration {
uint256 constant STABLE_BORROWING_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFF; // prettier-ignore
uint256 constant RESERVE_FACTOR_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFF; // prettier-ignore
uint256 constant BORROW_CAP_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFF; // prettier-ignore
uint256 constant SUPPLY_CAP_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFF; // prettier-ignore
uint256 constant SUPPLY_CAP_MASK = 0xFFFFFFFFFFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore
/// @dev For the LTV, the start bit is 0 (up to 15), hence no bitshifting is needed
uint256 constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16;

View File

@ -16,6 +16,7 @@ export const oneRay = new BigNumber(Math.pow(10, 27));
export const MAX_UINT_AMOUNT =
'115792089237316195423570985008687907853269984665640564039457584007913129639935';
export const MAX_BORROW_CAP = '281474976710655';
export const MAX_SUPPLY_CAP = '281474976710655';
export const ONE_YEAR = '31536000';
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
export const ONE_ADDRESS = '0x0000000000000000000000000000000000000001';

View File

@ -276,6 +276,7 @@ export const configureReservesByHelper = async (
const liquidationBonuses: string[] = [];
const reserveFactors: string[] = [];
const borrowCaps: string[] = [];
const supplyCaps: string[] = [];
const stableRatesEnabled: boolean[] = [];
const inputParams: {
@ -285,6 +286,7 @@ export const configureReservesByHelper = async (
liquidationBonus: BigNumberish;
reserveFactor: BigNumberish;
borrowCap: BigNumberish;
supplyCap: BigNumberish;
stableBorrowingEnabled: boolean;
}[] = [];
@ -296,6 +298,7 @@ export const configureReservesByHelper = async (
liquidationThreshold,
reserveFactor,
borrowCap,
supplyCap,
stableBorrowRateEnabled,
},
] of Object.entries(reservesParams) as [string, IReserveParams][]) {
@ -324,6 +327,7 @@ export const configureReservesByHelper = async (
liquidationBonus,
reserveFactor,
borrowCap,
supplyCap,
stableBorrowingEnabled: stableBorrowRateEnabled,
});
@ -334,6 +338,7 @@ export const configureReservesByHelper = async (
liquidationBonuses.push(liquidationBonus);
reserveFactors.push(reserveFactor);
borrowCaps.push(borrowCap);
supplyCaps.push(supplyCap);
stableRatesEnabled.push(stableBorrowRateEnabled);
}
if (tokens.length) {

View File

@ -353,12 +353,13 @@ export enum TokenContractId {
BptBALWETH = 'BptBALWETH',
WMATIC = 'WMATIC',
STAKE = 'STAKE',
xSUSHI = 'xSUSHI'
xSUSHI = 'xSUSHI',
}
export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams {
aTokenImpl: eContractid;
reserveFactor: string;
supplyCap: string;
strategy: IInterestRateStrategyParams;
}
@ -382,13 +383,13 @@ export interface IReserveBorrowParams {
borrowingEnabled: boolean;
stableBorrowRateEnabled: boolean;
reserveDecimals: string;
borrowCap: string;
}
export interface IReserveCollateralParams {
baseLTVAsCollateral: string;
liquidationThreshold: string;
liquidationBonus: string;
borrowCap: string;
}
export interface IMarketRates {
borrowRate: string;

View File

@ -1,7 +1,7 @@
import { MAX_BORROW_CAP } from '../../helpers/constants';
import { MAX_BORROW_CAP, MAX_SUPPLY_CAP } from '../../helpers/constants';
import { eContractid, IReserveParams } from '../../helpers/types';
import {
import {
rateStrategyStableOne,
rateStrategyStableTwo,
rateStrategyStableThree,
@ -24,6 +24,7 @@ export const strategyBUSD: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyDAI: IReserveParams = {
@ -37,6 +38,7 @@ export const strategyDAI: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategySUSD: IReserveParams = {
@ -50,6 +52,7 @@ export const strategySUSD: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyTUSD: IReserveParams = {
@ -63,6 +66,7 @@ export const strategyTUSD: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyUSDC: IReserveParams = {
@ -76,6 +80,7 @@ export const strategyUSDC: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyUSDT: IReserveParams = {
@ -89,6 +94,7 @@ export const strategyUSDT: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyAAVE: IReserveParams = {
@ -102,6 +108,7 @@ export const strategyAAVE: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '0',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyBAT: IReserveParams = {
@ -115,6 +122,7 @@ export const strategyBAT: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyENJ: IReserveParams = {
@ -128,6 +136,7 @@ export const strategyENJ: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyWETH: IReserveParams = {
@ -141,6 +150,7 @@ export const strategyWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyKNC: IReserveParams = {
@ -154,6 +164,7 @@ export const strategyKNC: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyLINK: IReserveParams = {
@ -167,6 +178,7 @@ export const strategyLINK: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyMANA: IReserveParams = {
@ -180,6 +192,7 @@ export const strategyMANA: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '3500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyMKR: IReserveParams = {
@ -193,6 +206,7 @@ export const strategyMKR: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyREN: IReserveParams = {
@ -206,6 +220,7 @@ export const strategyREN: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategySNX: IReserveParams = {
@ -219,6 +234,7 @@ export const strategySNX: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '3500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
// Invalid borrow rates in params currently, replaced with snx params
@ -233,6 +249,7 @@ export const strategyUNI: IReserveParams = {
aTokenImpl: eContractid.DelegationAwareAToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyWBTC: IReserveParams = {
@ -246,6 +263,7 @@ export const strategyWBTC: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyYFI: IReserveParams = {
@ -259,6 +277,7 @@ export const strategyYFI: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyZRX: IReserveParams = {
@ -272,6 +291,7 @@ export const strategyZRX: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyXSUSHI: IReserveParams = {
@ -285,4 +305,5 @@ export const strategyXSUSHI: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '3500',
borrowCap: MAX_BORROW_CAP,
};
supplyCap: MAX_SUPPLY_CAP,
};

View File

@ -1,4 +1,4 @@
import { MAX_BORROW_CAP } from '../../helpers/constants';
import { MAX_BORROW_CAP, MAX_SUPPLY_CAP } from '../../helpers/constants';
import { eContractid, IReserveParams} from '../../helpers/types';
import {
rateStrategyAmmBase,
@ -18,6 +18,7 @@ export const strategyWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyWBTC: IReserveParams = {
@ -31,6 +32,7 @@ export const strategyWBTC: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyDAI: IReserveParams = {
@ -44,6 +46,7 @@ export const strategyDAI: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyUSDC: IReserveParams = {
@ -57,6 +60,7 @@ export const strategyUSDC: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyUSDT: IReserveParams = {
@ -70,6 +74,7 @@ export const strategyUSDT: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyDAIWETH: IReserveParams = {
@ -83,6 +88,7 @@ export const strategyDAIWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyWBTCWETH: IReserveParams = {
@ -96,6 +102,7 @@ export const strategyWBTCWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyAAVEWETH: IReserveParams = {
@ -109,6 +116,7 @@ export const strategyAAVEWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyBATWETH: IReserveParams = {
@ -122,6 +130,7 @@ export const strategyBATWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyDAIUSDC: IReserveParams = {
@ -135,6 +144,7 @@ export const strategyDAIUSDC: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyCRVWETH: IReserveParams = {
@ -148,6 +158,7 @@ export const strategyCRVWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyLINKWETH: IReserveParams = {
@ -161,6 +172,7 @@ export const strategyLINKWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyMKRWETH: IReserveParams = {
@ -174,6 +186,7 @@ export const strategyMKRWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyRENWETH: IReserveParams = {
@ -187,6 +200,7 @@ export const strategyRENWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategySNXWETH: IReserveParams = {
@ -200,6 +214,7 @@ export const strategySNXWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyUNIWETH: IReserveParams = {
@ -213,6 +228,7 @@ export const strategyUNIWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyUSDCWETH: IReserveParams = {
@ -226,6 +242,7 @@ export const strategyUSDCWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyWBTCUSDC: IReserveParams = {
@ -239,6 +256,7 @@ export const strategyWBTCUSDC: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyYFIWETH: IReserveParams = {
@ -252,6 +270,7 @@ export const strategyYFIWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyBALWETH: IReserveParams = {
@ -265,4 +284,5 @@ export const strategyBALWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1500',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
}

View File

@ -1,8 +1,8 @@
// import BigNumber from 'bignumber.js';
// import { oneRay } from '../../helpers/constants';
import { MAX_BORROW_CAP } from '../../helpers/constants';
import { MAX_BORROW_CAP, MAX_SUPPLY_CAP } from '../../helpers/constants';
import { eContractid, IReserveParams } from '../../helpers/types';
import {
import {
rateStrategyStableOne,
rateStrategyStableTwo,
rateStrategyStableThree,
@ -24,6 +24,7 @@ export const strategyDAI: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyUSDC: IReserveParams = {
@ -37,19 +38,21 @@ export const strategyUSDC: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyUSDT: IReserveParams = {
strategy: rateStrategyStableThree,
baseLTVAsCollateral: '8000',
liquidationThreshold: '8500',
liquidationBonus: '10500',
borrowingEnabled: true,
stableBorrowRateEnabled: true,
reserveDecimals: '6',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
strategy: rateStrategyStableThree,
baseLTVAsCollateral: '8000',
liquidationThreshold: '8500',
liquidationBonus: '10500',
borrowingEnabled: true,
stableBorrowRateEnabled: true,
reserveDecimals: '6',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyWETH: IReserveParams = {
@ -63,6 +66,7 @@ export const strategyWETH: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyWBTC: IReserveParams = {
@ -76,10 +80,11 @@ export const strategyWBTC: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
supplyCap: MAX_SUPPLY_CAP,
};
export const strategyMATIC: IReserveParams = {
strategy: rateStrategyVolatileOne, //Temp?
strategy: rateStrategyVolatileOne, //Temp?
baseLTVAsCollateral: '5000',
liquidationThreshold: '6500',
liquidationBonus: '11000',
@ -89,4 +94,5 @@ export const strategyMATIC: IReserveParams = {
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
borrowCap: MAX_BORROW_CAP,
};
supplyCap: MAX_SUPPLY_CAP,
};

View File

@ -42,8 +42,8 @@ makeSuite('Borrow Cap', (testEnv: TestEnv) => {
await dai.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT);
await weth.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT);
await usdc.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT);
let usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
let daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
let usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
let daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
expect(usdcBorrowCap).to.be.equal(MAX_BORROW_CAP);
expect(daiBorrowCap).to.be.equal(MAX_BORROW_CAP);
@ -53,8 +53,8 @@ makeSuite('Borrow Cap', (testEnv: TestEnv) => {
await configurator.setBorrowCap(usdc.address, 0);
await configurator.setBorrowCap(dai.address, 0);
usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
expect(usdcBorrowCap).to.be.equal(0);
expect(daiBorrowCap).to.be.equal(0);
@ -97,8 +97,8 @@ makeSuite('Borrow Cap', (testEnv: TestEnv) => {
it('Should fail to set the borrow cap for usdc and DAI to max cap + 1 Units', async () => {
const { configurator, usdc, pool, dai, deployer, helpersContract } = testEnv;
const newCap = Number(MAX_BORROW_CAP) + 1;
let usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
let daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
let usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
let daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
expect(usdcBorrowCap).to.be.equal(0);
expect(daiBorrowCap).to.be.equal(0);
@ -110,14 +110,14 @@ makeSuite('Borrow Cap', (testEnv: TestEnv) => {
RC_INVALID_BORROW_CAP
);
usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
});
it('Sets the borrow cap for usdc and DAI to 110 Units', async () => {
const { configurator, usdc, pool, dai, deployer, helpersContract } = testEnv;
const newCap = '110';
let usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
let daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
let usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
let daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
expect(usdcBorrowCap).to.be.equal(0);
expect(daiBorrowCap).to.be.equal(0);
@ -125,8 +125,8 @@ makeSuite('Borrow Cap', (testEnv: TestEnv) => {
await configurator.setBorrowCap(usdc.address, newCap);
await configurator.setBorrowCap(dai.address, newCap);
usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
expect(usdcBorrowCap).to.be.equal(newCap);
expect(daiBorrowCap).to.be.equal(newCap);
@ -199,14 +199,14 @@ makeSuite('Borrow Cap', (testEnv: TestEnv) => {
it('Raises the borrow cap for usdc and DAI to 1000 Units', async () => {
const { configurator, usdc, pool, dai, deployer, helpersContract } = testEnv;
const newCap = '1000';
let usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
let daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
let usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
let daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
await configurator.setBorrowCap(usdc.address, newCap);
await configurator.setBorrowCap(dai.address, newCap);
usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
expect(usdcBorrowCap).to.be.equal(newCap);
expect(daiBorrowCap).to.be.equal(newCap);
@ -235,14 +235,14 @@ makeSuite('Borrow Cap', (testEnv: TestEnv) => {
it('Lowers the borrow cap for usdc and DAI to 200 Units', async () => {
const { configurator, usdc, pool, dai, deployer, helpersContract } = testEnv;
const newCap = '200';
let usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
let daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
let usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
let daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
await configurator.setBorrowCap(usdc.address, newCap);
await configurator.setBorrowCap(dai.address, newCap);
usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
expect(usdcBorrowCap).to.be.equal(newCap);
expect(daiBorrowCap).to.be.equal(newCap);
@ -275,14 +275,14 @@ makeSuite('Borrow Cap', (testEnv: TestEnv) => {
it('Raises the borrow cap for usdc and DAI to max cap Units', async () => {
const { configurator, usdc, pool, dai, deployer, helpersContract } = testEnv;
const newCap = MAX_BORROW_CAP;
let usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
let daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
let usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
let daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
await configurator.setBorrowCap(usdc.address, newCap);
await configurator.setBorrowCap(dai.address, newCap);
usdcBorrowCap = await helpersContract.getReserveBorrowCap(usdc.address);
daiBorrowCap = await helpersContract.getReserveBorrowCap(dai.address);
usdcBorrowCap = (await helpersContract.getReserveCaps(usdc.address)).borrowCap;
daiBorrowCap = (await helpersContract.getReserveCaps(dai.address)).borrowCap;
expect(usdcBorrowCap).to.be.equal(newCap);
expect(daiBorrowCap).to.be.equal(newCap);

View File

@ -75,7 +75,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
isActive,
isFrozen,
} = await helpersContract.getReserveConfigurationData(weth.address);
const borrowCap = await helpersContract.getReserveBorrowCap(weth.address);
const { borrowCap, supplyCap } = await helpersContract.getReserveCaps(weth.address);
expect(borrowingEnabled).to.be.equal(true);
expect(isActive).to.be.equal(true);
@ -104,7 +104,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
isActive,
isFrozen,
} = await helpersContract.getReserveConfigurationData(weth.address);
const borrowCap = await helpersContract.getReserveBorrowCap(weth.address);
const { borrowCap, supplyCap } = await helpersContract.getReserveCaps(weth.address);
expect(borrowingEnabled).to.be.equal(true);
expect(isActive).to.be.equal(true);
@ -148,7 +148,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
isActive,
isFrozen,
} = await helpersContract.getReserveConfigurationData(weth.address);
const borrowCap = await helpersContract.getReserveBorrowCap(weth.address);
const { borrowCap, supplyCap } = await helpersContract.getReserveCaps(weth.address);
expect(borrowingEnabled).to.be.equal(false);
expect(isActive).to.be.equal(true);
@ -178,7 +178,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
isActive,
isFrozen,
} = await helpersContract.getReserveConfigurationData(weth.address);
const borrowCap = await helpersContract.getReserveBorrowCap(weth.address);
const { borrowCap, supplyCap } = await helpersContract.getReserveCaps(weth.address);
expect(borrowingEnabled).to.be.equal(true);
expect(isActive).to.be.equal(true);
@ -227,7 +227,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
isActive,
isFrozen,
} = await helpersContract.getReserveConfigurationData(weth.address);
const borrowCap = await helpersContract.getReserveBorrowCap(weth.address);
const { borrowCap, supplyCap } = await helpersContract.getReserveCaps(weth.address);
expect(borrowingEnabled).to.be.equal(true);
expect(isActive).to.be.equal(true);
@ -256,7 +256,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
isActive,
isFrozen,
} = await helpersContract.getReserveConfigurationData(weth.address);
const borrowCap = await helpersContract.getReserveBorrowCap(weth.address);
const { borrowCap, supplyCap } = await helpersContract.getReserveCaps(weth.address);
expect(borrowingEnabled).to.be.equal(true);
expect(isActive).to.be.equal(true);
@ -294,7 +294,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
isActive,
isFrozen,
} = await helpersContract.getReserveConfigurationData(weth.address);
const borrowCap = await helpersContract.getReserveBorrowCap(weth.address);
const { borrowCap, supplyCap } = await helpersContract.getReserveCaps(weth.address);
expect(borrowingEnabled).to.be.equal(true);
expect(isActive).to.be.equal(true);
@ -322,7 +322,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
isActive,
isFrozen,
} = await helpersContract.getReserveConfigurationData(weth.address);
const borrowCap = await helpersContract.getReserveBorrowCap(weth.address);
const { borrowCap, supplyCap } = await helpersContract.getReserveCaps(weth.address);
expect(borrowingEnabled).to.be.equal(true);
expect(isActive).to.be.equal(true);
@ -382,7 +382,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
isActive,
isFrozen,
} = await helpersContract.getReserveConfigurationData(weth.address);
const borrowCap = await helpersContract.getReserveBorrowCap(weth.address);
const { borrowCap, supplyCap } = await helpersContract.getReserveCaps(weth.address);
expect(borrowingEnabled).to.be.equal(true);
expect(isActive).to.be.equal(true);
@ -418,7 +418,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
isActive,
isFrozen,
} = await helpersContract.getReserveConfigurationData(weth.address);
const borrowCap = await helpersContract.getReserveBorrowCap(weth.address);
const { borrowCap, supplyCap } = await helpersContract.getReserveCaps(weth.address);
expect(borrowingEnabled).to.be.equal(true);
expect(isActive).to.be.equal(true);