Deployment

Deploying on a Local Network

  1. Compile the contract:

    npx hardhat compile
  2. Deploy the contract: Create a script /scripts/deploy.js:

    async function main() {
      const Contract = await ethers.getContractFactory("MyContract");
      const contract = await Contract.deploy();
      console.log("Contract deployed to:", contract.address);
    }
    
    main()
      .then(() => process.exit(0))
      .catch((error) => {
        console.error(error);
        process.exit(1);
      });
  3. Run the deployment script:

    npx hardhat run scripts/deploy.js --network localhost

Deploying on Testnet

  1. Configure Networks in Hardhat: Edit hardhat.config.js to include testnet configurations:

    codemodule.exports = {
      networks: {
        phron: {
          url: "https://testnet.phron.ai",
        }
      },
      solidity: "0.8.4",
    };

Last updated