Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. template PaintContract
  2. with
  3. painter : Party
  4. beneficiary : Party
  5. amount : EtherUnits
  6. settled : Bool
  7. to : Text
  8. txHash : Optional Text
  9. where
  10. signatory painter, beneficiary
  11.  
  12. agreement partyToText painter <> " will paint " <> partyToText beneficiary
  13. <> "'s house for " <> show amount <> ". The Ether transaction "
  14. <> if settled then "has" else "has not" <> " been settled."
  15.  
  16. controller beneficiary can
  17. SettleTransfer : ContractId PaintContract
  18. with
  19. paymentCid : ContractId SignedTransferTransaction
  20. do
  21. assert (settled == False)
  22. pay <- fetch paymentCid
  23. assert (pay.user == beneficiary)
  24. assert (pay.to == to)
  25. assert (pay.value == amount)
  26. assert (isSentStatus pay.sendStatus)
  27. exercise paymentCid SignedTransferTransaction_Archive
  28. create this with settled = True, txHash = pay.sendStatus.txHash
  29.  
  30.  
  31. isSentStatus : SendStatus -> Bool
  32. isSentStatus ss = case ss of
  33. Sent _ _ _ -> True
  34. _ -> False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement