Sneak Peek of new Daml Training Videos for Daml forum members

Hi Daml’ers,
We’ve got a sneak peek of our new Introduction to Daml video training series we’ve been working on and we’d love to get your feedback. While we continue to work on the UX a bit, the first 4 of 6 episodes are available now through our Learning Management System. You can get them here. All feedback welcome!

8 Likes

Hi,
this couldn’t have come at a better time! I am trying to get to know DAML as we would like to leverage it in our company and actuallly have just started during the weekend.

I will give feedback as I finish the different episodes.

Episode 1
Great intro and a source of information as the DAML content seems to be scattered through different websites/resources; for example I had absolutely no idea about the interactive tutorials on daml.com and wasn’t sure where to go after playing in hub.daml.com

Main point to consider:

  • Typically learning videos are cut to smaller sections and it is for a good reason. If anyone wants to return to the video in the future to find some specific info / statement, they will have to skim through the whole 30 minute video. I would say there were some pretty obvious places to do the “cut”, at minimum Installation, Docs, Course project.

  • Presenter mentioned some business materials at the very beginning but they were not actually included in the “description” as was said in the video.

Nevertheles great job and keep the materials coming.

Cheers,

4 Likes

Thanks for the feedback @mpetran it’s very helpful and welcome to the forum. Glad you’ve found the videos useful. Also we have a list of our informational and learning sources here and are working to make them more accessible/findable in the future on daml.com.

Also cc @nemanja and @Levente_Barczy you might want to see the feedback above.

I thought that I’d jump into the training, both to learn me some more and offer feedback (… as if there was any doubt :grinning:)

So far in Episode 1, my only feedback is the presenter volume. It seems that @Levente_Barczy is not using a high-quality microphone, or if he is, his positioning is too far from it which creates a very, low-volume audio.

Full marks to @Levente_Barczy @nemanja @Chris_Olson et al for putting this together, very slick :+1:t2:

3 Likes

Glad to hear that you find the videos useful @mpetran @quidagis! And many thanks for your feedback, will help us for sure with improving it :slight_smile: :pray:

2 Likes

Part two inspired me to write up an expansion based on usage of records.

2 Likes

I have been in the training portal for almost 2 hours now and just noticed on the front page that there are now additional options:

This looks really good.

Do you want further feedback here, or would you prefer it through the training platform messaging service?

1 Like

Feel free to post further general feedback here :slight_smile:

1 Like

In Episode 3, I was able to get the testing to finally work correctly, only after I fixed the 2 ridiculously minor typos from Episode 2 :angry:

Executing the Script Test, saw the results, no errors but noticed that the output of the Currency and Royalty Rates as being:

  • Currency: 100.0000000000
  • Royalty Rate: 0.0500000000

Questions:

  • Why is the decimal point for these floats set to 10 in this instance?
  • Is this solely on the tests in VS Code?
  • If not, can the decimal point be explicitly nominated as per Python’s f-strings (Python 3.6+)?
1 Like

In Episode 3 - Daml Connect SDK Tooling, I am stuck with an error on the Bob modifications, The error is with the ‘bobOffer ← submit alice do’ as when this block is commented out, the error is no longer active.

I have watched the video now 2 times, and totally wiped the code examples, probably another typo :man_facepalming:t2:

Current Main.daml and Token.daml below.

Episode 3 - Daml Connect Main.daml
module Main where

import UserAdmin
import Daml.Script

setup : Script ()

setup = script do
  alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
  bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")
  userAdmin <- allocatePartyWithHint "UserAdmin" (PartyIdHint "UserAdmin")

  now <- getTime

  aliceIssuer <- submit userAdmin do
    createCmd Issuer
      with
        userAdmin = userAdmin
        issuer = alice

  originalToken <- submit alice do
    exerciseCmd aliceIssuer MintToken
      with
        description = "Cat Pic 1"
        initialPrice = 100.00
        currency = "USD"
        royaltyRate = 0.05

  bobOffer <- submit alice do
    exerciseCmd originalToken Offer <-- This is the error: **Not in scope, data constructor 'Offer' typecheck**
      with
        newOwner = bob
        price = 200.00

  bobRequest <- submit bob do
    createCmd OwnerRequest
      with
        userAdmin = userAdmin
        owner = bob
        reason = "I've got connections"

  submit userAdmin do
    exerciseCmd bobRequest GrantOwnerRights

  return ()
