Skip to content
This repository was archived by the owner on Apr 11, 2021. It is now read-only.
This repository was archived by the owner on Apr 11, 2021. It is now read-only.

Deploy failed, and the code is 0x. #107

@guanzhenxing

Description

@guanzhenxing

Hi, I want to deploy my contract to L2 network, but it failed. The message like this:

20210324091649

And my deploy code is

const deploy = async (factory, payload) => {
    console.log("Deploying with: ".blue, payload);
    const contract = await factory.deploy(...payload);
    return await _finish_and_check_deploy(
        contract,
        factory.provider || factory.signer.provider
    );

};
const _finish_and_check_deploy = async (contract, provider) => {
    const txHash = contract.deployTransaction.hash;
    console.log("Deployed in transaction: ".blue, txHash.green);

    await contract.deployTransaction.wait();
    console.log("Contract address: ".blue, contract.address.green);

    const txReceipt = await provider.getTransactionReceipt(txHash);
    console.log("Receipt: ", txReceipt);

    // Check if code is stored
    const code = await provider.getCode(contract.address);
    console.log("Code: ", code);
    
    assert(code.length > 2, "Contract NOT deployed (no code)".red);
    console.log("--------\n");
    return contract;
};

I don't understand why the deployment failed. The size of the contract is within the limits.I've tried making the contract a little smaller and it can be deployed successfully.

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