Skip to content

Commit

Permalink
Merge pull request #21 from phureewat29/feature/add-era-mainnet
Browse files Browse the repository at this point in the history
feat: add zkSync era mainnet to hardhat config
  • Loading branch information
dutterbutter authored Apr 9, 2024
2 parents d3c313d + cef0359 commit 631140c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 20 deletions.
7 changes: 2 additions & 5 deletions contracts/deploy/allowListPaymaster.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Provider, Wallet } from "zksync-web3";
import * as ethers from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { HardhatRuntimeEnvironment, HttpNetworkUserConfig } from "hardhat/types";
import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
import { HttpNetworkUserConfig } from "hardhat/types";

// load env file
import dotenv from "dotenv";
Expand All @@ -17,9 +16,7 @@ if (!PRIVATE_KEY)

export default async function (hre: HardhatRuntimeEnvironment) {
console.log(`Running deploy script for the AllowlistPaymaster contract...`);
// Currently targeting the Sepolia zkSync testnet
const network = hre.userConfig.networks?.zkSyncTestnet;
const provider = new Provider((network as HttpNetworkUserConfig).url);
const provider = new Provider((hre.network.config as HttpNetworkUserConfig).url);

// The wallet that will deploy the token and the paymaster
// It is assumed that this wallet already has sufficient funds on zkSync
Expand Down
4 changes: 1 addition & 3 deletions contracts/deploy/erc20fixedPaymaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ if (!TOKEN_ADDRESS)

export default async function (hre: HardhatRuntimeEnvironment) {
console.log(`Running deploy script for the ERC20fixedPaymaster contract...`);
// Currently targeting the Sepolia zkSync testnet
const network = hre.userConfig.networks?.zkSyncTestnet;
const provider = new Provider((network as HttpNetworkUserConfig).url);
const provider = new Provider((hre.network.config as HttpNetworkUserConfig).url);
// The wallet that will deploy the token and the paymaster
// It is assumed that this wallet already has sufficient funds on zkSync
const wallet = new Wallet(PRIVATE_KEY);
Expand Down
4 changes: 1 addition & 3 deletions contracts/deploy/erc721gatedPaymaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ if (!NFT_COLLECTION_ADDRESS)

export default async function (hre: HardhatRuntimeEnvironment) {
console.log(`Running deploy script for the ERC721gatedPaymaster contract...`);
// Currently targeting the Sepolia zkSync testnet
const network = hre.userConfig.networks?.zkSyncTestnet;
const provider = new Provider((network as HttpNetworkUserConfig).url);
const provider = new Provider((hre.network.config as HttpNetworkUserConfig).url);

// The wallet that will deploy the token and the paymaster
// It is assumed that this wallet already has sufficient funds on zkSync
Expand Down
4 changes: 1 addition & 3 deletions contracts/deploy/gaslessPaymaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ if (!PRIVATE_KEY)

export default async function (hre: HardhatRuntimeEnvironment) {
console.log(`Running deploy script for the GaslessPaymaster contract...`);
// Currently targeting the Sepolia zkSync testnet
const network = hre.userConfig.networks?.zkSyncTestnet;
const provider = new Provider((network as HttpNetworkUserConfig).url);
const provider = new Provider((hre.network.config as HttpNetworkUserConfig).url);
// The wallet that will deploy the token and the paymaster
// It is assumed that this wallet already has sufficient funds on zkSync
const wallet = new Wallet(PRIVATE_KEY);
Expand Down
4 changes: 1 addition & 3 deletions contracts/deploy/timeBasedPaymaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ if (!PRIVATE_KEY)

export default async function (hre: HardhatRuntimeEnvironment) {
console.log(`Running deploy script for the TimeBasedPaymaster contract...`);
// Currently targeting the Sepolia zkSync testnet
const network = hre.userConfig.networks?.zkSyncTestnet;
const provider = new Provider((network as HttpNetworkUserConfig).url);
const provider = new Provider((hre.network.config as HttpNetworkUserConfig).url);

const wallet = new Wallet(PRIVATE_KEY);
const deployer = new Deployer(hre, wallet);
Expand Down
6 changes: 3 additions & 3 deletions contracts/deploy/use-greeter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Provider } from "zksync-web3";
import * as ethers from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { HardhatRuntimeEnvironment, HttpNetworkUserConfig } from "hardhat/types";

// load env file
import dotenv from "dotenv";
Expand All @@ -14,7 +14,7 @@ const PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY || "";
if (!PRIVATE_KEY)
throw "⛔️ Private key not detected! Add it to the .env file!";

// Address of the contract on zksync testnet
// Address of the greeter contract on zksync
const CONTRACT_ADDRESS = "";

if (!CONTRACT_ADDRESS) throw "⛔️ Contract address not provided";
Expand All @@ -25,7 +25,7 @@ export default async function (hre: HardhatRuntimeEnvironment) {

// Initialize the provider.
// @ts-ignore
const provider = new Provider(hre.userConfig.networks?.zkSyncTestnet?.url);
const provider = new Provider((hre.network.config as HttpNetworkUserConfig).url);
const signer = new ethers.Wallet(PRIVATE_KEY, provider);

// Initialise contract instance
Expand Down
6 changes: 6 additions & 0 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ const config: HardhatUserConfig = {
verifyURL:
"https://explorer.sepolia.era.zksync.dev/contract_verification",
},
zkSyncMainnet: {
url: "https://mainnet.era.zksync.io",
ethNetwork: "mainnet",
zksync: true,
verifyURL: "https://zksync2-mainnet-explorer.zksync.io/contract_verification",
},
},
solidity: {
version: "0.8.17",
Expand Down

0 comments on commit 631140c

Please sign in to comment.