-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb11e78
commit 48e00bd
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
pragma solidity ^0.8.0; | ||
|
||
contract SimpleSmartContract { | ||
address public buyer; | ||
address public seller; | ||
address public arbiter; | ||
uint256 public price; | ||
bool public dispute; | ||
bool public settled; | ||
|
||
constructor(address _buyer, address _seller, address _arbiter, uint256 _price) { | ||
buyer = _buyer; | ||
seller = _seller; | ||
arbiter = _arbiter; | ||
price = _price; | ||
dispute = false; | ||
settled = false; | ||
} | ||
|
||
function initiateDispute() public { | ||
require(msg.sender == buyer || msg.sender == seller, "Only the buyer or seller can initiate a dispute"); | ||
|
||
dispute = true; | ||
} | ||
|
||
function settleDispute(address payable recipient) public { | ||
require(msg.sender == arbiter, "Only the arbiter can settle a dispute"); | ||
|
||
settled = true; | ||
recipient.transfer(price); | ||
} | ||
} |