Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
so-high-l opened this issue Jun 24, 2024 · 0 comments
Open

Comments

@so-high-l
Copy link

so-high-l commented Jun 24, 2024

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.

@so-high-l so-high-l changed the title Issue on smart contract deployment to local chain Issue on smart contract deployment with constructor args to local chain Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant