ScopeLift / flexible-voting

💪🗳️ Flexible Voting – A Powerful Building Block for DAO Governance
https://flexiblevoting.com
MIT License
86 stars 8 forks source link

N-01 OpenZeppelin Imports in Incorrect Format #45

Closed davidlaprade closed 1 year ago

davidlaprade commented 1 year ago

OZ recommends that contracts import its code using the node style so that they have out-of-the box compatibility with hardhat.

Note that CI will fail because of a formatting error. I've left the formatting change out of this PR to (a) keep it clean and specific to the issue above and (b) because that formatting error has already been fixed in #40 which will merge before this.

I manually tested that this can now be imported into a hardhat project without issue. Steps to do this were:

  1. mkdir + cd into a new directory
  2. npm init
  3. npx hardhat
  4. npm install @openzeppelin/contracts
  5. npm install ScopeLift/flexible-voting#oz-audit-fixes-N01-hardhat-friendly-imports --save
  6. copy this file into /contracts
  7. modify the file so that imports look like:
      import "flexible-voting/src/GovernorCountingFractional.sol";
      import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";
  8. npx hardhat compile
image