From 5367da16acb95b3bd4b88384e6c72cb431a05900 Mon Sep 17 00:00:00 2001 From: Alex Forshtat Date: Mon, 23 Dec 2024 17:07:31 +0100 Subject: [PATCH] Bring over hardhat and github actions configurations --- .github/workflows/build.yml | 43 +++++++++++++++++++++++++++++++++++++ hardhat.config.ts | 24 ++++++++++++++++----- package.json | 11 ++++++---- yarn.lock | 33 ++++++++++------------------ 4 files changed, 80 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ba664c8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,43 @@ +name: Build +on: + push: + branches: + - '*' + pull_request: + types: [opened, reopened, synchronize] + +env: + TS_NODE_TRANSPILE_ONLY: 1 + FORCE_COLORS: 1 + +jobs: + + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/setup-node@v1 + with: + node-version: '22' + - uses: actions/checkout@v1 + - uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install + - run: yarn compile + - run: yarn test + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v1 + with: + node-version: '22' + - uses: actions/checkout@v1 + - uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install + - run: yarn lint diff --git a/hardhat.config.ts b/hardhat.config.ts index 1d46a2e..f35d3a1 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,9 +1,23 @@ -import { HardhatUserConfig } from "hardhat/config"; -import "@nomicfoundation/hardhat-toolbox"; +import '@nomiclabs/hardhat-waffle' import '@typechain/hardhat' +import { HardhatUserConfig } from 'hardhat/config' const config: HardhatUserConfig = { - solidity: "0.8.28", -}; + solidity: { + compilers: [ + { + version: '0.8.24', + settings: { + evmVersion: 'cancun', + viaIR: true, + optimizer: { + enabled: true, + runs: 1000000 + } + } + } + ] + } +} -export default config; +export default config diff --git a/package.json b/package.json index f35886a..16f19c1 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,10 @@ "license": "MIT", "scripts": { "compile": "hardhat compile", - "test": "hardhat test" + "test": "hardhat test", + "lint": "yarn run lint:sol && yarn run lint:js", + "lint:js": "eslint -f unix .", + "lint:sol": "solhint -f unix \"contracts/**/*.sol\" --max-warnings 0" }, "dependencies": { "@account-abstraction/contracts": "^0.7.0", @@ -15,20 +18,20 @@ }, "devDependencies": { "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", - "@nomicfoundation/hardhat-ethers": "^3.0.0", "@nomicfoundation/hardhat-ignition": "^0.15.0", "@nomicfoundation/hardhat-ignition-ethers": "^0.15.0", "@nomicfoundation/hardhat-network-helpers": "^1.0.0", "@nomicfoundation/hardhat-toolbox": "^5.0.0", "@nomicfoundation/hardhat-verify": "^2.0.0", + "@nomiclabs/hardhat-ethers": "^2.2.3", + "@nomiclabs/hardhat-waffle": "^2.0.6", "@typechain/ethers-v5": "^10.1.0", - "@typechain/ethers-v6": "^0.5.0", "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.2.0", "@types/mocha": ">=9.1.0", "@types/node": ">=18.0.0", "chai": "^4.2.0", - "ethers": "^5.4.2", + "ethers": "^5.7.2", "hardhat": "^2.22.17", "hardhat-gas-reporter": "^1.0.8", "solidity-coverage": "^0.8.0", diff --git a/yarn.lock b/yarn.lock index e1a4c2a..36fbfa5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -571,14 +571,6 @@ deep-eql "^4.0.1" ordinal "^1.0.3" -"@nomicfoundation/hardhat-ethers@^3.0.0": - version "3.0.8" - resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.8.tgz#af078f566373abeb77e11cbe69fe3dd47f8bfc27" - integrity sha512-zhOZ4hdRORls31DTOqg+GmEZM0ujly8GGIuRY7t7szEk2zW/arY1qDug/py8AEktT00v5K+b6RvbVog+va51IA== - dependencies: - debug "^4.1.1" - lodash.isequal "^4.5.0" - "@nomicfoundation/hardhat-ignition-ethers@^0.15.0": version "0.15.9" resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ignition-ethers/-/hardhat-ignition-ethers-0.15.9.tgz#706801c2e8c70b39c77377439bdb240c20eee76c" @@ -692,6 +684,16 @@ "@nomicfoundation/solidity-analyzer-linux-x64-musl" "0.1.2" "@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.1.2" +"@nomiclabs/hardhat-ethers@^2.2.3": + version "2.2.3" + resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.2.3.tgz#b41053e360c31a32c2640c9a45ee981a7e603fe0" + integrity sha512-YhzPdzb612X591FOe68q+qXVXGG2ANZRvDo0RRUtimev85rCrAlv/TLMEZw5c+kq9AbzocLTVX/h2jVIFPL9Xg== + +"@nomiclabs/hardhat-waffle@^2.0.6": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-waffle/-/hardhat-waffle-2.0.6.tgz#d11cb063a5f61a77806053e54009c40ddee49a54" + integrity sha512-+Wz0hwmJGSI17B+BhU/qFRZ1l6/xMW82QGXE/Gi+WTmwgJrQefuBs1lIf7hzQ1hLk6hpkvb/zwcNkpVKRYTQYg== + "@openzeppelin/contracts@3.4.2-solc-0.7": version "3.4.2-solc-0.7" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.4.2-solc-0.7.tgz#38f4dbab672631034076ccdf2f3201fab1726635" @@ -849,14 +851,6 @@ lodash "^4.17.15" ts-essentials "^7.0.1" -"@typechain/ethers-v6@^0.5.0": - version "0.5.1" - resolved "https://registry.yarnpkg.com/@typechain/ethers-v6/-/ethers-v6-0.5.1.tgz#42fe214a19a8b687086c93189b301e2b878797ea" - integrity sha512-F+GklO8jBWlsaVV+9oHaPh5NJdd6rAKN4tklGfInX1Q7h0xPgVLP39Jl3eCulPB5qexI71ZFHwbljx4ZXNfouA== - dependencies: - lodash "^4.17.15" - ts-essentials "^7.0.1" - "@typechain/hardhat@^2.3.0": version "2.3.1" resolved "https://registry.yarnpkg.com/@typechain/hardhat/-/hardhat-2.3.1.tgz#1e8a6e3795e115a5d5348526282b5c597fab0b78" @@ -1909,7 +1903,7 @@ ethereumjs-util@^7.1.4: ethereum-cryptography "^0.1.3" rlp "^2.2.4" -ethers@^5.4.2, ethers@^5.7.2: +ethers@^5.7.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -2668,11 +2662,6 @@ lodash.clonedeep@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ== -lodash.isequal@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" - integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== - lodash.truncate@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193"