aave-protocol-v2/test/liquidation-underlying.spec.ts

495 lines
18 KiB
TypeScript
Raw Normal View History

2020-06-27 02:13:32 +00:00
import BigNumber from 'bignumber.js';
import {BRE, increaseTime} from '../helpers/misc-utils';
import {oneEther} from '../helpers/constants';
2020-06-27 02:13:32 +00:00
import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
import {makeSuite} from './helpers/make-suite';
import {ProtocolErrors, RateMode} from '../helpers/types';
2020-07-08 15:26:50 +00:00
import {calcExpectedStableDebtTokenBalance} from './helpers/utils/calculations';
2020-07-13 08:54:08 +00:00
import {getUserData} from './helpers/utils/helpers';
import {CommonsConfig} from '../config/commons';
const APPROVAL_AMOUNT_LENDING_POOL =
CommonsConfig.ProtocolGlobalParams.ApprovalAmountLendingPoolCore;
2020-09-13 08:08:14 +00:00
import {parseEther} from 'ethers/lib/utils';
2020-06-27 02:13:32 +00:00
const chai = require('chai');
const {expect} = chai;
makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', (testEnv) => {
const {INVALID_HF} = ProtocolErrors;
2020-06-27 02:13:32 +00:00
2020-09-09 14:35:49 +00:00
before('Before LendingPool liquidation: set config', () => {
BigNumber.config({DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_DOWN});
});
2020-09-09 19:26:52 +00:00
2020-09-09 14:35:49 +00:00
after('After LendingPool liquidation: reset config', () => {
BigNumber.config({DECIMAL_PLACES: 20, ROUNDING_MODE: BigNumber.ROUND_HALF_UP});
});
2020-06-27 02:13:32 +00:00
2020-09-13 08:08:14 +00:00
it("It's not possible to liquidate on a non-active collateral or a non active principal", async () => {
const {configurator, weth, pool, users, dai} = testEnv;
const user = users[1];
await configurator.deactivateReserve(weth.address);
await expect(
pool.liquidationCall(weth.address, dai.address, user.address, parseEther('1000'), false)
).to.be.revertedWith('2');
await configurator.activateReserve(weth.address);
await configurator.deactivateReserve(dai.address);
await expect(
pool.liquidationCall(weth.address, dai.address, user.address, parseEther('1000'), false)
).to.be.revertedWith('2');
await configurator.activateReserve(dai.address);
});
2020-08-13 17:25:29 +00:00
it('LIQUIDATION - Deposits WETH, borrows DAI', async () => {
const {dai, weth, users, pool, oracle} = testEnv;
2020-06-27 02:13:32 +00:00
const depositor = users[0];
const borrower = users[1];
//mints DAI to depositor
await dai.connect(depositor.signer).mint(await convertToCurrencyDecimals(dai.address, '1000'));
//approve protocol to access depositor wallet
await dai.connect(depositor.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
//user 1 deposits 1000 DAI
const amountDAItoDeposit = await convertToCurrencyDecimals(dai.address, '1000');
2020-09-09 10:47:27 +00:00
await pool
.connect(depositor.signer)
.deposit(dai.address, amountDAItoDeposit, depositor.address, '0');
2020-06-27 02:13:32 +00:00
//user 2 deposits 1 ETH
const amountETHtoDeposit = await convertToCurrencyDecimals(weth.address, '1');
2020-06-27 02:13:32 +00:00
2020-08-13 17:25:29 +00:00
//mints WETH to borrower
await weth.connect(borrower.signer).mint(await convertToCurrencyDecimals(weth.address, '1000'));
//approve protocol to access the borrower wallet
await weth.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
2020-08-19 12:23:41 +00:00
2020-09-09 10:47:27 +00:00
await pool
.connect(borrower.signer)
.deposit(weth.address, amountETHtoDeposit, borrower.address, '0');
2020-06-27 02:13:32 +00:00
//user 2 borrows
2020-08-19 12:23:41 +00:00
const userGlobalData = await pool.getUserAccountData(borrower.address);
2020-06-27 02:13:32 +00:00
const daiPrice = await oracle.getAssetPrice(dai.address);
const amountDAIToBorrow = await convertToCurrencyDecimals(
dai.address,
2020-08-19 12:23:41 +00:00
new BigNumber(userGlobalData.availableBorrowsETH.toString())
2020-06-27 02:13:32 +00:00
.div(daiPrice.toString())
.multipliedBy(0.95)
.toFixed(0)
);
await pool
.connect(borrower.signer)
.borrow(dai.address, amountDAIToBorrow, RateMode.Stable, '0', borrower.address);
2020-06-27 02:13:32 +00:00
2020-08-19 12:23:41 +00:00
const userGlobalDataAfter = await pool.getUserAccountData(borrower.address);
2020-06-27 02:13:32 +00:00
expect(userGlobalDataAfter.currentLiquidationThreshold.toString()).to.be.bignumber.equal(
'8000',
INVALID_HF
2020-06-27 02:13:32 +00:00
);
});
it('LIQUIDATION - Drop the health factor below 1', async () => {
const {dai, weth, users, pool, oracle} = testEnv;
2020-06-27 02:13:32 +00:00
const borrower = users[1];
const daiPrice = await oracle.getAssetPrice(dai.address);
await oracle.setAssetPrice(
dai.address,
new BigNumber(daiPrice.toString()).multipliedBy(1.25).toFixed(0)
);
2020-08-19 12:23:41 +00:00
const userGlobalData = await pool.getUserAccountData(borrower.address);
2020-06-27 02:13:32 +00:00
expect(userGlobalData.healthFactor.toString()).to.be.bignumber.lt(
oneEther.toFixed(0),
INVALID_HF
2020-06-27 02:13:32 +00:00
);
});
it('LIQUIDATION - Liquidates the borrow', async () => {
2020-10-12 18:07:17 +00:00
const {dai, weth, users, pool, oracle, helpersContract} = testEnv;
2020-06-27 02:13:32 +00:00
const liquidator = users[3];
const borrower = users[1];
2020-07-08 15:26:50 +00:00
//mints dai to the liquidator
await dai.connect(liquidator.signer).mint(await convertToCurrencyDecimals(dai.address, '1000'));
2020-06-27 02:13:32 +00:00
2020-07-08 15:26:50 +00:00
//approve protocol to access the liquidator wallet
2020-06-27 02:13:32 +00:00
await dai.connect(liquidator.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
2020-10-12 18:07:17 +00:00
const daiReserveDataBefore = await helpersContract.getReserveData(dai.address);
const ethReserveDataBefore = await helpersContract.getReserveData(weth.address);
2020-06-27 02:13:32 +00:00
2020-10-12 18:07:17 +00:00
const userReserveDataBefore = await getUserData(
pool,
helpersContract,
dai.address,
borrower.address
);
2020-07-08 15:26:50 +00:00
2020-08-19 12:23:41 +00:00
const amountToLiquidate = userReserveDataBefore.currentStableDebt.div(2).toFixed(0);
2020-06-27 02:13:32 +00:00
await increaseTime(100);
2020-07-08 15:26:50 +00:00
const tx = await pool
.connect(liquidator.signer)
.liquidationCall(weth.address, dai.address, borrower.address, amountToLiquidate, false);
2020-06-27 02:13:32 +00:00
2020-10-12 18:07:17 +00:00
const userReserveDataAfter = await getUserData(
pool,
helpersContract,
dai.address,
borrower.address
);
2020-06-27 02:13:32 +00:00
2020-10-12 18:07:17 +00:00
const daiReserveDataAfter = await helpersContract.getReserveData(dai.address);
const ethReserveDataAfter = await helpersContract.getReserveData(weth.address);
2020-06-27 02:13:32 +00:00
const collateralPrice = await oracle.getAssetPrice(weth.address);
2020-06-27 02:13:32 +00:00
const principalPrice = await oracle.getAssetPrice(dai.address);
2020-07-08 15:26:50 +00:00
const collateralDecimals = (
2020-10-12 18:07:17 +00:00
await helpersContract.getReserveConfigurationData(weth.address)
2020-07-08 15:26:50 +00:00
).decimals.toString();
const principalDecimals = (
2020-10-12 18:07:17 +00:00
await helpersContract.getReserveConfigurationData(dai.address)
2020-07-08 15:26:50 +00:00
).decimals.toString();
2020-06-27 02:13:32 +00:00
const expectedCollateralLiquidated = new BigNumber(principalPrice.toString())
.times(new BigNumber(amountToLiquidate).times(105))
.times(new BigNumber(10).pow(collateralDecimals))
.div(
new BigNumber(collateralPrice.toString()).times(new BigNumber(10).pow(principalDecimals))
)
.div(100)
.decimalPlaces(0, BigNumber.ROUND_DOWN);
2020-07-08 15:26:50 +00:00
if (!tx.blockNumber) {
expect(false, 'Invalid block number');
return;
}
const txTimestamp = new BigNumber(
(await BRE.ethers.provider.getBlock(tx.blockNumber)).timestamp
);
2020-06-27 02:13:32 +00:00
2020-07-08 15:26:50 +00:00
const stableDebtBeforeTx = calcExpectedStableDebtTokenBalance(
2020-09-17 17:05:22 +00:00
userReserveDataBefore.principalStableDebt,
userReserveDataBefore.stableBorrowRate,
userReserveDataBefore.stableRateLastUpdated,
2020-08-21 07:33:06 +00:00
txTimestamp
2020-06-27 02:13:32 +00:00
);
2020-07-08 15:26:50 +00:00
expect(userReserveDataAfter.currentStableDebt.toString()).to.be.bignumber.almostEqual(
2020-08-19 12:23:41 +00:00
stableDebtBeforeTx.minus(amountToLiquidate).toFixed(0),
2020-07-08 15:26:50 +00:00
'Invalid user debt after liquidation'
2020-06-27 02:13:32 +00:00
);
2020-07-15 14:49:56 +00:00
//the liquidity index of the principal reserve needs to be bigger than the index before
expect(daiReserveDataAfter.liquidityIndex.toString()).to.be.bignumber.gte(
2020-07-15 14:49:56 +00:00
daiReserveDataBefore.liquidityIndex.toString(),
'Invalid liquidity index'
);
//the principal APY after a liquidation needs to be lower than the APY before
expect(daiReserveDataAfter.liquidityRate.toString()).to.be.bignumber.lt(
daiReserveDataBefore.liquidityRate.toString(),
'Invalid liquidity APY'
);
2020-06-27 02:13:32 +00:00
expect(daiReserveDataAfter.availableLiquidity.toString()).to.be.bignumber.almostEqual(
2020-08-19 12:23:41 +00:00
new BigNumber(daiReserveDataBefore.availableLiquidity.toString())
.plus(amountToLiquidate)
.toFixed(0),
2020-06-27 02:13:32 +00:00
'Invalid principal available liquidity'
);
expect(ethReserveDataAfter.availableLiquidity.toString()).to.be.bignumber.almostEqual(
2020-08-19 12:23:41 +00:00
new BigNumber(ethReserveDataBefore.availableLiquidity.toString())
2020-06-27 02:13:32 +00:00
.minus(expectedCollateralLiquidated)
.toFixed(0),
'Invalid collateral available liquidity'
);
});
2020-08-13 17:25:29 +00:00
it('User 3 deposits 1000 USDC, user 4 1 WETH, user 4 borrows - drops HF, liquidates the borrow', async () => {
2020-10-12 18:07:17 +00:00
const {usdc, users, pool, oracle, weth, helpersContract} = testEnv;
2020-06-27 02:13:32 +00:00
const depositor = users[3];
const borrower = users[4];
const liquidator = users[5];
//mints USDC to depositor
await usdc
.connect(depositor.signer)
.mint(await convertToCurrencyDecimals(usdc.address, '1000'));
//approve protocol to access depositor wallet
await usdc.connect(depositor.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
//depositor deposits 1000 USDC
const amountUSDCtoDeposit = await convertToCurrencyDecimals(usdc.address, '1000');
2020-09-09 10:47:27 +00:00
await pool
.connect(depositor.signer)
.deposit(usdc.address, amountUSDCtoDeposit, depositor.address, '0');
2020-06-27 02:13:32 +00:00
//borrower deposits 1 ETH
const amountETHtoDeposit = await convertToCurrencyDecimals(weth.address, '1');
2020-06-27 02:13:32 +00:00
2020-08-13 17:25:29 +00:00
//mints WETH to borrower
await weth.connect(borrower.signer).mint(await convertToCurrencyDecimals(weth.address, '1000'));
//approve protocol to access the borrower wallet
await weth.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
2020-08-19 12:23:41 +00:00
2020-09-09 10:47:27 +00:00
await pool
.connect(borrower.signer)
.deposit(weth.address, amountETHtoDeposit, borrower.address, '0');
2020-06-27 02:13:32 +00:00
//borrower borrows
2020-08-19 12:23:41 +00:00
const userGlobalData = await pool.getUserAccountData(borrower.address);
2020-06-27 02:13:32 +00:00
const usdcPrice = await oracle.getAssetPrice(usdc.address);
const amountUSDCToBorrow = await convertToCurrencyDecimals(
usdc.address,
2020-08-19 12:23:41 +00:00
new BigNumber(userGlobalData.availableBorrowsETH.toString())
2020-07-08 15:26:50 +00:00
.div(usdcPrice.toString())
.multipliedBy(0.9502)
2020-07-08 15:26:50 +00:00
.toFixed(0)
2020-06-27 02:13:32 +00:00
);
2020-07-08 15:26:50 +00:00
await pool
.connect(borrower.signer)
.borrow(usdc.address, amountUSDCToBorrow, RateMode.Stable, '0', borrower.address);
2020-06-27 02:13:32 +00:00
//drops HF below 1
2020-07-08 15:26:50 +00:00
await oracle.setAssetPrice(
usdc.address,
new BigNumber(usdcPrice.toString()).multipliedBy(1.2).toFixed(0)
);
2020-06-27 02:13:32 +00:00
//mints dai to the liquidator
2020-07-08 15:26:50 +00:00
await usdc
.connect(liquidator.signer)
.mint(await convertToCurrencyDecimals(usdc.address, '1000'));
2020-06-27 02:13:32 +00:00
//approve protocol to access depositor wallet
2020-07-08 15:26:50 +00:00
await usdc.connect(liquidator.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
2020-06-27 02:13:32 +00:00
2020-10-12 18:07:17 +00:00
const userReserveDataBefore = await helpersContract.getUserReserveData(
usdc.address,
borrower.address
);
2020-06-27 02:13:32 +00:00
2020-10-12 18:07:17 +00:00
const usdcReserveDataBefore = await helpersContract.getReserveData(usdc.address);
const ethReserveDataBefore = await helpersContract.getReserveData(weth.address);
2020-06-27 02:13:32 +00:00
const amountToLiquidate = BRE.ethers.BigNumber.from(
userReserveDataBefore.currentStableDebt.toString()
)
2020-06-27 02:13:32 +00:00
.div(2)
.toString();
2020-06-27 02:13:32 +00:00
2020-07-08 15:26:50 +00:00
await pool
.connect(liquidator.signer)
.liquidationCall(weth.address, usdc.address, borrower.address, amountToLiquidate, false);
2020-06-27 02:13:32 +00:00
2020-10-12 18:07:17 +00:00
const userReserveDataAfter = await helpersContract.getUserReserveData(
usdc.address,
borrower.address
);
2020-06-27 02:13:32 +00:00
2020-08-19 12:23:41 +00:00
const userGlobalDataAfter = await pool.getUserAccountData(borrower.address);
2020-06-27 02:13:32 +00:00
2020-10-12 18:07:17 +00:00
const usdcReserveDataAfter = await helpersContract.getReserveData(usdc.address);
const ethReserveDataAfter = await helpersContract.getReserveData(weth.address);
2020-06-27 02:13:32 +00:00
const collateralPrice = await oracle.getAssetPrice(weth.address);
2020-06-27 02:13:32 +00:00
const principalPrice = await oracle.getAssetPrice(usdc.address);
2020-07-13 08:54:08 +00:00
const collateralDecimals = (
2020-10-12 18:07:17 +00:00
await helpersContract.getReserveConfigurationData(weth.address)
2020-07-13 08:54:08 +00:00
).decimals.toString();
const principalDecimals = (
2020-10-12 18:07:17 +00:00
await helpersContract.getReserveConfigurationData(usdc.address)
2020-07-13 08:54:08 +00:00
).decimals.toString();
2020-06-27 02:13:32 +00:00
const expectedCollateralLiquidated = new BigNumber(principalPrice.toString())
.times(new BigNumber(amountToLiquidate).times(105))
.times(new BigNumber(10).pow(collateralDecimals))
2020-07-08 15:26:50 +00:00
.div(
new BigNumber(collateralPrice.toString()).times(new BigNumber(10).pow(principalDecimals))
)
2020-06-27 02:13:32 +00:00
.div(100)
.decimalPlaces(0, BigNumber.ROUND_DOWN);
expect(userGlobalDataAfter.healthFactor.toString()).to.be.bignumber.gt(
oneEther.toFixed(0),
'Invalid health factor'
);
2020-07-08 15:26:50 +00:00
expect(userReserveDataAfter.currentStableDebt.toString()).to.be.bignumber.almostEqual(
new BigNumber(userReserveDataBefore.currentStableDebt.toString())
2020-06-27 02:13:32 +00:00
.minus(amountToLiquidate)
.toFixed(0),
'Invalid user borrow balance after liquidation'
);
2020-07-15 14:49:56 +00:00
//the liquidity index of the principal reserve needs to be bigger than the index before
expect(usdcReserveDataAfter.liquidityIndex.toString()).to.be.bignumber.gte(
2020-07-15 14:49:56 +00:00
usdcReserveDataBefore.liquidityIndex.toString(),
'Invalid liquidity index'
);
//the principal APY after a liquidation needs to be lower than the APY before
expect(usdcReserveDataAfter.liquidityRate.toString()).to.be.bignumber.lt(
usdcReserveDataBefore.liquidityRate.toString(),
'Invalid liquidity APY'
);
2020-06-27 02:13:32 +00:00
expect(usdcReserveDataAfter.availableLiquidity.toString()).to.be.bignumber.almostEqual(
2020-08-19 12:23:41 +00:00
new BigNumber(usdcReserveDataBefore.availableLiquidity.toString())
.plus(amountToLiquidate)
.toFixed(0),
2020-06-27 02:13:32 +00:00
'Invalid principal available liquidity'
);
expect(ethReserveDataAfter.availableLiquidity.toString()).to.be.bignumber.almostEqual(
2020-08-19 12:23:41 +00:00
new BigNumber(ethReserveDataBefore.availableLiquidity.toString())
2020-06-27 02:13:32 +00:00
.minus(expectedCollateralLiquidated)
.toFixed(0),
'Invalid collateral available liquidity'
);
});
it('User 4 deposits 1000 LEND - drops HF, liquidates the LEND, which results on a lower amount being liquidated', async () => {
2020-10-12 18:07:17 +00:00
const {lend, usdc, users, pool, oracle, helpersContract} = testEnv;
2020-06-27 02:13:32 +00:00
const depositor = users[3];
const borrower = users[4];
const liquidator = users[5];
//mints LEND to borrower
await lend.connect(borrower.signer).mint(await convertToCurrencyDecimals(lend.address, '1000'));
//approve protocol to access the borrower wallet
await lend.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
//borrower deposits 1000 LEND
const amountLENDtoDeposit = await convertToCurrencyDecimals(lend.address, '1000');
2020-09-09 10:47:27 +00:00
await pool
.connect(borrower.signer)
.deposit(lend.address, amountLENDtoDeposit, borrower.address, '0');
2020-06-27 02:13:32 +00:00
const usdcPrice = await oracle.getAssetPrice(usdc.address);
//drops HF below 1
2020-07-08 15:26:50 +00:00
await oracle.setAssetPrice(
usdc.address,
new BigNumber(usdcPrice.toString()).multipliedBy(1.12).toFixed(0)
);
2020-06-27 02:13:32 +00:00
//mints usdc to the liquidator
2020-07-13 08:54:08 +00:00
await usdc
.connect(liquidator.signer)
.mint(await convertToCurrencyDecimals(usdc.address, '1000'));
2020-06-27 02:13:32 +00:00
//approve protocol to access depositor wallet
2020-07-08 15:26:50 +00:00
await usdc.connect(liquidator.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
2020-06-27 02:13:32 +00:00
2020-10-12 18:07:17 +00:00
const userReserveDataBefore = await helpersContract.getUserReserveData(
usdc.address,
borrower.address
);
2020-06-27 02:13:32 +00:00
2020-10-12 18:07:17 +00:00
const usdcReserveDataBefore = await helpersContract.getReserveData(usdc.address);
const lendReserveDataBefore = await helpersContract.getReserveData(lend.address);
2020-06-27 02:13:32 +00:00
2020-08-19 12:23:41 +00:00
const amountToLiquidate = new BigNumber(userReserveDataBefore.currentStableDebt.toString())
2020-06-27 02:13:32 +00:00
.div(2)
.decimalPlaces(0, BigNumber.ROUND_DOWN)
.toFixed(0);
const collateralPrice = await oracle.getAssetPrice(lend.address);
const principalPrice = await oracle.getAssetPrice(usdc.address);
2020-07-08 15:26:50 +00:00
await pool
.connect(liquidator.signer)
.liquidationCall(lend.address, usdc.address, borrower.address, amountToLiquidate, false);
2020-06-27 02:13:32 +00:00
2020-10-12 18:07:17 +00:00
const userReserveDataAfter = await helpersContract.getUserReserveData(
usdc.address,
borrower.address
);
2020-06-27 02:13:32 +00:00
2020-08-19 12:23:41 +00:00
const userGlobalDataAfter = await pool.getUserAccountData(borrower.address);
2020-06-27 02:13:32 +00:00
2020-10-12 18:07:17 +00:00
const usdcReserveDataAfter = await helpersContract.getReserveData(usdc.address);
const lendReserveDataAfter = await helpersContract.getReserveData(lend.address);
const lendConfiguration = await helpersContract.getReserveConfigurationData(lend.address);
const collateralDecimals = lendConfiguration.decimals.toString();
const liquidationBonus = lendConfiguration.liquidationBonus.toString();
2020-06-27 02:13:32 +00:00
2020-07-13 08:54:08 +00:00
const principalDecimals = (
2020-10-12 18:07:17 +00:00
await helpersContract.getReserveConfigurationData(usdc.address)
2020-07-13 08:54:08 +00:00
).decimals.toString();
2020-06-27 02:13:32 +00:00
const expectedCollateralLiquidated = oneEther.multipliedBy('1000');
const expectedPrincipal = new BigNumber(collateralPrice.toString())
.times(expectedCollateralLiquidated)
.times(new BigNumber(10).pow(principalDecimals))
2020-07-08 15:26:50 +00:00
.div(
new BigNumber(principalPrice.toString()).times(new BigNumber(10).pow(collateralDecimals))
)
2020-08-02 16:36:04 +00:00
.times(10000)
2020-06-27 02:13:32 +00:00
.div(liquidationBonus.toString())
.decimalPlaces(0, BigNumber.ROUND_DOWN);
expect(userGlobalDataAfter.healthFactor.toString()).to.be.bignumber.gt(
oneEther.toFixed(0),
'Invalid health factor'
);
2020-07-08 15:26:50 +00:00
expect(userReserveDataAfter.currentStableDebt.toString()).to.be.bignumber.almostEqual(
2020-08-19 12:23:41 +00:00
new BigNumber(userReserveDataBefore.currentStableDebt.toString())
.minus(expectedPrincipal)
.toFixed(0),
2020-06-27 02:13:32 +00:00
'Invalid user borrow balance after liquidation'
);
expect(usdcReserveDataAfter.availableLiquidity.toString()).to.be.bignumber.almostEqual(
2020-08-19 12:23:41 +00:00
new BigNumber(usdcReserveDataBefore.availableLiquidity.toString())
.plus(expectedPrincipal)
.toFixed(0),
2020-06-27 02:13:32 +00:00
'Invalid principal available liquidity'
);
expect(lendReserveDataAfter.availableLiquidity.toString()).to.be.bignumber.almostEqual(
2020-08-19 12:23:41 +00:00
new BigNumber(lendReserveDataBefore.availableLiquidity.toString())
2020-06-27 02:13:32 +00:00
.minus(expectedCollateralLiquidated)
.toFixed(0),
'Invalid collateral available liquidity'
);
});
});