-
Notifications
You must be signed in to change notification settings - Fork 0
/
SkyLinkInstances.sol
74 lines (64 loc) · 3.08 KB
/
SkyLinkInstances.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "./SkyLinkPayments.sol";
/**
* @title SkyLinkInstances
* @dev A contract that defines data structures and mappings for managing aircraft, components, and service records in the SkyLink Protocol.
*/
contract SkyLinkInstances is SkyLinkPayments {
/**
* @dev Passes arguments to parent contract `SkyLinkPayments`.
* @param _classAFee The fee amount for fee class A.
* @param _classBFee The fee amount for fee class B.
* @param _classCFee The fee amount for fee class C.
*/
constructor(
uint _classAFee,
uint _classBFee,
uint _classCFee
) SkyLinkPayments(_classAFee, _classBFee, _classCFee) {}
/**
* @dev Struct to represent an aircraft entity in the SkyLink Protocol.
*/
struct AirCraft {
address currentOwner; // Address of the current owner.
address[] previousOwners; // Array of addresses representing previous owners.
string regNumber; // Registration number of the aircraft.
string manufacturer; // Manufacturer of the aircraft.
string model; // Model of the aircraft.
uint64 productionDate; // Production date of the aircraft.
uint16 seatCapacity; // Seat capacity of the aircraft.
bool inService; // Status indicating whether the aircraft is in service.
}
/**
* @dev Struct to represent an aircraft component entity in the SkyLink Protocol.
*/
struct AirComponent {
string identifier; // Identifier of the air component.
string name; // Name of the air component. eg Engine.
string manufacturer; // Manufacturer of the air component.
uint64 productionDate; // Production date of the air component.
bool inService; // Status indicating whether the air component is in service.
}
/**
* @dev Struct to represent a service record entity in the SkyLink Protocol.
*/
struct ServiceRecord {
address performer; // Address of the performer (MRO) of the service record.
uint64 date; // Date of the service record.
string result; // Result of the service record.
string description; // Description of the service record.
string[] servicedComponents; // Array of air component identifiers serviced in the record.
}
// Mapping to store aircraft information based on their registration numbers.
mapping(string => AirCraft) internal regNumberToAircraft;
// Mapping to associate flight numbers with aircraft entities.
mapping(string => AirCraft) internal flightNumberToAircraft;
// Mapping to store service records associated with aircraft registration numbers.
mapping(string => ServiceRecord[]) internal regNumberToServiceRecords;
// Mapping to store air components associated with aircraft registration numbers, categorized by service status.
mapping(string => mapping(bool => AirComponent[]))
internal regNumberToAirComponents;
// Mapping to track the existence of component identifiers to enforce uniqueness.
mapping(string => bool) internal componentIdentifierExists;
}