Skip to content

Commit

Permalink
➕ Add World Chain Test and Main Network Configurations
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Marco Caversaccio <[email protected]>
  • Loading branch information
pcaversaccio committed Sep 28, 2024
1 parent 9c20acf commit f5e52b6
Show file tree
Hide file tree
Showing 5 changed files with 274 additions and 239 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pnpm install
pnpm deploy:goerli
```

> The deployment script [`deploy.ts`](./scripts/deploy.ts) includes the `tenderly` Hardhat Runtime Environment (HRE) extension with the `verify` method. Please consider uncommenting and configuring the Tenderly `project`, `username`, `forkNetwork`, `privateVerification`, and `deploymentsDir` attributes in the [`hardhat.config.ts`](./hardhat.config.ts) file before deploying or remove this call. Also, for this plugin to function you need to create a `config.yaml` file at `$HOME/.tenderly/config.yaml` or `%HOMEPATH%\.tenderly\config.yaml` and add an `access_key` field to it. For further information, see [here](https://www.npmjs.com/package/@tenderly/hardhat-tenderly#installing-tenderly-cli).
> The deployment script [`deploy.ts`](./scripts/deploy.ts) includes the `tenderly` Hardhat Runtime Environment (HRE) extension with the `verify` method. Please consider uncommenting and configuring the Tenderly `project`, `username`, `forkNetwork`, `privateVerification`, and `deploymentsDir` attributes in the [`hardhat.config.ts`](./hardhat.config.ts) file before deploying or remove this call. Also, for this plugin to function you need to create a `config.yaml` file at `$HOME/.tenderly/config.yaml` or `%HOMEPATH%\.tenderly\config.yaml` and add an `access_key` field to it. For further information, see [here](https://github.com/Tenderly/hardhat-tenderly/tree/master/packages/tenderly-hardhat#installing-tenderly-cli).
> For the deployment on the [ZKsync Era](https://docs.zksync.io/) test network, you must add your to-be-deployed contract artifact to [`deploy-zksync.ts`](./deploy/deploy-zksync.ts), enable `zksync` in the [`hardhat.config.ts`](./hardhat.config.ts#L121) file, and then run `pnpm compile` (in case you face any compilation issues, disable all configurations associated with the [`@tenderly/hardhat-tenderly`](https://github.com/Tenderly/hardhat-tenderly) plugin, including the `import` statement itself; see also [here](https://github.com/matter-labs/hardhat-zksync/issues/998) and [here](https://github.com/matter-labs/hardhat-zksync/issues/1174)). Next, fund your deployer account on ZKsync Era Testnet, setup the ZKsync-related configuration variables accordingly, and simply run `pnpm deploy:zksynctestnet`. Eventually, to verify the contract you can invoke: `npx hardhat verify --network zkSyncTestnet --constructor-args arguments.js <YOUR_CONTRACT_ADDRESS>`. The same approach applies if you want to deploy on the production network, except that you need to run `pnpm deploy:zksyncmain` and use `--network zkSyncMain` for the contract verification.

Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/forge-std
58 changes: 47 additions & 11 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ import "hardhat-gas-reporter";
import "hardhat-abi-exporter";
import "solidity-coverage";
import "hardhat-contract-sizer";
import * as tdly from "@tenderly/hardhat-tenderly";

// Turning off the automatic Tenderly verification
tdly.setup({ automaticVerifications: false });
// Uncomment if you want to use the Hardhat Tenderly module
// You must also uncomment the subsequent `tenderly` configuration in this file accordingly
// import "@tenderly/hardhat-tenderly";

const ethMainnetUrl = vars.get("ETH_MAINNET_URL", "https://rpc.ankr.com/eth");
const accounts = [
Expand Down Expand Up @@ -860,6 +859,24 @@ const config: HardhatUserConfig = {
accounts,
ledgerAccounts,
},
worldChainTestnet: {
chainId: 4801,
url: vars.get(
"WORLD_CHAIN_TESTNET_URL",
"https://worldchain-sepolia.g.alchemy.com/public",
),
accounts,
ledgerAccounts,
},
worldChainMain: {
chainId: 480,
url: vars.get(
"WORLD_CHAIN_MAINNET_URL",
"https://worldchain-mainnet.g.alchemy.com/public",
),
accounts,
ledgerAccounts,
},
},
xdeploy: {
// Change this name to the name of your main contract
Expand Down Expand Up @@ -1079,6 +1096,9 @@ const config: HardhatUserConfig = {
// For Oasis Sapphire testnet & mainnet
sapphire: vars.get("SAPPHIRE_API_KEY", ""),
sapphireTestnet: vars.get("SAPPHIRE_API_KEY", ""),
// For World Chain testnet & mainnet
worldChain: vars.get("WORLD_CHAIN_API_KEY", ""),
worldChainTestnet: vars.get("WORLD_CHAIN_API_KEY", ""),
},
customChains: [
{
Expand Down Expand Up @@ -1719,15 +1739,31 @@ const config: HardhatUserConfig = {
browserURL: "https://explorer.oasis.io/testnet/sapphire",
},
},
{
network: "worldChain",
chainId: 480,
urls: {
apiURL: "https://worldchain-mainnet.explorer.alchemy.com/api",
browserURL: "https://worldchain-mainnet.explorer.alchemy.com",
},
},
{
network: "worldChainTestnet",
chainId: 4801,
urls: {
apiURL: "https://worldchain-sepolia.explorer.alchemy.com/api",
browserURL: "https://worldchain-sepolia.explorer.alchemy.com",
},
},
],
},
tenderly: {
username: "MyAwesomeUsername",
project: "super-awesome-project",
forkNetwork: "",
privateVerification: false,
deploymentsDir: "deployments_tenderly",
},
// tenderly: {
// username: "MyAwesomeUsername",
// project: "super-awesome-project",
// forkNetwork: "",
// privateVerification: false,
// deploymentsDir: "deployments_tenderly",
// },
};

export default config;
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@
"deploy:5irechainmain": "npx hardhat run --network 5ireChainMain scripts/deploy.ts",
"deploy:sapphiretestnet": "npx hardhat run --network sapphireTestnet scripts/deploy.ts",
"deploy:sapphiremain": "npx hardhat run --network sapphireMain scripts/deploy.ts",
"deploy:worldchaintestnet": "npx hardhat run --network worldChainTestnet scripts/deploy.ts",
"deploy:worldchainmain": "npx hardhat run --network worldChainMain scripts/deploy.ts",
"prettier:check": "npx prettier -c \"**/*.{js,ts,md,sol,json,yml,yaml}\"",
"prettier:fix": "npx prettier -w \"**/*.{js,ts,md,sol,json,yml,yaml}\"",
"solhint:check": "npx solhint \"contracts/**/*.sol\"",
Expand All @@ -166,20 +168,20 @@
"@nomicfoundation/hardhat-chai-matchers": "^2.0.8",
"@nomicfoundation/hardhat-ethers": "^3.0.8",
"@nomicfoundation/hardhat-foundry": "^1.1.2",
"@nomicfoundation/hardhat-ignition": "^0.15.5",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.5",
"@nomicfoundation/hardhat-ignition": "^0.15.6",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.6",
"@nomicfoundation/hardhat-ledger": "^1.0.3",
"@nomicfoundation/hardhat-network-helpers": "^1.0.12",
"@nomicfoundation/hardhat-verify": "^2.0.11",
"@nomicfoundation/ignition-core": "^0.15.5",
"@nomicfoundation/ignition-core": "^0.15.6",
"@openzeppelin/contracts": "^5.0.2",
"@tenderly/hardhat-tenderly": "^2.3.2",
"@tenderly/hardhat-tenderly": "^2.4.0",
"@truffle/dashboard-hardhat-plugin": "^0.2.15",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.8",
"@types/node": "^22.7.1",
"@types/node": "^22.7.4",
"chai": "^4.5.0",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -196,7 +198,7 @@
"typechain": "^8.3.2",
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0",
"xdeployer": "^3.1.1",
"zksync-ethers": "^6.12.1"
"xdeployer": "^3.1.2",
"zksync-ethers": "^6.13.0"
}
}
Loading

0 comments on commit f5e52b6

Please sign in to comment.