I'm trying to get started with what should be a very simple Solidity contract but VSCode is giving me a hard time. I'm using Juan Blancos solidity plugin but VSCode cannot find openzepplin imports
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
The error is:
Source "@openzeppelin/contracts/token/ERC20/ERC20.sol" not found: File import callback not supported
Even though vscode shows red squigglies I can compile successfully via hardhat compile.
If I change the path to
import "../node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol";
VScode stops complaining but then I cannot compile via hardhard, with the error being:
Source "node_modules/@openzeppelin/contracts/security/Pausable.sol" not found: File outside of allowed directories.
My VSCode settings for Solidity extension for both User and Workspace are:
"solidity.packageDefaultDependenciesContractsDirectory": "contracts",
"solidity.packageDefaultDependenciesDirectory": "node_modules"
Which corresponds to my project structure
root
|_ contracts
|_ MyToken.sol
|_ node_modules
|_ @openzepplin
I followed the instructions here and have done extensive researching but unfortunately can't get it to working.
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/access/Ownable.sol";
But it's giving me an errorThis contract not found and File import callback not supported
. UsingJuan Blanco
extension forSolidity
. – Religieux