Last active
February 27, 2019 13:48
-
-
Save tssandor/eb8e1488067440edb947284f936bda72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function rentAFlat(uint8 _flat) public payable returns(uint256) { | |
| tenantAddress = msg.sender; | |
| if (msg.value % flatDB[_flat].priceInWei == 0 && msg.value > 0 && flatDB[_flat].flatIsAvailable == true) { | |
| uint256 numberOfNightsPaid = msg.value / flatDB[_flat].priceInWei; | |
| flatDB[_flat].flatIsAvailable = false; | |
| flatDB[_flat].currentOccupant = tenantAddress; | |
| landlordAddress.transfer(msg.value); | |
| return numberOfNightsPaid; | |
| } else { | |
| tenantAddress.transfer(msg.value); | |
| return 0; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment