BikeRental

Under Review

UTILITYTOOLS

Contract purpose

Smart contracts that manages bike rentals

Contract parameters

manager: manager of the system

Exposed methods and variables

bikeMap return the details about the bike identified by the given id

addBikes this function allows the manager to add bike in groups where the bikes have the same price per day and per hour

parameter nametypedetails
idsarray of integersunique IDs for the bikes (maximum 100 bikes per function call)
_pricePerHourintegerthe price for renting the bike for one hour
_pricePerDayintegerthe price for renting the bike for one day

bikeBroken allows the manager to set the state of a specific bike as broken

parameter nametypedetails
idintegerthe id of the broken bike

bikeOk allows the manager to set the state of a broken bike back to normal

parameter nametypedetails
idintegerthe id of the repaired bike

reserveBike payable function that allows someone to rent a bike. The amount of money sent must equal the price per day for a bike or must be a multiple of the price per hour. It emits the BikeReserved event.

parameter nametypedetails
idintegerthe id of the bike to be reserved

freeBike called by the client who reserved the bike or by the manager to set the bike as available again

parameter nametypedetails
idintegerthe id of the bike to be free

getBalance called by the manager to query the balance of the contract

transferFunds called by the manager to transfer money from the contract to a certain address

parameter nametypedetails
amountintegerthe amount to be transferred
addrethereum addressthe account where the money will be sent

getCurrentClient allows the manager to see the address of the current client who rented a specific bike

parameter nametypedetails
idintegerthe id of the bike

Events

BikeReserved

parameter nametypedetails
idintegerthe id of the bike
priceintegerthe price paid by the client
Reviewed by Modex
Buy

Copyright © Modex Marketplace