Car Ride Sharing

TOOLSUTILITY

Contract purpose

This Smart Contract enables people to share details about their car rides so that other people could join the ride and split the price for gas afterward. The driver can receive ratings ranging from 2-very bad to 5-very good. This will make it easier for people to choose a driver if his rating is better.

Exposed methods and variables

creator the ethereum address of contract creator

registerAsDriver allows a person to register himself as a driver so that he could share his rides and emits the newDriver event

parameter nametypedetails
_carBrandstringthe brand of the car
_licencenNrstringthe licence number of the car

addRide allows a previously registered driver to add a new ride to the contract to let other people see it and join his ride. It emits the newRide event that contains the rideID so that this particular ride can be further identified

parameter nametypedetails
_startLocationstringthe location from which the ride will start
_destinationstringthe destination of the ride
_rideDateintegerthe date of the ride (unix time)
_seatsAvailableintegerthe number of seats available on the ride

selectRide allows people to select a seat on a ride, or more than one if there are still more seats available. Only callers of this function can rate the driver after the rides end

parameter nametypedetails
_rideIDintegerthe unique identifier of the ride
_seatsintegerthe number of seats the function caller wants, has to be within the limits of available seats

rateRide allows the passengers of a ride to rate the driver after the ride is completed, the rating has to be between 2 and 5 (2-very bad, 3-bad, 4-good, 5-very good)

parameter nametypedetails
_ratingintegerthe rating given by the passenger
_rideIDintegerthe unique identifier of the ride

getDriverDetails returns the details of a particular driver

parameter nametypedetails
_driverethereum addressthe ethereum address of the driver

getRideDetails returns the details of a particular ride

parameter nametypedetails
_rideIDintegerthe unique identifier of the ride

Events

newDriver

parameter nametypedetails
DriverAddressethereum addressthe address of the new driver

newRide

parameter nametypedetails
RideIDintegerthe ID of the new added ride

newPassengers

parameter nametypedetails
RideIDintegerthe ID of the selected ride
passengerethereum addressthe address of the person who selected the ride
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract