def acceptAgreement(self, params): self.data.houseaddress = params._houseAddress sp.if ~(self.data.propertyList.contains(self.data.houseaddress)): sp.failwith('Property Does Not Exists.')
self.data.propertyList[self.data.houseaddress].dispute = True @sp.entry_point def settleDispute(self, params): self.data.houseaddress = params._houseAddress sp.if (sp.sender != self.data.propertyList[self.data.houseaddress].tenant): sp.failwith("Only Tenant can mark Dispute.") sp.else: self.data.propertyList[self.data.houseaddress].dispute = False def checkHouseAlreadyExits(self, params): sp.if ~(self.data.propertyList.contains(params._houseAddress)): self.data.propertyList[params._houseAddress] = sp.record(tenant=self.data.owner, rent=sp.tez( params._rent), deposit=sp.tez(params._deposit), active=sp.bool(False), paidRents=sp.list(), dispute=False) sp.else: sp.failwith('Property Already Exists.') @sp.add_test(name="Minimal") def test(): scenario = sp.test_scenario() owner = sp.test_account("Owner") tenant1 = sp.test_account("Tenant1") tenant2 = sp.test_account("Tenant2") scenario.h1("Rental Contract") c1 = RentalContract(owner.address) scenario += c1 scenario.h2("Add 1st Property")
def updatePropertyRequest(self, params): self.data.houseaddress = params._houseAddress sp.verify(self.data.owner == sp.sender, message='Only Owner Can update his/her Property.') sp.if ~(self.data.propertyList.contains(self.data.houseaddress)): sp.failwith('Property Does Not Exists.')
def createUser(self, params): username = params.username sp.if self.data.pointsMap.contains(username): sp.failwith('username already exists')