Carpet Wash

TOOLSUTILITYFINANCIAL

Contract purpose

This Smart Contract manages a carpet wash system. There are more washing programs available for the client to choose. These programs are introduced to the contract by the system manager.

Exposed methods and variables

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

programs returns the details about a particular program (id, name, price, maximum length and width of the carpet) when called with the program id

addProgram function called by the manager when he wants to add a new program to the list

parameter nametypedetails
_idintegerunique identifier of the program
maxLintegerthe maximum length of a carpet that can use this washing program
maxWintegerthe maximum width of a carpet that can use this washing program
_namestringthe name of the program
_priceintegerthe sum a client need to pay for this program

washCarpet called by a client who wishes to have his carpet washed using a specific washing program.The client needs to send to the contract the exact price of the selected program. It emits the WahCarpet event

parameter nametypedetails
_lengthintegerthe length of the carpet (it has to be less than or equal to the max length defined in the washing program details)
_widthintegerthe width of the carpet (it has to be less than or equal to the max width defined in the washing program details)
programIDintegerunique identifier of the washing program

getCarpetDetails returns the details about a particular carpet washed here (the dimensions, program id and date)

parameter nametypedetails
ownerethereum addressthe address of the carpet owner

changeProgramPrice allows the manager change the price of a particular washing program

parameter nametypedetails
pIDintegerthe program ID
newPriceintegerthe new price of the program

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

Events

WashCarpet

parameter nametypedetails
Ownerethereum addressthe address of the carpet owner
ProgramIDintegerthe id of the washing program to be used
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract