
Contract purpose
This Smart Contract manages bookings for a billiard venue. The number of tables is set at the contract creation and people can book a billiard table using a reference number provided by the venue for a particular table.
Exposed methods and variables
manager the ethereum address of system manager, given as parameter at contract creation
nrOfTables the total number of billiard table in the venue (parameter set in the constructor)
pricePerHour the price for booking a table for an hour (set in the constructor)
availableTables the total number of available tables (not booked). Initially, it equals the nrOfTables value
tableList returns the details about particular table identified by a reference number (if it is booked, the address of the client and the booking time)
bookTable payable function called when booking a table. The client has to send to the contract the same amount as the price per hour set by the manager or a multiple of that value. It emits the TableBooked event.
parameter name | type | details |
---|---|---|
_refNr | integer | unique identifier of a billiard table |
payExtraTime in case the client spent more time than he initially paid for, he can use this function to pay for the extra time
parameter name | type | details |
---|---|---|
_refNr | integer | unique identifier of a billiard table |
tableAvailable called by the same client who booked the billiard table, this time to set it as available again after he leaves
parameter name | type | details |
---|---|---|
_refNr | integer | unique identifier of a billiard table |
changePrice allows the manager to change the price for table booking
parameter name | type | details |
---|---|---|
newPrice | integer | the new price for booking |
transferMoney allows the owner to transfer money from the contract's balance to his own account
parameter name | type | details |
---|---|---|
amount | integer | the sum the manager wants to transfer |
getBalance returns the balance of the contract when called by the manager
Events
TableBooked
parameter name | type | details |
---|---|---|
RefNr | integer | the reference number of the booked table |