Skip to content

Instantly share code, notes, and snippets.

@dibakarsutradhar
Created December 8, 2018 08:07
Show Gist options
  • Save dibakarsutradhar/570b776ffa199ea8bbca5a0a3cb8b34d to your computer and use it in GitHub Desktop.
Save dibakarsutradhar/570b776ffa199ea8bbca5a0a3cb8b34d to your computer and use it in GitHub Desktop.
Real Estate Solidity Contract
pragma solidity ^0.5.1;
contract RealEstate {
address payable public seller;
address public buyer;
string public streetAddress;
string title;
uint256 public price;
constructor () public {
// Who is the seller
seller = msg.sender;
// What is the street address
streetAddress = "3517, Gouripur Bazar, Gouripur, Cumilla, BD";
// What is the title
title = "4A24DB5D05488D99B92BD503F688DF980B49067476FADBBD04228C6145120A9F";
// What is the price
price = 99000000000000000000; // 99 ETH
}
function buyHouse () payable public {
require(seller != address(0x0));
require(buyer == address(0x0));
require(msg.sender != seller);
require(msg.value == price);
buyer = msg.sender;
seller.transfer(msg.value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment