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
  • 23:29 (UTC +02:00)
  • X @winnfield
View GitHub Profile
@gyorgybalazsi
gyorgybalazsi / surgicalEventUpdateRole.daml
Created September 2, 2021 10:07
Surgical Event Update Role
module Main where
import Types
import Utils
import DA.Text
import DA.Optional
import DA.Date as D
import DA.Time
import Daml.Script
@gyorgybalazsi
gyorgybalazsi / authorization.daml
Created August 19, 2021 15:00
Authorization example
module Main where
import Daml.Script
type AssetId = ContractId Asset
template Asset
with
issuer : Party
owner : Party
@gyorgybalazsi
gyorgybalazsi / accountId.daml
Created August 18, 2021 14:45
Daml code for generating unique account id
module Main where
import DA.Text (sha256)
import Daml.Script
import DA.Optional (isSome)
template SystemRoleContract
with
system : Party
where
signatory system
@gyorgybalazsi
gyorgybalazsi / relationship.daml
Created August 17, 2021 13:33
Relationship contract for creating separate contracts signed by two different parties
module Main where
import Daml.Script
template RelationshipOffer
with
alice : Party
bob : Party
where
signatory alice
@gyorgybalazsi
gyorgybalazsi / propose-accept.hs
Last active April 26, 2021 15:51
Daml propose-accept pattern
module Main where
import Daml.Script
import DA.Date
import DA.Time
data Currency = USD | EUR | CHF | HUF
deriving (Eq, Show)
module Main where
import Daml.Script
import DA.List
data VehicleListingStatus = FOR_SALE | SOLD
deriving (Eq, Show)
template Member
with
participant : Party
-- Copyright (c) 2021 Rethink Ledgers LLC. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
module EF_BGY where
import Daml.Script as S
import Daml.Trigger as T
import DA.Date
repeatAssetName : Asset -> Asset
repeatAssetName Asset with .. = Asset with name = name <> name, ..
setup : Script AssetId
setup = script do
alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")
let
issuer = alice
template Asset
with
issuer : Party
owner : Party
name : Text
where
ensure name /= ""
signatory issuer
controller owner can
Give : AssetId
setup : Script AssetId
setup = script do
alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")
let
issuer = alice
owner = alice
name = "TV"