diff --git a/config/snippet-config/daml-snippet-list-remote.json b/config/snippet-config/daml-snippet-list-remote.json index 6d6d78e38..b9381a4e8 100644 --- a/config/snippet-config/daml-snippet-list-remote.json +++ b/config/snippet-config/daml-snippet-list-remote.json @@ -11,7 +11,35 @@ }, "description": "", "options": { - "language": "daml" + "language": "haskell" + } + }, + { + "snippetName": "tutorials-smart-contracts-daml-daml-intro-choices-daml-party-roles-asset-begin", + "sourceRepo": "daml", + "sourceFilepath": "sdk/docs/sharable/sdk/tutorials/smart-contracts/daml/daml-intro-choices/daml/PartyRoles.daml", + "location": { + "type": "stringMarker", + "start": "-- ASSET_BEGIN", + "end": "-- ASSET_END" + }, + "description": "Core concepts: party roles in contracts (Asset template)", + "options": { + "language": "haskell" + } + }, + { + "snippetName": "tutorials-smart-contracts-daml-daml-intro-choices-daml-party-roles-template-structure-begin", + "sourceRepo": "daml", + "sourceFilepath": "sdk/docs/sharable/sdk/tutorials/smart-contracts/daml/daml-intro-choices/daml/TemplateChoices.daml", + "location": { + "type": "stringMarker", + "start": "-- TEMPLATE_STRUCTURE_BEGIN", + "end": "-- TEMPLATE_STRUCTURE_END" + }, + "description": "Core concepts: template structure (Token template)", + "options": { + "language": "haskell" } } ] diff --git a/docs-main/overview/understand/core-concepts.mdx b/docs-main/overview/understand/core-concepts.mdx index d90a82bad..4488501ef 100644 --- a/docs-main/overview/understand/core-concepts.mdx +++ b/docs-main/overview/understand/core-concepts.mdx @@ -3,9 +3,9 @@ title: "Core Concepts" description: "Essential building blocks of Canton Network: parties, validators, synchronizers, and smart contracts" --- -import DamlOverviewUnderstandCoreConceptsL183 from "/snippets/daml-docs/overview_understand_core-concepts_L183.mdx"; +import DamlPartyRolesAsset from "/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-choices-daml-party-roles-asset-begin.mdx"; +import DamlPartyRolesTemplateStructure from "/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-choices-daml-party-roles-template-structure-begin.mdx"; import DamlOverviewUnderstandCoreConceptsL223 from "/snippets/daml-docs/overview_understand_core-concepts_L223.mdx"; -import DamlOverviewUnderstandCoreConceptsL44 from "/snippets/daml-docs/overview_understand_core-concepts_L44.mdx"; Understanding Canton requires grasping four fundamental concepts: **parties**, **validator** node, **synchronizers**, and **templates** (smart contracts). This page introduces each and explains how they work together. @@ -46,7 +46,7 @@ Unlike Ethereum addresses, parties create state on validators and have costs ass Parties interact with contracts in three roles: - + | Role | Can Create | Can See | Can Act | |------|------------|---------|---------| @@ -171,7 +171,7 @@ Smart contracts in Canton are defined using **Daml**, a purpose-built language f ### Template Structure - + ### Contracts Are Immutable diff --git a/docs-main/snippets/daml-docs/overview_understand_core-concepts_L223.mdx b/docs-main/snippets/daml-docs/overview_understand_core-concepts_L223.mdx index 87e97e54d..dce53f8d5 100644 --- a/docs-main/snippets/daml-docs/overview_understand_core-concepts_L223.mdx +++ b/docs-main/snippets/daml-docs/overview_understand_core-concepts_L223.mdx @@ -1,6 +1,6 @@ ```haskell -- Consuming: archives the contract -choice Transfer : ContractId Token +choice ChangeOwner : ContractId Token controller owner do create this with owner = newOwner diff --git a/docs-main/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-9-daml-test-intro-asset-multi-trade-fora-example-begin.mdx b/docs-main/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-9-daml-test-intro-asset-multi-trade-fora-example-begin.mdx index bcca05b53..af65751f7 100644 --- a/docs-main/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-9-daml-test-intro-asset-multi-trade-fora-example-begin.mdx +++ b/docs-main/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-9-daml-test-intro-asset-multi-trade-fora-example-begin.mdx @@ -1,6 +1,6 @@ -```haskell - [usdCid, chfCid] <- forA [usdCid, chfCid] (\cid -> submit alice do - exerciseCmd cid SetObservers with - newObservers = [bob] - ) +```daml +[usdCid, chfCid] <- forA [usdCid, chfCid] (\cid -> submit alice do + exerciseCmd cid SetObservers with + newObservers = [bob] + ) ``` \ No newline at end of file diff --git a/docs-main/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-choices-daml-party-roles-asset-begin.mdx b/docs-main/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-choices-daml-party-roles-asset-begin.mdx new file mode 100644 index 000000000..89cf12116 --- /dev/null +++ b/docs-main/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-choices-daml-party-roles-asset-begin.mdx @@ -0,0 +1,15 @@ +```haskell +template Asset + with + issuer : Party -- Will be signatory + owner : Party -- Will be observer and controller + auditor : Party -- Will be observer + where + signatory issuer -- Must authorize creation; always sees contract + observer owner, auditor -- Can see contract + + choice ChangeOwner : ContractId Asset + with newOwner : Party + controller owner -- Only owner can exercise this choice + do create this with owner = newOwner +``` \ No newline at end of file diff --git a/docs-main/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-choices-daml-party-roles-template-structure-begin.mdx b/docs-main/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-choices-daml-party-roles-template-structure-begin.mdx new file mode 100644 index 000000000..3e20eb646 --- /dev/null +++ b/docs-main/snippets/external/daml/main/tutorials-smart-contracts-daml-daml-intro-choices-daml-party-roles-template-structure-begin.mdx @@ -0,0 +1,20 @@ +```haskell +template Token + with + -- Data fields + owner : Party + issuer : Party + amount : Decimal + where + -- Authorization + signatory issuer + observer owner + + -- Actions + choice ChangeOwner : ContractId Token + with + newOwner : Party + controller owner + do + create this with owner = newOwner +``` \ No newline at end of file