mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fix test related to the LTV change
This commit is contained in:
parent
e328cf0482
commit
35044941b0
|
@ -833,12 +833,13 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn
|
|||
await oracle.setAssetPrice(dai.address, daiPrice);
|
||||
});
|
||||
|
||||
it('User 5 deposits WETH and DAI, then borrows USDC at Variable, then disables WETH as collateral', async () => {
|
||||
it('User 4 deposits WETH, LEND and DAI, then borrows USDC at Variable, then disables WETH as collateral', async () => {
|
||||
const {pool, weth, dai, usdc, users} = testEnv;
|
||||
const user = users[4];
|
||||
const amountWETHToDeposit = parseEther('10');
|
||||
const amountDAIToDeposit = parseEther('60');
|
||||
const amountToBorrow = parseUnits('65', 6);
|
||||
const amountDAIToDeposit = parseEther('100');
|
||||
|
||||
const amountToBorrow = parseUnits('75', 6);
|
||||
|
||||
await weth.connect(user.signer).mint(amountWETHToDeposit);
|
||||
await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
|
||||
|
@ -851,8 +852,8 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn
|
|||
await pool.connect(user.signer).borrow(usdc.address, amountToBorrow, 2, 0, user.address);
|
||||
});
|
||||
|
||||
it('Liquidator tries to liquidates User 5 USDC loan by swapping his WETH collateral, should revert due WETH collateral disabled', async () => {
|
||||
const {pool, weth, usdc, users, mockSwapAdapter, oracle} = testEnv;
|
||||
it('Liquidator tries to liquidate User 5 USDC loan by swapping his WETH collateral, should revert due WETH collateral disabled', async () => {
|
||||
const {pool, weth, dai, usdc, users, mockSwapAdapter, oracle} = testEnv;
|
||||
const user = users[4];
|
||||
const liquidator = users[5];
|
||||
|
||||
|
@ -874,6 +875,14 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn
|
|||
|
||||
expect(wethUserDataBefore.usageAsCollateralEnabled).to.be.false;
|
||||
|
||||
//drop the price to set the HF below 1
|
||||
const daiPrice = await oracle.getAssetPrice(dai.address);
|
||||
|
||||
await oracle.setAssetPrice(
|
||||
dai.address,
|
||||
new BigNumber(daiPrice.toString()).multipliedBy(0.9).toFixed(0)
|
||||
);
|
||||
|
||||
// Liquidator should NOT be able to liquidate himself with WETH, even if is disabled
|
||||
await mockSwapAdapter.setAmountToReturn(amountToRepay);
|
||||
await expect(
|
||||
|
@ -888,6 +897,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn
|
|||
'0x'
|
||||
)
|
||||
).to.be.revertedWith(COLLATERAL_CANNOT_BE_LIQUIDATED);
|
||||
|
||||
const repayWithCollateralTimestamp = await timeLatest();
|
||||
|
||||
const {userData: wethUserDataAfter} = await getContractsData(
|
||||
|
|
Loading…
Reference in New Issue
Block a user