1

I'm trying to follow this tutorial by Patrick Collins on Flashloans but in Foundry: https://www.youtube.com/watch?v=Aw7yvGFtOvI&t=328s

When in try to forge build I get the following error:

: src\FlashL.sol (>=0.6.0 <0.9.0) imports:
    lib/openzeppelin-contracts\contracts/utils/math/SafeMath.sol (^0.8.0)
    lib/protocol-v2\contracts/flashloan/base/FlashLoanReceiverBase.sol (0.6.12)
    lib/protocol-v2\contracts/interfaces/ILendingPoolAddressesProvider.sol (0.6.12)
    lib/protocol-v2\contracts/interfaces/ILendingPool.sol (0.6.12)
    lib/protocol-v2/contracts/dependencies/openzeppelin/contracts/SafeMath.sol (0.6.12)
    lib/protocol-v2/contracts/dependencies/openzeppelin/contracts/IERC20.sol (0.6.12)
    lib/protocol-v2/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol (0.6.12)
    lib/protocol-v2/contracts/flashloan/interfaces/IFlashLoanReceiver.sol (0.6.12)
    lib/protocol-v2\contracts/interfaces/ILendingPoolAddressesProvider.sol (0.6.12)
    lib/protocol-v2\contracts/interfaces/ILendingPool.sol (0.6.12)
    lib/protocol-v2\contracts/interfaces/ILendingPoolAddressesProvider.sol (0.6.12)
    lib/protocol-v2/contracts/protocol/libraries/types/DataTypes.sol (0.6.12)
    lib/protocol-v2/contracts/dependencies/openzeppelin/contracts/IERC20.sol (0.6.12)
    lib/protocol-v2/contracts/dependencies/openzeppelin/contracts/SafeMath.sol (0.6.12)
    lib/protocol-v2/contracts/dependencies/openzeppelin/contracts/Address.sol (0.6.12)
    lib/protocol-v2\contracts/interfaces/ILendingPoolAddressesProvider.sol (0.6.12)
    lib/protocol-v2\contracts/interfaces/ILendingPool.sol (0.6.12) 

As you can see I have tried some pretty crazy pragma directives including ^0.6.0 and ^0.8.16.

I think this has to do with an incompatability between Aave contracts using old Open Zeppelin contracts and then Openzeppelin having SafeMath 0.8.0 to account for breaking changes related to overflow/underflow.

How do I go about resolving something like this in Foundry?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.