Solidity-docgen: Source file requires different compiler version (0.6.10 vs 0.6.12)

Hal reported on ConsenSys Discord (https://discordapp.com/channels/697535391594446898/718202932239007844/776868878457503785)

Error: Solidity was unable to compile. 
    contracts/truefi/LoanFactory.sol:2:1: ParserError: Source file requires 
    different compiler version (current compiler is 
    0.6.12+commit.27d51765.Emscripten.clang) - note that nightly builds are 
    considered to be strictly less than the released version
    pragma solidity 0.6.10;

after running solidity-docgen --solc-module solc-0.6.10 -i contracts/truefi -o docs

To use Solidity DocGen with a different version of the compiler we can do the following:

Install the version of the compiler and use an alias to it:

$ npm install -D solc-0.6@npm:solc@0.6.10

Then run Solidity DocGen using the alias

$ npx solidity-docgen --solc-module solc-0.6

I tried this with example contract:

pragma solidity 0.6.10;

contract MyContract {
    
}

Now I’m getting:

TypeError: Cannot destructure property 'content' of 
    'this.input.sources[source]' as it is undefined.

After running:

yarn add -D solc-0.6@npm:solc@0.6.10
npx solidity-docgen --solc-module solc-0.6
1 Like

Hi @feewet,

Welcome to the community :wave:

I assume you need to specify your input?
npx solidity-docgen --solc-module solc-0.6 -i contracts/truefi -o docs

Do you have a repository that you can share?

Branch I’m working on: https://github.com/trusttoken/smart-contracts/tree/additional-docs

I was able to generate some docs (yay), but am still getting the following error:

Error: Solidity was unable to compile. 
    contracts/registry/interface/IRegistry.sol:7:1: ParserError: Source 
    "contracts/registry/true-currencies/interface/IReclaimerToken.sol" not
     found: Cannot find module 
    'contracts/registry/true-currencies/interface/IReclaimerToken.sol'
    Require stack:
    - /Users/haroldhyatt/.config/yarn/global/node_modules/solidity-docgen/
    dist/solc.js
    - /Users/haroldhyatt/.config/yarn/global/node_modules/solidity-docgen/
    dist/docgen.js
    - /Users/haroldhyatt/.config/yarn/global/node_modules/solidity-docgen/
    dist/cli.js
    import {IReclaimerToken} from 
    "../true-currencies/interface/IReclaimerToken.sol";
    ^---------------------------------------------------------------------
    ----------^

Thanks so much for the support!

1 Like

Hi @feewet,

The following import doesn’t exist, you need to update the reference (or remove it if it isn’t needed), I assume this is meant to be: import {IReclaimerToken} from "../../true-currencies/interface/IReclaimerToken.sol";

Hi @feewet,

Just wanted to check if you were able to create your documentation?