diff --git a/contracts/.gitignore b/contracts/.gitignore index fa5bbee3..842f3e85 100644 --- a/contracts/.gitignore +++ b/contracts/.gitignore @@ -19,3 +19,5 @@ node_modules coverage/ coverage.json +mochaOutput.json +testMatrix.json \ No newline at end of file diff --git a/contracts/.solcover.js b/contracts/.solcover.js new file mode 100644 index 00000000..b8b8466f --- /dev/null +++ b/contracts/.solcover.js @@ -0,0 +1,25 @@ +module.exports = { + // Improve performance by skipping statements and functions. Tool still checks lines of code and branches: + // https://github.com/sc-forks/solidity-coverage/blob/master/docs/advanced.md + //measureStatementCoverage: false, + //measureFunctionCoverage: false, + + skipFiles: [ + "GasPool", + "test/", + "TestContracts/", + "Interfaces/", + "Dependencies/IERC20.sol", + "Dependencies/IERC2612.sol", + "Dependencies/Math.sol", + "Dependencies/Ownable.sol", + "Dependencies/", + "Integrations/" + ], + // https://github.com/sc-forks/solidity-coverage/blob/master/docs/advanced.md#skipping-tests + mocha: { + grep: "@skip-on-coverage", // Find everything with this tag + invert: true // Run the grep's inverse set. + }, + contractsDir: "src/", +}; diff --git a/contracts/hardhat.config.js b/contracts/hardhat.config.js index e404f6ec..eb6c8f4d 100644 --- a/contracts/hardhat.config.js +++ b/contracts/hardhat.config.js @@ -1,6 +1,7 @@ require("@nomicfoundation/hardhat-foundry"); require("@nomicfoundation/hardhat-toolbox"); require("@nomiclabs/hardhat-truffle5"); +require("solidity-coverage"); const accounts = require("./hardhatAccountsList2k.js"); const accountsList = accounts.accountsList; diff --git a/contracts/package.json b/contracts/package.json index 6975219a..834a6a87 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -39,7 +39,7 @@ "decimal.js": "^10.4.3", "hardhat": "^2.14.0", "hardhat-gas-reporter": "^1.0.8", - "solidity-coverage": "^0.8.1", + "solidity-coverage": "^0.8.8", "ts-node": ">=8.0.0", "typechain": "^8.1.0", "typescript": ">=4.5.0" diff --git a/contracts/yarn.lock b/contracts/yarn.lock index 003f477e..14a1e833 100644 --- a/contracts/yarn.lock +++ b/contracts/yarn.lock @@ -998,12 +998,10 @@ dependencies: antlr4ts "^0.5.0-alpha.4" -"@solidity-parser/parser@^0.16.0": - version "0.16.2" - resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.16.2.tgz#42cb1e3d88b3e8029b0c9befff00b634cd92d2fa" - integrity sha512-PI9NfoA3P8XK2VBkK5oIfRgKDsicwDZfkVq9ZTBCQYGOP1N2owgY2dyLGyU5/J/hQs8KRk55kdmvTLjy3Mu3vg== - dependencies: - antlr4ts "^0.5.0-alpha.4" +"@solidity-parser/parser@^0.18.0": + version "0.18.0" + resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.18.0.tgz#8e77a02a09ecce957255a2f48c9a7178ec191908" + integrity sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA== "@szmarczak/http-timer@^4.0.5": version "4.0.6" @@ -1364,11 +1362,6 @@ acorn@^8.4.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== -address@^1.0.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/address/-/address-1.2.2.tgz#2b5248dac5485a6390532c6a517fda2e3faac89e" - integrity sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA== - adm-zip@^0.4.16: version "0.4.16" resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.16.tgz#cf4c508fdffab02c269cbc7f471a875f05570365" @@ -2470,14 +2463,6 @@ detect-indent@^5.0.0: resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" integrity sha512-rlpvsxUtM0PQvy9iZe640/IWwWYyBsTApREbA1pHOpmOUIl9MkP/U4z7vTtg4Oaojvqhxt7sdufnT0EzGaR31g== -detect-port@^1.3.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/detect-port/-/detect-port-1.5.1.tgz#451ca9b6eaf20451acb0799b8ab40dff7718727b" - integrity sha512-aBzdj76lueB6uUst5iAs7+0H/oOjqI5D16XUWxlWMIMROhcM0rfsNVk93zTngq1dDNpoXRr++Sus7ETAExppAQ== - dependencies: - address "^1.0.1" - debug "4" - diff@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" @@ -4403,7 +4388,7 @@ mnemonist@^0.38.0: dependencies: obliterator "^2.0.0" -mocha@10.2.0, mocha@^10.0.0, mocha@^10.2.0: +mocha@^10.0.0, mocha@^10.2.0: version "10.2.0" resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8" integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg== @@ -5531,16 +5516,15 @@ solc@^0.4.20: semver "^5.3.0" yargs "^4.7.1" -solidity-coverage@^0.8.1: - version "0.8.5" - resolved "https://registry.yarnpkg.com/solidity-coverage/-/solidity-coverage-0.8.5.tgz#64071c3a0c06a0cecf9a7776c35f49edc961e875" - integrity sha512-6C6N6OV2O8FQA0FWA95FdzVH+L16HU94iFgg5wAFZ29UpLFkgNI/DRR2HotG1bC0F4gAc/OMs2BJI44Q/DYlKQ== +solidity-coverage@^0.8.8: + version "0.8.8" + resolved "https://registry.yarnpkg.com/solidity-coverage/-/solidity-coverage-0.8.8.tgz#f856e13817efc75d963cd2a549590c3c54ea565d" + integrity sha512-7RN6/8YAFMQNeMdSulARtE0VC5JitBAUMwvkr10FkOK+nux5q+WykrgSZntkWrX/VHzRa096P4OOViO0T9Q9Cw== dependencies: "@ethersproject/abi" "^5.0.9" - "@solidity-parser/parser" "^0.16.0" + "@solidity-parser/parser" "^0.18.0" chalk "^2.4.2" death "^1.1.0" - detect-port "^1.3.0" difflib "^0.2.4" fs-extra "^8.1.0" ghost-testrpc "^0.0.2" @@ -5548,7 +5532,7 @@ solidity-coverage@^0.8.1: globby "^10.0.1" jsonschema "^1.2.4" lodash "^4.17.15" - mocha "10.2.0" + mocha "^10.2.0" node-emoji "^1.10.0" pify "^4.0.1" recursive-readdir "^2.2.2"