-
Notifications
You must be signed in to change notification settings - Fork 0
/
us1.feature
265 lines (255 loc) · 6.53 KB
/
us1.feature
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
Feature: User Story 1
As a seller:
- I create an asset with a quantity which is equal to weight in metric tons.
- I add my product metadata to the token which can be seen by everybody.
- I add my process and transport emissions from me to my customers in Kg CO2e emitted per metric tons of my product quantity.
- I add upstream emissions.
- I send the token to my buyer.
- I verify the new owner of the token.
- I verify the emissions are correct in the asset.
- I can build an asset tree by altering the original asset.
Scenario: Seller creates an asset
Given I have the environment prepared.
When "Seller" blasts an asset defined as the following:
"""
{
"metadata": {
"weight": 100
},
"emissions": [
{
"category": "Upstream",
"dataSource": "Some Algorithm",
"value": 10,
"balanced": true,
"date": 1682632800
}
]
}
"""
Then The asset 1 and emitted events will be the following:
"""
{
"asset": {
"assetId": 1,
"metadata": "0x7b22776569676874223a3130307d",
"emissions": [
{
"category": "Upstream",
"dataSource": "0x536f6d6520416c676f726974686d",
"balanced": true,
"value": 10,
"date": 1682632800
}
],
"parent": null
},
"events": [
{"event":{"name":"Blasted","args":["1","{\"weight\":100}","5CXgNxM5hQSk9hiKxmYsLPhGun363r4J3q98A6RtHfMZauR4",null]}},
{"event":{"name":"Emission","args":["1","Upstream","Some Algorithm", true,"1,682,632,800","10"]}}
]
}
"""
Scenario: Seller transfers asset to Buyer
Given The "Seller" has blasted the asset with the following parameters:
"""
{
"metadata": {
"weight": 100
},
"emissions": [
{
"category": "Upstream",
"dataSource": "Some Algorithm",
"value": 10,
"balanced": true,
"date": 1682632800
}
]
}
"""
When "Seller" transfers asset with ID 1 to "Buyer" with emissions of:
"""
[
{
"category": "Transport",
"dataSource": "Some Algorithm",
"balanced": true,
"value": 10,
"date": 1702632800
}
]
"""
Then "Buyer" will be the new owner of asset 1, the emissions and transfer events will be the following:
"""
{
"emissions": [
{
"category": "Upstream",
"dataSource": "0x536f6d6520416c676f726974686d",
"balanced": true,
"value": 10,
"date": 1682632800
},
{
"category": "Transport",
"dataSource": "0x536f6d6520416c676f726974686d",
"balanced": true,
"value": 10,
"date": 1702632800
}
],
"events": [
{"event":{"name":"Transfer","args":["5CXgNxM5hQSk9hiKxmYsLPhGun363r4J3q98A6RtHfMZauR4","5FTrX9Po5UMmwze8Um87zjmAazxYTrWUrt61ZkTKBQ5FHbMy","1"]}},
{"event":{"name":"Emission","args":["1","Transport","Some Algorithm", true,"1,702,632,800","10"]}}
]
}
"""
Scenario: Seller adds emissions to asset
Given The "Seller" has blasted the following asset:
"""
{
"metadata": {
"weight": 100
},
"emissions": [
{
"category": "Upstream",
"dataSource": "Some Algorithm",
"value": 10,
"balanced": true,
"date": 1682632800
}
]
}
"""
When "Seller" adds the following emission to the asset with ID 1:
"""
{
"category": "Transport",
"dataSource": "Some Algorithm",
"balanced": true,
"value": 10,
"date": 1782632800
}
"""
Then The asset 1 will be:
"""
{
"emissions": [
{
"category": "Upstream",
"dataSource": "0x536f6d6520416c676f726974686d",
"balanced": true,
"value": 10,
"date": 1682632800
},
{
"category": "Transport",
"dataSource": "0x536f6d6520416c676f726974686d",
"balanced": true,
"value": 10,
"date": 1782632800
}
],
"events": [
{"event":{"name":"Emission","args":["1","Transport", "Some Algorithm", true,"1,782,632,800","10"]}}
]
}
"""
Scenario: Seller creates asset tree
Given The "Seller" blasts the following parent asset:
"""
{
"metadata": {
"weight": 100
},
"emissions": [
{
"category": "Upstream",
"dataSource": "Some Algorithm",
"value": 15,
"balanced": true,
"date": 1682632800
}
]
}
"""
When "Seller" pauses the parent asset 1 and creates a child asset, which creates a child, defined as:
"""
[
{
"metadata": {
"weight": 50
},
"emissions": [
{
"emission_category": "Upstream",
"dataSource": "Some Algorithm",
"value": 10,
"date": 1705040054
}
]
},
{
"metadata": {
"weight": 25
},
"emissions": [
{
"emission_category": "Upstream",
"dataSource": "Some Algorithm",
"value": 5,
"date": 1755040054
}
]
}
]
"""
Then The asset 3 when queried will equal the following asset tree:
"""
[
{
"assetId": 3,
"metadata": "0x7b22776569676874223a32357d",
"emissions": [
{
"category": "Upstream",
"dataSource": "0x536f6d6520416c676f726974686d",
"balanced": true,
"value": 5,
"date": 1755040054
}
],
"parent": 2
},
{
"assetId": 2,
"metadata": "0x7b22776569676874223a35307d",
"emissions": [
{
"category": "Upstream",
"dataSource": "0x536f6d6520416c676f726974686d",
"balanced": true,
"value": 10,
"date": 1705040054
}
],
"parent": 1
},
{
"assetId": 1,
"metadata": "0x7b22776569676874223a3130307d",
"emissions": [
{
"category": "Upstream",
"dataSource": "0x536f6d6520416c676f726974686d",
"balanced": true,
"value": 15,
"date": 1682632800
}
],
"parent": null
}
]
"""