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);
      }
Sundeep Kumar
  • 147
  • 2
  • 10

1 Answers1

3

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

contracts.push(c)

To this:

contracts.push(address(c))
goodvibration
  • 26,003
  • 5
  • 46
  • 86