Storage Units

FINANCIALTOOLSDOCUMENTS

Contract purpose

This Smart Contract can be used to sell and buy storage units. Initially, the manager of the building where the storage units are located adds the available units tot he contracts so that people can buy them. Once someone bought a storage unit, he is the owner and he can resell it at the same or different price.

Exposed methods and variables

manager the ethereum address of the storage units, given as parameter at contract creation

units returns the details of a unit when called with the particular unit ID

addStorageUnit the manager calls this function to add available units to the selling list. It emits the UnitAdded event

parameter nametypedetails
_idintegerthe unique identifier of the storage unit
_surfaceintegerthe area of the storage unit (squared meters)
_priceintegerthe selling price of the unit (wei)

buyUnit payable function that allows people to buy storage units. The amount sent to the contract has to be equal to the price of the storage unit. It emits the UnitSold event/

parameter nametypedetails
_idintegerthe unique identifier of the storage unit

sellUnit using this function, people who previously bought a storage unit can put it up for sale again

parameter nametypedetails
_idintegerthe unique identifier of the storage unit
_priceintegerthe price for the unit resale (can be the same or different as before)

Events

UnitAdded

parameter nametypedetails
StorageIDintegerthe id of the added storage unit

UnitSold

parameter nametypedetails
StorageIDintegerthe id of the sold storage unit
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract