Photography Gear Renting

Contract purpose

This Smart Contract allows the contract creator to rent out his photography equipment. He can add to the contract all the items that he wants to rent out. If an item is available, it can be rented by someone who pays the asking price.

Exposed methods and variables

owner the ethereum address of equipment owner, given as parameter at contract creation

items a list of the equipment pieces that were added to the contract. The details about each piece are returned when called with the index of the particular piece. This index is returned when the item is added to the contract.

addItem allows the owner to add a new piece of equipment to the list. It returns an index by which the added item can be further identified inside the contract.

parameter nametypedetails
_descriptionstringthe specifications of the equipment(all added items are assumed to be initially available for renting)
_priceintegerthe price asked for renting this piece

rentItem function called by a client who wishes to rent a particular item. He has to send to the contract the exact amount asked by the owner and the piece has to be available for renting. It emits the ItemRented event.

parameter nametypedetails
_indexintegerthe index of the item

itemAvailable function called by the owner to mark as available an item which was previously rented by someone.

parameter nametypedetails
_indexintegerthe index of the item

changeItemPrice allows the owner to change the renting price of an item

parameter nametypedetails
_indexintegerthe index of the item
_newPriceintegerthe new price of the item

transferMoney allows the owner to transfer money from the contract's balance to his own account

parameter nametypedetails
amountintegerthe sum the manager wants to transfer

getBalance returns the balance of the contract when called by the owner



parameter nametypedetails
Indexintegerthe index of the rented item
Clientethereum addressthe address of the client who rented the item
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract