pragma solidity ^0.4.22; contract EthBnB { struct Room { /** * NOTE: we'll likely want to use another form of identifier for rooms */ uint roomId; uint price; address owner; string location; /** * maps 'date' of booking to address. * The 'date' is now represented as string */ mapping(string => address) bookingDates; } /** * increments for every room that is created */ uint roomId = 1; /** * maps 'roomId' to Room */ mapping(uint => Room) rooms; /** * creates a new room for the message sender */ function createRoom() { rooms[roomId] = Room({ roomId : roomId }); } /** * only the room owner can execute this function */ function makeRoomAvailable(uint roomId, uint price, string []dates) public { // the message sender must be the owner of the room require(rooms[roomId].owner == msg.sender); } }