Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion config/snippet-config/daml-snippet-list-remote.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
Expand Down
8 changes: 4 additions & 4 deletions docs-main/overview/understand/core-concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -46,7 +46,7 @@ Unlike Ethereum addresses, parties create state on validators and have costs ass

Parties interact with contracts in three roles:

<DamlOverviewUnderstandCoreConceptsL44 />
<DamlPartyRolesAsset />

| Role | Can Create | Can See | Can Act |
|------|------------|---------|---------|
Expand Down Expand Up @@ -171,7 +171,7 @@ Smart contracts in Canton are defined using **Daml**, a purpose-built language f

### Template Structure

<DamlOverviewUnderstandCoreConceptsL183 />
<DamlPartyRolesTemplateStructure />

### Contracts Are Immutable

Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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]
)
```
Original file line number Diff line number Diff line change
@@ -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
```
Original file line number Diff line number Diff line change
@@ -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
```