From 453aea2e98a18a44dc570b39a157252722a09f3b Mon Sep 17 00:00:00 2001 From: Alain Nicolas Date: Thu, 14 Mar 2024 11:46:37 +0100 Subject: [PATCH] chore: Fix CI (#564) --- governance/.prettierrc.yml | 13 - governance/README.md | 6 +- governance/hardhat.config.js | 36 --- governance/hardhat.config.ts | 47 ++++ governance/jest.config.js | 7 + governance/package.json | 30 ++- governance/scripts/deploy.js | 25 -- governance/scripts/deploy.ts | 21 ++ .../{deployProxy.js => deployProxy.ts} | 13 +- governance/scripts/upgrade.js | 17 -- governance/scripts/upgrade.ts | 19 ++ .../{VeraxVotingNFT.js => VeraxVotingNFT.ts} | 15 +- governance/tsconfig.json | 4 + package.json | 4 +- pnpm-lock.yaml | 245 ++++++++++++++++-- pnpm-workspace.yaml | 5 +- tsconfig.json | 17 +- 17 files changed, 384 insertions(+), 140 deletions(-) delete mode 100644 governance/.prettierrc.yml delete mode 100644 governance/hardhat.config.js create mode 100644 governance/hardhat.config.ts create mode 100644 governance/jest.config.js delete mode 100644 governance/scripts/deploy.js create mode 100644 governance/scripts/deploy.ts rename governance/scripts/{deployProxy.js => deployProxy.ts} (53%) delete mode 100644 governance/scripts/upgrade.js create mode 100644 governance/scripts/upgrade.ts rename governance/test/{VeraxVotingNFT.js => VeraxVotingNFT.ts} (82%) create mode 100644 governance/tsconfig.json diff --git a/governance/.prettierrc.yml b/governance/.prettierrc.yml deleted file mode 100644 index babf76ce..00000000 --- a/governance/.prettierrc.yml +++ /dev/null @@ -1,13 +0,0 @@ -bracketSpacing: true -printWidth: 120 -proseWrap: "always" -singleQuote: false -tabWidth: 2 -trailingComma: "all" -useTabs: false -overrides: - - files: "*.svg" - options: - parser: "html" -plugins: - - "prettier-plugin-solidity" diff --git a/governance/README.md b/governance/README.md index 14063ae8..ca09b8e7 100644 --- a/governance/README.md +++ b/governance/README.md @@ -12,9 +12,9 @@ npx hardhat help npx hardhat test REPORT_GAS=true npx hardhat test npx hardhat node -npx hardhat run scripts/deploy.js +npx hardhat run scripts/deploy.ts -npx hardhat run scripts/deployProxy.js --network arbitrum_one +npx hardhat run scripts/deployProxy.ts --network arbitrum_one npx hardhat verify --network arbitrum_one [PROXY_ADDRESS] -npx hardhat run scripts/upgrade.js --network arbitrum_one +npx hardhat run scripts/upgrade.ts --network arbitrum_one ``` diff --git a/governance/hardhat.config.js b/governance/hardhat.config.js deleted file mode 100644 index 6657d58d..00000000 --- a/governance/hardhat.config.js +++ /dev/null @@ -1,36 +0,0 @@ -require("@nomicfoundation/hardhat-toolbox"); -require("@openzeppelin/hardhat-upgrades"); -require("dotenv").config(); - -const { PRIVATE_KEY, LINEASCAN_API_KEY, ARBITRUM_MAINNET_PRIVATE_KEY, ARBITRUM_API_KEY } = process.env; - -/** @type import('hardhat/config').HardhatUserConfig */ -module.exports = { - solidity: "0.8.20", - networks: { - linea_testnet: { - url: `https://rpc.goerli.linea.build/`, - accounts: [PRIVATE_KEY], - }, - arbitrum_one: { - url: "https://arb1.arbitrum.io/rpc", - accounts: [ARBITRUM_MAINNET_PRIVATE_KEY], - }, - }, - etherscan: { - apiKey: { - linea_testnet: LINEASCAN_API_KEY, - arbitrumOne: ARBITRUM_API_KEY, - }, - customChains: [ - { - network: "linea_testnet", - chainId: 59140, - urls: { - apiURL: "https://api-testnet.lineascan.build/api", - browserURL: "https://goerli.lineascan.build/address", - }, - }, - ], - }, -}; diff --git a/governance/hardhat.config.ts b/governance/hardhat.config.ts new file mode 100644 index 00000000..a0ba462d --- /dev/null +++ b/governance/hardhat.config.ts @@ -0,0 +1,47 @@ +import { HardhatUserConfig } from "hardhat/config"; +import "@nomicfoundation/hardhat-toolbox"; +import "@nomicfoundation/hardhat-foundry"; +import "@openzeppelin/hardhat-upgrades"; +import dotenv from "dotenv"; + +dotenv.config({ path: "./.env" }); + +const { PRIVATE_KEY, LINEASCAN_API_KEY, ARBITRUM_MAINNET_PRIVATE_KEY, ARBITRUM_API_KEY } = process.env; + +const config: HardhatUserConfig = { + solidity: { + compilers: [ + { + version: "0.8.20", + }, + ], + }, + networks: { + linea_testnet: { + url: `https://rpc.goerli.linea.build/`, + accounts: [PRIVATE_KEY ?? ""], + }, + arbitrum_one: { + url: "https://arb1.arbitrum.io/rpc", + accounts: [ARBITRUM_MAINNET_PRIVATE_KEY ?? ""], + }, + }, + etherscan: { + apiKey: { + linea_testnet: LINEASCAN_API_KEY ?? "", + arbitrumOne: ARBITRUM_API_KEY ?? "", + }, + customChains: [ + { + network: "linea_testnet", + chainId: 59140, + urls: { + apiURL: "https://api-testnet.lineascan.build/api", + browserURL: "https://goerli.lineascan.build/address", + }, + }, + ], + }, +}; + +export default config; diff --git a/governance/jest.config.js b/governance/jest.config.js new file mode 100644 index 00000000..ccf458d9 --- /dev/null +++ b/governance/jest.config.js @@ -0,0 +1,7 @@ +/** @type {import("jest").Config} */ +const config = { + preset: "ts-jest", + testEnvironment: "node", +}; + +module.exports = config; diff --git a/governance/package.json b/governance/package.json index 47522a1e..db0f740f 100644 --- a/governance/package.json +++ b/governance/package.json @@ -2,25 +2,31 @@ "name": "votingnft", "version": "1.0.0", "description": "", + "license": "ISC", + "author": "", "main": "index.js", "scripts": { "lint": "eslint .", - "prepare": "husky install", "prettier:check": "prettier --check \"**/*.{json,yml,md,sol,js}\"", "prettier:write": "prettier --write \"**/*.{json,yml,md,sol,js}\"" }, - "author": "", - "license": "ISC", - "devDependencies": { - "@nomicfoundation/hardhat-toolbox": "^4.0.0", - "@openzeppelin/hardhat-upgrades": "^3.0.0", - "dotenv": "^16.3.1", - "hardhat": "^2.19.2", - "prettier": "^3.1.1", - "prettier-plugin-solidity": "^1.2.0" - }, "dependencies": { "@openzeppelin/contracts": "^5.0.1", - "@openzeppelin/contracts-upgradeable": "^5.0.2" + "@openzeppelin/contracts-upgradeable": "^5.0.2", + "@types/node": "^20.9.0" + }, + "devDependencies": { + "@nomicfoundation/hardhat-ethers": "^3.0.4", + "@nomicfoundation/hardhat-toolbox": "^3.0.0", + "@openzeppelin/hardhat-upgrades": "^2.3.3", + "@types/jest": "^29.5.8", + "@types/node": "^20.9.0", + "babel-jest": "^29.7.0", + "dotenv": "^16.3.1", + "ethers": "^6.8.1", + "hardhat": "^2.19.0", + "jest": "^29.7.0", + "ts-jest": "^29.1.1", + "ts-node": "^10.9.1" } } diff --git a/governance/scripts/deploy.js b/governance/scripts/deploy.js deleted file mode 100644 index 0327a277..00000000 --- a/governance/scripts/deploy.js +++ /dev/null @@ -1,25 +0,0 @@ -// We require the Hardhat Runtime Environment explicitly here. This is optional -// but useful for running the script in a standalone fashion through `node