1

I'm trying to create a copy of an contract existent contract using web3.js 1.0. I'm trying to use the functions clone and deploy but without success.

        contract2 = contract1.clone();

        contract2.deploy().send({from : web3.eth.defaultAccount})
        .on('error', function(error){ 
             alert(error);
         })
         .then(function(result){
            alert(result); 
            } 
        );
0

You need to pass an argument to deploy, this object contains the bytecode and the arguments to pass to the constructor (if any). See here

The issue is that the contract object does not store the bytecode, you need to provide it to deploy.

hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.