1

I am using this function to create a new contract instance of Match contract which takes 4 parameters. However i am getting this error message "invalid implicit conversion from contract to address requested contract". I have no idea how to address this.

function newMatch(uint _matchId,uint _noOfGames,uint _oddsOfA, uint _oddsOfB) public returns(address newContract)
      {
        Match c = new Match(_matchId,_noOfGames,_oddsOfA,_oddsOfB);
        contracts.push(c);
        return address(c);
      }
2
  • What is contracts??? Nov 22, 2019 at 11:29
  • its an array of addresses Nov 22, 2019 at 11:33

1 Answer 1

3

Given that contracts is an array of addresses, change this:

contracts.push(c)

To this:

contracts.push(address(c))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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