mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Merge branch 'feat/26-repay-collateral' of gitlab.com:aave-tech/protocol-v2 into feat/26-repay-collateral
This commit is contained in:
commit
2b930e4cd7
|
@ -398,6 +398,10 @@ contract LendingPoolLiquidationManager is ReentrancyGuard, VersionedInitializabl
|
|||
|
||||
vars.collateralAtoken.burn(user, receiver, vars.maxCollateralToLiquidate);
|
||||
|
||||
if (vars.userCollateralBalance == vars.maxCollateralToLiquidate) {
|
||||
usersConfig[user].setUsingAsCollateral(collateralReserve.index, false);
|
||||
}
|
||||
|
||||
address principalAToken = debtReserve.aTokenAddress;
|
||||
|
||||
// Notifies the receiver to proceed, sending as param the underlying already transferred
|
||||
|
|
|
@ -171,6 +171,8 @@ makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => {
|
|||
expectedCollateralLiquidated.toString()
|
||||
)
|
||||
);
|
||||
|
||||
expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.true;
|
||||
});
|
||||
|
||||
it('User 3 deposits WETH and borrows USDC at Variable', async () => {
|
||||
|
@ -271,6 +273,8 @@ makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => {
|
|||
),
|
||||
'INVALID_COLLATERAL_POSITION'
|
||||
);
|
||||
|
||||
expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.true;
|
||||
});
|
||||
|
||||
it('Revert expected. User 3 tries to repay with his collateral a currency he havent borrow', async () => {
|
||||
|
@ -426,6 +430,8 @@ makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => {
|
|||
usdc.address,
|
||||
user.address
|
||||
);
|
||||
|
||||
expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.true;
|
||||
});
|
||||
|
||||
it('User 4 tries to repay a bigger amount that what can be swapped of a particular collateral, repaying only the maximum allowed by that collateral', async () => {
|
||||
|
@ -517,5 +523,7 @@ makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => {
|
|||
);
|
||||
|
||||
expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.equal(0);
|
||||
|
||||
expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.false;
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user