Fix comments, tests

This commit is contained in:
The3D 2020-10-23 18:41:08 +02:00
parent b660f81baf
commit 6398fe4260
3 changed files with 8 additions and 8 deletions

View File

@ -9,7 +9,7 @@ pragma solidity ^0.6.8;
**/
interface IFlashLoanReceiver {
function executeOperation(
address[] calldata reserve,
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata premiums,
bytes calldata params

View File

@ -499,8 +499,8 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
* as long as the amount taken plus a fee is returned. NOTE There are security concerns for developers of flashloan receiver contracts
* that must be kept into consideration. For further details please visit https://developers.aave.com
* @param receiverAddress The address of the contract receiving the funds. The receiver should implement the IFlashLoanReceiver interface.
* @param assets The address of the principal reserve
* @param amounts The amount requested for this flashloan
* @param assets The addresss of the assets being flashborrowed
* @param amounts The amounts requested for this flashloan for each asset
* @param mode Type of the debt to open if the flash loan is not returned. 0 -> Don't open any debt, just revert, 1 -> stable, 2 -> variable
* @param params Variadic packed params to pass to the receiver as extra information
* @param referralCode Referral code of the flash loan
@ -546,7 +546,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
vars.currentPremium = premiums[vars.i];
vars.currentATokenAddress = aTokenAddresses[vars.i];
vars.currentAmountPlusPremium = amounts[vars.i].add(premiums[vars.i]);
vars.currentAmountPlusPremium = vars.currentAmount.add(vars.currentPremium);
if (vars.debtMode == ReserveLogic.InterestRateMode.NONE) {
_reserves[vars.currentAsset].updateState();
@ -555,7 +555,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
vars.currentPremium
);
_reserves[vars.currentAsset].updateInterestRates(
assets[vars.i],
vars.currentAsset,
vars.currentATokenAddress,
vars.currentPremium,
0

View File

@ -193,7 +193,7 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => {
const callerDebt = await wethDebtToken.balanceOf(caller.address);
expect(callerDebt.toString()).to.be.equal('800720000000000000', 'Invalid user debt');
expect(callerDebt.toString()).to.be.equal('800000000000000000', 'Invalid user debt');
});
it('tries to take a flashloan that is bigger than the available liquidity (revert expected)', async () => {
@ -324,7 +324,7 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => {
const callerDebt = await usdcDebtToken.balanceOf(caller.address);
expect(callerDebt.toString()).to.be.equal('500450000', 'Invalid user debt');
expect(callerDebt.toString()).to.be.equal('500000000', 'Invalid user debt');
});
it('Caller deposits 1000 DAI as collateral, Takes a WETH flashloan with mode = 0, does not approve the transfer of the funds', async () => {
@ -373,6 +373,6 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => {
const callerDebt = await wethDebtToken.balanceOf(caller.address);
expect(callerDebt.toString()).to.be.equal('800720000000000000', 'Invalid user debt');
expect(callerDebt.toString()).to.be.equal('800000000000000000', 'Invalid user debt');
});
});