0

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

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

contracts.push(c)

To this:

contracts.push(address(c))
| improve this answer | |

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.