Skip to content

Commit

Permalink
fix: refactor (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZigBalthazar committed Mar 31, 2024
1 parent b186b6c commit cde0662
Show file tree
Hide file tree
Showing 22 changed files with 98 additions and 265 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
build:
name: Run tests with Hardhat
runs-on: ubuntu-latest
env:
CI: 'true'

steps:
- name: Checkout code
Expand Down
136 changes: 12 additions & 124 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
Empty file removed contracts/.keep
Empty file.
18 changes: 0 additions & 18 deletions contracts/evm/.gitignore

This file was deleted.

13 changes: 0 additions & 13 deletions contracts/evm/README.md

This file was deleted.

55 changes: 0 additions & 55 deletions contracts/evm/hardhat.config.ts

This file was deleted.

18 changes: 0 additions & 18 deletions contracts/evm/package.json

This file was deleted.

File renamed without changes.
95 changes: 74 additions & 21 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
{
"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": [
"contracts/evm/*",
"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",
Expand All @@ -17,7 +24,7 @@
},
"keywords": [],
"author": "",
"license": "ISC",
"license": "MIT",
"dependencies": {
"@openzeppelin/hardhat-upgrades": "^3.0.5",
"@openzeppelin/contracts": "^5.0.2",
Expand Down
Empty file.
Loading

0 comments on commit cde0662

Please sign in to comment.