in

Improvement to *crypto market pool* tutorial

Hey everyone, I was running through the Solidity tutorials provided at https://cryptomarketpool.com/getting-started-with-solidity/ . Was doing the practice smart contract deployment on Remix IDE and improved one of those sample smart contracts (https://cryptomarketpool.com/hotel-and-vending-solidity-smart-contract/).

Features added:
Introduced a tenant address, so that vacating a room becomes possible

Only the owner or current tenat can vacate the room

The hotel room rent can be adjusted and is not a static value

Only the owner can change the rent

If excess funds are transferred to the contract, the surplus is returned to the msg.sender

Please have a look, and let me know your thoughts. I am not new to programming, but definitely new to web3 and solidity, I am here to learn.
https://gist.github.com/hinduBale/710f2e86d7df1652e2c723c4f30dca20

What do you think?

10 Points
Upvote Downvote

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

2 Comments

  1. You could probably add more events, a getter function to get the current room status, and move the fallback logic to an occupyRoom function that is called within it instead — people have really moved away from fallback functions being the entrypoint. Otherwise looks pretty good.

Introducing The Daily Gwei

Is TD broken or do I actually owe $1,000,000?