0

ParserError: Source "@openzeppelin/[email protected]/token/ERC20/ERC20.sol" not found: File import callback not supported --> myc:4:1: | 4 | import "@openzeppelin/[email protected]/token/ERC20/ERC20.sol" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "@openzeppelin/[email protected]/access/Ownable.sol" not found: File import callback not supported --> myc:5:1: | 5 | import "@openzeppelin/[email protected]/access/Ownable.sol" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 Answer 1

1

If you are deploying from local machine and not remix IDE then what you can do is flatten your code using sol-merger. To install sol-merger you can do npm install -g sol-merger. And to flatten the file you can do sol-merger <your-contract-with-fullpath> <new-location-to-store-flatten-file>

  • Ex. sol-merger ./contract/test.sol ./build

  • Or you can do is use hardhat or truffle plugins to verify your contracts.

  • You can reference this also ref

  • In this example I assume that you already install node_modules of @openzeppelin/contracts in your local.

2
  • // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/[email protected]/token/ERC20/ERC20.sol"; import "@openzeppelin/[email protected]/access/Ownable.sol"; /// @custom:security-contact p*********@gmail.com contract U********** is ERC20, Ownable { constructor() ERC20("Uranium238", "U238") { _mint(msg.sender, 500000000000000 * 10 ** decimals()); } }
    – John Smith
    May 30, 2023 at 17:40
  • That is my contract
    – John Smith
    May 30, 2023 at 17:41

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.