Truffle Flattener: ParserError: missing ';' at '{'

Help please, I already deployed a contract that I need to verify but I am getting the following error:

npx truffle-flattener .\contracts\ERC20Token.sol > .\contracts\FlatERC20Token.sol
(node:23120) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:23120) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
Error: Could not parse C:\Users\ateyar\Documents\GitHub\token-erc20\node_modules\@openzeppelin\contracts\utils\math\SafeMath.sol for extracting its imports: ParserError: missing ';' at '{' (22:18)
    at getDependencies (C:\Users\ateyar\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:44:11)
    at dependenciesDfs (C:\Users\ateyar\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:64:24)
    at async dependenciesDfs (C:\Users\ateyar\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:73:7)
    at async getSortedFilePaths (C:\Users\ateyar\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:83:5)
    at async flatten (C:\Users\ateyar\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:180:23)
    at async main (C:\Users\ateyar\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:237:3)
1 Like

Hi @aress31,

You may want to check in the Hardhat Discord: https://hardhat.org/discord

Assuming you are flattening to verify, I suggest using Hardhat to verify: Verify smart contract inheriting from OpenZeppelin Contracts

Using the truffle plugin: truffle-plugin-verify solved this issue!

2 Likes