Skip to content

Commit

Permalink
Update src.js
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumelauzier committed Feb 20, 2023
1 parent fb11e78 commit 48e00bd
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Contractual obligations/Dispute Resolution/src.js
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);
}
}

0 comments on commit 48e00bd

Please sign in to comment.