Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. pragma solidity ^0.5.8;
  2.  
  3. contract Escrow {
  4.  
  5. address payable public payee;
  6. address payable public beneficiary;
  7. address public witness;
  8. address public judge;
  9. bool public testified;
  10. bool public escalated;
  11.  
  12. modifier only(address role) {
  13. require(msg.sender == role);
  14. _;
  15. }
  16.  
  17. constructor(address payable _payee, address payable _beneficiary, address _witness) public {
  18. payee = _payee;
  19. beneficiary = _beneficiary;
  20. witness = _witness;
  21. judge = msg.sender;
  22. }
  23.  
  24. function testify() public only(witness) {
  25. testified = true;
  26.  
  27. }
  28.  
  29. function escalate() public only(payee) {
  30. escalated = true;
  31. }
  32.  
  33. function judgeEscalation(bool toBeneficiary) public only(judge) {
  34. require(escalated == true);
  35. if(toBeneficiary) {
  36. beneficiary.transfer(address(this).balance);
  37. } else {
  38. payee.transfer(address(this).balance);
  39. }
  40. }
  41.  
  42. function payout() public {
  43. require(testified == true);
  44. beneficiary.transfer(address(this).balance);
  45. }
  46.  
  47. function() external only(payee) {
  48.  
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement