Failing to verify contract on Etherscan from Remix

Hi all, I deployed a contract and I'm having trouble verifying via Etherscan. I used Remix to compile and deploy this contract.

A gist of the code I'm trying to get verified is https://gist.github.com/jonathonyule/9794fe274aafb8027a4bf3ad064df387

The error(s) are as follows:

ParserError: Source "@openzeppelin/contracts/security/ReentrancyGuard.sol" not found: File import callback not supported
  --> contracts...MuniGolfClub.sol:36:1:
   |
36 | import "@openzeppelin/contracts/security/ReentrancyGuard.sol"
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "@openzeppelin/contracts/access/Ownable.sol" not found: File import callback not supported
  --> contracts...MuniGolfClub.sol:37:1:
   |
37 | import "@openzeppelin/contracts/access/Ownable.sol"
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "@openzeppelin/contracts/utils/Counters.sol" not found: File import callback not supported
  --> contracts...MuniGolfClub.sol:38:1:
   |
38 | import "@openzeppelin/contracts/utils/Counters.sol"
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol" not found: File import callback not supported
  --> contracts...MuniGolfClub.sol:39:1:
   |
39 | import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "@openzeppelin/contracts/token/ERC20/ERC20.sol" not found: File import callback not supported
  --> contracts...MuniGolfClub.sol:40:1:
   |
40 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "@openzeppelin/contracts/token/ERC20/IERC20.sol" not found: File import callback not supported
  --> contracts...MuniGolfClub.sol:41:1:
   |
41 | import "@openzeppelin/contracts/token/ERC20/IERC20.sol"
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "Base64.sol" not found: File import callback not supported
  --> contracts...MuniGolfClub.sol:42:1:
   |
42 | import "./Base64.sol"
   | ^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "remix_tests.sol" not found: File import callback not supported
 --> tests...4_Ballot_test.sol:4:1:
  |
4 | import "remix_tests.sol" // this import is automatically injected by Remix.
  | ^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "contracts/3_Ballot.sol" not found: File import callback not supported
 --> tests...4_Ballot_test.sol:5:1:
  |
5 | import "../contracts/3_Ballot.sol"
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I have tried truffle-flattener as well but i get errors like below that prevent progress from trying to upload a flattened file as well.

{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":40,"msg":"!!! @openzeppelin/contracts/security/ReentrancyGuard.sol SOURCE FILE WAS NOT FOUND. I'M TRYING TO FIND IT RECURSIVELY !!!","time":"2021-11-28T07:06:26.150Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":30,"msg":"@openzeppelin/contracts/security/ReentrancyGuard.sol SOURCE FILE WAS FOUND","time":"2021-11-28T07:06:26.422Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":40,"msg":"!!! @openzeppelin/contracts/access/Ownable.sol SOURCE FILE WAS NOT FOUND. I'M TRYING TO FIND IT RECURSIVELY !!!","time":"2021-11-28T07:06:26.422Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":30,"msg":"@openzeppelin/contracts/access/Ownable.sol SOURCE FILE WAS FOUND","time":"2021-11-28T07:06:26.635Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":40,"msg":"!!! @openzeppelin/contracts/utils/Counters.sol SOURCE FILE WAS NOT FOUND. I'M TRYING TO FIND IT RECURSIVELY !!!","time":"2021-11-28T07:06:26.635Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":30,"msg":"@openzeppelin/contracts/utils/Counters.sol SOURCE FILE WAS FOUND","time":"2021-11-28T07:06:26.818Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":40,"msg":"!!! @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol SOURCE FILE WAS NOT FOUND. I'M TRYING TO FIND IT RECURSIVELY !!!","time":"2021-11-28T07:06:26.818Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":30,"msg":"@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol SOURCE FILE WAS FOUND","time":"2021-11-28T07:06:27.028Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":40,"msg":"!!! @openzeppelin/contracts/token/ERC20/ERC20.sol SOURCE FILE WAS NOT FOUND. I'M TRYING TO FIND IT RECURSIVELY !!!","time":"2021-11-28T07:06:27.028Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":30,"msg":"@openzeppelin/contracts/token/ERC20/ERC20.sol SOURCE FILE WAS FOUND","time":"2021-11-28T07:06:27.230Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":40,"msg":"!!! @openzeppelin/contracts/token/ERC20/IERC20.sol SOURCE FILE WAS NOT FOUND. I'M TRYING TO FIND IT RECURSIVELY !!!","time":"2021-11-28T07:06:27.230Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":30,"msg":"@openzeppelin/contracts/token/ERC20/IERC20.sol SOURCE FILE WAS FOUND","time":"2021-11-28T07:06:27.413Z","v":0}
{"name":"solidity-flattener","hostname":"computer.local","pid":38721,"level":40,"msg":"!!! /Users/jonathonyule/municipal-contract-truffle/node_modules/@poanet/solidity-flattener/contracts/Base64.sol SOURCE FILE WAS NOT FOUND. I'M TRYING TO FIND IT RECURSIVELY !!!","time":"2021-11-28T07:06:27.413Z","v":0}
glob error [Error: EPERM: operation not permitted, scandir '/Users/jonathonyule/Library/Accounts'] {
  errno: -1,
  code: 'EPERM',
  syscall: 'scandir',
  path: '/Users/jonathonyule/Library/Accounts'
}
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

[Error: EPERM: operation not permitted, scandir '/Users/jonathonyule/Library/Accounts'] {
  errno: -1,
  code: 'EPERM',
  syscall: 'scandir',
  path: '/Users/jonathonyule/Library/Accounts'
}

Any help would be greatly appreciated.

1 Like

Did you try Flattener in Remix?

1 Like

This worked, thank you!

Please search before posting on this forum. This is answered at length in our megathread on verification: