From 7b9b7daa2d14155fbfd35677c6339582138f4d4a Mon Sep 17 00:00:00 2001 From: MathisGD Date: Thu, 1 Jun 2023 20:46:18 +0200 Subject: [PATCH 1/9] fix: indexes caching --- src/aave-v2/InterestRatesManager.sol | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/aave-v2/InterestRatesManager.sol b/src/aave-v2/InterestRatesManager.sol index 48d2c1d4b..df90a3459 100644 --- a/src/aave-v2/InterestRatesManager.sol +++ b/src/aave-v2/InterestRatesManager.sol @@ -53,8 +53,6 @@ contract InterestRatesManager is IInterestRatesManager, MorphoStorage { function updateIndexes(address _poolToken) external { Types.PoolIndexes storage marketPoolIndexes = poolIndexes[_poolToken]; - if (block.timestamp == marketPoolIndexes.lastUpdateTimestamp) return; - Types.Market storage market = market[_poolToken]; (uint256 newPoolSupplyIndex, uint256 newPoolBorrowIndex) = _getPoolIndexes( market.underlyingToken From e654bba7c1c7d29575b71ac3cbbe5ea3d09f3bfc Mon Sep 17 00:00:00 2001 From: MathisGD Date: Thu, 1 Jun 2023 21:11:50 +0200 Subject: [PATCH 2/9] test: remove indexes update skip --- test/aave-v2/TestSupply.t.sol | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/aave-v2/TestSupply.t.sol b/test/aave-v2/TestSupply.t.sol index 6d8d21f4c..80444bb0e 100644 --- a/test/aave-v2/TestSupply.t.sol +++ b/test/aave-v2/TestSupply.t.sol @@ -277,6 +277,24 @@ contract TestSupply is TestSetup { assertGt(gasUsed2, gasUsed1 + 1e4); } + function testNoIndexUpdateSkip() public { + supplier1.approve(dai, type(uint256).max); + supplier1.supply(aDai, 1); + + (, uint256 poolSupplyIndexCachedBefore, ) = morpho.poolIndexes(aDai); + + FlashLoan flashLoan = new FlashLoan(pool); + vm.prank(address(supplier2)); + ERC20(dai).transfer(address(flashLoan), 10_000 ether); // to pay the premium. + flashLoan.callFlashLoan(dai, 10_000 ether); + + supplier1.supply(aDai, 1); + + (, uint256 poolSupplyIndexCachedAfter, ) = morpho.poolIndexes(aDai); + + assertGt(poolSupplyIndexCachedAfter, poolSupplyIndexCachedBefore); + } + /// @dev Helper for gas usage test function _getSupplyGasUsage(uint256 amount, uint256 maxGas) internal returns (uint256 gasUsed) { // 2 * NMAX borrowers borrow amount From 57b06a5d3c23114d6b32459f4f70423666d40546 Mon Sep 17 00:00:00 2001 From: julien Date: Thu, 1 Jun 2023 21:26:05 +0200 Subject: [PATCH 3/9] fix(ci): update foundry action --- .github/actions/ci-foundry-upgrade/action.yml | 2 +- .github/actions/ci-foundry/action.yml | 2 +- .github/workflows/ci-storage-check-aave-v2.yml | 2 +- .github/workflows/ci-storage-check-compound.yml | 2 +- .github/workflows/ci-storage-snapshot-check-aave-v2.yml | 2 +- .github/workflows/ci-storage-snapshot-check-compound.yml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/ci-foundry-upgrade/action.yml b/.github/actions/ci-foundry-upgrade/action.yml index 77a419976..5aa038c3a 100644 --- a/.github/actions/ci-foundry-upgrade/action.yml +++ b/.github/actions/ci-foundry-upgrade/action.yml @@ -25,7 +25,7 @@ runs: shell: bash - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly diff --git a/.github/actions/ci-foundry/action.yml b/.github/actions/ci-foundry/action.yml index dadb951b3..225171300 100644 --- a/.github/actions/ci-foundry/action.yml +++ b/.github/actions/ci-foundry/action.yml @@ -33,7 +33,7 @@ runs: shell: bash - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly diff --git a/.github/workflows/ci-storage-check-aave-v2.yml b/.github/workflows/ci-storage-check-aave-v2.yml index 399a152bb..574809710 100644 --- a/.github/workflows/ci-storage-check-aave-v2.yml +++ b/.github/workflows/ci-storage-check-aave-v2.yml @@ -33,7 +33,7 @@ jobs: shell: bash - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly diff --git a/.github/workflows/ci-storage-check-compound.yml b/.github/workflows/ci-storage-check-compound.yml index c4f73bcf1..27d6faab3 100644 --- a/.github/workflows/ci-storage-check-compound.yml +++ b/.github/workflows/ci-storage-check-compound.yml @@ -33,7 +33,7 @@ jobs: shell: bash - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly diff --git a/.github/workflows/ci-storage-snapshot-check-aave-v2.yml b/.github/workflows/ci-storage-snapshot-check-aave-v2.yml index cc28caa3b..814c4d59a 100644 --- a/.github/workflows/ci-storage-snapshot-check-aave-v2.yml +++ b/.github/workflows/ci-storage-snapshot-check-aave-v2.yml @@ -32,7 +32,7 @@ jobs: run: yarn install --frozen-lockfile - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly diff --git a/.github/workflows/ci-storage-snapshot-check-compound.yml b/.github/workflows/ci-storage-snapshot-check-compound.yml index ab1b5f839..8ec14546a 100644 --- a/.github/workflows/ci-storage-snapshot-check-compound.yml +++ b/.github/workflows/ci-storage-snapshot-check-compound.yml @@ -32,7 +32,7 @@ jobs: run: yarn install --frozen-lockfile - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly From 981629b1491254e57ce5d72f89a80df1f6ab33ce Mon Sep 17 00:00:00 2001 From: MathisGD Date: Fri, 2 Jun 2023 11:40:19 +0200 Subject: [PATCH 4/9] fix: indexes caching --- src/compound/InterestRatesManager.sol | 2 -- test/compound/TestSupply.t.sol | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/compound/InterestRatesManager.sol b/src/compound/InterestRatesManager.sol index 164a2d430..5bd4ab35c 100644 --- a/src/compound/InterestRatesManager.sol +++ b/src/compound/InterestRatesManager.sol @@ -52,8 +52,6 @@ contract InterestRatesManager is IInterestRatesManager, MorphoStorage { function updateP2PIndexes(address _poolToken) external { Types.LastPoolIndexes storage poolIndexes = lastPoolIndexes[_poolToken]; - if (block.number == poolIndexes.lastUpdateBlockNumber) return; - Types.MarketParameters memory marketParams = marketParameters[_poolToken]; uint256 poolSupplyIndex = ICToken(_poolToken).exchangeRateCurrent(); diff --git a/test/compound/TestSupply.t.sol b/test/compound/TestSupply.t.sol index 25c192034..091feb53f 100644 --- a/test/compound/TestSupply.t.sol +++ b/test/compound/TestSupply.t.sol @@ -321,6 +321,22 @@ contract TestSupply is TestSetup { assertGt(gasUsed2, gasUsed1 + 5e4); } + function testNoIndexUpdateSkip() public { + supplier1.approve(dai, type(uint256).max); + supplier1.supply(cDai, 1 ether); + + (, uint256 poolSupplyIndexCachedBefore, ) = morpho.lastPoolIndexes(cDai); + + vm.prank(address(supplier1)); + ERC20(dai).transfer(cDai, 10_000 ether); + + supplier1.supply(cDai, 1); + + (, uint256 poolSupplyIndexCachedAfter, ) = morpho.lastPoolIndexes(cDai); + + assertGt(poolSupplyIndexCachedAfter, poolSupplyIndexCachedBefore); + } + /// @dev Helper for gas usage test function _getSupplyGasUsage(uint256 amount, uint256 maxGas) internal returns (uint256 gasUsed) { // 2 * NMAX borrowers borrow amount From 75cd9bad78882a1a1ee99e3bea9c535b6fb72dff Mon Sep 17 00:00:00 2001 From: julien Date: Thu, 1 Jun 2023 21:26:05 +0200 Subject: [PATCH 5/9] fix(ci): update foundry action --- .github/actions/ci-foundry-upgrade/action.yml | 2 +- .github/actions/ci-foundry/action.yml | 2 +- .github/workflows/ci-storage-check-aave-v2.yml | 2 +- .github/workflows/ci-storage-check-compound.yml | 2 +- .github/workflows/ci-storage-snapshot-check-aave-v2.yml | 2 +- .github/workflows/ci-storage-snapshot-check-compound.yml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/ci-foundry-upgrade/action.yml b/.github/actions/ci-foundry-upgrade/action.yml index 77a419976..5aa038c3a 100644 --- a/.github/actions/ci-foundry-upgrade/action.yml +++ b/.github/actions/ci-foundry-upgrade/action.yml @@ -25,7 +25,7 @@ runs: shell: bash - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly diff --git a/.github/actions/ci-foundry/action.yml b/.github/actions/ci-foundry/action.yml index dadb951b3..225171300 100644 --- a/.github/actions/ci-foundry/action.yml +++ b/.github/actions/ci-foundry/action.yml @@ -33,7 +33,7 @@ runs: shell: bash - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly diff --git a/.github/workflows/ci-storage-check-aave-v2.yml b/.github/workflows/ci-storage-check-aave-v2.yml index 399a152bb..574809710 100644 --- a/.github/workflows/ci-storage-check-aave-v2.yml +++ b/.github/workflows/ci-storage-check-aave-v2.yml @@ -33,7 +33,7 @@ jobs: shell: bash - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly diff --git a/.github/workflows/ci-storage-check-compound.yml b/.github/workflows/ci-storage-check-compound.yml index c4f73bcf1..27d6faab3 100644 --- a/.github/workflows/ci-storage-check-compound.yml +++ b/.github/workflows/ci-storage-check-compound.yml @@ -33,7 +33,7 @@ jobs: shell: bash - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly diff --git a/.github/workflows/ci-storage-snapshot-check-aave-v2.yml b/.github/workflows/ci-storage-snapshot-check-aave-v2.yml index cc28caa3b..814c4d59a 100644 --- a/.github/workflows/ci-storage-snapshot-check-aave-v2.yml +++ b/.github/workflows/ci-storage-snapshot-check-aave-v2.yml @@ -32,7 +32,7 @@ jobs: run: yarn install --frozen-lockfile - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly diff --git a/.github/workflows/ci-storage-snapshot-check-compound.yml b/.github/workflows/ci-storage-snapshot-check-compound.yml index ab1b5f839..8ec14546a 100644 --- a/.github/workflows/ci-storage-snapshot-check-compound.yml +++ b/.github/workflows/ci-storage-snapshot-check-compound.yml @@ -32,7 +32,7 @@ jobs: run: yarn install --frozen-lockfile - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1 with: version: nightly From 1671e64c028adf85426491e9ab4e03a2d7f27b4d Mon Sep 17 00:00:00 2001 From: MathisGD Date: Sat, 3 Jun 2023 12:58:45 +0200 Subject: [PATCH 6/9] test: indexes caching (ma2) --- test/aave-v2/TestLens.t.sol | 36 +++++++++++++++++++++++++++++++++++ test/aave-v2/TestSupply.t.sol | 24 ++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/test/aave-v2/TestLens.t.sol b/test/aave-v2/TestLens.t.sol index ac901243b..61f0c60f8 100644 --- a/test/aave-v2/TestLens.t.sol +++ b/test/aave-v2/TestLens.t.sol @@ -1658,4 +1658,40 @@ contract TestLens is TestSetup { morpho.setIsLiquidateBorrowPaused(aDai, true); assertTrue(lens.getMarketPauseStatus(aDai).isLiquidateBorrowPaused); } + + function testPoolIndexGrowthInsideBlock() public { + supplier1.approve(dai, type(uint256).max); + supplier1.supply(aDai, 10 ether); + + uint256 poolSupplyIndexBefore = lens.getIndexes(aDai).poolSupplyIndex; + + FlashLoan flashLoan = new FlashLoan(pool); + vm.prank(address(supplier2)); + ERC20(dai).transfer(address(flashLoan), 10_000 ether); // to pay the premium. + flashLoan.callFlashLoan(dai, 10_000 ether); + + uint256 poolSupplyIndexAfter = lens.getIndexes(aDai).poolSupplyIndex; + + assertGt(poolSupplyIndexAfter, poolSupplyIndexBefore); + } + + function testP2PIndexGrowthInsideBlock() public { + borrower1.approve(dai, type(uint256).max); + borrower1.supply(aDai, 10 ether); + borrower1.borrow(aDai, 5 ether); + setDefaultMaxGasForMatchingHelper(3e6, 3e6, 3e6, 0); + // Create delta. + borrower1.repay(aDai, type(uint256).max); + + uint256 p2pSupplyIndexBefore = lens.getCurrentP2PSupplyIndex(aDai); + + FlashLoan flashLoan = new FlashLoan(pool); + vm.prank(address(supplier2)); + ERC20(dai).transfer(address(flashLoan), 10_000 ether); // to pay the premium. + flashLoan.callFlashLoan(dai, 10_000 ether); + + uint256 p2pSupplyIndexAfter = lens.getCurrentP2PSupplyIndex(aDai); + + assertGt(p2pSupplyIndexAfter, p2pSupplyIndexBefore); + } } diff --git a/test/aave-v2/TestSupply.t.sol b/test/aave-v2/TestSupply.t.sol index 80444bb0e..65d847b33 100644 --- a/test/aave-v2/TestSupply.t.sol +++ b/test/aave-v2/TestSupply.t.sol @@ -277,7 +277,7 @@ contract TestSupply is TestSetup { assertGt(gasUsed2, gasUsed1 + 1e4); } - function testNoIndexUpdateSkip() public { + function testPoolIndexGrowthInsideBlock() public { supplier1.approve(dai, type(uint256).max); supplier1.supply(aDai, 1); @@ -295,6 +295,28 @@ contract TestSupply is TestSetup { assertGt(poolSupplyIndexCachedAfter, poolSupplyIndexCachedBefore); } + function testP2PIndexGrowthInsideBlock() public { + borrower1.approve(dai, type(uint256).max); + borrower1.supply(aDai, 10 ether); + borrower1.borrow(aDai, 5 ether); + setDefaultMaxGasForMatchingHelper(3e6, 3e6, 3e6, 0); + // Create delta. + borrower1.repay(aDai, type(uint256).max); + + uint256 p2pSupplyIndexBefore = morpho.p2pSupplyIndex(aDai); + + FlashLoan flashLoan = new FlashLoan(pool); + vm.prank(address(supplier2)); + ERC20(dai).transfer(address(flashLoan), 10_000 ether); // to pay the premium. + flashLoan.callFlashLoan(dai, 10_000 ether); + + borrower1.supply(aDai, 1); + + uint256 p2pSupplyIndexAfter = morpho.p2pSupplyIndex(aDai); + + assertGt(p2pSupplyIndexAfter, p2pSupplyIndexBefore); + } + /// @dev Helper for gas usage test function _getSupplyGasUsage(uint256 amount, uint256 maxGas) internal returns (uint256 gasUsed) { // 2 * NMAX borrowers borrow amount From 5db2d2843e3c10a40baeee01016788048e87db85 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Sat, 3 Jun 2023 13:33:18 +0200 Subject: [PATCH 7/9] test: index caching issue (mc core + lens) --- test/compound/TestLens.t.sol | 36 ++++++++++++++++++++++++++++++++++ test/compound/TestSupply.t.sol | 24 ++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/test/compound/TestLens.t.sol b/test/compound/TestLens.t.sol index c08944941..27a7f1087 100644 --- a/test/compound/TestLens.t.sol +++ b/test/compound/TestLens.t.sol @@ -1719,4 +1719,40 @@ contract TestLens is TestSetup { morpho.setIsLiquidateBorrowPaused(cDai, true); assertTrue(lens.getMarketPauseStatus(cDai).isLiquidateBorrowPaused); } + + function testPoolIndexGrowthInsideBlock() public { + supplier1.approve(dai, type(uint256).max); + supplier1.supply(cDai, 1 ether); + + uint256 poolBorrowIndexBefore = lens.getIndexes(cDai, true).poolSupplyIndex; + + vm.prank(address(supplier1)); + ERC20(dai).transfer(cDai, 10_000 ether); + + supplier1.supply(cDai, 1); + + uint256 poolSupplyIndexAfter = lens.getIndexes(cDai, true).poolSupplyIndex; + + assertGt(poolSupplyIndexAfter, poolBorrowIndexBefore); + } + + function testP2PIndexGrowthInsideBlock() public { + borrower1.approve(dai, type(uint256).max); + borrower1.supply(cDai, 1 ether); + borrower1.borrow(cDai, 0.5 ether); + setDefaultMaxGasForMatchingHelper(0, 0, 0, 0); + // Bypass the borrow repay in the same block by overwritting the storage slot lastBorrowBlock[borrower1]. + hevm.store(address(morpho), keccak256(abi.encode(address(borrower1), 178)), 0); + // Create delta. + borrower1.repay(cDai, type(uint256).max); + + uint256 p2pSupplyIndexBefore = lens.getCurrentP2PSupplyIndex(cDai); + + vm.prank(address(supplier1)); + ERC20(dai).transfer(cDai, 10_000 ether); + + uint256 p2pSupplyIndexAfter = lens.getCurrentP2PSupplyIndex(cDai); + + assertGt(p2pSupplyIndexAfter, p2pSupplyIndexBefore); + } } diff --git a/test/compound/TestSupply.t.sol b/test/compound/TestSupply.t.sol index 091feb53f..5f6beaf16 100644 --- a/test/compound/TestSupply.t.sol +++ b/test/compound/TestSupply.t.sol @@ -321,7 +321,7 @@ contract TestSupply is TestSetup { assertGt(gasUsed2, gasUsed1 + 5e4); } - function testNoIndexUpdateSkip() public { + function testPoolIndexGrowthInsideBlock() public { supplier1.approve(dai, type(uint256).max); supplier1.supply(cDai, 1 ether); @@ -337,6 +337,28 @@ contract TestSupply is TestSetup { assertGt(poolSupplyIndexCachedAfter, poolSupplyIndexCachedBefore); } + function testP2PIndexGrowthInsideBlock() public { + borrower1.approve(dai, type(uint256).max); + borrower1.supply(cDai, 1 ether); + borrower1.borrow(cDai, 0.5 ether); + setDefaultMaxGasForMatchingHelper(0, 0, 0, 0); + // Bypass the borrow repay in the same block by overwritting the storage slot lastBorrowBlock[borrower1]. + hevm.store(address(morpho), keccak256(abi.encode(address(borrower1), 178)), 0); + // Create delta. + borrower1.repay(cDai, type(uint256).max); + + uint256 p2pSupplyIndexBefore = morpho.p2pSupplyIndex(cDai); + + vm.prank(address(supplier1)); + ERC20(dai).transfer(cDai, 10_000 ether); + + borrower1.supply(cDai, 1); + + uint256 p2pSupplyIndexAfter = morpho.p2pSupplyIndex(cDai); + + assertGt(p2pSupplyIndexAfter, p2pSupplyIndexBefore); + } + /// @dev Helper for gas usage test function _getSupplyGasUsage(uint256 amount, uint256 maxGas) internal returns (uint256 gasUsed) { // 2 * NMAX borrowers borrow amount From aaab80266a21677e6220b6dea068592ab9bcef54 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Sat, 3 Jun 2023 13:51:49 +0200 Subject: [PATCH 8/9] fix: indexes caching (mc lens) --- src/compound/lens/IndexesLens.sol | 2 +- test/compound/TestLens.t.sol | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/compound/lens/IndexesLens.sol b/src/compound/lens/IndexesLens.sol index e4b5c915b..55aee1450 100644 --- a/src/compound/lens/IndexesLens.sol +++ b/src/compound/lens/IndexesLens.sol @@ -179,7 +179,7 @@ abstract contract IndexesLens is LensStorage { { marketParameters = morpho.marketParameters(_poolToken); - if (!_updated || block.number == _lastPoolIndexes.lastUpdateBlockNumber) { + if (!_updated) { return ( morpho.p2pSupplyIndex(_poolToken), morpho.p2pBorrowIndex(_poolToken), diff --git a/test/compound/TestLens.t.sol b/test/compound/TestLens.t.sol index 27a7f1087..ddce0d8cd 100644 --- a/test/compound/TestLens.t.sol +++ b/test/compound/TestLens.t.sol @@ -74,10 +74,9 @@ contract TestLens is TestSetup { uint256 amount = 10_000 ether; uint256 toBorrow = amount / 2; - borrower1.approve(dai, amount); + borrower1.approve(dai, type(uint256).max); indexes.index1 = ICToken(cDai).exchangeRateCurrent(); borrower1.supply(cDai, amount); - uint256 p2pBorrowIndex = morpho.p2pBorrowIndex(cDai); borrower1.borrow(cDai, toBorrow); indexes.index2 = ICToken(cDai).exchangeRateCurrent(); @@ -94,6 +93,9 @@ contract TestLens is TestSetup { uint256 total; + // To update p2p indexes on Morpho (they can change inside of a block because the poolSupplyIndex can change due to rounding errors). + borrower1.supply(cDai, 1); + uint256 p2pBorrowIndex = morpho.p2pBorrowIndex(cDai); { uint256 onPool = amount.div(indexes.index1); uint256 matchedInP2P = toBorrow.div(morpho.p2pSupplyIndex(cDai)); From 4b4a7bb1b9eb52ef7db3b5df81f47e34f1a18547 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Sat, 3 Jun 2023 16:56:08 +0200 Subject: [PATCH 9/9] docs: minor comments improvements --- test/aave-v2/TestLens.t.sol | 4 ++-- test/aave-v2/TestSupply.t.sol | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/aave-v2/TestLens.t.sol b/test/aave-v2/TestLens.t.sol index 61f0c60f8..26f97a2bc 100644 --- a/test/aave-v2/TestLens.t.sol +++ b/test/aave-v2/TestLens.t.sol @@ -1667,7 +1667,7 @@ contract TestLens is TestSetup { FlashLoan flashLoan = new FlashLoan(pool); vm.prank(address(supplier2)); - ERC20(dai).transfer(address(flashLoan), 10_000 ether); // to pay the premium. + ERC20(dai).transfer(address(flashLoan), 10_000 ether); // To pay the premium. flashLoan.callFlashLoan(dai, 10_000 ether); uint256 poolSupplyIndexAfter = lens.getIndexes(aDai).poolSupplyIndex; @@ -1687,7 +1687,7 @@ contract TestLens is TestSetup { FlashLoan flashLoan = new FlashLoan(pool); vm.prank(address(supplier2)); - ERC20(dai).transfer(address(flashLoan), 10_000 ether); // to pay the premium. + ERC20(dai).transfer(address(flashLoan), 10_000 ether); // To pay the premium. flashLoan.callFlashLoan(dai, 10_000 ether); uint256 p2pSupplyIndexAfter = lens.getCurrentP2PSupplyIndex(aDai); diff --git a/test/aave-v2/TestSupply.t.sol b/test/aave-v2/TestSupply.t.sol index 65d847b33..1c46c433c 100644 --- a/test/aave-v2/TestSupply.t.sol +++ b/test/aave-v2/TestSupply.t.sol @@ -257,7 +257,7 @@ contract TestSupply is TestSetup { FlashLoan flashLoan = new FlashLoan(pool); vm.prank(address(supplier2)); - ERC20(dai).transfer(address(flashLoan), 10_000 ether); // to pay the premium. + ERC20(dai).transfer(address(flashLoan), 10_000 ether); // To pay the premium. flashLoan.callFlashLoan(dai, flashLoanAmount); vm.warp(block.timestamp + 1); @@ -285,7 +285,7 @@ contract TestSupply is TestSetup { FlashLoan flashLoan = new FlashLoan(pool); vm.prank(address(supplier2)); - ERC20(dai).transfer(address(flashLoan), 10_000 ether); // to pay the premium. + ERC20(dai).transfer(address(flashLoan), 10_000 ether); // To pay the premium. flashLoan.callFlashLoan(dai, 10_000 ether); supplier1.supply(aDai, 1); @@ -307,7 +307,7 @@ contract TestSupply is TestSetup { FlashLoan flashLoan = new FlashLoan(pool); vm.prank(address(supplier2)); - ERC20(dai).transfer(address(flashLoan), 10_000 ether); // to pay the premium. + ERC20(dai).transfer(address(flashLoan), 10_000 ether); // To pay the premium. flashLoan.callFlashLoan(dai, 10_000 ether); borrower1.supply(aDai, 1);