devbootstrap / flashloan-arbitrage-money-legos

A flashloan arbitrage example using money legos
94 stars 46 forks source link

Imports breaking with required solidity compiler change #1

Closed Sshimaninja closed 3 years ago

Sshimaninja commented 3 years ago

flashloanmoneylego.sol requires 0.5.0, and changing compiler breaks the imports.

Getting errors:

Source "@studydefi/money-legos/uniswap/contracts/IUniswapExchange.sol" not found: File import callback not supported Source "@openzeppelin/contracts/token/ERC20/IERC20.sol" not found: File import callback not supported

... etc ad nauseum I've tried updating the solidity compiler, but that's not helping either. (Some files require 0.5.0 some require 0.6.6, so that breaks either, depending)

I'm using VScode, and I'm actively trying to solve this, so I'll update if I find anything, but I thought it best to ask at the source.

I'm using JuanBlanco's solidity extension for VSCode: https://github.com/juanfranblanco/vscode-solidity#openzeppelin

And following the file structure laid out there.

Sshimaninja commented 3 years ago

Changed to relative format and it worked a la: import "../node_modules/@studydefi/money-legos/aave/contracts/ILendingPool.sol";

Probably not best practice, but it'll do for testing.

Great tutorial, thanks. You're good at going through complex subjects.

Sshimaninja commented 3 years ago

I keep getting this error, but changing compilers creates more errors, and necessitates changing all the files in the project to 0.6.6.

Is this necessary, or have I missed something?

I did run npm install so dependencies should be there.

"Error: Truffle is currently using solc ^0.6.6, but one or more of your contracts specify "pragma solidity ^0.5.0". Please update your truffle config or pragma statement(s)."

Sshimaninja commented 3 years ago

Fixed by updating hdwallet provider version in package.json v1.4.0, in which they fixed this issue.

ref: https://github.com/trufflesuite/truffle/issues/3961