Skip to content

Commit

Permalink
Merge pull request #41 from immunefi-team/deprecated_flash_loans
Browse files Browse the repository at this point in the history
Removed AAVE and Euler tests due to flash loan functionality deprecation
  • Loading branch information
janbro authored Feb 15, 2024
2 parents 41c8358 + 17fc450 commit 5d05466
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/flashloan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ This template is for getting started with attack PoCs which use flash loans. The

| Network | Protocol | Library |
| ---------- | -------- | ------------------------------------------------------- |
| Ethereum | AAVEV1 | [AAVEV1FlashLoan](./lib/AAVEV1FlashLoan.sol) |
| Ethereum | AAVEV1 ⚠️ | [AAVEV1FlashLoan](./lib/AAVEV1FlashLoan.sol) |
| Ethereum | AAVEV2 | [AAVEV2FlashLoan](./lib/AAVEV2FlashLoan.sol) |
| Ethereum | AAVEV3 | [AAVEV3FlashLoan](./lib/AAVEV3FlashLoan.sol) |
| Ethereum | Euler | [EulerFlashLoan](./lib/EulerFlashLoan.sol) |
| Ethereum | Euler ⚠️ | [EulerFlashLoan](./lib/EulerFlashLoan.sol) |
| Ethereum | Balancer | [BalancerFlashLoan](./lib/BalancerFlashLoan.sol) |
| Ethereum | MakerDAO | [MakerDAOFlashLoan](./lib/MakerDAOFlashLoan.sol) |
| Ethereum | UniswapV2 | [UniswapV2FlashLoan](./lib/UniswapV2FlashLoan.sol) |
Expand Down
4 changes: 2 additions & 2 deletions src/flashloan/examples/MultiProviderFlashLoanExample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ contract MultiProviderFlashLoanExample is FlashLoan, Tokens {
function _executeAttack() internal override {
console.log("DAI BALANCE DURING:", EthereumTokens.DAI.balanceOf(address(this)));
if (currentFlashLoanProvider() == FlashLoanProviders.UNISWAPV3) {
takeFlashLoan(FlashLoanProviders.AAVEV1, address(EthereumTokens.DAI), 1 ether);
} else if (currentFlashLoanProvider() == FlashLoanProviders.AAVEV1) {
takeFlashLoan(FlashLoanProviders.AAVEV3, address(EthereumTokens.DAI), 1 ether);
} else if (currentFlashLoanProvider() == FlashLoanProviders.AAVEV3) {
// Execute attack with funds from UNISWAPV3 and AAVE
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/flashloan/lib/AAVEV1FlashLoan.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ pragma solidity ^0.8.0;

import "forge-std/interfaces/IERC20.sol";

/**
* @custom:deprecated
* @dev AAVE V1 flash loans have been disabled as part of the AAVE V1 deprecation strategy
* from BGD Labs. Flash loans only work from block 19168280 or earlier.
* https://governance.aave.com/t/temp-check-bgd-further-aave-v1-deprecation-strategy/15893/3.
*/
library AAVEV1FlashLoan {
/**
* @dev struct that hold the reference of IAAVEV1LendingPool and address core
Expand Down
6 changes: 6 additions & 0 deletions src/flashloan/lib/EulerFlashLoan.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ pragma solidity ^0.8.0;

import "forge-std/interfaces/IERC20.sol";

/**
* @custom:deprecated
* @dev Euler flash loans no longer work due to the $187M hack on March 13, 2023.
* Flash loans only work from block 16818068 or earlier.
* https://github.com/iphelix/euler-exploit-poc
*/
library EulerFlashLoan {
/**
* @dev struct that hold the reference of Euler and the dToken
Expand Down
12 changes: 9 additions & 3 deletions test/examples/FlashLoanExample.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ contract FlashLoanExampleTest is Test {
multiProviderFlashLoanExample = new MultiProviderFlashLoanExample();
}

function testAAVEV1FlashLoan() public {
flashLoanExample.initiateAttack(FlashLoanProviders.AAVEV1);
}
/**
* @dev Flash loans only work from block 19168280 or earlier.
*/
// function testAAVEV1FlashLoan() public {
// flashLoanExample.initiateAttack(FlashLoanProviders.AAVEV1);
// }

function testAAVEV2FlashLoan() public {
flashLoanExample.initiateAttack(FlashLoanProviders.AAVEV2);
Expand All @@ -34,6 +37,9 @@ contract FlashLoanExampleTest is Test {
flashLoanExample.initiateAttack(FlashLoanProviders.BALANCER);
}

/**
* @dev Flash loans only work from block 16818068 or earlier.
*/
// function testEulerFlashLoan() public {
// flashLoanExample.initiateAttack(FlashLoanProviders.EULER);
// }
Expand Down

0 comments on commit 5d05466

Please sign in to comment.