Skip to content

Commit

Permalink
feat: add neon & parallel
Browse files Browse the repository at this point in the history
Signed-off-by: GopherJ <[email protected]>
  • Loading branch information
GopherJ committed Jan 5, 2024
1 parent 20a316f commit f759c6d
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 20 deletions.
42 changes: 25 additions & 17 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import {
SEPOLIA_ETHERSCAN_KEY,
ARBITRUM_SEPOLIA_ETHERSCAN_KEY,
PARAX_DEV_ETHERSCAN_KEY,
NEON_ETHERSCAN_KEY,
PARALLEL_ETHERSCAN_KEY,
} from "./helpers/hardhat-constants";
import {accounts} from "./wallets";
import {accounts as evmAccounts} from "./evm-wallets";
Expand Down Expand Up @@ -152,13 +154,23 @@ const hardhatConfig: HardhatUserConfig = {
allowUnlimitedContractSize: true,
timeout: 9000000,
},
hardhat: {
hardfork: HARDFORK,
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
gas: DEFAULT_BLOCK_GAS_LIMIT,
gasPrice: "auto",
chainId: CHAINS_ID[eEthereumNetwork.hardhat],
throwOnTransactionFailures: true,
throwOnCallFailures: true,
accounts,
loggingEnabled: VERBOSE,
forking: buildForkConfig(),
allowUnlimitedContractSize: true,
},
parallel: {
url: NETWORKS_RPC_URL[eEthereumNetwork.parallel],
chainId: CHAINS_ID[eEthereumNetwork.parallel],
accounts: evmAccounts.map(({privateKey}) => privateKey),
gasPrice: 4e9,
gas: 4e6,
allowUnlimitedContractSize: true,
accounts: DEPLOYER,
},
moonbeam: {
chainId: CHAINS_ID[eEthereumNetwork.moonbeam],
Expand All @@ -170,19 +182,6 @@ const hardhatConfig: HardhatUserConfig = {
url: NETWORKS_RPC_URL[eEthereumNetwork.moonbase],
accounts: DEPLOYER,
},
hardhat: {
hardfork: HARDFORK,
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
gas: DEFAULT_BLOCK_GAS_LIMIT,
gasPrice: "auto",
chainId: CHAINS_ID[eEthereumNetwork.hardhat],
throwOnTransactionFailures: true,
throwOnCallFailures: true,
accounts,
loggingEnabled: VERBOSE,
forking: buildForkConfig(),
allowUnlimitedContractSize: true,
},
goerli: {
chainId: CHAINS_ID[eEthereumNetwork.goerli],
url: NETWORKS_RPC_URL[eEthereumNetwork.goerli],
Expand Down Expand Up @@ -259,6 +258,11 @@ const hardhatConfig: HardhatUserConfig = {
url: NETWORKS_RPC_URL[eEthereumNetwork.lineaGoerli],
accounts: DEPLOYER,
},
neon: {
chainId: CHAINS_ID[eEthereumNetwork.neon],
url: NETWORKS_RPC_URL[eEthereumNetwork.neon],
accounts: DEPLOYER,
},
mainnet: {
chainId: CHAINS_ID[eEthereumNetwork.mainnet],
url: NETWORKS_RPC_URL[eEthereumNetwork.mainnet],
Expand All @@ -283,6 +287,8 @@ const hardhatConfig: HardhatUserConfig = {
moonbase: MOONBASE_ETHERSCAN_KEY,
linea: LINEA_ETHERSCAN_KEY,
lineaGoerli: LINEA_GOERLI_ETHERSCAN_KEY,
neon: NEON_ETHERSCAN_KEY,
parallel: PARALLEL_ETHERSCAN_KEY,
},
customChains: [
eEthereumNetwork.localhost,
Expand All @@ -302,6 +308,8 @@ const hardhatConfig: HardhatUserConfig = {
eEthereumNetwork.moonbase,
eEthereumNetwork.linea,
eEthereumNetwork.lineaGoerli,
eEthereumNetwork.neon,
eEthereumNetwork.parallel,
].map((network) => ({
network,
chainId: CHAINS_ID[network]!,
Expand Down
7 changes: 6 additions & 1 deletion helper-hardhat-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
ZKSYNC_GOERLI_CHAINID,
ARBITRUM_SEPOLIA_CHAINID,
PARAX_DEV_CHAINID,
NEON_CHAINID,
} from "./helpers/hardhat-constants";

dotenv.config();
Expand Down Expand Up @@ -75,7 +76,7 @@ export const NETWORKS_RPC_URL: iParamsPerNetwork<string> = {
[eEthereumNetwork.ganache]: RPC_URL || "http://localhost:8545",
[eEthereumNetwork.tenderlyMain]:
RPC_URL || `https://rpc.tenderly.co/fork/${TENDERLY_FORK_ID}`,
[eEthereumNetwork.parallel]: RPC_URL || "http://localhost:29933",
[eEthereumNetwork.parallel]: RPC_URL || "https://rpc.parallel.fi",
[eEthereumNetwork.moonbeam]: "https://rpc.api.moonbeam.network",
[eEthereumNetwork.moonbase]: "https://rpc.testnet.moonbeam.network",
[eEthereumNetwork.arbitrum]:
Expand Down Expand Up @@ -122,6 +123,8 @@ export const NETWORKS_RPC_URL: iParamsPerNetwork<string> = {
(INFURA_KEY
? `https://linea-goerli.infura.io/v3/${INFURA_KEY}`
: `https://rpc.goerli.linea.build`),
[eEthereumNetwork.neon]:
RPC_URL || `https://neon-proxy-mainnet.solana.p2p.org`,
};

export const CHAINS_ID: iParamsPerNetwork<number | undefined> = {
Expand All @@ -147,6 +150,7 @@ export const CHAINS_ID: iParamsPerNetwork<number | undefined> = {
[eEthereumNetwork.zksyncGoerli]: ZKSYNC_GOERLI_CHAINID,
[eEthereumNetwork.linea]: LINEA_CHAINID,
[eEthereumNetwork.lineaGoerli]: LINEA_GOERLI_CHAINID,
[eEthereumNetwork.neon]: NEON_CHAINID,
};

export const BLOCK_TO_FORK: iParamsPerNetwork<number | undefined> = {
Expand All @@ -172,4 +176,5 @@ export const BLOCK_TO_FORK: iParamsPerNetwork<number | undefined> = {
[eEthereumNetwork.zksyncGoerli]: undefined,
[eEthereumNetwork.linea]: undefined,
[eEthereumNetwork.lineaGoerli]: undefined,
[eEthereumNetwork.neon]: undefined,
};
14 changes: 13 additions & 1 deletion helpers/hardhat-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const GOERLI_CHAINID = 5;
export const SEPOLIA_CHAINID = 11155111;
export const FORK_CHAINID = 522;
export const MAINNET_CHAINID = 1;
export const PARALLEL_CHAINID = 1592;
export const PARALLEL_CHAINID = 1024;
export const PARAX_DEV_CHAINID = 2982896226593698;
export const MOONBEAM_CHAINID = 1284;
export const MOONBASE_CHAINID = 1287;
Expand All @@ -40,6 +40,7 @@ export const ZKSYNC_CHAINID = 324;
export const ZKSYNC_GOERLI_CHAINID = 280;
export const LINEA_GOERLI_CHAINID = 59140;
export const LINEA_CHAINID = 59144;
export const NEON_CHAINID = 245022934;

export const INFURA_KEY = process.env.INFURA_KEY || "";
export const ALCHEMY_KEY = process.env.ALCHEMY_KEY || "";
Expand Down Expand Up @@ -108,6 +109,11 @@ export const ETHERSCAN_VERIFICATION_JOBS = parseInt(
export const ETHERSCAN_VERIFICATION_MAX_RETRIES = parseInt(
process.env.ETHERSCAN_VERIFICATION_MAX_RETRIES || "3"
);
export const NEON_ETHERSCAN_KEY =
process.env.NEON_ETHERSCAN_KEY || ETHERSCAN_KEY;
export const PARALLEL_ETHERSCAN_KEY =
process.env.PARALLEL_ETHERSCAN_KEY || ETHERSCAN_KEY;

export const ETHERSCAN_NETWORKS = [
"localhost",
"mainnet",
Expand All @@ -127,6 +133,8 @@ export const ETHERSCAN_NETWORKS = [
"lineaGoerli",
"moonbeam",
"moonbase",
"neon",
"parallel",
];
export const ETHERSCAN_APIS = {
localhost: "http://localhost:4000/api",
Expand All @@ -149,6 +157,8 @@ export const ETHERSCAN_APIS = {
moonbase: "https://api-moonbase.moonscan.io/api",
linea: "http://explorer.linea.build/api",
lineaGoerli: "https://explorer.goerli.linea.build/api",
neon: "https://neonscan.org/api",
parallel: "https://explorer.parallel.fi/api",
};
export const BROWSER_URLS = {
localhost: "http://localhost:4000",
Expand All @@ -170,6 +180,8 @@ export const BROWSER_URLS = {
moonbase: "https://moonbase.moonscan.io",
linea: "https://explorer.linea.build",
lineaGoerli: "https://explorer.goerli.linea.build",
neon: "https://neonscan.org",
parallel: "https://explorer.parallel.fi",
};

export const DEPLOY_START = parseInt(process.env.DEPLOY_START || "0");
Expand Down
22 changes: 21 additions & 1 deletion helpers/misc-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import {
SEPOLIA_CHAINID,
ARBITRUM_SEPOLIA_CHAINID,
PARAX_DEV_CHAINID,
NEON_CHAINID,
PARALLEL_CHAINID,
} from "./hardhat-constants";
import {ConstructorArgs, eContractid, tEthereumAddress} from "./types";
import dotenv from "dotenv";
Expand Down Expand Up @@ -146,14 +148,32 @@ export const isLinea = (): boolean => {
);
};

export const isNeon = (): boolean => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return (
[NEON_CHAINID].includes(DRE.network.config.chainId!) ||
[eEthereumNetwork.neon].includes(FORK as eEthereumNetwork)
);
};

export const isParallel = (): boolean => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return (
[PARALLEL_CHAINID].includes(DRE.network.config.chainId!) ||
[eEthereumNetwork.parallel].includes(FORK as eEthereumNetwork)
);
};

export const isMainnet = (): boolean =>
isEthereum() ||
isMoonbeam() ||
isArbitrum() ||
isZkSync() ||
isPolygon() ||
isPolygonZkEVM() ||
isLinea();
isLinea() ||
isNeon() ||
isParallel();

export const safeTransactionServiceUrl = (): string => {
return isMoonbeam()
Expand Down
2 changes: 2 additions & 0 deletions helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export enum eEthereumNetwork {
zksyncGoerli = "zksyncGoerli",
linea = "linea",
lineaGoerli = "lineaGoerli",
neon = "neon",
}

export enum eContractid {
Expand Down Expand Up @@ -771,6 +772,7 @@ export interface iEthereumParamsPerNetwork<T> {
[eEthereumNetwork.zksyncGoerli]: T;
[eEthereumNetwork.linea]: T;
[eEthereumNetwork.lineaGoerli]: T;
[eEthereumNetwork.neon]: T;
}

export enum RateMode {
Expand Down
2 changes: 2 additions & 0 deletions market-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1111,4 +1111,6 @@ export const ParaSpaceConfigs: Partial<
[eEthereumNetwork.zksyncGoerli]: ZkSyncGoerliConfig,
[eEthereumNetwork.linea]: LineaConfig,
[eEthereumNetwork.lineaGoerli]: LineaGoerliConfig,
[eEthereumNetwork.parallel]: HardhatConfig,
[eEthereumNetwork.neon]: HardhatConfig,
};

0 comments on commit f759c6d

Please sign in to comment.