CryptoDoggies.sol pragma solidity >=0.7.0 <0.9.0; contract...
Question CryptoDoggies.sol pragma solidity >=0.7.0 <0.9.0; contract... Image transcription textExercise 1 This exercise is 10% of your total grade. It can also carry up to 5% in extra~credit points.CryptoDoggies is a game that can be played on the Ethereum blockchain and is implemented as a smartcontracll. The basic object in this game is a virtual pet, called a doggy. Each doggy has a unique D... Show more... Show more CryptoDoggies.sol pragma solidity >=0.7.0 <0.9.0;contract CryptoDoggies{ address payable developer; //the address of the developer of this contract uint16[] doggies; //a list of all of our current doggies mapping(uint16 => address) owner; //maps each doggy to its owner mapping(uint16 => address) previous_owner; //previous owner of the doggy (before the sale) mapping(uint16 => uint) birthBlock; //maps each doggy to the block number in which the doggy was created/born mapping(uint16 => uint) paidCreationFee; //fee paid for creating this doggy mapping(uint16 => uint16) currentMate; //current mate of this doggy (decided by its owner) mapping(uint16 => uint) price; //the price set by the current owner (assuming they are willing to sell the doggy) //The following are hard-coded fees uint64 creationFee = 1 ether; uint64 breedingFee = 1 ether; uint64 sellingFee = 0.1 ether; uint64 buyingFee = 0.1 ether; event newDoggyEvent(uint16 doggy, address owner); //an event that shows a new doggy was created event transferDoggyEvent(uint16 doggy, address old_owner, address new_owner); //an event that is triggered when a doggy is transfered constructor() { developer = payable(msg.sender); } //creates a random uint16 that can be used e.g. as the DNA of a doggy function random_uint16() private view returns (uint16) { uint random = uint(blockhash(block.number))^tx.gasprice; uint16 ans = uint16(random % 2**16); return ans; } //creates a new doggy function createNewDoggy() public payable { //make sure the fee that is paid for creating this doggy is enough require(msg.value > creationFee); for(uint i=0;i


