Perishable Goods
Example business network that shows growers, shippers and importers defining contracts for the price of perishable goods, based on temperature readings received for shipping containers.
The business network defines a contract between growers and importers. The contract stipulates that: On receipt of the shipment the importer pays the grower the unit price x the number of units in the shipment. Shipments that arrive late are free. Shipments that have breached the low temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factor. Shipments that have breached the high temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factor.
This business network defines:
Participants Grower Importer Shipper
Assets Contract Shipment
Transactions TemperatureReading ShipmentReceived SetupDemo
composer-sample-networks/packages/perishable-network at master · hyperledger-archives/composer-sample-networks
GitHub
perishable.arl
1
archetype perishable
2
3
enum productType =
4
| Bananas
5
| Apples
6
| Pears
7
| Peaches
8
| Coffee
9
10
enum shipmentStatus =
11
| Created
12
| In_transit
13
| Arrived
14
15
asset grower identified by gid {
16
gid : role
17
}
18
19
asset importer identified by iid {
20
iid : role;
21
}
22
23
asset shipper identified by sid {
24
sid : role;
25
}
26
27
asset p_contract {
28
id : string;
29
grower_id : pkey<grower>;
30
shipper_id : pkey<shipper>;
31
importer_id : pkey<importer>;
32
arrivalDateTime : date;
33
unitPrice : rational;
34
}
35
36
asset shipment identified by ship_id {
37
ship_id : string;
38
type : productType;
39
count : int;
40
p_c : pkey<p_contract>;
41
} with states shipmentStatus
42
43
transition payOut (arrival : date) on (sk : pkey<shipment>) {
44
from In_transit
45
to Arrived
46
}
47
Copied!
Last modified 1yr ago
Export as PDF
Copy link
Edit on GitHub