Skip to content

Instantly share code, notes, and snippets.

@gyorgybalazsi
Last active January 31, 2022 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gyorgybalazsi/074bf2a1da44f0b19ef26fd9613e30f2 to your computer and use it in GitHub Desktop.
Save gyorgybalazsi/074bf2a1da44f0b19ef26fd9613e30f2 to your computer and use it in GitHub Desktop.
TicketOffer template
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