-
Notifications
You must be signed in to change notification settings - Fork 0
/
SaladShipping.sol
56 lines (45 loc) · 1.18 KB
/
SaladShipping.sol
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
pragma solidity ^0.5.0;
contract SourceTracker {
string Salads; //product
uint numNodes; //number of nodes
uint numSalads; //total number of salads
struct Node {
string MichiganClub; //client
string Chipotle; //business provider
uint numSaladsReceived; //total number of delivered
bool condition; //if salads were prepared at satisfactory level
string Date; //date when salads were delivered
uint nodeIndex;
}
}
event newNode (
string Chipotle;
uint numSaladsReceived;
)
Node[] supplyChain;
mapping (string => uint) ChipotlePos;
constructor (string memory Salads_var, uint numSalads_var) public {
Salads = Salads_var;
numSalads = numSalads_var;
numNodes = 0;
}
function GetProductName() {
return Chipotle;
}
function GetOriginalNumberOfItems() {
return numSalads;
}
function GetNumberOfNodes() {
return numNodes;
}
function AddNode (
string calldata Chipotle, string calldata Date,
uint numSaladsReceived, bool condition;
)
{
supplyChain.push(Node(Chipotle, Date, numSaladsReceived, condition));
ChipotlePos[Chipotle] = numNodes;
emit newNode(Chipotle, numSaladsReceived);
++numNodes;
}
function FindDamage()