Contract purpose

This smart contract manages parking spots of a car park.

Contract parameters

totalSpots the total number of sports in the car park

pricePerHour the price per hour for one parking spot

Exposed methods and variables

manager address of the car park manager

available the number of available parking spots

clients returns the details about a client (check-in time, check-out time, payment and if the payment was made)

checkIn called by the client when he enters the car park

checkOut called by the client when he leaves the car park and the function returns the amount the client needs to pay based on how long he stayed

payParking allows the client to pay for the time his car was parked

addSpots allows the manager to add more parking spots to the contract

parameter nametypedetails
nrintegernumber of parking spots to be added

transferMoney allows the manager 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

Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract