I have a function that returns a list of BetProposition
smart contracts:
function getBetsForMatchup(uint matchupIdentifier) public returns (BetProposition[]) {
return bets[matchupIdentifier];
}
Later I initialize a local variable array as such, so I can loop through them:
BetProposition[] betsToCancel = getBetsForMatchup(matchupIdentifier);
However, this doesn't seem to work and I get this error:
TypeError: Type contract BetProposition[] memory is not implicitly convertible to expected type contract BetProposition[] storage pointer.
BetProposition[] betsToCancel = getBetsForMatchup(matchupIdentifier);
^------------------------------------------------------------------^
I'm not totally sure what this means. Any help appreciated. Thanks
Best Answer
The compiler thinks you are trying to store the return value of getBetsForMatchup in contract (permanent) storage.
Try changing
to
This compiled on remix: