0

I am able to compile the smart contract successfully, which generates the ABI and bytecode for the contract as expected.

Below is my deployContract function that gets the ABI and bytecode for the respective smart contract and uses Hardhat upgrades proxy to deploy the contract:

async deployContract(contractName: string) {
  const { abi, bytecode } = this.getContractCode(contractName);
  const wallet = await this.getDeployWallet();

  const ContractRequest = new ethers.ContractFactory(abi, bytecode, wallet);
  await proxy.waitForDeployment();
}

However, I am encountering the following error during deployment:

Error: The requested contract was not found. Make sure the source code is available for compilation

I have confirmed that the contract compiles successfully and generates the ABI and bytecode as expected. Here are some additional points about my setup:

  • The function getContractCode(contractName) retrieves the compiled ABI and bytecode for the given contract name.
  • I am using Hardhat for compilation and deployment, along with the ethers.js library.
  • The deployment wallet is correctly initialised and connected.

Despite this, the error indicates that the requested contract cannot be found.

I would appreciate any insights or suggestions on what might be causing this issue. Could this be related to the Hardhat configuration, the contract factory initialization, or something else?

Additionally:

  • How can I verify if the correct ABI and bytecode are being passed to the ethers.ContractFactory?
  • Is there a better way to debug the deployment process in this setup?

Any help or guidance from the community would be greatly appreciated. Thank you!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.