mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fixed liquidation tests
This commit is contained in:
parent
4bb7d0c5db
commit
83346703a5
|
@ -20,7 +20,7 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) =>
|
||||||
LP_IS_PAUSED,
|
LP_IS_PAUSED,
|
||||||
} = ProtocolErrors;
|
} = ProtocolErrors;
|
||||||
|
|
||||||
it('LIQUIDATION - Deposits WETH, borrows DAI/Check liquidation fails because health factor is above 1', async () => {
|
it('Deposits WETH, borrows DAI/Check liquidation fails because health factor is above 1', async () => {
|
||||||
const { dai, weth, users, pool, oracle } = testEnv;
|
const { dai, weth, users, pool, oracle } = testEnv;
|
||||||
const depositor = users[0];
|
const depositor = users[0];
|
||||||
const borrower = users[1];
|
const borrower = users[1];
|
||||||
|
@ -79,7 +79,7 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) =>
|
||||||
).to.be.revertedWith(LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD);
|
).to.be.revertedWith(LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('LIQUIDATION - Drop the health factor below 1', async () => {
|
it('Drop the health factor below 1', async () => {
|
||||||
const { dai, users, pool, oracle } = testEnv;
|
const { dai, users, pool, oracle } = testEnv;
|
||||||
const borrower = users[1];
|
const borrower = users[1];
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) =>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('LIQUIDATION - Tries to liquidate a different currency than the loan principal', async () => {
|
it('Tries to liquidate a different currency than the loan principal', async () => {
|
||||||
const { pool, users, weth } = testEnv;
|
const { pool, users, weth } = testEnv;
|
||||||
const borrower = users[1];
|
const borrower = users[1];
|
||||||
//user 2 tries to borrow
|
//user 2 tries to borrow
|
||||||
|
@ -107,7 +107,7 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) =>
|
||||||
).revertedWith(LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER);
|
).revertedWith(LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('LIQUIDATION - Tries to liquidate a different collateral than the borrower collateral', async () => {
|
it('Tries to liquidate a different collateral than the borrower collateral', async () => {
|
||||||
const { pool, dai, users } = testEnv;
|
const { pool, dai, users } = testEnv;
|
||||||
const borrower = users[1];
|
const borrower = users[1];
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) =>
|
||||||
).revertedWith(LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED);
|
).revertedWith(LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('LIQUIDATION - Liquidates the borrow', async () => {
|
it('Liquidates the borrow', async () => {
|
||||||
const { pool, dai, weth, aWETH, aDai, users, oracle, helpersContract, deployer } = testEnv;
|
const { pool, dai, weth, aWETH, aDai, users, oracle, helpersContract, deployer } = testEnv;
|
||||||
const borrower = users[1];
|
const borrower = users[1];
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) =>
|
||||||
|
|
||||||
await oracle.setAssetPrice(
|
await oracle.setAssetPrice(
|
||||||
usdc.address,
|
usdc.address,
|
||||||
new BigNumber(usdcPrice.toString()).multipliedBy(1.2).toFixed(0)
|
new BigNumber(usdcPrice.toString()).multipliedBy(1.12).toFixed(0)
|
||||||
);
|
);
|
||||||
|
|
||||||
//mints dai to the liquidator
|
//mints dai to the liquidator
|
||||||
|
|
|
@ -46,7 +46,7 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset',
|
||||||
await configurator.activateReserve(dai.address);
|
await configurator.activateReserve(dai.address);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('LIQUIDATION - Deposits WETH, borrows DAI', async () => {
|
it('Deposits WETH, borrows DAI', async () => {
|
||||||
const {dai, weth, users, pool, oracle} = testEnv;
|
const {dai, weth, users, pool, oracle} = testEnv;
|
||||||
const depositor = users[0];
|
const depositor = users[0];
|
||||||
const borrower = users[1];
|
const borrower = users[1];
|
||||||
|
@ -101,7 +101,7 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('LIQUIDATION - Drop the health factor below 1', async () => {
|
it('Drop the health factor below 1', async () => {
|
||||||
const {dai, weth, users, pool, oracle} = testEnv;
|
const {dai, weth, users, pool, oracle} = testEnv;
|
||||||
const borrower = users[1];
|
const borrower = users[1];
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('LIQUIDATION - Liquidates the borrow', async () => {
|
it('Liquidates the borrow', async () => {
|
||||||
const {dai, weth, users, pool, oracle, helpersContract} = testEnv;
|
const {dai, weth, users, pool, oracle, helpersContract} = testEnv;
|
||||||
const liquidator = users[3];
|
const liquidator = users[3];
|
||||||
const borrower = users[1];
|
const borrower = users[1];
|
||||||
|
@ -402,7 +402,7 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset',
|
||||||
//drops HF below 1
|
//drops HF below 1
|
||||||
await oracle.setAssetPrice(
|
await oracle.setAssetPrice(
|
||||||
usdc.address,
|
usdc.address,
|
||||||
new BigNumber(usdcPrice.toString()).multipliedBy(1.08).toFixed(0)
|
new BigNumber(usdcPrice.toString()).multipliedBy(1.14).toFixed(0)
|
||||||
);
|
);
|
||||||
|
|
||||||
//mints usdc to the liquidator
|
//mints usdc to the liquidator
|
||||||
|
|
Loading…
Reference in New Issue
Block a user