TennisCourtBooking

UTILITYDOCUMENTSTOOLS

Contract purpose

This Smart Contract manages bookings for a complex of tennis courts.

Exposed methods and variables

manager the ethereum address of the system manager given at contract creation

map returns the details about a specific court (if it is available, the price per hour)

addCourt called by the manager to add a new court to the contract

parameter nametypedetails
_numberintegerthe number of the court (unique)
_pricePerHourintegerthe price the clients need to pay to book this court for an hour

bookCourt called by someone who wants to book the court. The amount of money sent when calling this function has to be equal to the court's price per hour or a multiple of that price. Also, the court has to be available for the call to succeed and emit CourtBooked event.

parameter nametypedetails
_numberintegerthe number of the court (unique)

CourtAvailable called by the system manager to set a court as available again after the clients left

parameter nametypedetails
_numberintegerthe number of the court (unique)

transferMoney allows the owner to transfer money from the contract's balance to his own account

parameter nametypedetails
amountintegerthe sum the manager wants to transfer

getBalance returns the balance of the contract when called by the manager

Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract