create-canton-app 1.4.0 โ 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/commands/create.js
CHANGED
|
@@ -139,8 +139,8 @@ async function create(projectName, options) {
|
|
|
139
139
|
name: 'template',
|
|
140
140
|
message: 'Which template would you like to use?',
|
|
141
141
|
choices: [
|
|
142
|
-
{ name: '
|
|
143
|
-
{ name: '
|
|
142
|
+
{ name: 'Token Contract (fungible token like ERC20)', value: 'token' },
|
|
143
|
+
{ name: 'Escrow Contract (multi-party escrow)', value: 'escrow' },
|
|
144
144
|
{ name: '๐ Empty Template (blank starter)', value: 'empty' }
|
|
145
145
|
]
|
|
146
146
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# testcanton
|
|
2
|
+
|
|
3
|
+
> A Canton Network dApp built with create-canton-app
|
|
4
|
+
|
|
5
|
+
## Template: escrow
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Compile contracts
|
|
11
|
+
daml build
|
|
12
|
+
|
|
13
|
+
# Run tests
|
|
14
|
+
daml test
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Learn More
|
|
18
|
+
|
|
19
|
+
- [Canton Docs](https://docs.digitalasset.com)
|
|
20
|
+
- [Daml Docs](https://docs.daml.com)
|
|
21
|
+
- [Canton Network](https://canton.network)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
-- Escrow.daml
|
|
2
|
+
-- A two-party escrow with an arbiter
|
|
3
|
+
|
|
4
|
+
module Escrow where
|
|
5
|
+
|
|
6
|
+
import Daml.Script
|
|
7
|
+
|
|
8
|
+
template EscrowAgreement
|
|
9
|
+
with
|
|
10
|
+
buyer : Party
|
|
11
|
+
seller : Party
|
|
12
|
+
arbiter : Party
|
|
13
|
+
amount : Decimal
|
|
14
|
+
description : Text
|
|
15
|
+
where
|
|
16
|
+
signatory buyer, seller, arbiter
|
|
17
|
+
|
|
18
|
+
choice Release : ()
|
|
19
|
+
controller buyer
|
|
20
|
+
do
|
|
21
|
+
return ()
|
|
22
|
+
|
|
23
|
+
choice Dispute : ()
|
|
24
|
+
with
|
|
25
|
+
decision : Text
|
|
26
|
+
controller arbiter
|
|
27
|
+
do
|
|
28
|
+
return ()
|
|
29
|
+
|
|
30
|
+
choice Cancel : ()
|
|
31
|
+
controller buyer, seller
|
|
32
|
+
do
|
|
33
|
+
return ()
|
|
34
|
+
|
|
35
|
+
setup : Script ()
|
|
36
|
+
setup = script do
|
|
37
|
+
alice <- allocateParty "Alice"
|
|
38
|
+
bob <- allocateParty "Bob"
|
|
39
|
+
charlie <- allocateParty "Charlie"
|
|
40
|
+
|
|
41
|
+
escrow <- submit alice do
|
|
42
|
+
submitMulti [alice, bob, charlie] [] do
|
|
43
|
+
createCmd EscrowAgreement with
|
|
44
|
+
buyer = alice
|
|
45
|
+
seller = bob
|
|
46
|
+
arbiter = charlie
|
|
47
|
+
amount = 1000.0
|
|
48
|
+
description = "Laptop purchase"
|
|
49
|
+
|
|
50
|
+
submit alice do
|
|
51
|
+
exerciseCmd escrow Release
|
|
52
|
+
|
|
53
|
+
return ()
|