Ice Skates Renting

UTILITYTOOLS

Contract purpose

This Smart Contract manages the renting of ice skates renting for an ice skating rink. THe system manager add to the contract the pairs of skates grouped by their size. Each pair has a unique id given to a client before renting it.

Exposed methods and variables

manager the ethereum address of system manager, given as parameter at contract creation

addSkates this function is called by the system manager to add pairs of skates according to their size

parameter nametypedetails
_sizeintegerthe size of the pairs to be added
_ppHourintegerthe price per hour for renting a pair of skates
_nrOfPairsintegerthe total number of pairs available from this size

rentPair function called by a client for renting a spare pair of ice skates. He has to send to the contract a sum equal to the set price per hour for that pair or a multiple of that value. Also, the number of available pairs has to be at least one. It emits the PairRented event.

parameter nametypedetails
_sizeintegerthe size of the pair to be rented
_idintegerthe unique id of the pair of skates

pairAvailable called by the client, who previously rented the pair, when he wants to leave and set the pair available for renting again

parameter nametypedetails
_sizeintegerthe size of the pair to be made available
_idintegerthe unique id of the pair of skates

getSkatesDetails returns details about pairs of a particular size (the price per hour, the total number of pairs and the number of available pairs for renting)

parameter nametypedetails
_sizeintegerthe size of the pairs of skates

getPairDetails called by the manager to find out the details of a particular pair (the client who has the pair and the time (unix epoch time))

parameter nametypedetails
_sizeintegerthe size of the pair to be queried
_idintegerthe unique id of the pair of skates

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

Events

PairRented

parameter nametypedetails
Sizeintegerthe size of the pair that was rented
IDintegerthe unique id of the pair of skates

PairAvailable

parameter nametypedetails
Sizeintegerthe size of the pair that was made available
IDintegerthe unique id of the pair of skates
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract