From 5d28f586885fb2fefbcac53f70cdd1c36b0d8d15 Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Wed, 6 Mar 2024 13:49:14 +0100 Subject: [PATCH] fix: Bump aave dependencies and fix tests --- .../mocks/flashloan/MockFlashLoanReceiver.sol | 2 +- .../flashloan/MockSimpleFlashLoanReceiver.sol | 2 +- contracts/mocks/tests/FlashloanAttacker.sol | 4 +-- package.json | 6 ++-- test-suites/atoken-event-accounting.spec.ts | 5 ++- test-suites/atoken-events.spec.ts | 7 +++-- test-suites/atoken-repay.spec.ts | 6 ++-- test-suites/atoken-transfer.spec.ts | 6 +++- test-suites/configurator-borrow-cap.spec.ts | 5 +-- ...figurator-liquidation-protocol-fee.spec.ts | 4 +-- .../configurator-rate-strategy.spec.ts | 18 ++++++++--- test-suites/configurator-supply-cap.spec.ts | 4 +-- test-suites/configurator.spec.ts | 4 +-- .../debt-token-delegation-permit.spec.ts | 4 ++- test-suites/emode.spec.ts | 24 ++++++++------ test-suites/helpers/actions.ts | 2 +- test-suites/helpers/make-suite.ts | 31 ++++++++++++++++--- test-suites/isolation-mode.spec.ts | 21 ++++++++++--- test-suites/liquidation-atoken.spec.ts | 8 +++-- test-suites/liquidation-edge.spec.ts | 12 +++++-- test-suites/liquidation-emode.spec.ts | 12 +++++-- test-suites/liquidation-underlying.spec.ts | 10 ++++-- test-suites/liquidation-with-fee.spec.ts | 20 +++++++++--- test-suites/liquidity-indexes.spec.ts | 3 +- test-suites/ltv-validation.spec.ts | 4 +-- test-suites/pausable-pool.spec.ts | 8 +++-- test-suites/pausable-reserve.spec.ts | 8 +++-- test-suites/pool-authorized-flashloan.spec.ts | 8 +++-- test-suites/pool-drop-reserve.spec.ts | 2 +- test-suites/pool-edge.spec.ts | 22 +++++++++---- test-suites/pool-flashloan.spec.ts | 13 +++++--- test-suites/pool-normal-flashloan.spec.ts | 4 +-- test-suites/pool-simple-flashloan.spec.ts | 4 +-- test-suites/price-oracle-sentinel.spec.ts | 20 +++++++++--- test-suites/stable-debt-token-events.spec.ts | 7 +++-- test-suites/stable-debt-token.spec.ts | 12 +++++-- .../variable-debt-token-events.spec.ts | 7 +++-- test-suites/variable-debt-token.spec.ts | 16 +++++++--- 38 files changed, 251 insertions(+), 104 deletions(-) diff --git a/contracts/mocks/flashloan/MockFlashLoanReceiver.sol b/contracts/mocks/flashloan/MockFlashLoanReceiver.sol index c521de7dc..4b249da28 100644 --- a/contracts/mocks/flashloan/MockFlashLoanReceiver.sol +++ b/contracts/mocks/flashloan/MockFlashLoanReceiver.sol @@ -66,7 +66,7 @@ contract MockFlashLoanReceiver is FlashLoanReceiverBase { : amounts[i] + premiums[i]; //execution does not fail - mint tokens and return them to the _destination - token.mint(premiums[i]); + token.mint(address(this), premiums[i]); IERC20(assets[i]).approve(address(POOL), amountToReturn); } diff --git a/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol b/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol index 432e141ba..d0d1b9d40 100644 --- a/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol +++ b/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol @@ -63,7 +63,7 @@ contract MockFlashLoanSimpleReceiver is FlashLoanSimpleReceiverBase { uint256 amountToReturn = (_amountToApprove != 0) ? _amountToApprove : amount.add(premium); //execution does not fail - mint tokens and return them to the _destination - token.mint(premium); + token.mint(address(this), premium); IERC20(asset).approve(address(POOL), amountToReturn); diff --git a/contracts/mocks/tests/FlashloanAttacker.sol b/contracts/mocks/tests/FlashloanAttacker.sol index 9b5375019..9e47715a8 100644 --- a/contracts/mocks/tests/FlashloanAttacker.sol +++ b/contracts/mocks/tests/FlashloanAttacker.sol @@ -24,7 +24,7 @@ contract FlashloanAttacker is FlashLoanSimpleReceiverBase { function supplyAsset(address asset, uint256 amount) public { MintableERC20 token = MintableERC20(asset); - token.mint(amount); + token.mint(address(this), amount); token.approve(address(_pool), type(uint256).max); _pool.supply(asset, amount, address(this), 0); } @@ -49,7 +49,7 @@ contract FlashloanAttacker is FlashLoanSimpleReceiverBase { // Also do a normal borrow here in the middle _innerBorrow(asset); - token.mint(premium); + token.mint(address(this), premium); IERC20(asset).approve(address(POOL), amountToReturn); return true; diff --git a/package.json b/package.json index dd542fecd..f353dde76 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aave/core-v3", - "version": "1.19.2-beta.1", + "version": "1.19.2-beta.2", "description": "Aave Protocol V3 core smart contracts", "files": [ "contracts", @@ -33,8 +33,8 @@ "prepublish": "npm run compile && npm run build" }, "devDependencies": { - "@aave/deploy-v3": "1.56.0", - "@aave/periphery-v3": "2.5.0", + "@aave/deploy-v3": "1.56.0-beta.5", + "@aave/periphery-v3": "2.5.0-beta.8", "@ethersproject/bignumber": "^5.6.2", "@nomicfoundation/hardhat-chai-matchers": "1.0.5", "@nomicfoundation/hardhat-toolbox": "^2.0.0", diff --git a/test-suites/atoken-event-accounting.spec.ts b/test-suites/atoken-event-accounting.spec.ts index 97ef6b840..e565efa2f 100644 --- a/test-suites/atoken-event-accounting.spec.ts +++ b/test-suites/atoken-event-accounting.spec.ts @@ -141,7 +141,10 @@ makeSuite('AToken: Mint and Burn Event Accounting', (testEnv) => { await waitForTx( await weth .connect(borrower.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(weth.address, '20000')) + ['mint(address,uint256)']( + borrower.address, + await convertToCurrencyDecimals(weth.address, '20000') + ) ); // approve protocol to access the borrower wallet diff --git a/test-suites/atoken-events.spec.ts b/test-suites/atoken-events.spec.ts index 68939197f..7fb0238dd 100644 --- a/test-suites/atoken-events.spec.ts +++ b/test-suites/atoken-events.spec.ts @@ -54,7 +54,10 @@ const increaseSupplyIndex = async ( await collateralToken .connect(borrower.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(collateralToken.address, '10000000')); + ['mint(address,uint256)']( + borrower.address, + await convertToCurrencyDecimals(collateralToken.address, '10000000') + ); await collateralToken.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(borrower.signer) @@ -111,7 +114,7 @@ makeSuite('AToken: Events', (testEnv: TestEnv) => { const usersToInit = [alice, bob, eve, borrower, borrower2]; for (const user of usersToInit) { await dai.connect(user.signer)['mint(uint256)'](amountToMint); - await weth.connect(user.signer)['mint(uint256)'](amountToMint); + await weth.connect(user.signer)['mint(address,uint256)'](user.address, amountToMint); await dai.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); } diff --git a/test-suites/atoken-repay.spec.ts b/test-suites/atoken-repay.spec.ts index d544a5b62..11dd558ed 100644 --- a/test-suites/atoken-repay.spec.ts +++ b/test-suites/atoken-repay.spec.ts @@ -36,7 +36,9 @@ makeSuite('AToken: Repay', (testEnv: TestEnv) => { const daiAmount = utils.parseEther('100'); const wethAmount = utils.parseEther('1'); await waitForTx(await dai.connect(user0.signer)['mint(uint256)'](daiAmount)); - await waitForTx(await weth.connect(user1.signer)['mint(uint256)'](wethAmount)); + await waitForTx( + await weth.connect(user1.signer)['mint(address,uint256)'](user1.address, wethAmount) + ); await waitForTx(await dai.connect(user0.signer).approve(pool.address, MAX_UINT_AMOUNT)); await waitForTx(await weth.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT)); @@ -223,7 +225,7 @@ makeSuite('AToken: Repay', (testEnv: TestEnv) => { await pool.connect(user.signer).supply(dai.address, depositAmount, user.address, 0); const collateralAmount = parseUnits('100', 18); - await weth.connect(user.signer)['mint(uint256)'](collateralAmount); + await weth.connect(user.signer)['mint(address,uint256)'](user.address, collateralAmount); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool.connect(user.signer).supply(weth.address, collateralAmount, user.address, 0); diff --git a/test-suites/atoken-transfer.spec.ts b/test-suites/atoken-transfer.spec.ts index 79b963f13..a657d9b61 100644 --- a/test-suites/atoken-transfer.spec.ts +++ b/test-suites/atoken-transfer.spec.ts @@ -193,7 +193,11 @@ makeSuite('AToken: Transfer', (testEnv: TestEnv) => { const amountWETHtoDeposit = await convertToCurrencyDecimals(weth.address, '1'); const amountWETHtoBorrow = await convertToCurrencyDecimals(weth.address, '0.1'); - expect(await weth.connect(users[0].signer)['mint(uint256)'](amountWETHtoDeposit)); + expect( + await weth + .connect(users[0].signer) + ['mint(address,uint256)'](users[0].address, amountWETHtoDeposit) + ); expect(await weth.connect(users[0].signer).approve(pool.address, MAX_UINT_AMOUNT)); diff --git a/test-suites/configurator-borrow-cap.spec.ts b/test-suites/configurator-borrow-cap.spec.ts index 72acc9162..bdb23366c 100644 --- a/test-suites/configurator-borrow-cap.spec.ts +++ b/test-suites/configurator-borrow-cap.spec.ts @@ -16,17 +16,18 @@ makeSuite('PoolConfigurator: Borrow Cap', (testEnv: TestEnv) => { dai, usdc, users: [user1], + deployer, } = testEnv; const mintedAmount = utils.parseEther('1000000000'); // minting for main user expect(await dai['mint(uint256)'](mintedAmount)); - expect(await weth['mint(uint256)'](mintedAmount)); + expect(await weth['mint(address,uint256)'](deployer.address, mintedAmount)); expect(await usdc['mint(uint256)'](mintedAmount)); // minting for lp user expect(await dai.connect(user1.signer)['mint(uint256)'](mintedAmount)); - expect(await weth.connect(user1.signer)['mint(uint256)'](mintedAmount)); + expect(await weth.connect(user1.signer)['mint(address,uint256)'](user1.address, mintedAmount)); expect(await usdc.connect(user1.signer)['mint(uint256)'](mintedAmount)); expect(await dai.approve(pool.address, MAX_UINT_AMOUNT)); diff --git a/test-suites/configurator-liquidation-protocol-fee.spec.ts b/test-suites/configurator-liquidation-protocol-fee.spec.ts index 8db9a4e4a..fc3155edd 100644 --- a/test-suites/configurator-liquidation-protocol-fee.spec.ts +++ b/test-suites/configurator-liquidation-protocol-fee.spec.ts @@ -8,11 +8,11 @@ makeSuite('PoolConfigurator: Liquidation Protocol Fee', (testEnv: TestEnv) => { const { INVALID_LIQUIDATION_PROTOCOL_FEE } = ProtocolErrors; before(async () => { - const { weth, pool, dai, usdc } = testEnv; + const { weth, pool, dai, usdc, deployer } = testEnv; const mintedAmount = utils.parseEther('1000000000'); await dai['mint(uint256)'](mintedAmount); - await weth['mint(uint256)'](mintedAmount); + await weth['mint(address,uint256)'](deployer.address, mintedAmount); await usdc['mint(uint256)'](mintedAmount); await dai.approve(pool.address, MAX_UINT_AMOUNT); diff --git a/test-suites/configurator-rate-strategy.spec.ts b/test-suites/configurator-rate-strategy.spec.ts index c3fd06f14..372d7806d 100644 --- a/test-suites/configurator-rate-strategy.spec.ts +++ b/test-suites/configurator-rate-strategy.spec.ts @@ -35,7 +35,9 @@ makeSuite('PoolConfigurator: Set Rate Strategy', (testEnv: TestEnv) => { expect( await pool.connect(depositor.signer).deposit(dai.address, mintedAmount, depositor.address, 0) ); - expect(await weth.connect(borrower.signer)['mint(uint256)'](mintedAmount)); + expect( + await weth.connect(borrower.signer)['mint(address,uint256)'](borrower.address, mintedAmount) + ); expect(await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT)); expect( await pool.connect(borrower.signer).deposit(weth.address, mintedAmount, borrower.address, 0) @@ -116,7 +118,9 @@ makeSuite('PoolConfigurator: Set Rate Strategy', (testEnv: TestEnv) => { expect( await pool.connect(depositor.signer).deposit(dai.address, mintedAmount, depositor.address, 0) ); - expect(await weth.connect(borrower.signer)['mint(uint256)'](mintedAmount)); + expect( + await weth.connect(borrower.signer)['mint(address,uint256)'](borrower.address, mintedAmount) + ); expect(await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT)); expect( await pool.connect(borrower.signer).deposit(weth.address, mintedAmount, borrower.address, 0) @@ -210,7 +214,9 @@ makeSuite('PoolConfigurator: Set Rate Strategy', (testEnv: TestEnv) => { expect( await pool.connect(depositor.signer).deposit(dai.address, mintedAmount, depositor.address, 0) ); - expect(await weth.connect(borrower.signer)['mint(uint256)'](mintedAmount)); + expect( + await weth.connect(borrower.signer)['mint(address,uint256)'](borrower.address, mintedAmount) + ); expect(await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT)); expect( await pool.connect(borrower.signer).deposit(weth.address, mintedAmount, borrower.address, 0) @@ -220,7 +226,11 @@ makeSuite('PoolConfigurator: Set Rate Strategy', (testEnv: TestEnv) => { .connect(borrower.signer) .borrow(dai.address, utils.parseEther('1'), 2, 0, borrower.address) ); - expect(await weth.connect(stableBorrower.signer)['mint(uint256)'](mintedAmount)); + expect( + await weth + .connect(stableBorrower.signer) + ['mint(address,uint256)'](stableBorrower.address, mintedAmount) + ); expect(await weth.connect(stableBorrower.signer).approve(pool.address, MAX_UINT_AMOUNT)); expect( await pool diff --git a/test-suites/configurator-supply-cap.spec.ts b/test-suites/configurator-supply-cap.spec.ts index cd0577dee..4b4d8bf5a 100644 --- a/test-suites/configurator-supply-cap.spec.ts +++ b/test-suites/configurator-supply-cap.spec.ts @@ -10,11 +10,11 @@ makeSuite('PoolConfigurator: Supply Cap', (testEnv: TestEnv) => { const { SUPPLY_CAP_EXCEEDED, INVALID_SUPPLY_CAP } = ProtocolErrors; before(async () => { - const { weth, pool, dai, usdc } = testEnv; + const { weth, pool, dai, usdc, deployer } = testEnv; const mintedAmount = utils.parseEther('1000000000'); await dai['mint(uint256)'](mintedAmount); - await weth['mint(uint256)'](mintedAmount); + await weth['mint(address,uint256)'](deployer.address, mintedAmount); await usdc['mint(uint256)'](mintedAmount); await dai.approve(pool.address, MAX_UINT_AMOUNT); diff --git a/test-suites/configurator.spec.ts b/test-suites/configurator.spec.ts index 289c8efd3..eab943fa4 100644 --- a/test-suites/configurator.spec.ts +++ b/test-suites/configurator.spec.ts @@ -936,7 +936,7 @@ makeSuite('PoolConfigurator', (testEnv: TestEnv) => { const wethAmount = utils.parseEther('1'); const daiAmount = utils.parseEther('1000'); // user 1 supplies WETH - await weth.connect(user1.signer)['mint(uint256)'](wethAmount); + await weth.connect(user1.signer)['mint(address,uint256)'](user1.address, wethAmount); await weth.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT); @@ -1020,7 +1020,7 @@ makeSuite('PoolConfigurator', (testEnv: TestEnv) => { await configurator.connect(riskAdmin.signer).setDebtCeiling(weth.address, '0'); // user 1 deposits - await weth.connect(user1.signer)['mint(uint256)']('100'); + await weth.connect(user1.signer)['mint(address,uint256)'](user1.address, '100'); await weth.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT); diff --git a/test-suites/debt-token-delegation-permit.spec.ts b/test-suites/debt-token-delegation-permit.spec.ts index 59613825d..2e29ec014 100644 --- a/test-suites/debt-token-delegation-permit.spec.ts +++ b/test-suites/debt-token-delegation-permit.spec.ts @@ -49,7 +49,9 @@ makeSuite('DebtToken: Permit Delegation', (testEnv: TestEnv) => { expect(await dai['mint(uint256)'](daiMintedAmount)); expect(await dai.approve(pool.address, daiMintedAmount)); expect(await pool.deposit(dai.address, daiMintedAmount, user1.address, 0)); - expect(await weth.connect(user2.signer)['mint(uint256)'](wethMintedAmount)); + expect( + await weth.connect(user2.signer)['mint(address,uint256)'](user2.address, wethMintedAmount) + ); expect(await weth.connect(user2.signer).approve(pool.address, wethMintedAmount)); expect( await pool.connect(user2.signer).deposit(weth.address, wethMintedAmount, user2.address, 0) diff --git a/test-suites/emode.spec.ts b/test-suites/emode.spec.ts index 542b4e726..b7649da68 100644 --- a/test-suites/emode.spec.ts +++ b/test-suites/emode.spec.ts @@ -6,7 +6,7 @@ import { convertToCurrencyDecimals } from '../helpers/contracts-helpers'; import { makeSuite, TestEnv } from './helpers/make-suite'; import './helpers/utils/wadraymath'; import { parseUnits, formatUnits, parseEther } from '@ethersproject/units'; -import { evmSnapshot, evmRevert, VariableDebtToken__factory } from '@aave/deploy-v3'; +import { evmSnapshot, evmRevert, VariableDebtToken__factory, aave } from '@aave/deploy-v3'; makeSuite('EfficiencyMode', (testEnv: TestEnv) => { const { @@ -45,14 +45,16 @@ makeSuite('EfficiencyMode', (testEnv: TestEnv) => { weth, users: [user0, user1, user2], aaveOracle, + aave, + oracle, } = testEnv; const mintAmount = utils.parseEther('10000'); await dai.connect(user0.signer)['mint(uint256)'](mintAmount); await usdc.connect(user0.signer)['mint(uint256)'](mintAmount); - await weth.connect(user0.signer)['mint(uint256)'](mintAmount); + await weth.connect(user0.signer)['mint(address,uint256)'](user0.address, mintAmount); await usdc.connect(user1.signer)['mint(uint256)'](mintAmount); - await weth.connect(user1.signer)['mint(uint256)'](mintAmount); + await weth.connect(user1.signer)['mint(address,uint256)'](user1.address, mintAmount); await dai.connect(user2.signer)['mint(uint256)'](mintAmount); await dai.connect(user0.signer).approve(pool.address, MAX_UINT_AMOUNT); @@ -251,9 +253,9 @@ makeSuite('EfficiencyMode', (testEnv: TestEnv) => { helpersContract, weth, users: [, user1], - oracle, + aaveOracle, } = testEnv; - const wethPrice = await oracle.getAssetPrice(weth.address); + const wethPrice = await aaveOracle.getAssetPrice(weth.address); const userDataBeforeSupply = await pool.getUserAccountData(user1.address); @@ -456,7 +458,11 @@ makeSuite('EfficiencyMode', (testEnv: TestEnv) => { user4.signer ); - expect(await weth.connect(user3.signer)['mint(uint256)'](parseUnits('100', 18))); + expect( + await weth + .connect(user3.signer) + ['mint(address,uint256)'](user3.address, parseUnits('100', 18)) + ); expect(await weth.connect(user3.signer).approve(pool.address, MAX_UINT_AMOUNT)); expect( await pool.connect(user3.signer).supply(weth.address, parseUnits('100', 18), user3.address, 0) @@ -760,7 +766,7 @@ makeSuite('EfficiencyMode', (testEnv: TestEnv) => { pool, dai, usdc, - oracle, + aaveOracle, users: [, , user2], } = testEnv; @@ -769,8 +775,8 @@ makeSuite('EfficiencyMode', (testEnv: TestEnv) => { expect(await pool.connect(user2.signer).supply(dai.address, daiAmount, user2.address, 0)); - const daiPrice = await oracle.getAssetPrice(dai.address); - const usdcPrice = await oracle.getAssetPrice(usdc.address); + const daiPrice = await aaveOracle.getAssetPrice(dai.address); + const usdcPrice = await aaveOracle.getAssetPrice(usdc.address); const dataBefore = await pool.getUserAccountData(user2.address); const expectedCollateralDaiPrice = daiAmount.wadMul(daiPrice); diff --git a/test-suites/helpers/actions.ts b/test-suites/helpers/actions.ts index a755aff0e..9a3296422 100644 --- a/test-suites/helpers/actions.ts +++ b/test-suites/helpers/actions.ts @@ -126,7 +126,7 @@ export const mint = async (reserveSymbol: string, amount: string, user: SignerWi await waitForTx( await token .connect(user.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(reserve, amount)) + ['mint(address,uint256)'](user.address, await convertToCurrencyDecimals(reserve, amount)) ); }; diff --git a/test-suites/helpers/make-suite.ts b/test-suites/helpers/make-suite.ts index 371388944..7e8473f2c 100644 --- a/test-suites/helpers/make-suite.ts +++ b/test-suites/helpers/make-suite.ts @@ -1,4 +1,5 @@ import { Signer } from 'ethers'; +import { BigNumber } from '@ethersproject/bignumber'; import { getPool, getPoolAddressesProvider, @@ -12,15 +13,21 @@ import { getStableDebtToken, getAaveOracle, getACLManager, - getFallbackOracle, } from '@aave/deploy-v3/dist/helpers/contract-getters'; -import { tEthereumAddress } from '../../helpers/types'; +import { + waitForTx, + evmSnapshot, + evmRevert, + getEthersSigners, + deployPriceOracle, + Faucet, + getFaucet, +} from '@aave/deploy-v3'; import { Pool } from '../../types/Pool'; import { AaveProtocolDataProvider } from '../../types/AaveProtocolDataProvider'; import { MintableERC20 } from '../../types/MintableERC20'; import { AToken } from '../../types/AToken'; import { PoolConfigurator } from '../../types/PoolConfigurator'; - import { PriceOracle } from '../../types/PriceOracle'; import { PoolAddressesProvider } from '../../types/PoolAddressesProvider'; import { PoolAddressesProviderRegistry } from '../../types/PoolAddressesProviderRegistry'; @@ -28,7 +35,7 @@ import { WETH9Mocked } from '../../types/WETH9Mocked'; import { AaveOracle, ACLManager, StableDebtToken, VariableDebtToken } from '../../types'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { usingTenderly } from '../../helpers/tenderly-utils'; -import { waitForTx, evmSnapshot, evmRevert, getEthersSigners } from '@aave/deploy-v3'; +import { tEthereumAddress } from '../../helpers/types'; declare var hre: HardhatRuntimeEnvironment; @@ -49,6 +56,7 @@ export interface TestEnv { helpersContract: AaveProtocolDataProvider; weth: WETH9Mocked; aWETH: AToken; + faucetMintable: Faucet; dai: MintableERC20; aDai: AToken; aAave: AToken; @@ -80,6 +88,7 @@ const testEnv: TestEnv = { aaveOracle: {} as AaveOracle, weth: {} as WETH9Mocked, aWETH: {} as AToken, + faucetMintable: {} as Faucet, dai: {} as MintableERC20, aDai: {} as AToken, variableDebtDai: {} as VariableDebtToken, @@ -117,7 +126,7 @@ export async function initializeMakeSuite() { testEnv.registry = await getPoolAddressesProviderRegistry(); testEnv.aclManager = await getACLManager(); - testEnv.oracle = await getFallbackOracle(); + testEnv.oracle = await deployPriceOracle(); testEnv.aaveOracle = await getAaveOracle(); testEnv.helpersContract = await getAaveProtocolDataProvider(); @@ -146,6 +155,7 @@ export async function initializeMakeSuite() { throw 'Missing mandatory tokens'; } + testEnv.faucetMintable = await getFaucet(); testEnv.aDai = await getAToken(aDaiAddress); testEnv.variableDebtDai = await getVariableDebtToken(variableDebtDaiAddress); testEnv.stableDebtDai = await getStableDebtToken(stableDebtDaiAddress); @@ -158,6 +168,17 @@ export async function initializeMakeSuite() { testEnv.usdc = await getMintableERC20(usdcAddress); testEnv.weth = await getWETHMocked(wethAddress); + // Support direct minting + const testReserves = reservesTokens.map((x) => x.tokenAddress); + await waitForTx(await testEnv.faucetMintable.setProtectedOfChild(testReserves, false)); + + // Setup Fallback Oracle and feed up with current AaveOracle prices + for (const testReserve of testReserves) { + const price = await testEnv.aaveOracle.getAssetPrice(testReserve); + await waitForTx(await testEnv.oracle.setAssetPrice(testReserve, price)); + } + await waitForTx(await testEnv.aaveOracle.setFallbackOracle(testEnv.oracle.address)); + // Setup admins await waitForTx(await testEnv.aclManager.addRiskAdmin(testEnv.riskAdmin.address)); await waitForTx(await testEnv.aclManager.addEmergencyAdmin(testEnv.emergencyAdmin.address)); diff --git a/test-suites/isolation-mode.spec.ts b/test-suites/isolation-mode.spec.ts index c83a0f66d..54428b528 100644 --- a/test-suites/isolation-mode.spec.ts +++ b/test-suites/isolation-mode.spec.ts @@ -55,7 +55,17 @@ makeSuite('Isolation mode', (testEnv: TestEnv) => { let snapshot; before(async () => { - const { configurator, dai, usdc, aave, users, poolAdmin } = testEnv; + const { + configurator, + dai, + usdc, + aave, + users, + poolAdmin, + aaveOracle, + addressesProvider, + oracle, + } = testEnv; calculationsConfiguration.reservesParams = AaveConfig.ReservesConfig; //set debt ceiling for aave @@ -74,7 +84,6 @@ makeSuite('Isolation mode', (testEnv: TestEnv) => { ); // configure oracle - const { aaveOracle, addressesProvider, oracle } = testEnv; oracleBaseDecimals = (await aaveOracle.BASE_CURRENCY_UNIT()).toString().length - 1; await waitForTx(await addressesProvider.setPriceOracle(oracle.address)); @@ -140,7 +149,9 @@ makeSuite('Isolation mode', (testEnv: TestEnv) => { it('User 1 supply 1 eth. Checks that eth is NOT activated as collateral ', async () => { const { users, pool, weth, helpersContract } = testEnv; - await weth.connect(users[1].signer)['mint(uint256)'](utils.parseEther('1')); + await weth + .connect(users[1].signer) + ['mint(address,uint256)'](users[1].address, utils.parseEther('1')); await weth.connect(users[1].signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(users[1].signer) @@ -328,7 +339,7 @@ makeSuite('Isolation mode', (testEnv: TestEnv) => { .withdraw(dai.address, utils.parseEther('100'), users[1].address); const wethAmount = utils.parseEther('1'); - await weth.connect(users[2].signer)['mint(uint256)'](wethAmount); + await weth.connect(users[2].signer)['mint(address,uint256)'](users[2].address, wethAmount); await weth.connect(users[2].signer).approve(pool.address, MAX_UINT_AMOUNT); await pool.connect(users[2].signer).supply(weth.address, wethAmount, users[2].address, 0); @@ -503,7 +514,7 @@ makeSuite('Isolation mode', (testEnv: TestEnv) => { const { weth, dai, aave, aAave, users, pool, helpersContract } = testEnv; const wethAmount = utils.parseEther('1'); - await weth.connect(users[5].signer)['mint(uint256)'](wethAmount); + await weth.connect(users[5].signer)['mint(address,uint256)'](users[5].address, wethAmount); await weth.connect(users[5].signer).approve(pool.address, MAX_UINT_AMOUNT); await pool.connect(users[5].signer).supply(weth.address, wethAmount, users[5].address, 0); diff --git a/test-suites/liquidation-atoken.spec.ts b/test-suites/liquidation-atoken.spec.ts index 0eb59c2ed..bb7d1d807 100644 --- a/test-suites/liquidation-atoken.spec.ts +++ b/test-suites/liquidation-atoken.spec.ts @@ -75,7 +75,9 @@ makeSuite('Pool Liquidation: Liquidator receiving aToken', (testEnv) => { const amountETHtoDeposit = await convertToCurrencyDecimals(weth.address, '0.3'); //mints WETH to borrower - await weth.connect(borrower.signer)['mint(uint256)'](amountETHtoDeposit); + await weth + .connect(borrower.signer) + ['mint(address,uint256)'](borrower.address, amountETHtoDeposit); //approve protocol to access borrower wallet await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); @@ -335,7 +337,9 @@ makeSuite('Pool Liquidation: Liquidator receiving aToken', (testEnv) => { const amountETHtoDeposit = await convertToCurrencyDecimals(weth.address, '0.12'); //mints WETH to borrower - await weth.connect(borrower.signer)['mint(uint256)'](amountETHtoDeposit); + await weth + .connect(borrower.signer) + ['mint(address,uint256)'](borrower.address, amountETHtoDeposit); //approve protocol to access borrower wallet await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); diff --git a/test-suites/liquidation-edge.spec.ts b/test-suites/liquidation-edge.spec.ts index d785af832..a9f6a6f78 100644 --- a/test-suites/liquidation-edge.spec.ts +++ b/test-suites/liquidation-edge.spec.ts @@ -57,7 +57,9 @@ makeSuite('Pool Liquidation: Edge cases', (testEnv: TestEnv) => { ); // Deposit eth, borrow dai - await weth.connect(borrower.signer)['mint(uint256)'](utils.parseEther('0.9')); + await weth + .connect(borrower.signer) + ['mint(address,uint256)'](borrower.address, utils.parseEther('0.9')); await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(borrower.signer) @@ -133,7 +135,9 @@ makeSuite('Pool Liquidation: Edge cases', (testEnv: TestEnv) => { ); // Deposit eth, borrow dai - await weth.connect(borrower.signer)['mint(uint256)'](utils.parseEther('0.9')); + await weth + .connect(borrower.signer) + ['mint(address,uint256)'](borrower.address, utils.parseEther('0.9')); await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(borrower.signer) @@ -253,7 +257,9 @@ makeSuite('Pool Liquidation: Edge cases', (testEnv: TestEnv) => { ); // Deposit eth, borrow dai - await weth.connect(borrower.signer)['mint(uint256)'](utils.parseEther('0.9')); + await weth + .connect(borrower.signer) + ['mint(address,uint256)'](borrower.address, utils.parseEther('0.9')); await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(borrower.signer) diff --git a/test-suites/liquidation-emode.spec.ts b/test-suites/liquidation-emode.spec.ts index 163213d72..45f68f075 100644 --- a/test-suites/liquidation-emode.spec.ts +++ b/test-suites/liquidation-emode.spec.ts @@ -300,7 +300,9 @@ makeSuite('Pool Liquidation: Liquidates borrows in eMode with price change', (te const usdcSupplyAmount = utils.parseUnits('10000', 6); expect(await dai.connect(user1.signer)['mint(uint256)'](daiSupplyAmount)); - expect(await weth.connect(user1.signer)['mint(uint256)'](wethSupplyAmount)); + expect( + await weth.connect(user1.signer)['mint(address,uint256)'](user1.address, wethSupplyAmount) + ); expect(await usdc.connect(user2.signer)['mint(uint256)'](usdcSupplyAmount.mul(2))); expect(await dai.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT)); @@ -428,7 +430,9 @@ makeSuite('Pool Liquidation: Liquidates borrows in eMode with price change', (te const usdcSupplyAmount = utils.parseUnits('10000', 6); expect(await dai.connect(user1.signer)['mint(uint256)'](daiSupplyAmount)); - expect(await weth.connect(user1.signer)['mint(uint256)'](wethSupplyAmount)); + expect( + await weth.connect(user1.signer)['mint(address,uint256)'](user1.address, wethSupplyAmount) + ); expect(await usdc.connect(user2.signer)['mint(uint256)'](usdcSupplyAmount.mul(2))); expect(await dai.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT)); @@ -556,7 +560,9 @@ makeSuite('Pool Liquidation: Liquidates borrows in eMode with price change', (te const usdcSupplyAmount = utils.parseUnits('10000', 6); expect(await dai.connect(user1.signer)['mint(uint256)'](daiSupplyAmount)); - expect(await weth.connect(user1.signer)['mint(uint256)'](wethSupplyAmount)); + expect( + await weth.connect(user1.signer)['mint(address,uint256)'](user1.address, wethSupplyAmount) + ); expect(await usdc.connect(user2.signer)['mint(uint256)'](usdcSupplyAmount.mul(2))); expect(await dai.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT)); diff --git a/test-suites/liquidation-underlying.spec.ts b/test-suites/liquidation-underlying.spec.ts index dd2b1acbf..d4f6d1f4a 100644 --- a/test-suites/liquidation-underlying.spec.ts +++ b/test-suites/liquidation-underlying.spec.ts @@ -80,7 +80,10 @@ makeSuite('Pool Liquidation: Liquidator receiving the underlying asset', (testEn //mints WETH to borrower await weth .connect(borrower.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(weth.address, '1000')); + ['mint(address,uint256)']( + borrower.address, + await convertToCurrencyDecimals(weth.address, '1000') + ); //approve protocol to access the borrower wallet await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); @@ -274,7 +277,10 @@ makeSuite('Pool Liquidation: Liquidator receiving the underlying asset', (testEn //mints WETH to borrower await weth .connect(borrower.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(weth.address, '1000')); + ['mint(address,uint256)']( + borrower.address, + await convertToCurrencyDecimals(weth.address, '1000') + ); //approve protocol to access the borrower wallet await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); diff --git a/test-suites/liquidation-with-fee.spec.ts b/test-suites/liquidation-with-fee.spec.ts index 728d462a5..046d4403b 100644 --- a/test-suites/liquidation-with-fee.spec.ts +++ b/test-suites/liquidation-with-fee.spec.ts @@ -57,7 +57,10 @@ makeSuite('Pool Liquidation: Add fee to liquidations', (testEnv) => { await weth .connect(depositor.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(weth.address, '10')); + ['mint(address,uint256)']( + depositor.address, + await convertToCurrencyDecimals(weth.address, '10') + ); await weth.connect(depositor.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(depositor.signer) @@ -71,7 +74,10 @@ makeSuite('Pool Liquidation: Add fee to liquidations', (testEnv) => { //2. Borrower supplies 10 ETH, and borrows as much USDC as it can await weth .connect(borrower.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(weth.address, '10')); + ['mint(address,uint256)']( + borrower.address, + await convertToCurrencyDecimals(weth.address, '10') + ); await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(borrower.signer) @@ -210,7 +216,10 @@ makeSuite('Pool Liquidation: Add fee to liquidations', (testEnv) => { //mints WETH to borrower await weth .connect(borrower.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(weth.address, '1000')); + ['mint(address,uint256)']( + borrower.address, + await convertToCurrencyDecimals(weth.address, '1000') + ); //approve protocol to access the borrower wallet await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); @@ -445,7 +454,10 @@ makeSuite('Pool Liquidation: Add fee to liquidations', (testEnv) => { //mints WETH to borrower await weth .connect(borrower.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(weth.address, '1000')); + ['mint(address,uint256)']( + borrower.address, + await convertToCurrencyDecimals(weth.address, '1000') + ); //approve protocol to access the borrower wallet await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); diff --git a/test-suites/liquidity-indexes.spec.ts b/test-suites/liquidity-indexes.spec.ts index 8efc6b6dc..fcab6f1b0 100644 --- a/test-suites/liquidity-indexes.spec.ts +++ b/test-suites/liquidity-indexes.spec.ts @@ -30,6 +30,7 @@ makeSuite('Pool: liquidity indexes misc tests', (testEnv: TestEnv) => { aave, dai, users: [user0], + deployer, } = testEnv; _mockFlashLoanReceiver = await getMockFlashLoanReceiver(); @@ -40,7 +41,7 @@ makeSuite('Pool: liquidity indexes misc tests', (testEnv: TestEnv) => { const userAddress = user0.address; const amountToDeposit = ethers.utils.parseEther('1'); - await weth['mint(uint256)'](amountToDeposit); + await weth['mint(address,uint256)'](deployer.address, amountToDeposit); await weth.approve(pool.address, MAX_UINT_AMOUNT); diff --git a/test-suites/ltv-validation.spec.ts b/test-suites/ltv-validation.spec.ts index d9006cb58..f2331a019 100644 --- a/test-suites/ltv-validation.spec.ts +++ b/test-suites/ltv-validation.spec.ts @@ -33,7 +33,7 @@ makeSuite('LTV validation', (testEnv: TestEnv) => { await dai.connect(user1.signer)['mint(uint256)'](daiAmount); await usdc.connect(user1.signer)['mint(uint256)'](usdcAmount); - await weth.connect(user2.signer)['mint(uint256)'](wethAmount); + await weth.connect(user2.signer)['mint(address,uint256)'](user2.address, wethAmount); await pool.connect(user1.signer).deposit(dai.address, daiAmount, user1.address, 0); @@ -124,7 +124,7 @@ makeSuite('LTV validation', (testEnv: TestEnv) => { await weth.connect(user2.signer).approve(pool.address, MAX_UINT_AMOUNT); await dai.connect(user1.signer)['mint(uint256)'](daiAmount); - await weth.connect(user2.signer)['mint(uint256)'](wethAmount); + await weth.connect(user2.signer)['mint(address,uint256)'](user2.address, wethAmount); await pool.connect(user1.signer).supply(dai.address, daiAmount, user1.address, 0); await pool.connect(user2.signer).supply(weth.address, wethAmount, user2.address, 0); diff --git a/test-suites/pausable-pool.spec.ts b/test-suites/pausable-pool.spec.ts index e691e3307..995f9f94a 100644 --- a/test-suites/pausable-pool.spec.ts +++ b/test-suites/pausable-pool.spec.ts @@ -216,7 +216,9 @@ makeSuite('PausablePool', (testEnv: TestEnv) => { const amountETHtoDeposit = await convertToCurrencyDecimals(weth.address, '0.06775'); //mints WETH to borrower - await weth.connect(borrower.signer)['mint(uint256)'](amountETHtoDeposit); + await weth + .connect(borrower.signer) + ['mint(address,uint256)'](borrower.address, amountETHtoDeposit); //approve protocol to access borrower wallet await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); @@ -272,7 +274,7 @@ makeSuite('PausablePool', (testEnv: TestEnv) => { const amountDAIToDeposit = utils.parseEther('120'); const amountToBorrow = utils.parseUnits('65', 6); - await weth.connect(user.signer)['mint(uint256)'](amountWETHToDeposit); + await weth.connect(user.signer)['mint(address,uint256)'](user.address, amountWETHToDeposit); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool.connect(user.signer).deposit(weth.address, amountWETHToDeposit, user.address, '0'); @@ -313,7 +315,7 @@ makeSuite('PausablePool', (testEnv: TestEnv) => { const user = users[1]; const amountWETHToDeposit = utils.parseEther('1'); - await weth.connect(user.signer)['mint(uint256)'](amountWETHToDeposit); + await weth.connect(user.signer)['mint(address,uint256)'](user.address, amountWETHToDeposit); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool.connect(user.signer).deposit(weth.address, amountWETHToDeposit, user.address, '0'); diff --git a/test-suites/pausable-reserve.spec.ts b/test-suites/pausable-reserve.spec.ts index 2be0b63d5..9b13981d6 100644 --- a/test-suites/pausable-reserve.spec.ts +++ b/test-suites/pausable-reserve.spec.ts @@ -204,7 +204,9 @@ makeSuite('PausableReserve', (testEnv: TestEnv) => { const amountETHtoDeposit = await convertToCurrencyDecimals(weth.address, '0.06775'); //mints WETH to borrower - await weth.connect(borrower.signer)['mint(uint256)'](amountETHtoDeposit); + await weth + .connect(borrower.signer) + ['mint(address,uint256)'](borrower.address, amountETHtoDeposit); //approve protocol to access borrower wallet await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); @@ -260,7 +262,7 @@ makeSuite('PausableReserve', (testEnv: TestEnv) => { const amountDAIToDeposit = utils.parseEther('120'); const amountToBorrow = await convertToCurrencyDecimals(usdc.address, '65'); - await weth.connect(user.signer)['mint(uint256)'](amountWETHToDeposit); + await weth.connect(user.signer)['mint(address,uint256)'](user.address, amountWETHToDeposit); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool.connect(user.signer).deposit(weth.address, amountWETHToDeposit, user.address, '0'); @@ -301,7 +303,7 @@ makeSuite('PausableReserve', (testEnv: TestEnv) => { const user = users[1]; const amountWETHToDeposit = utils.parseEther('1'); - await weth.connect(user.signer)['mint(uint256)'](amountWETHToDeposit); + await weth.connect(user.signer)['mint(address,uint256)'](user.address, amountWETHToDeposit); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool.connect(user.signer).deposit(weth.address, amountWETHToDeposit, user.address, '0'); diff --git a/test-suites/pool-authorized-flashloan.spec.ts b/test-suites/pool-authorized-flashloan.spec.ts index d468180a0..0ba190f25 100644 --- a/test-suites/pool-authorized-flashloan.spec.ts +++ b/test-suites/pool-authorized-flashloan.spec.ts @@ -34,11 +34,11 @@ makeSuite('Pool: Authorized FlashLoan', (testEnv: TestEnv) => { }); it('Deposits WETH into the reserve', async () => { - const { pool, weth } = testEnv; + const { pool, weth, deployer } = testEnv; const userAddress = await pool.signer.getAddress(); const amountToDeposit = utils.parseEther('1'); - expect(await weth['mint(uint256)'](amountToDeposit)); + expect(await weth['mint(address,uint256)'](deployer.address, amountToDeposit)); expect(await weth.approve(pool.address, MAX_UINT_AMOUNT)); @@ -324,7 +324,9 @@ makeSuite('Pool: Authorized FlashLoan', (testEnv: TestEnv) => { const amountToDeposit = await convertToCurrencyDecimals(weth.address, '5'); // Top up user - expect(await weth.connect(caller.signer)['mint(uint256)'](amountToDeposit)); + expect( + await weth.connect(caller.signer)['mint(address,uint256)'](caller.address, amountToDeposit) + ); expect(await weth.connect(caller.signer).approve(pool.address, MAX_UINT_AMOUNT)); diff --git a/test-suites/pool-drop-reserve.spec.ts b/test-suites/pool-drop-reserve.spec.ts index 5c294859f..42241d344 100644 --- a/test-suites/pool-drop-reserve.spec.ts +++ b/test-suites/pool-drop-reserve.spec.ts @@ -41,7 +41,7 @@ makeSuite('Pool: Drop Reserve', (testEnv: TestEnv) => { await dai.connect(user1.signer)['mint(uint256)'](depositedAmount); await dai.connect(user1.signer).approve(pool.address, depositedAmount); - await weth.connect(user1.signer)['mint(uint256)'](depositedAmount); + await weth.connect(user1.signer)['mint(address,uint256)'](user1.address, depositedAmount); await weth.connect(user1.signer).approve(pool.address, depositedAmount); await pool.deposit(dai.address, depositedAmount, deployer.address, 0); diff --git a/test-suites/pool-edge.spec.ts b/test-suites/pool-edge.spec.ts index 6dce497cd..64d93018d 100644 --- a/test-suites/pool-edge.spec.ts +++ b/test-suites/pool-edge.spec.ts @@ -69,7 +69,10 @@ const setupPositions = async (testEnv: TestEnv, borrowingMode: RateMode) => { // mints WETH to borrower await weth .connect(borrower.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(weth.address, '1000')); + ['mint(address,uint256)']( + borrower.address, + await convertToCurrencyDecimals(weth.address, '1000') + ); // approve protocol to access the borrower wallet await weth.connect(borrower.signer).approve(pool.address, MAX_UINT_AMOUNT); @@ -876,7 +879,7 @@ makeSuite('Pool: Edge cases', (testEnv: TestEnv) => { pool, weth, aWETH, - dai, + deployer, users: [user0], } = testEnv; @@ -888,7 +891,7 @@ makeSuite('Pool: Edge cases', (testEnv: TestEnv) => { const userAddress = user0.address; const amountToDeposit = ethers.utils.parseEther('1'); - await weth['mint(uint256)'](amountToDeposit); + await weth['mint(address,uint256)'](deployer.address, amountToDeposit); await weth.approve(pool.address, MAX_UINT_AMOUNT); @@ -930,7 +933,7 @@ makeSuite('Pool: Edge cases', (testEnv: TestEnv) => { configurator, pool, weth, - aWETH, + deployer, users: [user0], } = testEnv; @@ -942,7 +945,10 @@ makeSuite('Pool: Edge cases', (testEnv: TestEnv) => { const userAddress = user0.address; const amountToDeposit = ethers.utils.parseEther('100000'); - await weth['mint(uint256)'](amountToDeposit.add(ethers.utils.parseEther('30'))); + await weth['mint(address,uint256)']( + deployer.address, + amountToDeposit.add(ethers.utils.parseEther('30')) + ); await weth.approve(pool.address, MAX_UINT_AMOUNT); @@ -982,6 +988,7 @@ makeSuite('Pool: Edge cases', (testEnv: TestEnv) => { weth, aWETH, users: [user0], + deployer, } = testEnv; _mockFlashLoanReceiver = await getMockFlashLoanReceiver(); @@ -992,7 +999,10 @@ makeSuite('Pool: Edge cases', (testEnv: TestEnv) => { const userAddress = user0.address; const amountToDeposit = ethers.utils.parseEther('100000'); - await weth['mint(uint256)'](amountToDeposit.add(ethers.utils.parseEther('30'))); + await weth['mint(address,uint256)']( + deployer.address, + amountToDeposit.add(ethers.utils.parseEther('30')) + ); await weth.approve(pool.address, MAX_UINT_AMOUNT); diff --git a/test-suites/pool-flashloan.spec.ts b/test-suites/pool-flashloan.spec.ts index 0374abdcb..4e359395d 100644 --- a/test-suites/pool-flashloan.spec.ts +++ b/test-suites/pool-flashloan.spec.ts @@ -58,11 +58,11 @@ makeSuite('Pool: FlashLoan', (testEnv: TestEnv) => { expect(await pool.FLASHLOAN_PREMIUM_TO_PROTOCOL()).to.be.equal(PREMIUM_TO_PROTOCOL); }); it('Deposits WETH into the reserve', async () => { - const { pool, weth, aave, dai } = testEnv; + const { pool, weth, aave, dai, deployer } = testEnv; const userAddress = await pool.signer.getAddress(); const amountToDeposit = ethers.utils.parseEther('1'); - await weth['mint(uint256)'](amountToDeposit); + await weth['mint(address,uint256)'](deployer.address, amountToDeposit); await weth.approve(pool.address, MAX_UINT_AMOUNT); @@ -438,7 +438,10 @@ makeSuite('Pool: FlashLoan', (testEnv: TestEnv) => { // repays debt for later, so no interest accrue await weth .connect(caller.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(weth.address, '1000')); + ['mint(address,uint256)']( + caller.address, + await convertToCurrencyDecimals(weth.address, '1000') + ); await weth.connect(caller.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool.connect(caller.signer).repay(weth.address, MAX_UINT_AMOUNT, 2, caller.address); }); @@ -581,7 +584,7 @@ makeSuite('Pool: FlashLoan', (testEnv: TestEnv) => { await weth .connect(caller.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(weth.address, '5')); + ['mint(address,uint256)'](caller.address, await convertToCurrencyDecimals(weth.address, '5')); await weth.connect(caller.signer).approve(pool.address, MAX_UINT_AMOUNT); @@ -633,7 +636,7 @@ makeSuite('Pool: FlashLoan', (testEnv: TestEnv) => { await weth .connect(caller.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(weth.address, '5')); + ['mint(address,uint256)'](caller.address, await convertToCurrencyDecimals(weth.address, '5')); await weth.connect(caller.signer).approve(pool.address, MAX_UINT_AMOUNT); diff --git a/test-suites/pool-normal-flashloan.spec.ts b/test-suites/pool-normal-flashloan.spec.ts index e0540582c..d383dd253 100644 --- a/test-suites/pool-normal-flashloan.spec.ts +++ b/test-suites/pool-normal-flashloan.spec.ts @@ -34,11 +34,11 @@ makeSuite('Pool: FlashLoan for gas comparison', (testEnv: TestEnv) => { expect(await pool.FLASHLOAN_PREMIUM_TO_PROTOCOL()).to.be.equal(PREMIUM_TO_PROTOCOL); }); it('Deposits WETH into the reserve', async () => { - const { pool, weth, aave, dai } = testEnv; + const { pool, weth, aave, dai, deployer } = testEnv; const userAddress = await pool.signer.getAddress(); const amountToDeposit = ethers.utils.parseEther('1'); - await weth['mint(uint256)'](amountToDeposit); + await weth['mint(address,uint256)'](deployer.address, amountToDeposit); await weth.approve(pool.address, MAX_UINT_AMOUNT); diff --git a/test-suites/pool-simple-flashloan.spec.ts b/test-suites/pool-simple-flashloan.spec.ts index e8a21597e..abe75f27b 100644 --- a/test-suites/pool-simple-flashloan.spec.ts +++ b/test-suites/pool-simple-flashloan.spec.ts @@ -44,11 +44,11 @@ makeSuite('Pool: Simple FlashLoan', (testEnv: TestEnv) => { }); it('Deposits WETH into the reserve', async () => { - const { pool, weth, aave, dai } = testEnv; + const { pool, weth, aave, dai, deployer } = testEnv; const userAddress = await pool.signer.getAddress(); const amountToDeposit = ethers.utils.parseEther('1'); - await weth['mint(uint256)'](amountToDeposit); + await weth['mint(address,uint256)'](deployer.address, amountToDeposit); await weth.approve(pool.address, MAX_UINT_AMOUNT); diff --git a/test-suites/price-oracle-sentinel.spec.ts b/test-suites/price-oracle-sentinel.spec.ts index 20244be93..21c5dc19b 100644 --- a/test-suites/price-oracle-sentinel.spec.ts +++ b/test-suites/price-oracle-sentinel.spec.ts @@ -172,7 +172,9 @@ makeSuite('PriceOracleSentinel', (testEnv: TestEnv) => { const borrowers = [borrower, borrower2]; const currBorrower = borrowers[i]; //mints WETH to borrower - await weth.connect(currBorrower.signer)['mint(uint256)'](amountETHtoDeposit); + await weth + .connect(currBorrower.signer) + ['mint(address,uint256)'](currBorrower.address, amountETHtoDeposit); //approve protocol to access borrower wallet await weth.connect(currBorrower.signer).approve(pool.address, MAX_UINT_AMOUNT); @@ -390,7 +392,9 @@ makeSuite('PriceOracleSentinel', (testEnv: TestEnv) => { oracle, } = testEnv; - await weth.connect(user.signer)['mint(uint256)'](utils.parseUnits('0.06775', 18)); + await weth + .connect(user.signer) + ['mint(address,uint256)'](user.address, utils.parseUnits('0.06775', 18)); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(user.signer) @@ -415,7 +419,9 @@ makeSuite('PriceOracleSentinel', (testEnv: TestEnv) => { pool, } = testEnv; - await weth.connect(user.signer)['mint(uint256)'](utils.parseUnits('0.06775', 18)); + await weth + .connect(user.signer) + ['mint(address,uint256)'](user.address, utils.parseUnits('0.06775', 18)); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(user.signer) @@ -442,7 +448,9 @@ makeSuite('PriceOracleSentinel', (testEnv: TestEnv) => { pool, } = testEnv; - await weth.connect(user.signer)['mint(uint256)'](utils.parseUnits('0.06775', 18)); + await weth + .connect(user.signer) + ['mint(address,uint256)'](user.address, utils.parseUnits('0.06775', 18)); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(user.signer) @@ -468,7 +476,9 @@ makeSuite('PriceOracleSentinel', (testEnv: TestEnv) => { pool, } = testEnv; - await weth.connect(user.signer)['mint(uint256)'](utils.parseUnits('0.06775', 18)); + await weth + .connect(user.signer) + ['mint(address,uint256)'](user.address, utils.parseUnits('0.06775', 18)); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(user.signer) diff --git a/test-suites/stable-debt-token-events.spec.ts b/test-suites/stable-debt-token-events.spec.ts index 7d99c6ff0..8d4b51ca5 100644 --- a/test-suites/stable-debt-token-events.spec.ts +++ b/test-suites/stable-debt-token-events.spec.ts @@ -49,7 +49,10 @@ const increaseSupplyIndex = async ( await collateralToken .connect(depositor.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(collateralToken.address, '10000000')); + ['mint(address,uint256)']( + depositor.address, + await convertToCurrencyDecimals(collateralToken.address, '10000000') + ); await collateralToken.connect(depositor.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(depositor.signer) @@ -104,7 +107,7 @@ makeSuite('StableDebtToken: Events', (testEnv: TestEnv) => { const usersToInit = [alice, bob, depositor, depositor2]; for (const user of usersToInit) { await dai.connect(user.signer)['mint(uint256)'](amountToMint); - await weth.connect(user.signer)['mint(uint256)'](amountToMint); + await weth.connect(user.signer)['mint(address,uint256)'](user.address, amountToMint); await dai.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); } diff --git a/test-suites/stable-debt-token.spec.ts b/test-suites/stable-debt-token.spec.ts index 52e40d794..d91bd33d1 100644 --- a/test-suites/stable-debt-token.spec.ts +++ b/test-suites/stable-debt-token.spec.ts @@ -60,7 +60,9 @@ makeSuite('StableDebtToken', (testEnv: TestEnv) => { users[0].address, 0 ); - await weth.connect(users[1].signer)['mint(uint256)'](utils.parseEther('10')); + await weth + .connect(users[1].signer) + ['mint(address,uint256)'](users[1].address, utils.parseEther('10')); await weth.connect(users[1].signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(users[1].signer) @@ -147,7 +149,9 @@ makeSuite('StableDebtToken', (testEnv: TestEnv) => { .supply(usdc.address, utils.parseUnits('1000', 6), user3.address, 0); // User1 supplies 10 WETH - await weth.connect(user1.signer)['mint(uint256)'](utils.parseUnits('10', 18)); + await weth + .connect(user1.signer) + ['mint(address,uint256)'](user1.address, utils.parseUnits('10', 18)); await weth.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(user1.signer) @@ -408,7 +412,9 @@ makeSuite('StableDebtToken', (testEnv: TestEnv) => { // User1 supplies 10 WETH await dai.connect(user1.signer)['mint(uint256)'](utils.parseUnits('100', 18)); await dai.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT); - await weth.connect(user1.signer)['mint(uint256)'](utils.parseUnits('10', 18)); + await weth + .connect(user1.signer) + ['mint(address,uint256)'](user1.address, utils.parseUnits('10', 18)); await weth.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(user1.signer) diff --git a/test-suites/variable-debt-token-events.spec.ts b/test-suites/variable-debt-token-events.spec.ts index 393ef383f..09a010660 100644 --- a/test-suites/variable-debt-token-events.spec.ts +++ b/test-suites/variable-debt-token-events.spec.ts @@ -51,7 +51,10 @@ const increaseSupplyIndex = async ( await collateralToken .connect(depositor.signer) - ['mint(uint256)'](await convertToCurrencyDecimals(collateralToken.address, '10000000')); + ['mint(address,uint256)']( + depositor.address, + await convertToCurrencyDecimals(collateralToken.address, '10000000') + ); await collateralToken.connect(depositor.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(depositor.signer) @@ -106,7 +109,7 @@ makeSuite('VariableDebtToken: Events', (testEnv: TestEnv) => { const usersToInit = [alice, bob, depositor, depositor2]; for (const user of usersToInit) { await dai.connect(user.signer)['mint(uint256)'](amountToMint); - await weth.connect(user.signer)['mint(uint256)'](amountToMint); + await weth.connect(user.signer)['mint(address,uint256)'](user.address, amountToMint); await dai.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); await weth.connect(user.signer).approve(pool.address, MAX_UINT_AMOUNT); } diff --git a/test-suites/variable-debt-token.spec.ts b/test-suites/variable-debt-token.spec.ts index 92260c761..9d4e8b99b 100644 --- a/test-suites/variable-debt-token.spec.ts +++ b/test-suites/variable-debt-token.spec.ts @@ -66,7 +66,9 @@ makeSuite('VariableDebtToken', (testEnv: TestEnv) => { users[0].address, 0 ); - await weth.connect(users[1].signer)['mint(uint256)'](utils.parseEther('10')); + await weth + .connect(users[1].signer) + ['mint(address,uint256)'](users[1].address, utils.parseEther('10')); await weth.connect(users[1].signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(users[1].signer) @@ -312,7 +314,9 @@ makeSuite('VariableDebtToken', (testEnv: TestEnv) => { .supply(dai.address, utils.parseUnits('1000', 18), user3.address, 0); // User1 supplies 10 WETH - await weth.connect(user1.signer)['mint(uint256)'](utils.parseUnits('10', 18)); + await weth + .connect(user1.signer) + ['mint(address,uint256)'](user1.address, utils.parseUnits('10', 18)); await weth.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(user1.signer) @@ -435,7 +439,9 @@ makeSuite('VariableDebtToken', (testEnv: TestEnv) => { // User1 supplies 10 WETH await dai.connect(user1.signer)['mint(uint256)'](utils.parseUnits('100', 18)); await dai.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT); - await weth.connect(user1.signer)['mint(uint256)'](utils.parseUnits('10', 18)); + await weth + .connect(user1.signer) + ['mint(address,uint256)'](user1.address, utils.parseUnits('10', 18)); await weth.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(user1.signer) @@ -499,7 +505,9 @@ makeSuite('VariableDebtToken', (testEnv: TestEnv) => { // User1 supplies 10 WETH await dai.connect(user1.signer)['mint(uint256)'](utils.parseUnits('100', 18)); await dai.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT); - await weth.connect(user1.signer)['mint(uint256)'](utils.parseUnits('10', 18)); + await weth + .connect(user1.signer) + ['mint(address,uint256)'](user1.address, utils.parseUnits('10', 18)); await weth.connect(user1.signer).approve(pool.address, MAX_UINT_AMOUNT); await pool .connect(user1.signer)