Cross Chain Tutorial Deploying

Replace the code in hardhat.config.ts with the following:

Replace the code in hardhat.config.ts with the following:

L1-Governance/hardhat.config.ts
import type { HardhatUserConfig } from 'hardhat/config';
import '@nomicfoundation/hardhat-toolbox';

import dotenv from 'dotenv';
dotenv.config();

const config: HardhatUserConfig = {
  solidity: '0.8.24',
  networks: {
    // Sepolia network
    sepolia: {
      url: process.env.NODE_RPC_URL,
      accounts: [process.env.PRIVATE_KEY!],
    },
  },
};

export default config;

Next, create the file Governance.ts inside the /ignition/modules folder and copy/paste the following code into it:

touch ignition/modules/Governance.ts
L1-Governance/ignition/modules/Governance.ts
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules';

const GovernanceModule = buildModule('GovernanceModule', (m) => {
  const governance = m.contract('Governance', [], {});

  return { governance };
});

export default GovernanceModule;

Then, from the L1-governance folder root, compile and deploy the contract:

npx hardhat compile
npx hardhat ignition deploy ./ignition/modules/Governance.ts --network sepolia

You should see the following output:

Deploying [ GovernanceModule ]
Batch #1
  Executed GovernanceModule#Governance

[ GovernanceModule ] successfully deployed 🚀

Deployed Addresses

GovernanceModule#Governance - 0xA7d27A1202bE1237919Cf2cb60970141100725b4

Save the address to use in a later step.


Made with ❤️ by the ZKsync Community