Skip to content

Issue on smart contract deployment with constructor args to local chain #33

@so-high-l

Description

@so-high-l

Hello,
I just started using the fantastic dApp-launchpad tool to develop a dapp, however when I add my smart contract to the smart contracts folder, and i run the dev environment, my contract doesn't get deployed. but the "wall" contract used as sample gets deployed correctly.
I tried to deploy the contracts using the hardhat cli (npx hardhat run script ./script/deploy...) and it worked just fine (which means the error is not related to the contract itself), but when I try to run dev only the "Wall" contract gets deployed and added to the constants/smart-contracts-development.json file

this is my deploy_localhost.js

const { ethers } = require("hardhat");

async function main() {
  try {

    // Deploy Wall contract
    const WallFactory = await ethers.getContractFactory("Wall");
    const wallContract = await WallFactory.deploy();
    await wallContract.waitForDeployment();
    console.log("Wall deployed to:", wallContract.target);

    // Deploy Nftcert contract
    const NftcertFactory = await ethers.getContractFactory("Nftcert");
    const NftcertContract = await NftcertFactory.deploy("NFTCertificate", "NFTC");
    await NftcertContract.waitForDeployment();
    console.log("Nftcert deployed to:", NftcertContract.target);

  } catch (error) {
    console.error("Deployment failed:", error);
  }
}
main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

Output
[19:06] > Deploying smart contracts on local chain
[19:06] ✔ Contract deployed: WALL -> 0x5fbdb2315678afecb367f032d93f642f64180aa3
[19:06] > Starting frontend dev server...

Is this problem related to some config that I don't know or is it an issue ?

Edit :
I noticed that contracts with constructor args doesn't get deployed by adding a constructor with 1arg to the Wall contract, and it didn't get deployed. So the scope of the problem is contracts with constructor arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions