Vehicle Part Origin
This smart contract keeps track of a vehicle part origin. It stores the details about the previous owners and also allows the selling of the part (ownership transfer).
Exposed methods and variables
manufacturerName the name of the manufacturer of the piece (given in the constructor). It is assumed that the manufacturer creates the contract.
manufacturerAddress the ethereum address of the manufacturer, given as parameter at contract creation
currentOwner the ethereum address of the current owner (initially is the manufacturer address).
description the description of the vehicle part (given in the constructor)
price this price is set when the current owner wants to sell the piece
forSale this value is set to true if the current owner wants to sell the part
owners returns the address of a previous owner. Can be queried starting from the index 0 until the number of the current owner
partForSale this function allows the current owner to let people know that the vehicle part is up for sale
|_price||integer||the price asked by the owner for the part|
buyPart allows a person to buy the piece by sending to the contract the amount asked by the owner. This function work only after the owner called the previous function. The sent amount will be transferred to the address of the current owner, before setting the new owner and emitting the New Owner event.
changeDescription allows the current owner to change the description of the vehicle part
|newDescription||string||the new description of the part|
|Owner||ethereum address||the address of the new owner|