//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f. pragma solidity ^0.4.18; contract SellZombie { struct Zombie { address owner; uint32 dna; } Zombie public zombie; address public owner; uint256 public zombiePrice = 0.1 ether; /// @dev constructor function SellZombie(address _zombieOwner) public { owner = msg.sender; zombie.owner = _zombieOwner; } function buyZombie() payable public { require(msg.value == zombiePrice); // Can omit the following line if transferring all at once with withdraw owner.transfer(msg.value/10); zombie.owner.transfer((9 * msg.value)/10); zombie.owner = msg.sender; } function withdraw() external { owner.transfer(this.balance); } }
0.4.19