Boat Renting


Contract purpose

This Smart Contract manages the boat renting system for a company that offers this service. Each boat has to be identified by a unique boat ID when is added to the contract.

Exposed methods and variables

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

boats returns the details about a particular boat when called with the boat ID

addBoat function called by the manager when he wants to add a new boat to the list

parameter nametypedetails
_boatIDintegerunique identifier of the boat
_priceintegerthe sum a client has to pay for renting this boat

rentBoat called by a client who wishes to rent a particular boat .The client has to send to the contract the exact price of the selected boat. It emits the BoatRented event

parameter nametypedetails
_boatIDintegerunique identifier of the boat (the call succeeds only if the boat is available for renting)

boatAvailable allows the manager to mark a boat as available after the client leaves it and it is ready for renting again

parameter nametypedetails
_boatIDintegerunique identifier of the boat

changeBoatPrice allows the manager to change the renting price of a particular boat

parameter nametypedetails
_boatIDintegerunique identifier of the boat
_newPriceintegerthe new price of the boat

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 manager



parameter nametypedetails
BoatIDintegerthe id of the rented boat
Clientethereum addressthe address of the client who rented the boat
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract