pragma solidity 0.4.25; contract CryptoCats { struct Cat { uint rand; } /* The players own families of cats */ mapping (uint => address) public familiesToPlayers; /* Cats are grouped in families */ mapping (uint => uint[]) public familiesToCats; /* Keeps track of the family of a cat */ mapping (uint => uint) public catsToFamilies; /* All our cats are here */ Cat[] public cats; function createCat(uint rand, uint familyId) public { /* Push a new Cat in cats array */ uint catId = cats.push(Cat({ rand: rand })) - 1; /* Push new Cat in a family in familiesToCats mapping */ familiesToCats[familyId].push(catId); /* Sets the family Id of the new Cat in catsToFamilies mapping */ catsToFamilies[catId] = familyId; /* Assigning an ownership is not needed because players own families NOT cats */ } function setFamilyOwnership(uint familyId, address newOwner) public { familiesToPlayers[familyId] = newOwner; } function setCatOwnership(uint catId, address newOwner) public { /* Remove Cat from its family in familiesToCats mapping */ /* Gets the familyId of the new owner and sets it in catsToFamilies mapping */ } }
0.4.25