Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template PaintContract
- with
- painter : Party
- beneficiary : Party
- amount : EtherUnits
- settled : Bool
- to : Text
- txHash : Optional Text
- where
- signatory painter, beneficiary
- agreement partyToText painter <> " will paint " <> partyToText beneficiary
- <> "'s house for " <> show amount <> ". The Ether transaction "
- <> if settled then "has" else "has not" <> " been settled."
- controller beneficiary can
- SettleTransfer : ContractId PaintContract
- with
- paymentCid : ContractId SignedTransferTransaction
- do
- assert (settled == False)
- pay <- fetch paymentCid
- assert (pay.user == beneficiary)
- assert (pay.to == to)
- assert (pay.value == amount)
- assert (isSentStatus pay.sendStatus)
- exercise paymentCid SignedTransferTransaction_Archive
- create this with settled = True, txHash = pay.sendStatus.txHash
- isSentStatus : SendStatus -> Bool
- isSentStatus ss = case ss of
- Sent _ _ _ -> True
- _ -> False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement