Merge branch 'feat/26-repay-collateral' of gitlab.com:aave-tech/protocol-v2 into feat/26-repay-collateral

This commit is contained in:
David Racero 2020-09-09 14:47:56 +02:00
commit 2b930e4cd7
2 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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;
});
});