1
// contracts/OurToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract OurToken is ERC20 {
constructor(uint256 initialSupply) ERC20("tkname", "tkn") {
    _mint(msg.sender, initialSupply);
    }
 }

this are my helpful-scripts py

dependencies:
  - OpenZeppelin/[email protected]
compiler:
  solc:
    remappinigs:
      - '@openzeppelin=OpenZeppelin/[email protected]'
dotenv: .env
wallets:
  from_key: ${PRIVATE_KEY}

error ParserError: Source "@openzeppelin/contracts/token/ERC20/ERC20.sol" not found: File not found. Searched the following locations: "". --> contracts/OurToken.sol:5:1: | 5 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2 Answers 2

1

seems like you are simply just missing to install the OpenZeppelin library in your project. To fix the issue, you can simply run the following command

npm install @openzeppelin/contracts

Try to check whether you can find any @openzeppelin folder under node_modules. If there is, then the import should not fail.

Hope this helps~

0

Brownie Solution

You can double check that the package is installed using brownie pm list. The output will look something like this:

OpenZeppelin
 ├─OpenZeppelin/[email protected]

If its not installed, you can run the following command in the terminal:

brownie pm install OpenZeppelin/[email protected]

Read more about the package manager command here.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.