-
Notifications
You must be signed in to change notification settings - Fork 687
/
SimpleMarketplace.json
175 lines (175 loc) · 4.86 KB
/
SimpleMarketplace.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
{
"ApplicationName": "SimpleMarketplace",
"DisplayName": "Simple Marketplace",
"Description": "Allows a simple transaction between a seller and a buyer in a marketplace.",
"ApplicationRoles": [
{
"Name": "Owner",
"Description": "User who wants to sell an item."
},
{
"Name": "Buyer",
"Description": "User who wants to buy the item."
}
],
"Workflows": [
{
"Name": "SimpleMarketplace",
"DisplayName": "Simple Marketplace",
"Description": "Handles the business logic for a simple buyer-seller scenario.",
"Initiators": [ "Owner" ],
"StartState": "ItemAvailable",
"Properties": [
{
"Name": "State",
"DisplayName": "State",
"Description": "Holds the state of the contract",
"Type": {
"Name": "state"
}
},
{
"Name": "Description",
"DisplayName": "Description",
"Description": "Describes the asset being sold",
"Type": {
"Name": "string"
}
},
{
"Name": "AskingPrice",
"DisplayName": "Asking Price",
"Description": "The asking price for the asset",
"Type": {
"Name": "money"
}
},
{
"Name": "OfferPrice",
"DisplayName": "Offer Price",
"Description": "The price being offered for the asset",
"Type": {
"Name": "money"
}
},
{
"Name": "InstanceBuyer",
"DisplayName": "Instance Buyer",
"Description": "The user that places an offer for this asset",
"Type": {
"Name": "Buyer"
}
},
{
"Name": "InstanceOwner",
"DisplayName": "Instance Owner",
"Description": "The seller of this particular asset",
"Type": {
"Name": "Owner"
}
}
],
"Constructor": {
"Parameters": [
{
"Name": "description",
"Description": "The description of this asset",
"DisplayName": "Description",
"Type": {
"Name": "string"
}
},
{
"Name": "price",
"Description": "The price of this asset",
"DisplayName": "Price",
"Type": {
"Name": "money"
}
}
]
},
"Functions": [
{
"Name": "MakeOffer",
"DisplayName": "Make Offer",
"Description": "Make an offer",
"Parameters": [
{
"Name": "offerPrice",
"Description": "Offer Price",
"DisplayName": "Offer Price",
"Type": {
"Name": "money"
}
}
]
},
{
"Name": "AcceptOffer",
"DisplayName": "Accept Offer",
"Description": "Accept the offer made",
"Parameters": []
},
{
"Name": "Reject",
"DisplayName": "Reject Offer",
"Description": "Reject the offer made",
"Parameters": []
}
],
"States": [
{
"Name": "ItemAvailable",
"DisplayName": "Item Available",
"Description": "The item is available",
"PercentComplete": 20,
"Style": "Success",
"Transitions": [
{
"AllowedRoles": [ "Buyer" ],
"AllowedInstanceRoles": [],
"Description": "Make an offer for this asset",
"Function": "MakeOffer",
"NextStates": [ "OfferPlaced" ],
"DisplayName": "Make Offer"
}
]
},
{
"Name": "OfferPlaced",
"DisplayName": "Offer Placed",
"Description": "Offer has been placed for the item",
"PercentComplete": 60,
"Style": "Success",
"Transitions": [
{
"AllowedRoles": [ ],
"AllowedInstanceRoles": [ "InstanceOwner" ],
"Description": "Accept the proposed offer for the item",
"Function": "AcceptOffer",
"NextStates": [ "Accepted" ],
"DisplayName": "Accept Offer"
},
{
"AllowedRoles": [ ],
"AllowedInstanceRoles": [ "InstanceOwner" ],
"Description": "Reject the proposed offer for the item",
"Function": "Reject",
"NextStates": [ "ItemAvailable" ],
"DisplayName": "Reject"
}
]
},
{
"Name": "Accepted",
"DisplayName": "Accepted",
"Description": "Asset transfer process is complete",
"PercentComplete": 100,
"Style": "Success",
"Transitions": []
}
]
}
]
}