• Generates a future-proof contract address using a salt plus bytecode, allowing the determination of an address before deployment.

    Parameters

    • sender: string

      The sender's address.

    • bytecodeHash: Bytes

      The hash of the bytecode, typically the output from zkSolc.

    • salt: Bytes

      A randomization element used to create the contract address.

    • input: Bytes = ''

      The ABI-encoded constructor arguments, if any.

    Returns string

    The implementation of create2Address in ZKsync Era may differ slightly from Ethereum.

    const address = utils.create2Address("0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", "0x010001cb6a6e8d5f6829522f19fa9568660e0a9cd53b2e8be4deb0a679452e41", "0x01", "0x01");
    // address = "0x29bac3E5E8FFE7415F97C956BFA106D70316ad50"