From 959a0c044894fa221342fc809c081e563444dfc4 Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Tue, 5 Mar 2024 17:42:34 +0100 Subject: [PATCH] fix: revert changes of mock minting --- contracts/mocks/swap/MockParaSwapAugustus.sol | 10 ++- test/helpers/make-suite.ts | 41 +++++++----- .../paraswapAdapters.liquiditySwap.spec.ts | 66 +++++++++---------- test/paraswap/paraswapAdapters.repay.spec.ts | 30 ++++----- .../paraswapAdapters.withdrawSwap.spec.ts | 20 +++--- .../rewards/claim-all-rewards-to-self.spec.ts | 4 +- test/rewards/claim-all-rewards.spec.ts | 4 +- .../claim-rewards-low-decimals.spec.ts | 4 +- test/rewards/strategies/base-strategy.spec.ts | 4 +- .../strategies/pull-rewards-strategy.spec.ts | 10 +-- .../staked-rewards-strategy.spec.ts | 5 +- test/wrapped-token-gateway.spec.ts | 9 ++- 12 files changed, 104 insertions(+), 103 deletions(-) diff --git a/contracts/mocks/swap/MockParaSwapAugustus.sol b/contracts/mocks/swap/MockParaSwapAugustus.sol index f5ab37e9..f05deca4 100644 --- a/contracts/mocks/swap/MockParaSwapAugustus.sol +++ b/contracts/mocks/swap/MockParaSwapAugustus.sol @@ -2,13 +2,12 @@ pragma solidity ^0.8.10; import {IParaSwapAugustus} from '../../adapters/paraswap/interfaces/IParaSwapAugustus.sol'; -import {IFaucet} from '../testnet-helpers/IFaucet.sol'; import {MockParaSwapTokenTransferProxy} from './MockParaSwapTokenTransferProxy.sol'; import {IERC20} from '@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol'; +import {MintableERC20} from '@aave/core-v3/contracts/mocks/tokens/MintableERC20.sol'; contract MockParaSwapAugustus is IParaSwapAugustus { MockParaSwapTokenTransferProxy immutable TOKEN_TRANSFER_PROXY; - IFaucet immutable FAUCET; bool _expectingSwap; address _expectedFromToken; address _expectedToToken; @@ -21,9 +20,8 @@ contract MockParaSwapAugustus is IParaSwapAugustus { uint256 _expectedToAmountMax; uint256 _expectedToAmountMin; - constructor(address faucetMintable) { + constructor() { TOKEN_TRANSFER_PROXY = new MockParaSwapTokenTransferProxy(); - FAUCET = IFaucet(faucetMintable); } function getTokenTransferProxy() external view override returns (address) { @@ -75,7 +73,7 @@ contract MockParaSwapAugustus is IParaSwapAugustus { ); require(_receivedAmount >= toAmount, 'Received amount of tokens are less than expected'); TOKEN_TRANSFER_PROXY.transferFrom(fromToken, msg.sender, address(this), fromAmount); - FAUCET.mint(toToken, address(this), _receivedAmount); + MintableERC20(toToken).mint(_receivedAmount); IERC20(toToken).transfer(msg.sender, _receivedAmount); _expectingSwap = false; return _receivedAmount; @@ -96,7 +94,7 @@ contract MockParaSwapAugustus is IParaSwapAugustus { ); require(_fromAmount <= fromAmount, 'From amount of tokens are higher than expected'); TOKEN_TRANSFER_PROXY.transferFrom(fromToken, msg.sender, address(this), _fromAmount); - FAUCET.mint(toToken, address(this), toAmount); + MintableERC20(toToken).mint(toAmount); IERC20(toToken).transfer(msg.sender, toAmount); _expectingSwap = false; return fromAmount; diff --git a/test/helpers/make-suite.ts b/test/helpers/make-suite.ts index 71a29ff1..7e128947 100644 --- a/test/helpers/make-suite.ts +++ b/test/helpers/make-suite.ts @@ -50,7 +50,6 @@ import { impersonateAddress, getEmissionManager, getFaucet, - MAX_UINT_AMOUNT, } from '@aave/deploy-v3'; import { deployATokenMock } from '../rewards/helpers/deploy'; import { parseEther } from 'ethers/lib/utils'; @@ -282,22 +281,34 @@ export async function initializeMakeSuite() { ).address ); - // Increase maximum amount for mints on Faucet for tests - await testEnv.faucetMintable.setMaximumMintAmount(BigNumber.from(10).pow(40)); // 1e40 - await testEnv.faucetMintable.mint( - testEnv.aave.address, - rewardsVault.address, - parseEther('60000000000') + // Support direct minting + await waitForTx( + await testEnv.faucetMintable.setProtectedOfChild( + [ + testEnv.aave.address, + testEnv.dai.address, + testEnv.usdc.address, + testEnv.rewardToken.address, + ], + false + ) ); - await testEnv.faucetMintable.mint( - testEnv.rewardToken.address, - rewardsVault.address, - parseEther('200000000') + + await waitForTx( + await testEnv.aaveToken + .connect(rewardsVault.signer) + ['mint(address,uint256)'](rewardsVault.address, parseEther('60000000000')) + ); + await waitForTx( + await testEnv.rewardToken + .connect(rewardsVault.signer) + ['mint(address,uint256)'](rewardsVault.address, parseEther('200000000')) ); - await testEnv.faucetMintable.mint( - testEnv.aave.address, - testEnv.stakedTokenStrategy.address, - parseEther('30000000000') + + await waitForTx( + await testEnv.aaveToken + .connect(rewardsVault.signer) + .transfer(testEnv.stakedTokenStrategy.address, parseEther('30000000000')) ); } diff --git a/test/paraswap/paraswapAdapters.liquiditySwap.spec.ts b/test/paraswap/paraswapAdapters.liquiditySwap.spec.ts index 2722a002..e2a04440 100644 --- a/test/paraswap/paraswapAdapters.liquiditySwap.spec.ts +++ b/test/paraswap/paraswapAdapters.liquiditySwap.spec.ts @@ -36,11 +36,9 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { let evmSnapshotId: string; before(async () => { - const { addressesProvider, deployer, faucetMintable } = testEnv; + const { addressesProvider, deployer } = testEnv; - mockAugustus = await new MockParaSwapAugustus__factory(await getFirstSigner()).deploy( - faucetMintable.address - ); + mockAugustus = await new MockParaSwapAugustus__factory(await getFirstSigner()).deploy(); mockAugustusRegistry = await new MockParaSwapAugustusRegistry__factory( await getFirstSigner() ).deploy(mockAugustus.address); @@ -95,20 +93,20 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { describe('executeOperation', () => { beforeEach(async () => { - const { users, weth, dai, pool, deployer, faucetMintable } = testEnv; + const { users, weth, dai, pool, deployer } = testEnv; const userAddress = users[0].address; // Provide liquidity - await faucetMintable.mint(dai.address, deployer.address, parseEther('20000')); + await dai['mint(uint256)'](parseEther('20000')); await dai.approve(pool.address, parseEther('20000')); await pool.deposit(dai.address, parseEther('20000'), deployer.address, 0); - await faucetMintable.mint(weth.address, deployer.address, parseEther('10000')); + await weth['mint(uint256)'](parseEther('10000')); await weth.approve(pool.address, parseEther('10000')); await pool.deposit(weth.address, parseEther('10000'), deployer.address, 0); // Make a deposit for user - await faucetMintable.mint(weth.address, deployer.address, parseEther('100')); + await weth['mint(uint256)'](parseEther('100')); await weth.approve(pool.address, parseEther('100')); await pool.deposit(weth.address, parseEther('100'), userAddress, 0); }); @@ -339,7 +337,7 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { }); it('should work correctly with tokens of different decimals', async () => { - const { users, usdc, oracle, dai, aDai, pool, deployer, faucetMintable } = testEnv; + const { users, usdc, oracle, dai, aDai, pool, deployer } = testEnv; const user = users[0].signer; const userAddress = users[0].address; @@ -350,12 +348,12 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { const flashloanTotal = amountUSDCtoSwap.add(flashloanPremium); // Provider liquidity - await faucetMintable.mint(usdc.address, deployer.address, liquidity); + await usdc['mint(uint256)'](liquidity); await usdc.approve(pool.address, liquidity); await pool.deposit(usdc.address, liquidity, deployer.address, 0); // Make a deposit for user - await faucetMintable.mint(usdc.address, userAddress, flashloanTotal); + await usdc.connect(user)['mint(uint256)'](flashloanTotal); await usdc.connect(user).approve(pool.address, flashloanTotal); await pool.connect(user).deposit(usdc.address, flashloanTotal, userAddress, 0); @@ -509,7 +507,7 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { }); it('should revert when min amount to receive exceeds the max slippage amount (with tokens of different decimals)', async () => { - const { users, usdc, oracle, dai, pool, deployer, faucetMintable } = testEnv; + const { users, usdc, oracle, dai, pool, deployer } = testEnv; const user = users[0].signer; const userAddress = users[0].address; @@ -520,12 +518,12 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { const flashloanTotal = amountUSDCtoSwap.add(flashloanPremium); // Provider liquidity - await faucetMintable.mint(usdc.address, deployer.address, liquidity); + await usdc['mint(uint256)'](liquidity); await usdc.approve(pool.address, liquidity); await pool.deposit(usdc.address, liquidity, deployer.address, 0); // Make a deposit for user - await faucetMintable.mint(usdc.address, userAddress, flashloanTotal); + await usdc.connect(user)['mint(uint256)'](flashloanTotal); await usdc.connect(user).approve(pool.address, flashloanTotal); await pool.connect(user).deposit(usdc.address, flashloanTotal, userAddress, 0); @@ -915,16 +913,16 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { }); it('should not touch any token balance already in the adapter', async () => { - const { users, weth, oracle, dai, aDai, aWETH, pool, faucetMintable, deployer } = testEnv; + const { users, weth, oracle, dai, aDai, aWETH, pool } = testEnv; const user = users[0].signer; const userAddress = users[0].address; // Put token balances in the adapter const adapterWethBalanceBefore = parseEther('123'); - await faucetMintable.mint(weth.address, deployer.address, adapterWethBalanceBefore); + await weth['mint(uint256)'](adapterWethBalanceBefore); await weth.transfer(paraswapLiquiditySwapAdapter.address, adapterWethBalanceBefore); const adapterDaiBalanceBefore = parseEther('234'); - await faucetMintable.mint(dai.address, deployer.address, adapterDaiBalanceBefore); + await dai['mint(uint256)'](adapterDaiBalanceBefore); await dai.transfer(paraswapLiquiditySwapAdapter.address, adapterDaiBalanceBefore); const amountWETHtoSwap = await parseUnitsFromToken(weth.address, '10'); @@ -1000,28 +998,28 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { describe('executeOperation with borrowing', () => { beforeEach(async () => { - const { users, weth, dai, pool, deployer, faucetMintable } = testEnv; + const { users, weth, dai, pool, deployer } = testEnv; const userAddress = users[0].address; const borrower = users[1].signer; const borrowerAddress = users[1].address; // Provide liquidity - await faucetMintable.mint(dai.address, deployer.address, parseEther('20000')); + await dai['mint(uint256)'](parseEther('20000')); await dai.approve(pool.address, parseEther('20000')); await pool.deposit(dai.address, parseEther('20000'), deployer.address, 0); - await faucetMintable.mint(weth.address, deployer.address, parseEther('10000')); + await weth['mint(uint256)'](parseEther('10000')); await weth.approve(pool.address, parseEther('10000')); await pool.deposit(weth.address, parseEther('10000'), deployer.address, 0); // Make a deposit for user - await faucetMintable.mint(weth.address, deployer.address, parseEther('100')); + await weth['mint(uint256)'](parseEther('100')); await weth.approve(pool.address, parseEther('100')); await pool.deposit(weth.address, parseEther('100'), userAddress, 0); // Add borrowing const collateralAmount = parseEther('30000000'); - await faucetMintable.mint(dai.address, deployer.address, collateralAmount); + await dai['mint(uint256)'](collateralAmount); await dai.approve(pool.address, collateralAmount); await pool.deposit(dai.address, collateralAmount, borrowerAddress, 0); await pool @@ -1382,20 +1380,20 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { describe('swapAndDeposit', () => { beforeEach(async () => { - const { users, weth, dai, pool, deployer, faucetMintable } = testEnv; + const { users, weth, dai, pool, deployer } = testEnv; const userAddress = users[0].address; // Provide liquidity - await faucetMintable.mint(dai.address, deployer.address, parseEther('20000')); + await dai['mint(uint256)'](parseEther('20000')); await dai.approve(pool.address, parseEther('20000')); await pool.deposit(dai.address, parseEther('20000'), deployer.address, 0); - await faucetMintable.mint(weth.address, deployer.address, parseEther('10000')); + await weth['mint(uint256)'](parseEther('10000')); await weth.approve(pool.address, parseEther('10000')); await pool.deposit(weth.address, parseEther('10000'), deployer.address, 0); // Make a deposit for user - await faucetMintable.mint(weth.address, deployer.address, parseEther('100')); + await weth['mint(uint256)'](parseEther('100')); await weth.approve(pool.address, parseEther('100')); await pool.deposit(weth.address, parseEther('100'), userAddress, 0); }); @@ -2202,16 +2200,16 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { }); it('should not touch any token balance already in the adapter', async () => { - const { users, weth, oracle, dai, aDai, aWETH, deployer, faucetMintable } = testEnv; + const { users, weth, oracle, dai, aDai, aWETH } = testEnv; const user = users[0].signer; const userAddress = users[0].address; // Put token balances in the adapter const adapterWethBalanceBefore = parseEther('123'); - await faucetMintable.mint(weth.address, deployer.address, adapterWethBalanceBefore); + await weth['mint(uint256)'](adapterWethBalanceBefore); await weth.transfer(paraswapLiquiditySwapAdapter.address, adapterWethBalanceBefore); const adapterDaiBalanceBefore = parseEther('234'); - await faucetMintable.mint(dai.address, deployer.address, adapterDaiBalanceBefore); + await dai['mint(uint256)'](adapterDaiBalanceBefore); await dai.transfer(paraswapLiquiditySwapAdapter.address, adapterDaiBalanceBefore); const amountWETHtoSwap = await parseUnitsFromToken(weth.address, '10'); @@ -2282,28 +2280,28 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { describe('swapAndDeposit with borrowing', () => { beforeEach(async () => { - const { users, weth, dai, pool, deployer, faucetMintable } = testEnv; + const { users, weth, dai, pool, deployer } = testEnv; const userAddress = users[0].address; const borrower = users[1].signer; const borrowerAddress = users[1].address; // Provide liquidity - await faucetMintable.mint(dai.address, deployer.address, parseEther('20000')); + await dai['mint(uint256)'](parseEther('20000')); await dai.approve(pool.address, parseEther('20000')); await pool.deposit(dai.address, parseEther('20000'), deployer.address, 0); - await faucetMintable.mint(weth.address, deployer.address, parseEther('10000')); + await weth['mint(uint256)'](parseEther('10000')); await weth.approve(pool.address, parseEther('10000')); await pool.deposit(weth.address, parseEther('10000'), deployer.address, 0); // Make a deposit for user - await faucetMintable.mint(weth.address, deployer.address, parseEther('100')); + await weth['mint(uint256)'](parseEther('100')); await weth.approve(pool.address, parseEther('100')); await pool.deposit(weth.address, parseEther('100'), userAddress, 0); // Add borrowing const collateralAmount = parseEther('30000000'); - await faucetMintable.mint(dai.address, deployer.address, collateralAmount); + await dai['mint(uint256)'](collateralAmount); await dai.approve(pool.address, collateralAmount); await pool.deposit(dai.address, collateralAmount, borrowerAddress, 0); await pool diff --git a/test/paraswap/paraswapAdapters.repay.spec.ts b/test/paraswap/paraswapAdapters.repay.spec.ts index 9705dc17..07e74e3e 100644 --- a/test/paraswap/paraswapAdapters.repay.spec.ts +++ b/test/paraswap/paraswapAdapters.repay.spec.ts @@ -37,11 +37,9 @@ makeSuite('Paraswap adapters', (testEnv: TestEnv) => { let evmSnapshotId: string; before(async () => { - const { addressesProvider, deployer, faucetMintable } = testEnv; + const { addressesProvider, deployer } = testEnv; - mockAugustus = await new MockParaSwapAugustus__factory(await getFirstSigner()).deploy( - faucetMintable.address - ); + mockAugustus = await new MockParaSwapAugustus__factory(await getFirstSigner()).deploy(); mockAugustusRegistry = await new MockParaSwapAugustusRegistry__factory( await getFirstSigner() ).deploy(mockAugustus.address); @@ -62,37 +60,37 @@ makeSuite('Paraswap adapters', (testEnv: TestEnv) => { describe('ParaswapRepayAdapter', () => { beforeEach(async () => { - const { users, weth, dai, usdc, aave, pool, deployer, faucetMintable } = testEnv; + const { users, weth, dai, usdc, aave, pool, deployer } = testEnv; const userAddress = users[0].address; // Provide liquidity - await faucetMintable.mint(dai.address, deployer.address, parseEther('400000')); + await dai['mint(uint256)'](parseEther('400000')); await dai.approve(pool.address, parseEther('400000')); await pool.deposit(dai.address, parseEther('400000'), deployer.address, 0); const usdcLiquidity = await parseUnitsFromToken(usdc.address, '5000000'); - await faucetMintable.mint(usdc.address, deployer.address, usdcLiquidity); + await usdc['mint(uint256)'](usdcLiquidity); await usdc.approve(pool.address, usdcLiquidity); await pool.deposit(usdc.address, usdcLiquidity, deployer.address, 0); - await faucetMintable.mint(weth.address, deployer.address, parseEther('100')); + await weth['mint(uint256)'](parseEther('100')); await weth.approve(pool.address, parseEther('100')); await pool.deposit(weth.address, parseEther('100'), deployer.address, 0); - await faucetMintable.mint(aave.address, deployer.address, parseEther('1000000')); + await aave['mint(uint256)'](parseEther('1000000')); await aave.approve(pool.address, parseEther('1000000')); await pool.deposit(aave.address, parseEther('1000000'), deployer.address, 0); // Make a deposit for user - await faucetMintable.mint(weth.address, deployer.address, parseEther('1000')); + await weth['mint(uint256)'](parseEther('1000')); await weth.approve(pool.address, parseEther('1000')); await pool.deposit(weth.address, parseEther('1000'), userAddress, 0); - await faucetMintable.mint(aave.address, deployer.address, parseEther('1000000')); + await aave['mint(uint256)'](parseEther('1000000')); await aave.approve(pool.address, parseEther('1000000')); await pool.deposit(aave.address, parseEther('1000000'), userAddress, 0); - await faucetMintable.mint(usdc.address, deployer.address, usdcLiquidity); + await usdc['mint(uint256)'](usdcLiquidity); await usdc.approve(pool.address, usdcLiquidity); await pool.deposit(usdc.address, usdcLiquidity, userAddress, 0); }); @@ -406,13 +404,13 @@ makeSuite('Paraswap adapters', (testEnv: TestEnv) => { }); it('should revert if there is not debt to repay with the specified rate mode', async () => { - const { users, pool, weth, oracle, dai, aWETH, faucetMintable } = testEnv; + const { users, pool, weth, oracle, dai, aWETH } = testEnv; const user = users[0].signer; const userAddress = users[0].address; const amountWETHtoSwap = await parseUnitsFromToken(weth.address, '10'); - await faucetMintable.mint(weth.address, userAddress, amountWETHtoSwap); + await weth.connect(user)['mint(uint256)'](amountWETHtoSwap); await weth.connect(user).transfer(paraswapRepayAdapter.address, amountWETHtoSwap); const daiPrice = await oracle.getAssetPrice(dai.address); @@ -475,13 +473,13 @@ makeSuite('Paraswap adapters', (testEnv: TestEnv) => { }); it('should revert if there is not debt to repay', async () => { - const { users, pool, weth, oracle, dai, aWETH, faucetMintable } = testEnv; + const { users, pool, weth, oracle, dai, aWETH } = testEnv; const user = users[0].signer; const userAddress = users[0].address; const amountWETHtoSwap = await parseUnitsFromToken(weth.address, '10'); - await faucetMintable.mint(weth.address, userAddress, amountWETHtoSwap); + await weth.connect(user)['mint(uint256)'](amountWETHtoSwap); await weth.connect(user).transfer(paraswapRepayAdapter.address, amountWETHtoSwap); const daiPrice = await oracle.getAssetPrice(dai.address); diff --git a/test/paraswap/paraswapAdapters.withdrawSwap.spec.ts b/test/paraswap/paraswapAdapters.withdrawSwap.spec.ts index 59bb554c..9664956b 100644 --- a/test/paraswap/paraswapAdapters.withdrawSwap.spec.ts +++ b/test/paraswap/paraswapAdapters.withdrawSwap.spec.ts @@ -30,11 +30,9 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { let evmSnapshotId: string; before(async () => { - const { addressesProvider, deployer, faucetMintable } = testEnv; + const { addressesProvider, deployer } = testEnv; - mockAugustus = await new MockParaSwapAugustus__factory(await getFirstSigner()).deploy( - faucetMintable.address - ); + mockAugustus = await new MockParaSwapAugustus__factory(await getFirstSigner()).deploy(); mockAugustusRegistry = await new MockParaSwapAugustusRegistry__factory( await getFirstSigner() ).deploy(mockAugustus.address); @@ -89,20 +87,20 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { describe('withdrawAndSwap', () => { beforeEach(async () => { - const { users, weth, dai, pool, deployer, faucetMintable } = testEnv; + const { users, weth, dai, pool, deployer } = testEnv; const userAddress = users[0].address; // Provide liquidity - await faucetMintable.mint(dai.address, deployer.address, parseEther('20000')); + await dai['mint(uint256)'](parseEther('20000')); await dai.approve(pool.address, parseEther('20000')); await pool.deposit(dai.address, parseEther('20000'), deployer.address, 0); - await faucetMintable.mint(weth.address, deployer.address, parseEther('10000')); + await weth['mint(uint256)'](parseEther('10000')); await weth.approve(pool.address, parseEther('10000')); await pool.deposit(weth.address, parseEther('10000'), deployer.address, 0); // Make a deposit for user - await faucetMintable.mint(weth.address, deployer.address, parseEther('100')); + await weth['mint(uint256)'](parseEther('100')); await weth.approve(pool.address, parseEther('100')); await pool.deposit(weth.address, parseEther('100'), userAddress, 0); }); @@ -892,16 +890,16 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => { }); it('should not touch any token balance already in the adapter', async () => { - const { deployer, users, weth, oracle, dai, aWETH, faucetMintable } = testEnv; + const { users, weth, oracle, dai, aWETH } = testEnv; const user = users[0].signer; const userAddress = users[0].address; // Put token balances in the adapter const adapterWethBalanceBefore = parseEther('123'); - await faucetMintable.mint(weth.address, deployer.address, adapterWethBalanceBefore); + await weth['mint(uint256)'](adapterWethBalanceBefore); await weth.transfer(paraswapWithdrawSwapAdapter.address, adapterWethBalanceBefore); const adapterDaiBalanceBefore = parseEther('234'); - await faucetMintable.mint(dai.address, deployer.address, adapterDaiBalanceBefore); + await dai['mint(uint256)'](adapterDaiBalanceBefore); await dai.transfer(paraswapWithdrawSwapAdapter.address, adapterDaiBalanceBefore); const amountWETHtoSwap = await parseUnitsFromToken(weth.address, '10'); diff --git a/test/rewards/claim-all-rewards-to-self.spec.ts b/test/rewards/claim-all-rewards-to-self.spec.ts index a1aefaf1..dd60f582 100644 --- a/test/rewards/claim-all-rewards-to-self.spec.ts +++ b/test/rewards/claim-all-rewards-to-self.spec.ts @@ -76,11 +76,11 @@ const getRewardsBalanceScenarios: ScenarioAction[] = [ makeSuite('Incentives Controller V2 claimRewards to self tests', (testEnv) => { before(async () => { - const { rewardTokens, rewardsVault, pullRewardsStrategy, faucetMintable } = testEnv; + const { rewardTokens, rewardsVault, pullRewardsStrategy } = testEnv; const rewards = rewardTokens.slice(0, 3); await Bluebird.each(rewards, async (reward, index) => { - await faucetMintable.mint(reward.address, rewardsVault.address, parseEther('1000000000')); + await reward.connect(rewardsVault.signer)['mint(uint256)'](parseEther('1000000000')); await reward .connect(rewardsVault.signer) .approve(pullRewardsStrategy.address, MAX_UINT_AMOUNT); diff --git a/test/rewards/claim-all-rewards.spec.ts b/test/rewards/claim-all-rewards.spec.ts index 8c0bcadd..6efe3da6 100644 --- a/test/rewards/claim-all-rewards.spec.ts +++ b/test/rewards/claim-all-rewards.spec.ts @@ -82,11 +82,11 @@ const getRewardsBalanceScenarios: ScenarioAction[] = [ makeSuite('Incentives Controller V2 claimAllRewards tests', (testEnv) => { before(async () => { - const { rewardTokens, rewardsVault, pullRewardsStrategy, faucetMintable } = testEnv; + const { rewardTokens, rewardsVault, pullRewardsStrategy } = testEnv; const rewards = rewardTokens.slice(0, 4); await Bluebird.each(rewards, async (reward, index) => { - await faucetMintable.mint(reward.address, rewardsVault.address, parseEther('1000000000')); + await reward.connect(rewardsVault.signer)['mint(uint256)'](parseEther('1000000000')); await reward .connect(rewardsVault.signer) .approve(pullRewardsStrategy.address, MAX_UINT_AMOUNT); diff --git a/test/rewards/claim-rewards-low-decimals.spec.ts b/test/rewards/claim-rewards-low-decimals.spec.ts index d08a9647..576d3aca 100644 --- a/test/rewards/claim-rewards-low-decimals.spec.ts +++ b/test/rewards/claim-rewards-low-decimals.spec.ts @@ -75,13 +75,11 @@ makeSuite('Incentives Controller V2 claimRewards with 2 decimals', (testEnv) => } of getRewardsBalanceScenarios) { let amountToClaim = _amountToClaim; it(caseName, async () => { - const { rewardsController, aave, rewardToken, stakedAave, aEursMockV2, stakedTokenStrategy } = - testEnv; - const { timestamp } = await hre.ethers.provider.getBlock('latest'); const timePerTest = 31536000; const distributionEnd = timestamp + timePerTest * getRewardsBalanceScenarios.length; await advanceTimeAndBlock(timePerTest); + const { rewardsController, stakedAave, aEursMockV2, stakedTokenStrategy } = testEnv; const userAddress = await rewardsController.signer.getAddress(); diff --git a/test/rewards/strategies/base-strategy.spec.ts b/test/rewards/strategies/base-strategy.spec.ts index 0644d357..bdaaddc9 100644 --- a/test/rewards/strategies/base-strategy.spec.ts +++ b/test/rewards/strategies/base-strategy.spec.ts @@ -28,12 +28,10 @@ makeSuite('Base Transfer Strategy', (testEnv: TestEnv) => { deployer, users: [user1], dai, - faucetMintable, } = testEnv; - const amountToRecover = parseEther('10'); await waitForTx( - await faucetMintable.mint(dai.address, pullRewardsStrategy.address, amountToRecover) + await dai['mint(address,uint256)'](pullRewardsStrategy.address, amountToRecover) ); const userBalanceBefore = await dai.balanceOf(user1.address); diff --git a/test/rewards/strategies/pull-rewards-strategy.spec.ts b/test/rewards/strategies/pull-rewards-strategy.spec.ts index 362a13ea..686fa8a3 100644 --- a/test/rewards/strategies/pull-rewards-strategy.spec.ts +++ b/test/rewards/strategies/pull-rewards-strategy.spec.ts @@ -108,7 +108,6 @@ makeSuite('Pull Rewards Transfer Strategy', (testEnv: TestEnv) => { users: [user1], rewardsVault, rewardToken, - faucetMintable, } = testEnv; const artifact = await hre.deployments.deploy('transfer-strategy-3', { @@ -123,7 +122,9 @@ makeSuite('Pull Rewards Transfer Strategy', (testEnv: TestEnv) => { ); await waitForTx( - await faucetMintable.mint(rewardToken.address, rewardsVault.address, parseEther('2000000')) + await rewardToken + .connect(rewardsVault.signer) + ['mint(address,uint256)'](rewardsVault.address, parseEther('2000000')) ); await waitForTx( await rewardToken.connect(rewardsVault.signer).approve(instance.address, MAX_UINT_AMOUNT) @@ -148,7 +149,6 @@ makeSuite('Pull Rewards Transfer Strategy', (testEnv: TestEnv) => { users: [user1], rewardsVault, rewardToken, - faucetMintable, } = testEnv; const artifact = await hre.deployments.deploy('transfer-strategy-4', { @@ -163,7 +163,9 @@ makeSuite('Pull Rewards Transfer Strategy', (testEnv: TestEnv) => { ); await waitForTx( - await faucetMintable.mint(rewardToken.address, rewardsVault.address, parseEther('2000000')) + await rewardToken + .connect(rewardsVault.signer) + ['mint(address,uint256)'](rewardsVault.address, parseEther('2000000')) ); await waitForTx( await rewardToken.connect(rewardsVault.signer).approve(instance.address, MAX_UINT_AMOUNT) diff --git a/test/rewards/strategies/staked-rewards-strategy.spec.ts b/test/rewards/strategies/staked-rewards-strategy.spec.ts index 21fb31ab..1d18e3bc 100644 --- a/test/rewards/strategies/staked-rewards-strategy.spec.ts +++ b/test/rewards/strategies/staked-rewards-strategy.spec.ts @@ -70,7 +70,6 @@ makeSuite('Staked Token Transfer Strategy', (testEnv: TestEnv) => { deployer, users: [user1], rewardsVault, - faucetMintable, aave, stakedAave, } = testEnv; @@ -87,7 +86,9 @@ makeSuite('Staked Token Transfer Strategy', (testEnv: TestEnv) => { ); await waitForTx( - await faucetMintable.mint(aave.address, instance.address, parseEther('20000000')) + await aave + .connect(rewardsVault.signer) + ['mint(address,uint256)'](instance.address, parseEther('20000000')) ); const rewardAmount = parseEther('20'); diff --git a/test/wrapped-token-gateway.spec.ts b/test/wrapped-token-gateway.spec.ts index 13957154..ec071148 100644 --- a/test/wrapped-token-gateway.spec.ts +++ b/test/wrapped-token-gateway.spec.ts @@ -120,8 +120,7 @@ makeSuite('Use native ETH at Pool via WrappedTokenGatewayV3', (testEnv: TestEnv) }); it('Borrow stable WETH and Full Repay with ETH', async () => { - const { users, WrappedTokenGatewayV3, aDai, weth, dai, pool, helpersContract, faucetMintable } = - testEnv; + const { users, WrappedTokenGatewayV3, aDai, weth, dai, pool, helpersContract } = testEnv; const borrowSize = utils.parseEther('1'); const repaySize = borrowSize.add(borrowSize.mul(5).div(100)); const user = users[1]; @@ -142,7 +141,7 @@ makeSuite('Use native ETH at Pool via WrappedTokenGatewayV3', (testEnv: TestEnv) const stableDebtToken = await getStableDebtToken(stableDebtTokenAddress); // Deposit 10000 DAI - await faucetMintable.mint(dai.address, user.address, daiSize); + await dai.connect(user.signer)['mint(uint256)'](daiSize); await dai.connect(user.signer).approve(pool.address, daiSize); await pool.connect(user.signer).deposit(dai.address, daiSize, user.address, '0'); @@ -344,11 +343,11 @@ makeSuite('Use native ETH at Pool via WrappedTokenGatewayV3', (testEnv: TestEnv) }); it('Owner can do emergency token recovery', async () => { - const { users, dai, WrappedTokenGatewayV3, deployer, faucetMintable } = testEnv; + const { users, dai, WrappedTokenGatewayV3, deployer } = testEnv; const user = users[0]; const amount = utils.parseEther('1'); - await faucetMintable.mint(dai.address, user.address, amount); + await dai.connect(user.signer)['mint(uint256)'](amount); const daiBalanceAfterMint = await dai.balanceOf(user.address); await dai.connect(user.signer).transfer(WrappedTokenGatewayV3.address, amount);