Skip to content

Commit

Permalink
update hh config
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyjj1679 committed Jul 27, 2023
1 parent ed11c46 commit 559f08e
Show file tree
Hide file tree
Showing 10 changed files with 620 additions and 51 deletions.
3 changes: 2 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ACCOUNT_PRIVATE_KEYS = ['<PRIVATE_KEY>']
ACCOUNT_PRIVATE_KEYS=["<PRIVATE_KEY>"]
ETHERSCAN_API_KEY=""
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
node_modules
yarn-error.log
typechain
typechain-types
coverage/
coverage.json
cache
Expand Down
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"printWidth": 120
}
2 changes: 1 addition & 1 deletion contracts/SimpleToken.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.5;
pragma solidity 0.8.21;

import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol';
Expand Down
25 changes: 11 additions & 14 deletions deploy/001_SimpleToken.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from 'hardhat/types'
import { DeployFunction } from 'hardhat-deploy/types'

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy, get, execute, getOrNull } = deployments;
const { deployer } = await getNamedAccounts();
const { deployments, getNamedAccounts } = hre
const { deploy } = deployments
const { deployer } = await getNamedAccounts()

const factory = await deploy("SimpleToken", {
const result = await deploy('SimpleToken', {
from: deployer,
args: [deployer, 10000],
log: true,
skipIfAlreadyDeployed: true,
});
})

await hre.run("verify:verify", {
address: factory.address,
constructorArguments: [deployer],
});
};
deployments.log(`Deployed ERC20: ${result.address}, Deployer: ${deployer}, network: ${hre.network.name}`)
}

export default func;
func.tags = ["SimpleToken"];
export default func
func.tags = ['SimpleToken']
1 change: 1 addition & 0 deletions deployments/sepolia/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11155111
458 changes: 458 additions & 0 deletions deployments/sepolia/SimpleToken.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

78 changes: 49 additions & 29 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import "@nomiclabs/hardhat-waffle";
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-solhint";
import "@nomiclabs/hardhat-etherscan";
import "@typechain/hardhat";
import "solidity-coverage";
import "hardhat-deploy";
import "hardhat-gas-reporter";
import "hardhat-docgen";
import "@hardhat-docgen/core";
import "@hardhat-docgen/markdown";
import "hardhat-contract-sizer";
import { HardhatUserConfig } from 'hardhat/config'
import '@hardhat-docgen/core'
import '@hardhat-docgen/markdown'
import '@nomiclabs/hardhat-solhint'
import '@nomiclabs/hardhat-ethers'
import '@nomiclabs/hardhat-etherscan'
import '@nomicfoundation/hardhat-ethers'
import '@nomicfoundation/hardhat-chai-matchers'
import '@nomicfoundation/hardhat-ethers'
import '@typechain/hardhat'
import '@typechain/ethers-v6'
import 'solidity-coverage'
import 'hardhat-deploy'
import 'hardhat-gas-reporter'
import 'hardhat-docgen'
import 'hardhat-contract-sizer'
import 'hardhat-gas-reporter'
import dotenv from 'dotenv'

import { HardhatUserConfig } from "hardhat/config";
import dotenv from "dotenv";

dotenv.config();
dotenv.config()

/**
* @type import('hardhat/config').HardhatUserConfig
Expand All @@ -23,7 +26,16 @@ const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: "0.7.6",
version: '0.8.21',
settings: {
optimizer: {
enabled: true,
runs: 99999,
},
},
},
{
version: '0.7.6',
settings: {
optimizer: {
enabled: true,
Expand All @@ -32,7 +44,7 @@ const config: HardhatUserConfig = {
},
},
{
version: "0.6.12",
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
Expand All @@ -54,37 +66,41 @@ const config: HardhatUserConfig = {
},
},
etherscan: {
apiKey: process.env.FUJI_ETHERSCAN_API_KEY,
apiKey: process.env.ETHERSCAN_API_KEY,
},
networks: {
mainnet: {
url: process.env.ALCHEMY_API || "",
url: process.env.ALCHEMY_API || '',
gasPrice: 140 * 1000000000,
},
fuji: {
url: "https://api.avax-test.network/ext/bc/C/rpc",
url: 'https://api.avax-test.network/ext/bc/C/rpc',
gas: 5000000,
gasPrice: 180 * 1000000000,
chainId: 43113,
},
ava_mainnet: {
url: "https://api.avax.network/ext/bc/C/rpc",
url: 'https://api.avax.network/ext/bc/C/rpc',
gasPrice: 28 * 1000000000,
chainId: 43114,
},
bsc_mainnet: {
url: "https://bsc-dataseed.binance.org/",
url: 'https://bsc-dataseed.binance.org/',
chainId: 56,
gasPrice: 5000000000,
},
sepolia: {
url: 'https://rpc.notadegen.com/sepolia',
chainId: 11155111,
},
},
docgen: {
path: "./docs",
path: './docs',
clear: true,
runOnCompile: false,
except: ["/test/*", "/mock/*"],
except: ['/test/*', '/mock/*'],
},
};
}

if (process.env.ACCOUNT_PRIVATE_KEYS) {
config.networks = {
Expand All @@ -101,11 +117,15 @@ if (process.env.ACCOUNT_PRIVATE_KEYS) {
...config.networks?.bsc_mainnet,
accounts: JSON.parse(process.env.ACCOUNT_PRIVATE_KEYS),
},
};
sepolia: {
...config.networks?.sepolia,
accounts: JSON.parse(process.env.ACCOUNT_PRIVATE_KEYS),
},
}
}

config.gasReporter = {
enabled: process.env.REPORT_GAS ? true : false,
};
}

export default config;
export default config
11 changes: 5 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"compilerOptions": {
"target": "es2018",
"target": "es2020",
"module": "commonjs",
"strict": false,
"esModuleInterop": true,
"typeRoots": ["./node_modules/@types", "./types"],
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"resolveJsonModule": true
},
"include": ["./scripts", "./test"],
"files": ["./hardhat.config.ts"]
}
}

0 comments on commit 559f08e

Please sign in to comment.