ContainersTracking

Under Review

UTILITYDOCUMENTSTOOLS

Contract purpose

Smart contract that keeps track of cargo containers. Following the path of the containers, their owner can change. Also, some of the contained items can be removed and others can be added. The current owner might also update the container location or the container value.

Exposed methods and variables

manager: returns address of the contract creator. He is the only one who can add a new container to the list.

containersCount: return the number of containers added into the system

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

addContainer allows the system manager to introduce a new container. The function returns the index for the current owner and the current location

parameter nametypedetails
_idintegerunique id of the container
_nrOfItemsintegerthe number of items contained inside the container
_valueintegervalue of the container
_originstringthe starting location of the container

addItems allows the current owner or the manager to add a number of items to the specified container and emits the nrOfItemsChanged event

parameter nametypedetails
_idintegerunique id of the container
number integernumber of items to be added

removeItems allows the current owner or the manager to remove a number of items to the specified container and emits the nrOfItemsChanged event

parameter nametypedetails
_idintegerunique id of the container
number integernumber of items to be removed

changeCurrentOwner called by the current owner or the manager in case a new owner for the container has to be set. It returns the new owner index and emits the OwnerChanged event.

parameter nametypedetails
_idintegerunique id of the container
newOwnerethereum addressaddress of the new owner

changeLocation called by the current owner or the manager in case a new location for the container has to be set. It returns the new location index and emits the LocationChanged event.

parameter nametypedetails
_idintegerunique id of the container
locstringthe new location of the container

getCurrentOwner it returns the address of the current owner of the container

parameter nametypedetails
_idintegerunique id of the container

getOwnerById it returns the address of the previous owner of the container, identified by the specified id (index)

parameter nametypedetails
_idintegerunique id of the container
ownerIDintegerindex of the previous owner

getCurrentLocation it returns the current location of the container

parameter nametypedetails
_idintegerunique id of the container

getLocationById it returns the previous location, identified by the specified id (index)

parameter nametypedetails
_idintegerunique id of the container
locationIDintegerindex of the previous location

changeValue called by the current owner or by the manager to change the value of the container and emits the ValueChanged event

parameter nametypedetails
_idintegerunique id of the container

Events

nrOfItemsChanged

parameter nametypedetails
containerIDintegerunique id of the container
currentNrOfItemsintegerthe updated number of items

OwnerChanged

parameter nametypedetails
containerIDintegerunique id of the container
newOwnerethereum addressaddress of the new owner

LocationChanged

parameter nametypedetails
containerIDintegerunique id of the container
currentLocationstringthe updated container location

ValueChanged

parameter nametypedetails
containerIDintegerunique id of the container
newValueintegerthe updated container value
Reviewed by Modex
Buy

Copyright © Modex Marketplace