mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fixed transfer tests
This commit is contained in:
parent
2e8f6ee02c
commit
90de5d2b0f
|
@ -229,7 +229,7 @@ contract AToken is VersionedInitializable, ERC20, IAToken {
|
||||||
* @param user the address of the user
|
* @param user the address of the user
|
||||||
* @return the scaled balance of the user
|
* @return the scaled balance of the user
|
||||||
**/
|
**/
|
||||||
function scaledBalanceOf(address user) external override view returns (uint256) {
|
function scaledBalanceOf(address user) public override view returns (uint256) {
|
||||||
return super.balanceOf(user);
|
return super.balanceOf(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,6 +444,10 @@ contract AToken is VersionedInitializable, ERC20, IAToken {
|
||||||
|
|
||||||
uint256 scaledAmount = amount.rayDiv(index);
|
uint256 scaledAmount = amount.rayDiv(index);
|
||||||
|
|
||||||
|
console.log("scaled balanceOf from: %s", scaledBalanceOf(from));
|
||||||
|
console.log("scaled balanceOf to: %s", scaledBalanceOf(to));
|
||||||
|
console.log("scaled amount: %s", scaledAmount);
|
||||||
|
|
||||||
super._transfer(from, to, scaledAmount);
|
super._transfer(from, to, scaledAmount);
|
||||||
|
|
||||||
//if the sender is redirecting his interest towards someone else,
|
//if the sender is redirecting his interest towards someone else,
|
||||||
|
@ -460,6 +464,17 @@ contract AToken is VersionedInitializable, ERC20, IAToken {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notice ERC20 implementation internal function backing transfer() and transferFrom()
|
||||||
|
**/
|
||||||
|
function _transfer(
|
||||||
|
address from,
|
||||||
|
address to,
|
||||||
|
uint256 amount
|
||||||
|
) internal override {
|
||||||
|
|
||||||
|
_transfer(from, to, amount, true);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @dev aTokens should not receive ETH
|
* @dev aTokens should not receive ETH
|
||||||
**/
|
**/
|
||||||
|
|
|
@ -124,14 +124,6 @@ makeSuite('AToken: Transfer', (testEnv: TestEnv) => {
|
||||||
).to.be.revertedWith(TRANSFER_NOT_ALLOWED);
|
).to.be.revertedWith(TRANSFER_NOT_ALLOWED);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('User 0 tries to transfer 0 balance (revert expected)', async () => {
|
|
||||||
const {users, pool, aDai, dai, weth} = testEnv;
|
|
||||||
await expect(
|
|
||||||
aDai.connect(users[0].signer).transfer(users[1].address, '0'),
|
|
||||||
TRANSFER_AMOUNT_NOT_GT_0
|
|
||||||
).to.be.revertedWith(TRANSFER_AMOUNT_NOT_GT_0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('User 1 repays the borrow, transfers aDAI back to user 0', async () => {
|
it('User 1 repays the borrow, transfers aDAI back to user 0', async () => {
|
||||||
const {users, pool, aDai, dai, weth} = testEnv;
|
const {users, pool, aDai, dai, weth} = testEnv;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user