Skip to content

Instantly share code, notes, and snippets.

View gyorgybalazsi's full-sized avatar

György Balázsi gyorgybalazsi

  • Rock Star Consulting
  • Budapest Hungary
  • 17:42 (UTC +02:00)
  • X @winnfield
View GitHub Profile
@gyorgybalazsi
gyorgybalazsi / ticket_offer_output.hs
Created September 15, 2022 10:02
Ticket offer output
Transactions:
TX 0 1970-01-01T00:00:00Z (Main:60:14)
#0:0
│ consumed by: #2:2
│ referenced by #2:1, #2:2
│ disclosed to (since): 'Alice' (0), 'ScroogeBank' (0)
│ divulged to (since): 'TicketWizard' (2)
└─> create Main:Cash
with
issuer = 'ScroogeBank'; owner = 'Alice'; amount = 10.0000000000
alice=Alice::1220903eba6363a0f4cea27fbfdad7e13810273f90aff60257046717ed2581b9d087
bob=Bob::1220903eba6363a0f4cea27fbfdad7e13810273f90aff60257046717ed2581b9d087
grpcurl --plaintext \
-d "{\"ledgerId\":\"sandbox\", \"filter\":{\"filtersByParty\":[{\"key\": \"${alice}\"},{\"key\": \"${bob}\"}]}}" \
"localhost:6865" com.daml.ledger.api.v1.ActiveContractsService/GetActiveContracts > contracts.json
@gyorgybalazsi
gyorgybalazsi / Asset.hs
Created August 29, 2022 09:13
Asset contract and setup script
module Main where
import Daml.Script
type AssetId = ContractId Asset
template Asset
with
issuer : Party
owner : Party
name : Text
where
ensure name /= ""
module Main where
import Daml.Script
import DA.List (sortOn, head)
import DA.Time
import DA.Assert ((===))
template Proposal
with
proposer : Party
@gyorgybalazsi
gyorgybalazsi / TicketOffer.hs
Last active January 31, 2022 14:24
TicketOffer template
module TicketOffer where
template TicketOffer
with
organizer : Party
buyer : Party
price : Decimal
where
signatory organizer
observer buyer
controller buyer can
@gyorgybalazsi
gyorgybalazsi / TicketOffer.hs
Last active September 2, 2022 09:31
Ticket offer
module Main where
import DA.Assert ((===))
import Daml.Script
template TicketOffer
with
organizer : Party
buyer : Party
price : Decimal
@gyorgybalazsi
gyorgybalazsi / transactions1.hs
Last active October 26, 2021 14:05
transactions1.hs
module Token1 where
import Daml.Script
template Token
with
issuer : Party
owner : Party
amount : Int
createdAt : Time
{-# LANGUAGE ApplicativeDo #-}
module Token where
import Daml.Script
template Token
with
issuer : Party
owner : Party
amount : Int
@gyorgybalazsi
gyorgybalazsi / oneliner.hs
Last active October 25, 2021 10:57
Daml template in one line
module Token where
template Token
with
issuer : Party
owner : Party
amount : Int
createdAt : Time
where
signatory issuer
@gyorgybalazsi
gyorgybalazsi / flexible.daml
Last active September 2, 2021 17:54
Surgical event update with flexible controller
module Main where
import Types
import Utils
import DA.Text
import DA.Optional
import DA.Date as D
import DA.Time
import Daml.Script