Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenZeppelin Contracts error during compilation #432

Closed
severalpens opened this issue Feb 3, 2021 · 2 comments
Closed

OpenZeppelin Contracts error during compilation #432

severalpens opened this issue Feb 3, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@severalpens
Copy link

I'm getting the following error when running 'npm run build':

Error: None of the sub-resolvers resolved "../../GSN/Context.sol" location.

waffle.json:

{
  "compilerType": "solcjs",
  "compilerVersion": "0.6.2",
  "sourceDirectory": "./src",
  "outputDirectory": "./build",
}

package.json (extract):

  "scripts": {
    "start": "node index",
     "build": "waffle"
  },
  "dependencies": {
    "dotenv": "^8.2.0",
    "ethers": "^5.0.28"
  },
  "devDependencies": {
    "@openzeppelin/contracts": "^3.4.0",
    "ethereum-waffle": "^3.2.2"
  }

contract:

pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract BasicToken is ERC20 {
constructor(uint256 initialBalance) ERC20("Basic", "BSC") public {
_mint(msg.sender, initialBalance);
_setupDecimals(0);
}

}
@marekkirejczyk marekkirejczyk added the bug Something isn't working label Feb 25, 2021
@slhodak
Copy link

slhodak commented Mar 27, 2021

I have encountered this too, in a project with both Chainlink and OpenZeppelin imports, only the OpenZeppelin ones cause the issue.

Minimal example with yarn add completed for both repositories:

Contract

pragma solidity ^0.6.6;
import "@openzeppelin/contracts/access/Ownable.sol";
contract AnyRateOracle is Ownable { constructor() public {} }

Terminal Output

$ yarn waffle
yarn run v1.22.10
$ /Users/----/Documents/Projects/Programming/-----/oss/bugs/waffle-imports/node_modules/.bin/waffle
Error: None of the sub-resolvers resolved "@openzeppelin/contracts/access/Ownable.sol" location.
    at resolverError (/Users/-----/Documents/Projects/Programming/----/oss/bugs/waffle-imports/node_modules/@resolver-engine/core/build/resolverengine.js:75:32)
    at ResolverEngine.<anonymous> (/Users/-----/Documents/Projects/Programming/-----/oss/bugs/waffle-imports/node_modules/@resolver-engine/core/build/resolverengine.js:52:23)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/-----/Documents/Projects/Programming/----/oss/bugs/waffle-imports/node_modules/@resolver-engine/core/build/resolverengine.js:4:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

note: paths with '-----' are my own redactions

waffle.json

{
  "compilerType": "solcjs",
  "compilerVersion": "0.6.6",
  "sourceDirectory": "./contracts",
  "outputDirectory": "./build"
}

About my waffle version

"@ethereum-waffle/compiler@^3.3.0":
  version "3.3.1"
  resolved "https://registry.yarnpkg.com/@ethereum-waffle/compiler/-/compiler-3.3.1.tgz#946128fd565aa4347075fd716dbd0f3f38189280"
  integrity sha512-X/TeQugt94AQwXEdCjIQxcXYGawNulVBYEBE7nloj4wE/RBxNolXwjoVNjcS4kuiMMbKkdO0JkL5sn6ixx8bDg==
  dependencies:
    "@resolver-engine/imports" "^0.3.3"
    "@resolver-engine/imports-fs" "^0.3.3"
...

@rzadp
Copy link
Contributor

rzadp commented Aug 1, 2022

I have not been able to reproduce the problem from @severalpens, and with problem from @slhodak I have something else:

Error: None of the sub-parsers resolved "src/contracts/AnyRateOracle.sol" into data. Please confirm your configuration.

Which goes away once I add any content to the smart contract except the empty constructor.
So it seems like I have not been able to reproduce the error with resolving the OpenZeppeling contracts.
So I'm going to close it now as non-reproducible, but feel free to reopen if the issue still persists for you, and you have another piece of code/configuration I can try.

@rzadp rzadp closed this as completed Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants