diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 43651ce..54eaabf 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -12,6 +12,8 @@ jobs: build: name: Run tests with Hardhat runs-on: ubuntu-latest + env: + CI: 'true' steps: - name: Checkout code diff --git a/.gitignore b/.gitignore index c6bba59..af113b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,130 +1,18 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) -web_modules/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional stylelint cache -.stylelintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variable files +node_modules .env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# parcel-bundler cache (https://parceljs.org/) -.cache -.parcel-cache - -# Next.js build output -.next -out - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and not Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# vuepress v2.x temp and cache directory -.temp -.cache - -# Docusaurus cache and generated files -.docusaurus - -# Serverless directories -.serverless/ -# FuseBox cache -.fusebox/ +# Hardhat files +/cache +/artifacts -# DynamoDB Local files -.dynamodb/ +# TypeChain files +/typechain +/typechain-types -# TernJS port file -.tern-port +# solidity-coverage files +/coverage +/coverage.json -# Stores VSCode versions used for testing VSCode extensions -.vscode-test +.openzeppelin -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* +/src/types \ No newline at end of file diff --git a/contracts/.keep b/contracts/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/contracts/evm/.gitignore b/contracts/evm/.gitignore deleted file mode 100644 index af113b1..0000000 --- a/contracts/evm/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -node_modules -.env - -# Hardhat files -/cache -/artifacts - -# TypeChain files -/typechain -/typechain-types - -# solidity-coverage files -/coverage -/coverage.json - -.openzeppelin - -/src/types \ No newline at end of file diff --git a/contracts/evm/README.md b/contracts/evm/README.md deleted file mode 100644 index 7be82e5..0000000 --- a/contracts/evm/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Sample Hardhat Project - -This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract. - -Try running some of the following tasks: - -```shell -npx hardhat help -npx hardhat test -REPORT_GAS=true npx hardhat test -npx hardhat node -npx hardhat run scripts/deploy.ts -``` diff --git a/contracts/evm/hardhat.config.ts b/contracts/evm/hardhat.config.ts deleted file mode 100644 index 2ab29a7..0000000 --- a/contracts/evm/hardhat.config.ts +++ /dev/null @@ -1,55 +0,0 @@ -import "@nomicfoundation/hardhat-chai-matchers" -import "@nomicfoundation/hardhat-toolbox" -import "@openzeppelin/hardhat-upgrades" -import { config as dotenvConfig } from "dotenv" -import type { HardhatUserConfig } from "hardhat/config" -import { resolve, join } from "path" - -const dotenvConfigPath: string = process.env.DOTENV_CONFIG_PATH || join(__dirname, "..", "..", ".env") -dotenvConfig({ path: resolve(__dirname, dotenvConfigPath) }) - -const etherscanApiKey = process.env.ETHERSCAN_API_KEY -const account = process.env.PRIVATE_KEY -const RPC = process.env.POLYGON_RPC_URL - -if (!etherscanApiKey) throw new Error("Hardhat_Config: etherscan api key is not defined.") -if (!account) throw new Error("Hardhat_Config: account is not defined.") -if (!RPC) throw new Error("Hardhat_Config: RPC is not defined.") - -const config: HardhatUserConfig = { - defaultNetwork: "hardhat", - solidity: "0.8.20", - networks: { - hardhat: { - allowUnlimitedContractSize: false, - }, - mumbai: { - url: RPC, - accounts: [account], - }, - }, - etherscan: { - apiKey: { - mumbai: etherscanApiKey, - }, - }, - gasReporter: { - currency: "USD", - enabled: true, - excludeContracts: [], - src: "./contracts", - }, - typechain: { - outDir: "src/types", - }, - mocha: { - timeout: 100000000, - }, - paths: { - artifacts: "./artifacts", - cache: "./cache", - sources: "./contracts", - }, -} - -export default config diff --git a/contracts/evm/package.json b/contracts/evm/package.json deleted file mode 100644 index 6484897..0000000 --- a/contracts/evm/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "evm", - "version": "1.0.0", - "description": "", - "scripts": { - "node":"npx hardhat node", - "compile": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat compile", - "clean": "shx rm -rf ./artifacts ./cache ./coverage ./src/types ./coverage.json && yarn typechain", - "lint:sol": "solhint --config ./.solhint.json --max-warnings 0 \"contracts/**/*.sol\"", - "lint:ts": "eslint --config ./.eslintrc.yml --ignore-path ./.eslintignore --ext .js,.ts .", - "postinstall": "DOTENV_CONFIG_PATH=./.env yarn typechain", - "test": "hardhat test", - "typechain": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat typechain" - }, - "keywords": [], - "author": "", - "license": "ISC" -} diff --git a/contracts/evm/contracts/wpac.sol b/contracts/wpac.sol similarity index 100% rename from contracts/evm/contracts/wpac.sol rename to contracts/wpac.sol diff --git a/hardhat.config.ts b/hardhat.config.ts index d67002a..e7fe6e4 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -5,29 +5,82 @@ import { config as dotenvConfig } from "dotenv" import type { HardhatUserConfig } from "hardhat/config" import { resolve, join } from "path" -const dotenvConfigPath: string = process.env.DOTENV_CONFIG_PATH || join(__dirname,".env") +const dotenvConfigPath: string = process.env.DOTENV_CONFIG_PATH || join(__dirname, ".env") dotenvConfig({ path: resolve(__dirname, dotenvConfigPath) }) -const config: HardhatUserConfig = { - defaultNetwork: "hardhat", - solidity: "0.8.20", - networks: { - hardhat: { - allowUnlimitedContractSize: false, - }, - }, - typechain: { - outDir: "./contracts/evm/src/types", - }, - mocha: { - timeout: 100000000, - }, - paths: { - artifacts: "./contracts/evm/artifacts", - cache: "./contracts/evm/cache", - sources: "./contracts/evm/contracts", - tests: "./contracts/evm/test", - }, +const etherscanApiKey = process.env.ETHERSCAN_API_KEY +const account = process.env.PRIVATE_KEY +const RPC = process.env.POLYGON_RPC_URL + +let config: HardhatUserConfig + +if (!process.env.CI) { + if (!etherscanApiKey) throw new Error("Hardhat_Config: etherscan api key is not defined.") + if (!account) throw new Error("Hardhat_Config: account is not defined.") + if (!RPC) throw new Error("Hardhat_Config: RPC is not defined.") + + config = { + defaultNetwork: "hardhat", + solidity: "0.8.20", + networks: { + hardhat: { + allowUnlimitedContractSize: false, + }, + mumbai: { + url: RPC, + accounts: [account], + }, + }, + etherscan: { + apiKey: { + mumbai: etherscanApiKey, + }, + }, + gasReporter: { + currency: "USD", + enabled: true, + excludeContracts: [], + src: "./contracts", + }, + typechain: { + outDir: "src/types", + }, + mocha: { + timeout: 100000000, + }, + paths: { + artifacts: "./artifacts", + cache: "./cache", + sources: "./contracts", + }, + } +} else { + config = { + defaultNetwork: "hardhat", + solidity: "0.8.20", + networks: { + hardhat: { + allowUnlimitedContractSize: false, + }, + }, + gasReporter: { + currency: "USD", + enabled: true, + excludeContracts: [], + src: "./contracts", + }, + typechain: { + outDir: "src/types", + }, + mocha: { + timeout: 100000000, + }, + paths: { + artifacts: "./artifacts", + cache: "./cache", + sources: "./contracts", + }, + } } export default config diff --git a/package.json b/package.json index 23e877a..e3393e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "telewrapped", - "description": "This monorepo contains wrapped tokens of teleport protocol contracts.", + "description": "wrapped tokens of teleport protocol contracts.", "version": "1.0.0", "main": "index.js", "workspaces": [ @@ -8,7 +8,14 @@ "packages/eslint-config" ], "scripts": { - "prepare": "husky install" + "node":"npx hardhat node", + "compile": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat compile", + "clean": "shx rm -rf ./artifacts ./cache ./coverage ./src/types ./coverage.json && yarn typechain", + "lint:sol": "solhint --config ./.solhint.json --max-warnings 0 \"contracts/**/*.sol\"", + "lint:ts": "eslint --config ./.eslintrc.yml --ignore-path ./.eslintignore --ext .js,.ts .", + "postinstall": "DOTENV_CONFIG_PATH=./.env yarn typechain", + "test": "hardhat test", + "typechain": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat typechain" }, "devDependencies": { "husky": "^8.0.3", @@ -17,7 +24,7 @@ }, "keywords": [], "author": "", - "license": "ISC", + "license": "MIT", "dependencies": { "@openzeppelin/hardhat-upgrades": "^3.0.5", "@openzeppelin/contracts": "^5.0.2", diff --git a/packages/eslint-config/.eslintrc.json b/packages/eslint-config/.eslintrc.json deleted file mode 100644 index e69de29..0000000 diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json deleted file mode 100644 index 9cce0d1..0000000 --- a/packages/eslint-config/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "eslint-config", - "version": "1.0.0", - "description": "", - "main": "index.js", - "devDependencies": {}, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC" -} diff --git a/contracts/evm/scripts/deploy.ts b/scripts/deploy.ts similarity index 100% rename from contracts/evm/scripts/deploy.ts rename to scripts/deploy.ts diff --git a/contracts/evm/scripts/upgrade.ts b/scripts/upgrade.ts similarity index 100% rename from contracts/evm/scripts/upgrade.ts rename to scripts/upgrade.ts diff --git a/contracts/evm/test/adminBridge.ts b/test/adminBridge.ts similarity index 100% rename from contracts/evm/test/adminBridge.ts rename to test/adminBridge.ts diff --git a/contracts/evm/test/bridge.ts b/test/bridge.ts similarity index 100% rename from contracts/evm/test/bridge.ts rename to test/bridge.ts diff --git a/contracts/evm/test/init.ts b/test/init.ts similarity index 100% rename from contracts/evm/test/init.ts rename to test/init.ts diff --git a/contracts/evm/test/main.ts b/test/main.ts similarity index 100% rename from contracts/evm/test/main.ts rename to test/main.ts diff --git a/contracts/evm/test/mint.ts b/test/mint.ts similarity index 100% rename from contracts/evm/test/mint.ts rename to test/mint.ts diff --git a/contracts/evm/test/withdrawFee.ts b/test/withdrawFee.ts similarity index 100% rename from contracts/evm/test/withdrawFee.ts rename to test/withdrawFee.ts diff --git a/contracts/evm/utils/decimal.ts b/utils/decimal.ts similarity index 100% rename from contracts/evm/utils/decimal.ts rename to utils/decimal.ts diff --git a/contracts/evm/utils/file.ts b/utils/file.ts similarity index 100% rename from contracts/evm/utils/file.ts rename to utils/file.ts