0

I am making a new copy of a already deployed contract. I am using truffle, truffle-contract to do so. From JS front end

var conf = contract(MyContract)
    conf.setProvider(this.state.web3.currentProvider)
    conf.new(this.state.party1name, this.state.party1regaddress, this.state.party2address, this.state.effdate,
            {from: web3.eth.accounts[0], gas : 3000000})
    .then((instance) => {conf = instance
        console.log(conf.address)
        console.log(conf.get())
    })

The above code deploys a new contract for me, but it seems like ignoring all the parameters I give and the state of my new contract is empty.

When i do the same thing from truffle console, it works fine

MyContract.new("Manish", "Raffles Place", "0x61b755c693d7cf263f969f336be281a564af915d", {from: web3.eth.accounts[0]})

I checked in console I get below log

enter image description here

So I am getting the new contract address but values passed into my constructor are empty.

  • I checked in console regarding my calls, I can see promise.value – Manish Oct 20 '17 at 2:55
  • I can't say much but I'd check the parameters to new are, just a console.log to ensure the values are correct. Other problem I've is that truffle artifacts will get out of sync, so I've to delete build/ folder to force a contracts recompilation. – Ismael Oct 21 '17 at 21:28
  • 1
    Thanks @Ismael.. that helped..I just deleted all compiled abi in build folder and compiled and deployed all of them again and made my constructor payable and guess what...its working smoothly now – Manish Oct 25 '17 at 10:52
  • You may add that as an answer so it can help others in similar situation. – Ismael Oct 25 '17 at 16:16
0

I just deleted all compiled abi in build folder and compiled and deployed all of them again and made my constructor payable and guess what...its working smoothly now

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.