Episode 3 - Daml Connect Token.daml
module Token where

import Payment

{-
Content creators can mint NFTs
Owner can sell NFTs
Owners pay royalties on sale 
Participants must be explicitly permitted
Royalty Rate = 2.75%
GST = 15%
Currency_Default = NZD
-}

-- behaviour
-- datamodel
-- rights/obligations

template Token
  with
    issuer: Party
    owner: Party
    description: Text
    userAdmin: Party -- makes sure that the issuers and owner are legit
    issued: Time
    lastPrice: Decimal
    currency: Text
    royaltyRate: Decimal -- 2.75%
  where
    signatory issuer, userAdmin

    controller owner can
      Offer: ContractId TokenOffer
        with
          newOwner: Party
          price: Decimal

        do
          create TokenOffer with ..

template TokenOffer
  with
    issuer: Party
    owner: Party
    description: Text
    userAdmin: Party -- makes sure that the issuers and owner are legit
    issued: Time
    newOwner: Party
    price: Decimal
    lastPrice: Decimal
    currency: Text
    royaltyRate: Decimal
  where
    signatory issuer, userAdmin, owner

    key (issuer, owner, description): (Party, Party, Text)
    maintainer key._2

    controller newOwner, userAdmin can
      AcceptToken: (ContractId Token, ContractId Payable, ContractId Payable)
        do
          fromNewOwnerToOwner <- create Payable
            with
              from = newOwner
              to = owner
              amount = price
              currency
              reference = "Notional for `" <> description <> "`."

          royaltyPayment <- create Payable
            with
              from = newOwner
              to = issuer
              amount = (price * royaltyRate)
              currency
              reference = "Royalty for `" <> description <> "`."

          newToken <- create Token
            with
              owner = newOwner
              lastPrice = price
              ..

          return (newToken, fromNewOwnerToOwner, royaltyPayment)

Fixed: I had removed the ‘import Token’
statement from the Main.daml.

1 Like

Hi @quidagis

What does your ‘UserAdmin’ module look like?

2 Likes

I think you just need to import Token at the top in Main.daml

3 Likes

An easy fix, thank you @Mate_Varga

I am sure that I did have ‘import Token’ in before but for whatever reason removed it. Could not see the Forest for the Trees :man_facepalming:t2:

I now realise that when running the Script Tests in VS Code, if it fails, then you only get the Transactional View. If it passes, you get the Transactional & Table Views.

1 Like

It shows the transactions view by default because it’s the one having the error messages. I still have a button to switch to table view and it shows me the same state if I comment out the erroneous last submission.

2 Likes
  • Because they’re not floats. Daml, by design, does not have floating-point arithmetic. What it does have is fixed-point arithmetic (and numbers), where the type includes the precision. These numbers are of type Decimal, which is just an alias for Numeric 10, the type of fixed-point numbers with 10 decimal places.
  • This is the printing behaviour in the JSON representation: a Numeric x prints with x digits after the dot, even if they’re all 0. The Show instance for Numeric does not seem to do that; I don’t know whether that discrepancy is intentional, but at this point it’s probably not going to change (as that would break backwards compatibiity).
  • I don’t think Daml has anything like printf at the moment, but, as mentioned, the Show instance does seem to truncate (though still keeps at least one digit after the dot to distinguish from integers), so depending on what you’re doing you may be able to use that.
2 Likes

Thanks for all the wonderful feedback. Keep it coming. FYI we are integrating chapter links and transcript search into the videos. It will make the process you mention much better. We can also help enhance many of the suggestions that are coming in here!

1 Like

Thank you for the comprehensive replies. I recall now that @cocreature had mentioned to me back in March, that Daml does not use Floats. I guess for Ledger operations and tests, displaying Decimal 10 is acceptable.

I’ll move on from the format issue until I bump into something that needs a :3f type format in the future.

1 Like