diff --git a/contracts/interfaces/ILendingPool.sol b/contracts/interfaces/ILendingPool.sol index 85290836..b14f5cb8 100644 --- a/contracts/interfaces/ILendingPool.sol +++ b/contracts/interfaces/ILendingPool.sol @@ -15,7 +15,8 @@ interface ILendingPool { **/ event Deposit( address indexed reserve, - address indexed user, + address user, + address indexed onBehalfOf, uint256 amount, uint16 indexed referral ); @@ -139,6 +140,7 @@ interface ILendingPool { function deposit( address reserve, uint256 amount, + address onBehalfOf, uint16 referralCode ) external; diff --git a/contracts/lendingpool/LendingPool.sol b/contracts/lendingpool/LendingPool.sol index 092e242f..517dc997 100644 --- a/contracts/lendingpool/LendingPool.sol +++ b/contracts/lendingpool/LendingPool.sol @@ -91,6 +91,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { function deposit( address asset, uint256 amount, + address onBehalfOf, uint16 referralCode ) external override { ReserveLogic.ReserveData storage reserve = _reserves[asset]; @@ -102,18 +103,18 @@ contract LendingPool is VersionedInitializable, ILendingPool { reserve.updateCumulativeIndexesAndTimestamp(); reserve.updateInterestRates(asset, aToken, amount, 0); - bool isFirstDeposit = IAToken(aToken).balanceOf(msg.sender) == 0; + bool isFirstDeposit = IAToken(aToken).balanceOf(onBehalfOf) == 0; if (isFirstDeposit) { - _usersConfig[msg.sender].setUsingAsCollateral(reserve.index, true); + _usersConfig[onBehalfOf].setUsingAsCollateral(reserve.index, true); } //minting AToken to user 1:1 with the specific exchange rate - IAToken(aToken).mint(msg.sender, amount); + IAToken(aToken).mint(onBehalfOf, amount); //transfer to the aToken contract IERC20(asset).safeTransferFrom(msg.sender, aToken, amount); - emit Deposit(asset, msg.sender, amount, referralCode); + emit Deposit(asset, msg.sender, onBehalfOf, amount, referralCode); } /** diff --git a/test/atoken-transfer.spec.ts b/test/atoken-transfer.spec.ts index 1c161608..bd113ce3 100644 --- a/test/atoken-transfer.spec.ts +++ b/test/atoken-transfer.spec.ts @@ -33,7 +33,9 @@ makeSuite('AToken: Transfer', (testEnv: TestEnv) => { //user 1 deposits 1000 DAI const amountDAItoDeposit = await convertToCurrencyDecimals(dai.address, '1000'); - await pool.connect(users[0].signer).deposit(dai.address, amountDAItoDeposit, '0'); + await pool + .connect(users[0].signer) + .deposit(dai.address, amountDAItoDeposit, users[0].address, '0'); await aDai.connect(users[0].signer).transfer(users[1].address, amountDAItoDeposit); @@ -94,12 +96,15 @@ makeSuite('AToken: Transfer', (testEnv: TestEnv) => { it('User 0 deposits 1 WETH and user 1 tries to borrow, but the aTokens received as a transfer are not available as collateral (revert expected)', async () => { const {users, pool, weth} = testEnv; + const userAddress = await pool.signer.getAddress(); await weth.connect(users[0].signer).mint(await convertToCurrencyDecimals(weth.address, '1')); await weth.connect(users[0].signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(users[0].signer).deposit(weth.address, ethers.utils.parseEther('1.0'), '0'); + await pool + .connect(users[0].signer) + .deposit(weth.address, ethers.utils.parseEther('1.0'), userAddress, '0'); await expect( pool .connect(users[1].signer) diff --git a/test/configurator.spec.ts b/test/configurator.spec.ts index a6513e54..6a85791c 100644 --- a/test/configurator.spec.ts +++ b/test/configurator.spec.ts @@ -234,7 +234,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => { it('Reverts when trying to disable the DAI reserve with liquidity on it', async () => { const {dai, pool, configurator} = testEnv; - + const userAddress = await pool.signer.getAddress(); await dai.mint(await convertToCurrencyDecimals(dai.address, '1000')); //approve protocol to access depositor wallet @@ -242,7 +242,7 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => { const amountDAItoDeposit = await convertToCurrencyDecimals(dai.address, '1000'); //user 1 deposits 1000 DAI - await pool.deposit(dai.address, amountDAItoDeposit, '0'); + await pool.deposit(dai.address, amountDAItoDeposit, userAddress, '0'); await expect( configurator.deactivateReserve(dai.address), diff --git a/test/flash-liquidation-with-collateral.spec.ts b/test/flash-liquidation-with-collateral.spec.ts index 87edf6d6..c48b5e99 100644 --- a/test/flash-liquidation-with-collateral.spec.ts +++ b/test/flash-liquidation-with-collateral.spec.ts @@ -20,17 +20,17 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn const {INVALID_HF, COLLATERAL_CANNOT_BE_LIQUIDATED} = ProtocolErrors; it('User 1 provides some liquidity for others to borrow', async () => { - const {pool, weth, dai, usdc} = testEnv; + const {pool, weth, dai, usdc, deployer} = testEnv; await weth.mint(parseEther('200')); await weth.approve(pool.address, parseEther('200')); - await pool.deposit(weth.address, parseEther('200'), 0); + await pool.deposit(weth.address, parseEther('200'), deployer.address, 0); await dai.mint(parseEther('20000')); await dai.approve(pool.address, parseEther('20000')); - await pool.deposit(dai.address, parseEther('20000'), 0); + await pool.deposit(dai.address, parseEther('20000'), deployer.address, 0); await usdc.mint(parseEther('20000')); await usdc.approve(pool.address, parseEther('20000')); - await pool.deposit(usdc.address, parseEther('20000'), 0); + await pool.deposit(usdc.address, parseEther('20000'), deployer.address, 0); }); it('User 5 liquidate User 3 collateral, all his variable debt and part of the stable', async () => { @@ -43,7 +43,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn await weth.connect(user.signer).mint(amountToDeposit); await weth.connect(user.signer).approve(pool.address, amountToDeposit); - await pool.connect(user.signer).deposit(weth.address, amountToDeposit, '0'); + await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0'); const usdcPrice = await oracle.getAssetPrice(usdc.address); @@ -189,7 +189,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(user.signer).deposit(weth.address, amountToDeposit, '0'); + await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0'); const userGlobalData = await pool.getUserAccountData(user.address); @@ -450,7 +450,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(user.signer).deposit(weth.address, amountToDeposit, '0'); + await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0'); const userGlobalData = await pool.getUserAccountData(user.address); @@ -733,8 +733,8 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); await dai.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(user.signer).deposit(weth.address, amountToDepositWeth, '0'); - await pool.connect(user.signer).deposit(dai.address, amountToDepositDAI, '0'); + await pool.connect(user.signer).deposit(weth.address, amountToDepositWeth, user.address, '0'); + await pool.connect(user.signer).deposit(dai.address, amountToDepositDAI, user.address, '0'); await pool.connect(user.signer).borrow(usdc.address, amountToBorrowVariable, 2, 0); @@ -838,11 +838,11 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn await weth.connect(user.signer).mint(amountWETHToDeposit); await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(user.signer).deposit(weth.address, amountWETHToDeposit, '0'); + await pool.connect(user.signer).deposit(weth.address, amountWETHToDeposit, user.address, '0'); await dai.connect(user.signer).mint(amountDAIToDeposit); await dai.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(user.signer).deposit(dai.address, amountDAIToDeposit, '0'); + await pool.connect(user.signer).deposit(dai.address, amountDAIToDeposit, user.address, '0'); await pool.connect(user.signer).borrow(usdc.address, amountToBorrow, 2, 0); }); diff --git a/test/flashloan.spec.ts b/test/flashloan.spec.ts index 7b964158..952bdab4 100644 --- a/test/flashloan.spec.ts +++ b/test/flashloan.spec.ts @@ -30,13 +30,14 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => { it('Deposits ETH into the reserve', async () => { const {pool, weth} = testEnv; + const userAddress = await pool.signer.getAddress(); const amountToDeposit = ethers.utils.parseEther('1'); await weth.mint(amountToDeposit); await weth.approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.deposit(weth.address, amountToDeposit, '0'); + await pool.deposit(weth.address, amountToDeposit, userAddress, '0'); }); it('Takes WETH flashloan with mode = 0, returns the funds correctly', async () => { @@ -143,7 +144,7 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => { const amountToDeposit = await convertToCurrencyDecimals(dai.address, '1000'); - await pool.connect(caller.signer).deposit(dai.address, amountToDeposit, '0'); + await pool.connect(caller.signer).deposit(dai.address, amountToDeposit, caller.address, '0'); await _mockFlashLoanReceiver.setFailExecutionTransfer(true); @@ -210,6 +211,7 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => { it('Deposits USDC into the reserve', async () => { const {usdc, pool} = testEnv; + const userAddress = await pool.signer.getAddress(); await usdc.mint(await convertToCurrencyDecimals(usdc.address, '1000')); @@ -217,7 +219,7 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => { const amountToDeposit = await convertToCurrencyDecimals(usdc.address, '1000'); - await pool.deposit(usdc.address, amountToDeposit, '0'); + await pool.deposit(usdc.address, amountToDeposit, userAddress, '0'); }); it('Takes out a 500 USDC flashloan, returns the funds correctly', async () => { @@ -284,7 +286,7 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => { const amountToDeposit = await convertToCurrencyDecimals(weth.address, '5'); - await pool.connect(caller.signer).deposit(weth.address, amountToDeposit, '0'); + await pool.connect(caller.signer).deposit(weth.address, amountToDeposit, caller.address, '0'); await _mockFlashLoanReceiver.setFailExecutionTransfer(true); @@ -307,7 +309,6 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => { it('Caller deposits 1000 DAI as collateral, Takes a WETH flashloan with mode = 0, does not approve the transfer of the funds', async () => { const {dai, pool, weth, users} = testEnv; - const caller = users[3]; await dai.connect(caller.signer).mint(await convertToCurrencyDecimals(dai.address, '1000')); @@ -316,7 +317,7 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => { const amountToDeposit = await convertToCurrencyDecimals(dai.address, '1000'); - await pool.connect(caller.signer).deposit(dai.address, amountToDeposit, '0'); + await pool.connect(caller.signer).deposit(dai.address, amountToDeposit, caller.address, '0'); const flashAmount = ethers.utils.parseEther('0.8'); diff --git a/test/helpers/actions.ts b/test/helpers/actions.ts index 4442b052..3942fdf3 100644 --- a/test/helpers/actions.ts +++ b/test/helpers/actions.ts @@ -133,7 +133,8 @@ export const approve = async (reserveSymbol: string, user: SignerWithAddress, te export const deposit = async ( reserveSymbol: string, amount: string, - user: SignerWithAddress, + sender: SignerWithAddress, + onBehalfOf: tEthereumAddress, sendValue: string, expectedResult: string, testEnv: TestEnv, @@ -149,8 +150,9 @@ export const deposit = async ( const {reserveData: reserveDataBefore, userData: userDataBefore} = await getContractsData( reserve, - user.address, - testEnv + onBehalfOf, + testEnv, + sender.address ); if (sendValue) { @@ -158,14 +160,16 @@ export const deposit = async ( } if (expectedResult === 'success') { const txResult = await waitForTx( - await await pool.connect(user.signer).deposit(reserve, amountToDeposit, '0', txOptions) + await pool + .connect(sender.signer) + .deposit(reserve, amountToDeposit, onBehalfOf, '0', txOptions) ); const { reserveData: reserveDataAfter, userData: userDataAfter, timestamp, - } = await getContractsData(reserve, user.address, testEnv); + } = await getContractsData(reserve, onBehalfOf, testEnv, sender.address); const {txCost, txTimestamp} = await getTxCostAndTimestamp(txResult); @@ -198,7 +202,7 @@ export const deposit = async ( // }); } else if (expectedResult === 'revert') { await expect( - pool.connect(user.signer).deposit(reserve, amountToDeposit, '0', txOptions), + pool.connect(sender.signer).deposit(reserve, amountToDeposit, onBehalfOf, '0', txOptions), revertMessage ).to.be.reverted; } @@ -845,10 +849,15 @@ const getTxCostAndTimestamp = async (tx: ContractReceipt) => { return {txCost, txTimestamp}; }; -export const getContractsData = async (reserve: string, user: string, testEnv: TestEnv) => { +export const getContractsData = async ( + reserve: string, + user: string, + testEnv: TestEnv, + sender?: string +) => { const {pool} = testEnv; const reserveData = await getReserveData(pool, reserve); - const userData = await getUserData(pool, reserve, user); + const userData = await getUserData(pool, reserve, user, sender || user); const timestamp = await timeLatest(); return { diff --git a/test/helpers/scenario-engine.ts b/test/helpers/scenario-engine.ts index 735d3b84..260e87e5 100644 --- a/test/helpers/scenario-engine.ts +++ b/test/helpers/scenario-engine.ts @@ -92,13 +92,25 @@ const executeAction = async (action: Action, users: SignerWithAddress[], testEnv case 'deposit': { - const {amount, sendValue} = action.args; + const {amount, sendValue, onBehalfOf: onBehalfOfIndex} = action.args; + const onBehalfOf = onBehalfOfIndex + ? users[parseInt(onBehalfOfIndex)].address + : user.address; if (!amount || amount === '') { throw `Invalid amount to deposit into the ${reserve} reserve`; } - await deposit(reserve, amount, user, sendValue, expected, testEnv, revertMessage); + await deposit( + reserve, + amount, + user, + onBehalfOf, + sendValue, + expected, + testEnv, + revertMessage + ); } break; diff --git a/test/helpers/scenarios/deposit.json b/test/helpers/scenarios/deposit.json index 34f9c9e9..2456d931 100644 --- a/test/helpers/scenarios/deposit.json +++ b/test/helpers/scenarios/deposit.json @@ -206,7 +206,6 @@ "name": "deposit", "args": { "reserve": "WETH", - "amount": "0", "user": "1" }, @@ -229,6 +228,40 @@ "revertMessage": "Amount must be greater than 0" } ] + }, + { + "description": "User 1 deposits 100 DAI on behalf of user 2, user 2 tries to borrow 0.1 WETH", + "actions": [ + { + "name": "mint", + "args": { + "reserve": "DAI", + "amount": "100", + "user": "1" + }, + "expected": "success" + }, + { + "name": "deposit", + "args": { + "reserve": "DAI", + "amount": "100", + "user": "1", + "onBehalfOf": "2" + }, + "expected": "success" + }, + { + "name": "borrow", + "args": { + "reserve": "WETH", + "amount": "0.1", + "borrowRateMode": "variable", + "user": "2" + }, + "expected": "success" + } + ] } ] } diff --git a/test/helpers/utils/helpers.ts b/test/helpers/utils/helpers.ts index c20c67ac..9dac685b 100644 --- a/test/helpers/utils/helpers.ts +++ b/test/helpers/utils/helpers.ts @@ -61,7 +61,8 @@ export const getReserveData = async ( export const getUserData = async ( pool: LendingPool, reserve: string, - user: string + user: tEthereumAddress, + sender?: tEthereumAddress ): Promise => { const [userData, aTokenData] = await Promise.all([ pool.getUserReserveData(reserve, user), @@ -77,7 +78,7 @@ export const getUserData = async ( ] = aTokenData; const token = await getMintableErc20(reserve); - const walletBalance = new BigNumber((await token.balanceOf(user)).toString()); + const walletBalance = new BigNumber((await token.balanceOf(sender || user)).toString()); return { principalATokenBalance: new BigNumber(principalATokenBalance), diff --git a/test/liquidation-atoken.spec.ts b/test/liquidation-atoken.spec.ts index 9ee03e45..342c2a63 100644 --- a/test/liquidation-atoken.spec.ts +++ b/test/liquidation-atoken.spec.ts @@ -32,7 +32,9 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) => //user 1 deposits 1000 DAI const amountDAItoDeposit = await convertToCurrencyDecimals(dai.address, '1000'); - await pool.connect(depositor.signer).deposit(dai.address, amountDAItoDeposit, '0'); + await pool + .connect(depositor.signer) + .deposit(dai.address, amountDAItoDeposit, depositor.address, '0'); const amountETHtoDeposit = await convertToCurrencyDecimals(weth.address, '1'); @@ -43,7 +45,9 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) => await weth.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); //user 2 deposits 1 WETH - await pool.connect(borrower.signer).deposit(weth.address, amountETHtoDeposit, '0'); + await pool + .connect(borrower.signer) + .deposit(weth.address, amountETHtoDeposit, borrower.address, '0'); //user 2 borrows const userGlobalData = await pool.getUserAccountData(borrower.address); @@ -225,7 +229,9 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) => //user 3 deposits 1000 USDC const amountUSDCtoDeposit = await convertToCurrencyDecimals(usdc.address, '1000'); - await pool.connect(depositor.signer).deposit(usdc.address, amountUSDCtoDeposit, '0'); + await pool + .connect(depositor.signer) + .deposit(usdc.address, amountUSDCtoDeposit, depositor.address, '0'); //user 4 deposits 1 ETH const amountETHtoDeposit = await convertToCurrencyDecimals(weth.address, '1'); @@ -236,7 +242,9 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) => //approve protocol to access borrower wallet await weth.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(borrower.signer).deposit(weth.address, amountETHtoDeposit, '0'); + await pool + .connect(borrower.signer) + .deposit(weth.address, amountETHtoDeposit, borrower.address, '0'); //user 4 borrows const userGlobalData = await pool.getUserAccountData(borrower.address); diff --git a/test/liquidation-underlying.spec.ts b/test/liquidation-underlying.spec.ts index 9ae7f81b..3f2aecbc 100644 --- a/test/liquidation-underlying.spec.ts +++ b/test/liquidation-underlying.spec.ts @@ -37,7 +37,9 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', //user 1 deposits 1000 DAI const amountDAItoDeposit = await convertToCurrencyDecimals(dai.address, '1000'); - await pool.connect(depositor.signer).deposit(dai.address, amountDAItoDeposit, '0'); + await pool + .connect(depositor.signer) + .deposit(dai.address, amountDAItoDeposit, depositor.address, '0'); //user 2 deposits 1 ETH const amountETHtoDeposit = await convertToCurrencyDecimals(weth.address, '1'); @@ -47,7 +49,9 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', //approve protocol to access the borrower wallet await weth.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(borrower.signer).deposit(weth.address, amountETHtoDeposit, '0'); + await pool + .connect(borrower.signer) + .deposit(weth.address, amountETHtoDeposit, borrower.address, '0'); //user 2 borrows @@ -204,7 +208,9 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', //depositor deposits 1000 USDC const amountUSDCtoDeposit = await convertToCurrencyDecimals(usdc.address, '1000'); - await pool.connect(depositor.signer).deposit(usdc.address, amountUSDCtoDeposit, '0'); + await pool + .connect(depositor.signer) + .deposit(usdc.address, amountUSDCtoDeposit, depositor.address, '0'); //borrower deposits 1 ETH const amountETHtoDeposit = await convertToCurrencyDecimals(weth.address, '1'); @@ -215,7 +221,9 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', //approve protocol to access the borrower wallet await weth.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(borrower.signer).deposit(weth.address, amountETHtoDeposit, '0'); + await pool + .connect(borrower.signer) + .deposit(weth.address, amountETHtoDeposit, borrower.address, '0'); //borrower borrows const userGlobalData = await pool.getUserAccountData(borrower.address); @@ -345,7 +353,9 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', //borrower deposits 1000 LEND const amountLENDtoDeposit = await convertToCurrencyDecimals(lend.address, '1000'); - await pool.connect(borrower.signer).deposit(lend.address, amountLENDtoDeposit, '0'); + await pool + .connect(borrower.signer) + .deposit(lend.address, amountLENDtoDeposit, borrower.address, '0'); const usdcPrice = await oracle.getAssetPrice(usdc.address); //drops HF below 1 diff --git a/test/repay-with-collateral.spec.ts b/test/repay-with-collateral.spec.ts index 2fbe66fc..faefa403 100644 --- a/test/repay-with-collateral.spec.ts +++ b/test/repay-with-collateral.spec.ts @@ -40,17 +40,17 @@ export const expectRepayWithCollateralEvent = ( makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => { it('User 1 provides some liquidity for others to borrow', async () => { - const {pool, weth, dai, usdc} = testEnv; + const {pool, weth, dai, usdc, deployer} = testEnv; await weth.mint(parseEther('200')); await weth.approve(pool.address, parseEther('200')); - await pool.deposit(weth.address, parseEther('200'), 0); + await pool.deposit(weth.address, parseEther('200'), deployer.address, 0); await dai.mint(parseEther('20000')); await dai.approve(pool.address, parseEther('20000')); - await pool.deposit(dai.address, parseEther('20000'), 0); + await pool.deposit(dai.address, parseEther('20000'), deployer.address, 0); await usdc.mint(parseEther('20000')); await usdc.approve(pool.address, parseEther('20000')); - await pool.deposit(usdc.address, parseEther('20000'), 0); + await pool.deposit(usdc.address, parseEther('20000'), deployer.address, 0); }); it('User 2 deposit WETH and borrows DAI at Variable', async () => { @@ -63,7 +63,7 @@ makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => { await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(user.signer).deposit(weth.address, amountToDeposit, '0'); + await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0'); await pool.connect(user.signer).borrow(dai.address, amountToBorrow, 2, 0); }); @@ -185,7 +185,7 @@ makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => { await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(user.signer).deposit(weth.address, amountToDeposit, '0'); + await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0'); await pool.connect(user.signer).borrow(usdc.address, amountToBorrow, 2, 0); }); @@ -307,7 +307,7 @@ makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => { await weth.connect(user.signer).mint(amountToDeposit); - await pool.connect(user.signer).deposit(weth.address, amountToDeposit, '0'); + await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0'); await pool.connect(user.signer).borrow(usdc.address, amountToBorrowVariable, 2, 0); @@ -447,8 +447,8 @@ makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => { await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); await dai.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(user.signer).deposit(weth.address, amountToDepositWeth, '0'); - await pool.connect(user.signer).deposit(dai.address, amountToDepositDAI, '0'); + await pool.connect(user.signer).deposit(weth.address, amountToDepositWeth, user.address, '0'); + await pool.connect(user.signer).deposit(dai.address, amountToDepositDAI, user.address, '0'); await pool.connect(user.signer).borrow(dai.address, amountToBorrowVariable, 2, 0); @@ -536,11 +536,11 @@ makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => { await weth.connect(user.signer).mint(amountWETHToDeposit); await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(user.signer).deposit(weth.address, amountWETHToDeposit, '0'); + await pool.connect(user.signer).deposit(weth.address, amountWETHToDeposit, user.address, '0'); await dai.connect(user.signer).mint(amountDAIToDeposit); await dai.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - await pool.connect(user.signer).deposit(dai.address, amountDAIToDeposit, '0'); + await pool.connect(user.signer).deposit(dai.address, amountDAIToDeposit, user.address, '0'); await pool.connect(user.signer).borrow(usdc.address, amountToBorrow, 2, 0); });