From e8cd17eef9d9b8d49349b4c8075f206652a256de Mon Sep 17 00:00:00 2001 From: Abhishek Krishna Date: Thu, 23 Apr 2026 18:34:38 +0530 Subject: [PATCH] feat(ci): wire contracts/*.sol into hardhat, bump solc to 0.8.26 cancun MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #27 unbroke `npx hardhat compile` (got `npm ci` working), but the job still output "Nothing to compile" — hardhat looked at `deploy/contracts/` which doesn't exist; the repo's Solidity sources live in `contracts/` at the repo root. This wires them up properly: - `paths.root = ".."` + `paths.sources = "contracts"` points hardhat at the real source tree. `paths.tests` / `paths.cache` / `paths.artifacts` follow the same root-relative convention so the structure stays clean. - Solidity bumped to `0.8.26` with `evmVersion: "cancun"` because `@openzeppelin/contracts ^5.0.0` (already in `package.json`) uses `mcopy` in `utils/Memory.sol`, which needs the cancun opcode. Verification (locally, from `deploy/`): ``` $ rm -rf cache artifacts && npx hardhat compile Compiled 24 Solidity files successfully (evm target: cancun). ``` The `contracts` CI job on main will now actually type-check the four Solidity files we ship — `MeridianVault.sol`, `MeridianVaultERC4626.sol` (ERC-4626 vault-share token), `OracleAdapter.sol`, `StrategyExecutor.sol` — instead of silently succeeding on an empty source set. Follow-up (separate PR): fix the `_getChainlinkPrice(pairId, ...)` vs `pairId(string)` name-shadowing warning in OracleAdapter.sol. Co-Authored-By: Claude Opus 4.7 --- .github/workflows/ci.yml | 5 +---- deploy/hardhat.config.js | 14 ++++++++++++-- deploy/package.json | 19 ------------------- deploy/package-lock.json => package-lock.json | 0 package.json | 19 +++++++++++++++++++ 5 files changed, 32 insertions(+), 25 deletions(-) delete mode 100644 deploy/package.json rename deploy/package-lock.json => package-lock.json (100%) create mode 100644 package.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9fd5b99..dba60ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,13 +13,10 @@ jobs: contracts: runs-on: ubuntu-latest - defaults: - run: - working-directory: deploy steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20' - run: npm ci - - run: npx hardhat compile + - run: npm run compile diff --git a/deploy/hardhat.config.js b/deploy/hardhat.config.js index 7e1e1a1..0742081 100644 --- a/deploy/hardhat.config.js +++ b/deploy/hardhat.config.js @@ -2,8 +2,18 @@ require("@nomicfoundation/hardhat-toolbox"); module.exports = { solidity: { - version: "0.8.24", - settings: { optimizer: { enabled: true, runs: 200 } }, + version: "0.8.26", + settings: { + optimizer: { enabled: true, runs: 200 }, + evmVersion: "cancun", + }, + }, + paths: { + root: "..", + sources: "contracts", + tests: "tests/contracts", + cache: "deploy/cache", + artifacts: "deploy/artifacts", }, networks: { hardhat: {}, diff --git a/deploy/package.json b/deploy/package.json deleted file mode 100644 index 006cf37..0000000 --- a/deploy/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "@kcolbchain/meridian-contracts", - "version": "0.1.0", - "scripts": { - "compile": "hardhat compile", - "test": "hardhat test", - "deploy:local": "hardhat run deploy.js --network localhost", - "deploy:base-sepolia": "hardhat run deploy.js --network base-sepolia", - "deploy:op-sepolia": "hardhat run deploy.js --network op-sepolia", - "deploy:fuji": "hardhat run deploy.js --network fuji" - }, - "dependencies": { - "@openzeppelin/contracts": "^5.0.0" - }, - "devDependencies": { - "@nomicfoundation/hardhat-toolbox": "^4.0.0", - "hardhat": "^2.19.0" - } -} diff --git a/deploy/package-lock.json b/package-lock.json similarity index 100% rename from deploy/package-lock.json rename to package-lock.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..1f6ca4a --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "@kcolbchain/meridian-contracts", + "version": "0.1.0", + "scripts": { + "compile": "hardhat --config deploy/hardhat.config.js compile", + "test": "hardhat --config deploy/hardhat.config.js test", + "deploy:local": "hardhat --config deploy/hardhat.config.js run deploy/deploy.js --network localhost", + "deploy:base-sepolia": "hardhat --config deploy/hardhat.config.js run deploy/deploy.js --network base-sepolia", + "deploy:op-sepolia": "hardhat --config deploy/hardhat.config.js run deploy/deploy.js --network op-sepolia", + "deploy:fuji": "hardhat --config deploy/hardhat.config.js run deploy/deploy.js --network fuji" + }, + "dependencies": { + "@openzeppelin/contracts": "^5.0.0" + }, + "devDependencies": { + "@nomicfoundation/hardhat-toolbox": "^4.0.0", + "hardhat": "^2.19.0" + } +}