Stuck while passing the the deployed contract address to another contracts constructor

706 views Asked by At

I deployed my first contract successfully and the get instance of that.but when i tried to deploy second contract that takes the first contract as an argument this got me error. I passed the address of first contract or also object(instance of first contract).every time its gives me error.

  1. when passed as an address it given invalid address or Iban address format like this.enter code herethis is an error image link

and error

Uncaught (in promise) Error: Provided address "[object Promise]" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.
    at Object.d [as inputAddressFormatter]
  1. The code of i trying to use for deployment[` //get compiled data
    let DhiSaleJsonInterface = await $.getJSON("DhiSale.json");

    //create new object of DhiSale Contract.
    let instance = new web3.eth.Contract(DhiSaleJsonInterface.abi);

    //added meta data or required options
    instance.options.address = "";
    instance.options.from = account;
    instance.options.gas = 1000000;
    instance.options.gasPrice = '1000000000';

    //add bytecode required for deployement.
    instance.options.data = DhiSaleJsonInterface.bytecode;

    //deploy the DhiSale contract

    //Dhi is an already deployed contract object.

    //it gives the error
    return instance.deploy({ arguments: [Dhi.options.address, 1000000000] }).send({ from: account }).then((contractInstance) => {
        console.log("Dhi Sale address :" + contractInstance.options.address);
        return contractInstance;
    })`]
0

There are 0 answers