Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.5.8;
- contract Escrow {
- address payable public payee;
- address payable public beneficiary;
- address public witness;
- address public judge;
- bool public testified;
- bool public escalated;
- modifier only(address role) {
- require(msg.sender == role);
- _;
- }
- constructor(address payable _payee, address payable _beneficiary, address _witness) public {
- payee = _payee;
- beneficiary = _beneficiary;
- witness = _witness;
- judge = msg.sender;
- }
- function testify() public only(witness) {
- testified = true;
- }
- function escalate() public only(payee) {
- escalated = true;
- }
- function judgeEscalation(bool toBeneficiary) public only(judge) {
- require(escalated == true);
- if(toBeneficiary) {
- beneficiary.transfer(address(this).balance);
- } else {
- payee.transfer(address(this).balance);
- }
- }
- function payout() public {
- require(testified == true);
- beneficiary.transfer(address(this).balance);
- }
- function() external only(payee) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement