diff --git a/contracts/flashloan/interfaces/IFlashLoanReceiver.sol b/contracts/flashloan/interfaces/IFlashLoanReceiver.sol index 8d4353f3..784d0fa3 100644 --- a/contracts/flashloan/interfaces/IFlashLoanReceiver.sol +++ b/contracts/flashloan/interfaces/IFlashLoanReceiver.sol @@ -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 diff --git a/contracts/lendingpool/LendingPool.sol b/contracts/lendingpool/LendingPool.sol index fc9413ab..a16e9cd6 100644 --- a/contracts/lendingpool/LendingPool.sol +++ b/contracts/lendingpool/LendingPool.sol @@ -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 diff --git a/test/flashloan.spec.ts b/test/flashloan.spec.ts index c34c37b1..4edd4848 100644 --- a/test/flashloan.spec.ts +++ b/test/flashloan.spec.ts @@ -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'); }); });