Jewelry Rent Out

FINANCIALUTILITYESCROW

Contract purpose

This smart contract enables a person or a store to ease the renting process of jewelry pieces.

Exposed methods and variables

owner ethereum address of the store manager or of the person who is renting out jewelry, given as parameter at contract creation

jewelryList returns the details of a particular jewelry piece when called with the specific jewelryID

addPiece this function allows the owner to add a new jewelry piece to the list and emits the JewelryAdded event

parameter nametypedetails
_idintegerthe unique identifier of the piece
_descriptionstringdescription of the added piece
_pricePerDayintegerthe price of renting the jewelry piece for a day
_pricePerWeekintegerthe price of renting the jewelry piece for a week

rentPiece payable function called by a person when he wants to rent a specific piece and it emits the PieceRented event in case the piece is available. The amount of wei sent to the contract has to be equal to the price per week for that piece or to be a multiple of the price per day value.

parameter nametypedetails
_idintegerthe unique identifier of the jewelry piece

setPieceAsAvailable the owner of the piece will use this function to mark a previously rented piece as available an it emits the PieceAvailable event

parameter nametypedetails
_idintegerthe unique identifier of the jewelry piece

changePieceDescription allows the owner to change the description of a particular piece

parameter nametypedetails
_idintegerthe unique identifier of the jewelry piece
_NewDescriptionstringthe new description of the piece

changePiecePrice allows the owner to change the price of a particular piece

parameter nametypedetails
_idintegerthe unique identifier of the jewelry piece
_newPpdintegerthe new price per day of the piece
_newPpwintegerthe new price per week of the piece

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

parameter nametypedetails
amountintegerthe sum the owner wants to transfer

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

Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract