CarProvenance

UTILITYTOOLSDOCUMENTS

Contract purpose

Contract that keep tracks of a car provenance.

Contract parameters

_brand: brand of the car

_model : model of the car

_nrKm: number of km the car accumulated until now

_licenceNr: current licence number

Exposed methods and variables

owner address of the current owner

owners list of previous owners (returns the owner details stored at the specified index )

mapOwners returns the owner detail based on his address

licenceNrs array of previous licence numbers (returns the licence number stored at the specified index )

firstOwner called by the first owner of the car with his details

parameter nametypedetails
_namestringowner's name
_countrystringowner's country
_priceintegerthe amount the owner paid for the car
_fromDateintegerthe date when the ownership started

changeOwner called by the current owner when the car ownership changes, the nr of km the car accumulated with the current owner is added to the total

parameter nametypedetails
_namestringowner's name
_countrystringowner's country
_addrethereum addressaddress of the new owner
_kmintegernumber of km the current owner accumulated
_priceintegerthe amount the owner paid for the car
_fromDateintegerthe date when the new ownership starts

changeLicenceNr called only by the current owner when he want to change the licenceNr

parameter nametypedetails
_newstringthe new licence number
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract