Skip to content

Commit

Permalink
style(solidity): format typescript (#515)
Browse files Browse the repository at this point in the history
Co-authored-by: nulnut <151493716+nulnut@users.noreply.github.com>
  • Loading branch information
zakir-code and nulnut authored May 27, 2024
1 parent 9e32c0e commit 7c336d0
Show file tree
Hide file tree
Showing 13 changed files with 2,239 additions and 1,509 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/solidity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ jobs:
cache-dependency-path: solidity/yarn.lock
- run: cd solidity && yarn install && yarn test

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
check-latest: false
cache: "yarn"
cache-dependency-path: solidity/yarn.lock
- run: cd solidity && yarn install && yarn format:ts && git diff --exit-code

abigen:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions solidity/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
typechain-types
231 changes: 119 additions & 112 deletions solidity/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,125 +1,132 @@
import {HardhatUserConfig} from "hardhat/config"
import "hardhat-dependency-compiler"
import "@nomicfoundation/hardhat-ethers"
import '@typechain/hardhat'
import "hardhat-gas-reporter"
import { HardhatUserConfig } from "hardhat/config";
import "hardhat-dependency-compiler";
import "@nomicfoundation/hardhat-ethers";
import "@typechain/hardhat";
import "hardhat-gas-reporter";
import "@nomicfoundation/hardhat-verify";
import "@nomicfoundation/hardhat-chai-matchers";
import "hardhat-ignore-warnings"
import "hardhat-ignore-warnings";

import './tasks/task'
import "./tasks/task";

const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: process.env.CHAIN_ID ? parseInt(process.env.CHAIN_ID) : 1337,
},
ethereum: {
url: `${process.env.ETHEREUM_URL || "https://1rpc.io/eth"}`,
chainId: 1,
},
sepolia: {
url: `${process.env.SEPOLIA_URL || "https://rpc.sepolia.org"}`,
chainId: 11155111,
},
arbitrumSepolia: {
url: `${process.env.ARBITRUM_URL || "https://sepolia-rollup.arbitrum.io/rpc"}`,
chainId: 421614,
},
optimisticSepolia: {
url: `${process.env.OPTIMISTIC_URL || "https://sepolia.optimism.io"}`,
chainId: 11155420,
},
baseSepolia: {
url: `${process.env.BASE_URL || "https://sepolia.base.org"}`,
chainId: 84532,
},
fxcore: {
url: `${process.env.FXCORE_URL || "https://fx-json-web3.functionx.io:8545"}`,
chainId: 530,
},
dhobyghaut: {
url: `${process.env.DHOBYGHAUT_URL || "https://testnet-fx-json-web3.functionx.io:8545"}`,
chainId: 90001,
},
localhost: {
url: `${process.env.LOCAL_URL || "http://127.0.0.1:8545"}`,
},
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: process.env.CHAIN_ID ? parseInt(process.env.CHAIN_ID) : 1337,
},
solidity: {
compilers: [
{
version: "0.8.0",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
},
{
version: "0.8.1",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
},
{
version: "0.8.2",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
},
]
ethereum: {
url: `${process.env.ETHEREUM_URL || "https://1rpc.io/eth"}`,
chainId: 1,
},
etherscan: {
apiKey: {
ethereum: `${process.env.ETHERSCAN_API_KEY}`,
sepolia: `${process.env.ETHERSCAN_API_KEY}`,
arbitrumSepolia: `${process.env.ETHERSCAN_API_KEY}`,
optimisticSepolia: `${process.env.ETHERSCAN_API_KEY}`,
baseSepolia: `${process.env.ETHERSCAN_API_KEY}`
},
customChains: [
{
network: "ethereum",
chainId: 1,
urls: {
apiURL: "https://api.etherscan.io/api",
browserURL: "https://etherscan.io"
}
},
{
network: "optimisticSepolia",
chainId: 11155420,
urls: {
apiURL: "https://api-sepolia-optimistic.etherscan.io/api",
browserURL: "https://sepolia-optimism.etherscan.io/"
}
},
]
sepolia: {
url: `${process.env.SEPOLIA_URL || "https://rpc.sepolia.org"}`,
chainId: 11155111,
},
dependencyCompiler: {
paths: [
"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol",
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol",
],
arbitrumSepolia: {
url: `${
process.env.ARBITRUM_URL || "https://sepolia-rollup.arbitrum.io/rpc"
}`,
chainId: 421614,
},
gasReporter: {
enabled: false,
currency: 'USD',
gasPrice: 30
optimisticSepolia: {
url: `${process.env.OPTIMISTIC_URL || "https://sepolia.optimism.io"}`,
chainId: 11155420,
},
warnings: {
"@openzeppelin/contracts/**/*": "off",
"@openzeppelin/contracts-upgradeable/**/*": "off",
}
baseSepolia: {
url: `${process.env.BASE_URL || "https://sepolia.base.org"}`,
chainId: 84532,
},
fxcore: {
url: `${
process.env.FXCORE_URL || "https://fx-json-web3.functionx.io:8545"
}`,
chainId: 530,
},
dhobyghaut: {
url: `${
process.env.DHOBYGHAUT_URL ||
"https://testnet-fx-json-web3.functionx.io:8545"
}`,
chainId: 90001,
},
localhost: {
url: `${process.env.LOCAL_URL || "http://127.0.0.1:8545"}`,
},
},
solidity: {
compilers: [
{
version: "0.8.0",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: "0.8.1",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: "0.8.2",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
etherscan: {
apiKey: {
ethereum: `${process.env.ETHERSCAN_API_KEY}`,
sepolia: `${process.env.ETHERSCAN_API_KEY}`,
arbitrumSepolia: `${process.env.ETHERSCAN_API_KEY}`,
optimisticSepolia: `${process.env.ETHERSCAN_API_KEY}`,
baseSepolia: `${process.env.ETHERSCAN_API_KEY}`,
},
customChains: [
{
network: "ethereum",
chainId: 1,
urls: {
apiURL: "https://api.etherscan.io/api",
browserURL: "https://etherscan.io",
},
},
{
network: "optimisticSepolia",
chainId: 11155420,
urls: {
apiURL: "https://api-sepolia-optimistic.etherscan.io/api",
browserURL: "https://sepolia-optimism.etherscan.io/",
},
},
],
},
dependencyCompiler: {
paths: [
"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol",
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol",
],
},
gasReporter: {
enabled: false,
currency: "USD",
gasPrice: 30,
},
warnings: {
"@openzeppelin/contracts/**/*": "off",
"@openzeppelin/contracts-upgradeable/**/*": "off",
},
};

export default config;
3 changes: 2 additions & 1 deletion solidity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"lint:sol": "npx solhint --config ./.solhint.json --max-warnings 0 \"contracts/**/*.sol\"",
"typechain": "npx hardhat typechain",
"fork": "npx hardhat node --fork ${NETWORK_URL}",
"fork:blocknumber": "npx hardhat node --fork ${NETWORK_URL} --fork-block-number ${BLOCK_NUMBER}"
"fork:blocknumber": "npx hardhat node --fork ${NETWORK_URL} --fork-block-number ${BLOCK_NUMBER}",
"format:ts": "prettier --write \"./**/*.{ts,tsx}\" && prettier --write \"./*.{ts,tsx}\""
},
"keywords": [
"solidity",
Expand Down
Loading

0 comments on commit 7c336d0

Please sign in to comment.