Skip to content

Commit cde0662

Browse files
authored
fix: refactor (#6)
1 parent b186b6c commit cde0662

22 files changed

+98
-265
lines changed

.github/workflows/unit-test.yml

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
build:
1313
name: Run tests with Hardhat
1414
runs-on: ubuntu-latest
15+
env:
16+
CI: 'true'
1517

1618
steps:
1719
- name: Checkout code

.gitignore

+12-124
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,18 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
.pnpm-debug.log*
9-
10-
# Diagnostic reports (https://nodejs.org/api/report.html)
11-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12-
13-
# Runtime data
14-
pids
15-
*.pid
16-
*.seed
17-
*.pid.lock
18-
19-
# Directory for instrumented libs generated by jscoverage/JSCover
20-
lib-cov
21-
22-
# Coverage directory used by tools like istanbul
23-
coverage
24-
*.lcov
25-
26-
# nyc test coverage
27-
.nyc_output
28-
29-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30-
.grunt
31-
32-
# Bower dependency directory (https://bower.io/)
33-
bower_components
34-
35-
# node-waf configuration
36-
.lock-wscript
37-
38-
# Compiled binary addons (https://nodejs.org/api/addons.html)
39-
build/Release
40-
41-
# Dependency directories
42-
node_modules/
43-
jspm_packages/
44-
45-
# Snowpack dependency directory (https://snowpack.dev/)
46-
web_modules/
47-
48-
# TypeScript cache
49-
*.tsbuildinfo
50-
51-
# Optional npm cache directory
52-
.npm
53-
54-
# Optional eslint cache
55-
.eslintcache
56-
57-
# Optional stylelint cache
58-
.stylelintcache
59-
60-
# Microbundle cache
61-
.rpt2_cache/
62-
.rts2_cache_cjs/
63-
.rts2_cache_es/
64-
.rts2_cache_umd/
65-
66-
# Optional REPL history
67-
.node_repl_history
68-
69-
# Output of 'npm pack'
70-
*.tgz
71-
72-
# Yarn Integrity file
73-
.yarn-integrity
74-
75-
# dotenv environment variable files
1+
node_modules
762
.env
77-
.env.development.local
78-
.env.test.local
79-
.env.production.local
80-
.env.local
81-
82-
# parcel-bundler cache (https://parceljs.org/)
83-
.cache
84-
.parcel-cache
85-
86-
# Next.js build output
87-
.next
88-
out
89-
90-
# Nuxt.js build / generate output
91-
.nuxt
92-
dist
93-
94-
# Gatsby files
95-
.cache/
96-
# Comment in the public line in if your project uses Gatsby and not Next.js
97-
# https://nextjs.org/blog/next-9-1#public-directory-support
98-
# public
99-
100-
# vuepress build output
101-
.vuepress/dist
102-
103-
# vuepress v2.x temp and cache directory
104-
.temp
105-
.cache
106-
107-
# Docusaurus cache and generated files
108-
.docusaurus
109-
110-
# Serverless directories
111-
.serverless/
1123

113-
# FuseBox cache
114-
.fusebox/
4+
# Hardhat files
5+
/cache
6+
/artifacts
1157

116-
# DynamoDB Local files
117-
.dynamodb/
8+
# TypeChain files
9+
/typechain
10+
/typechain-types
11811

119-
# TernJS port file
120-
.tern-port
12+
# solidity-coverage files
13+
/coverage
14+
/coverage.json
12115

122-
# Stores VSCode versions used for testing VSCode extensions
123-
.vscode-test
16+
.openzeppelin
12417

125-
# yarn v2
126-
.yarn/cache
127-
.yarn/unplugged
128-
.yarn/build-state.yml
129-
.yarn/install-state.gz
130-
.pnp.*
18+
/src/types

contracts/.keep

Whitespace-only changes.

contracts/evm/.gitignore

-18
This file was deleted.

contracts/evm/README.md

-13
This file was deleted.

contracts/evm/hardhat.config.ts

-55
This file was deleted.

contracts/evm/package.json

-18
This file was deleted.
File renamed without changes.

hardhat.config.ts

+74-21
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,82 @@ import { config as dotenvConfig } from "dotenv"
55
import type { HardhatUserConfig } from "hardhat/config"
66
import { resolve, join } from "path"
77

8-
const dotenvConfigPath: string = process.env.DOTENV_CONFIG_PATH || join(__dirname,".env")
8+
const dotenvConfigPath: string = process.env.DOTENV_CONFIG_PATH || join(__dirname, ".env")
99
dotenvConfig({ path: resolve(__dirname, dotenvConfigPath) })
1010

11-
const config: HardhatUserConfig = {
12-
defaultNetwork: "hardhat",
13-
solidity: "0.8.20",
14-
networks: {
15-
hardhat: {
16-
allowUnlimitedContractSize: false,
17-
},
18-
},
19-
typechain: {
20-
outDir: "./contracts/evm/src/types",
21-
},
22-
mocha: {
23-
timeout: 100000000,
24-
},
25-
paths: {
26-
artifacts: "./contracts/evm/artifacts",
27-
cache: "./contracts/evm/cache",
28-
sources: "./contracts/evm/contracts",
29-
tests: "./contracts/evm/test",
30-
},
11+
const etherscanApiKey = process.env.ETHERSCAN_API_KEY
12+
const account = process.env.PRIVATE_KEY
13+
const RPC = process.env.POLYGON_RPC_URL
14+
15+
let config: HardhatUserConfig
16+
17+
if (!process.env.CI) {
18+
if (!etherscanApiKey) throw new Error("Hardhat_Config: etherscan api key is not defined.")
19+
if (!account) throw new Error("Hardhat_Config: account is not defined.")
20+
if (!RPC) throw new Error("Hardhat_Config: RPC is not defined.")
21+
22+
config = {
23+
defaultNetwork: "hardhat",
24+
solidity: "0.8.20",
25+
networks: {
26+
hardhat: {
27+
allowUnlimitedContractSize: false,
28+
},
29+
mumbai: {
30+
url: RPC,
31+
accounts: [account],
32+
},
33+
},
34+
etherscan: {
35+
apiKey: {
36+
mumbai: etherscanApiKey,
37+
},
38+
},
39+
gasReporter: {
40+
currency: "USD",
41+
enabled: true,
42+
excludeContracts: [],
43+
src: "./contracts",
44+
},
45+
typechain: {
46+
outDir: "src/types",
47+
},
48+
mocha: {
49+
timeout: 100000000,
50+
},
51+
paths: {
52+
artifacts: "./artifacts",
53+
cache: "./cache",
54+
sources: "./contracts",
55+
},
56+
}
57+
} else {
58+
config = {
59+
defaultNetwork: "hardhat",
60+
solidity: "0.8.20",
61+
networks: {
62+
hardhat: {
63+
allowUnlimitedContractSize: false,
64+
},
65+
},
66+
gasReporter: {
67+
currency: "USD",
68+
enabled: true,
69+
excludeContracts: [],
70+
src: "./contracts",
71+
},
72+
typechain: {
73+
outDir: "src/types",
74+
},
75+
mocha: {
76+
timeout: 100000000,
77+
},
78+
paths: {
79+
artifacts: "./artifacts",
80+
cache: "./cache",
81+
sources: "./contracts",
82+
},
83+
}
3184
}
3285

3386
export default config

package.json

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
{
22
"name": "telewrapped",
3-
"description": "This monorepo contains wrapped tokens of teleport protocol contracts.",
3+
"description": "wrapped tokens of teleport protocol contracts.",
44
"version": "1.0.0",
55
"main": "index.js",
66
"workspaces": [
77
"contracts/evm/*",
88
"packages/eslint-config"
99
],
1010
"scripts": {
11-
"prepare": "husky install"
11+
"node":"npx hardhat node",
12+
"compile": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat compile",
13+
"clean": "shx rm -rf ./artifacts ./cache ./coverage ./src/types ./coverage.json && yarn typechain",
14+
"lint:sol": "solhint --config ./.solhint.json --max-warnings 0 \"contracts/**/*.sol\"",
15+
"lint:ts": "eslint --config ./.eslintrc.yml --ignore-path ./.eslintignore --ext .js,.ts .",
16+
"postinstall": "DOTENV_CONFIG_PATH=./.env yarn typechain",
17+
"test": "hardhat test",
18+
"typechain": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat typechain"
1219
},
1320
"devDependencies": {
1421
"husky": "^8.0.3",
@@ -17,7 +24,7 @@
1724
},
1825
"keywords": [],
1926
"author": "",
20-
"license": "ISC",
27+
"license": "MIT",
2128
"dependencies": {
2229
"@openzeppelin/hardhat-upgrades": "^3.0.5",
2330
"@openzeppelin/contracts": "^5.0.2",

packages/eslint-config/.eslintrc.json

Whitespace-only changes.

0 commit comments

Comments
 (0)