I'm a newbie and 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:
Discovered incompatible solidity versions in following
: src\FlashL.sol (>=0.6.0 <= 0.8.16) 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/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)
I believe this has to do with an incompatability with aave v2 contracts using a version of SafeMath from 0.6.12 and my flashloan contract using SafeMath from 0.8.0.
How would you go about fixing this and collisions of compiler version like this in the future, it seems like this would be very common considering the breaking changes.