Flattener Fails on some imports

I am trying to use BlockScout “Verify and Publish” for an OpenZeppelin-based NFT contract.

I tried using the poa flattener on the file node_modules/@openzeppelin/contracts/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol

BS gives an error saying that the identifier AccessControlEnumerable was not found. Looking at the flattened code, I agree with BlockScout. The flattener has failed to import the required code.

The original contract code is certainly correct. It contains this correct import statement:
import “…/…/…/access/AccessControlEnumerable.sol”;

The flattener says it found node_modules/@openzeppelin/contracts/token/ERC20/access/AccessControlEnumerable.sol, but it seems to be confused about where it is looking and, sadly, does not include the necessary code.

Any suggestions on how to proceed?

Are you sure, that you pasted flattened code to the contract verification page and not raw code? I am asking because if flattener didn’t find any of the sources during flattening, it shouldn’t generate flattened code. Could you provide a step-by-step guide of reproducing this issue?

1 Like