mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fixes aToken bug
This commit is contained in:
parent
89ad335912
commit
92f2f2a9b3
|
@ -554,7 +554,7 @@ contract AToken is ERC20 {
|
|||
|
||||
bool fromIndexReset = false;
|
||||
//reset the user data if the remaining balance is 0
|
||||
if (fromBalance.sub(_value) == 0) {
|
||||
if (fromBalance.sub(_value) == 0 && _from != _to) {
|
||||
fromIndexReset = resetDataOnZeroBalanceInternal(_from);
|
||||
}
|
||||
|
||||
|
|
|
@ -188,4 +188,19 @@ makeSuite('AToken: Transfer', (testEnv: TestEnv) => {
|
|||
INVALID_REDIRECTED_BALANCE_AFTER_TRANSFER
|
||||
);
|
||||
});
|
||||
|
||||
it('User 1 transfers the whole amount to himself', async () => {
|
||||
const {users, pool, aDai, dai} = testEnv;
|
||||
|
||||
const user1BalanceBefore = await aDai.balanceOf(users[1].address);
|
||||
|
||||
await aDai.connect(users[1].signer).transfer(users[1].address, user1BalanceBefore);
|
||||
|
||||
const user1BalanceAfter = await aDai.balanceOf(users[1].address);
|
||||
|
||||
expect(user1BalanceAfter.toString()).to.be.equal(
|
||||
user1BalanceBefore,
|
||||
INVALID_REDIRECTED_BALANCE_AFTER_TRANSFER
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user