Created
February 20, 2022 14:10
-
-
Save sondnm/61a3904d96133fa061ee920222a91813 to your computer and use it in GitHub Desktop.
Init hardhat project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
yarn add --dev hardhat | |
npx hardhat | |
yarn add --dev @nomiclabs/hardhat-ethers @nomiclabs/hardhat-waffle @nomiclabs/hardhat-etherscan \ | |
@typechain/hardhat @typechain/ethers-v5 @types/chai @types/chai-as-promised @types/mocha \ | |
chai chai-as-promised \ | |
dotenv ethereum-waffle ethers \ | |
hardhat-abi-exporter hardhat-deploy hardhat-deploy-ethers \ | |
hardhat-typechain ts-generator ts-node typechain typescript \ | |
@openzeppelin/contracts | |
mkdir -p contracts test scripts | |
mv hardhat.config.js hardhat.config.ts | |
echo "import { config as dotEnvConfig } from \"dotenv\"; | |
dotEnvConfig(); | |
import { HardhatUserConfig } from \"hardhat/types\"; | |
import \"@nomiclabs/hardhat-waffle\"; | |
import \"@typechain/hardhat\"; | |
import \"hardhat-abi-exporter\"; | |
import \"@nomiclabs/hardhat-etherscan\"; | |
import \"hardhat-deploy\"; | |
import \"hardhat-deploy-ethers\"; | |
import \"hardhat-gas-reporter\"; | |
const config: HardhatUserConfig = { | |
defaultNetwork: \"hardhat\", | |
networks: { | |
hardhat: {}, | |
testnet: { | |
url: process.env.BSC_TESTNET_RPC || \"https://data-seed-prebsc-1-s1.binance.org:8545/\", | |
chainId: 97, | |
accounts: [process.env.BSC_TESTNET_PRIVATE_KEY!], | |
}, | |
mainnet: { | |
url: process.env.BSC_MAINNET_RPC || \"https://bsc-dataseed.binance.org\", | |
chainId: 56, | |
accounts: [process.env.BSC_MAINNET_PRIVATE_KEY!], | |
}, | |
}, | |
namedAccounts: { | |
deployer: { | |
default: 0, | |
}, | |
}, | |
solidity: { | |
compilers: [ | |
{ | |
version: \"0.8.11\", | |
settings: { | |
optimizer: { | |
enabled: true, | |
runs: 200, | |
} | |
}, | |
}, | |
], | |
}, | |
etherscan: { | |
apiKey: process.env.BLOCK_EXPLORER_API_KEY!, | |
}, | |
mocha: { | |
timeout: 500000, | |
}, | |
gasReporter: { | |
enabled: !!process.env.REPORT_GAS, | |
currency: "BNB", | |
gasPrice: 1, | |
}, | |
}; | |
export default config; | |
" > hardhat.config.ts | |
echo "{ | |
\"compilerOptions\": { | |
\"target\": \"es5\", | |
\"module\": \"commonjs\", | |
\"strict\": true, | |
\"noImplicitReturns\": true, | |
\"strictNullChecks\": true, | |
\"esModuleInterop\": true, | |
\"resolveJsonModule\": true, | |
\"types\": [\"@types/node\", \"@types/chai\", \"@types/mocha\"], | |
\"typeRoots\": [\"./node_modules/@types\", \"./types\"] | |
}, | |
\"include\": [ | |
\"**/*.ts\", | |
\"./typechain/**/*\", | |
\"./typechain-types/**/*\" | |
], | |
\"exclude\": [\"node_modules\", \"build\", \"cache\", \"artifacts\"] | |
} | |
" > tsconfig.json | |
echo "package.json" > .prettierignore | |
echo "{ | |
\"printWidth\": 120, | |
\"singleQuote\": false, | |
\"tabWidth\": 2, | |
\"bracketSpacing\": true, | |
\"overrides\": [ | |
{ | |
\"files\": \"*.sol\", | |
\"options\": { | |
\"tabWidth\": 4, | |
\"useTabs\": false, | |
\"singleQuote\": false, | |
\"bracketSpacing\": true, | |
\"endOfLine\": \"auto\", | |
\"explicitTypes\": \"always\" | |
} | |
} | |
] | |
}" > .prettierrc | |
yarn install | |
touch .env README.md | |
git init | |
echo "node_modules/ | |
cache/ | |
build/ | |
typechain/ | |
artifacts/ | |
deployments/ | |
.vscode/ | |
coverage* | |
.env | |
.DS_Store | |
*.swp | |
.tmp | |
yarn-error.log | |
.idea/ | |
" > .gitignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment