Last active
January 31, 2022 14:24
-
-
Save gyorgybalazsi/074bf2a1da44f0b19ef26fd9613e30f2 to your computer and use it in GitHub Desktop.
TicketOffer template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TicketOffer where | |
template TicketOffer | |
with | |
organizer : Party | |
buyer : Party | |
price : Decimal | |
where | |
signatory organizer | |
observer buyer | |
controller buyer can | |
Accept : ContractId TicketAgreement | |
-- ^^^^^^^^^^^^^^^ | |
-- Error because of the missing | |
-- `TicketAgreement` template | |
with | |
cashId : ContractId Cash | |
-- ^^^^ | |
-- Error because of the missing | |
-- `Cash` template | |
do | |
cash <- fetch cashId | |
assert (cash.amount == price) | |
exercise cashId Transfer with | |
-- ^^^^^^^^ | |
-- Error because of the missing | |
-- `Transfer` choice | |
newOwner = organizer | |
create TicketAgreement with | |
-- ^^^^^^^^^^^^^^^ | |
-- Error because of the missing | |
-- `TicketAgreement` template | |
organizer; owner = buyer | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment