pragma solidity ^0.4.25; contract BuySellParcelF{ address public buyerAddress; address public sellerAddress; uint public pay_amount = 1 ether; bool public pay; bool public delivered; bool public acknowledge; bytes32 public hashedPassword; bytes32 public hashedVerify; // bytes32 public sharedPassword; constructor(address _sellerAddress)public payable{ // require(msg.value == pay_amount); buyerAddress = msg.sender; sellerAddress = _sellerAddress; } // buyer's own hashed password function hashPasswordBuyer() public returns (bytes32){ hashedPassword = keccak256("pass123"); return hashedPassword; } //buyer pay decided amount bool variable check function buyerPaid() public payable { require(msg.sender == buyerAddress); // require(msg.value == pay_amount); pay = true; } // to check whether or not parcel delivered function deliveredParcel() public { require(pay == true); require(delivered == false); delivered = true; } // function sharedPasswordSeller() public returns (bytes32){ hashedVerify = keccak256("pass123"); return hashedVerify; } // password logic function /* function hashPassword() public returns (bytes32){ hashed = keccak256("pass123"); return hashed; }*/ function acknowledgementParcel() public { if(msg.sender == buyerAddress && hashedPassword == hashedVerify){ acknowledge = true; } } function withdrawAmount() public payable { if(pay == true && delivered == true && acknowledge == true){ buyerAddress.transfer(pay_amount); } } }
0.4.25