House Buying Escrow

Under Review

DOCUMENTSTOOLSESCROWUTILITYFINANCIAL

Contract purpose

This Smart Contract acts like an escrow that secures the money for a house buying until a house inspection is performed by an inspector agreed upon by both parties. The inspector sets a score for the house and if that score is higher than the minimum score set by the buyer, the money will go to the seller. Otherwise, the buyer will receive his money back.

Contract parameters

buyer : address of the buyer housePrice : the sum the buyer needs to send to the contract ( in wei)

Exposed methods and variables

seller : address of the seller (contract creator) inspector : the address of the inspector

setInspector : this function lets enables the buyer to set the address of the house inspector and emits the event InspectorSet

parameter nametypedetails
_inspectorethereum addressthe address of the inspector

setMinScore : allows the buyer to set the minimum score for the house inspection

parameter nametypedetails
_minScoreintegervalue of the minimum score

sendMoney : payable function used by the buyer to send to the contract the amount set by the buyer. It emits the MoneySent event

approveInspector : called by the seller to agree upon the chosen inspector and emits the event InspectorApproval

disapproveInspector : called by the seller to agree upon the chosen inspector and emits the event InspectorApproval. After this, the buyer needs to set another inspector.

inspDone : enables the inspector to set the score for the inspection (it works only if the money were sent, the inspector was approved and the minimum score was set) and emits the event InspectionDone

parameter nametypedetails
_inspScoreintegervalue of house inspection score

getMoney : called by either the buyer or the seller, it checks if the minimum score was obtained and if so, send the money to the seller, otherwise it send the money back to the buyer. It emits moneyToSeller or moneyToBuyer events.

Events

InspectorSet

parameter nametypedetails
inspSetbooleantrue if the inspector was set

InspectorApproval

parameter nametypedetails
inspAppbooleantrue if the inspector was approved
inspectoraddressaddress of the inspector

MoneySent

parameter nametypedetails
moneySentbooleantrue if the money was sent

InspectionDone

parameter nametypedetails
inscpScorebooleanthe house inspection score given by the inspector

moneyToSeller

parameter nametypedetails
balanceintegerthe balance of the contract

moneyToBuyer

parameter nametypedetails
balanceintegerthe balance of the contract
Reviewed by Modex
Buy

Copyright © Modex Marketplace