-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathPandora.sol
87 lines (69 loc) · 3.17 KB
/
Pandora.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
75
76
77
78
79
80
81
82
83
84
85
86
87
pragma solidity ^0.4.24;
import "../lifecycle/OnlyOnce.sol";
import "./factories/IWorkerNodeFactory.sol";
import "./managers/CognitiveJobManager.sol";
import "./managers/ICognitiveJobController.sol";
import "./token/Pan.sol";
/**
* @title Pandora Smart Contract
* @author "Dr Maxim Orlovsky" <[email protected]>
*
* @dev # Pandora Smart Contract
*
* Main & root contract implementing the first level of Pandora Boxchain consensus
* See section ["3.3. Proof of Cognitive Work (PoCW)" in Pandora white paper](https://steemit.com/cryptocurrency/%40pandoraboxchain/world-decentralized-ai-on-blockchain-with-cognitive-mining-and-open-markets-for-data-and-algorithms-pandora-boxchain)
* for more details.
*
* Contract token functionality is separated into a separate contract named PAN (after the name of the token)
* and Pandora contracts just simply inherits PAN contract.
*/
contract Pandora is OnlyOnce, CognitiveJobManager {
/*******************************************************************************************************************
* ## Storage
*/
/// ### Public variables
bytes32 public constant version = "0.6.1";
/*******************************************************************************************************************
* ## Events
*/
/*******************************************************************************************************************
* ## Constructor and initialization
*/
/// ### Constructor
/// @dev Constructor receives addresses for the owners of whitelisted worker nodes, which will be assigned an owners
/// of worker nodes contracts
constructor(
ICognitiveJobController _jobController,
IEconomicController _economicController,
IWorkerNodeFactory _nodeFactory, /// Factory class for creating WorkerNode contracts
IReputation _reputation,
Pan _pan
) public
CognitiveJobManager(_jobController, _economicController, _nodeFactory, _reputation, _pan)
// Ensure that the contract is still uninitialized and `initialize` function be called to check the proper
// setup of class factories
Initializable()
Ownable() {
}
/// ### Initialization
/// @notice Function that checks the proper setup of class factories. May be called only once and only by Pandora
/// contract owner.
/// @dev Function that checks the proper setup of class factories. May be called only once and only by Pandora
/// contract owner.
function initialize()
public
onlyOwner
onlyOnce("initialize") {
// Checks that the factory contracts creator has assigned Pandora as an owner of the factory contracts:
// an important security measure preventing "Parity-style" contract bugs
require(workerNodeFactory.owner() == address(this));
Initializable.initialize();
}
/*******************************************************************************************************************
* ## Modifiers
*/
/*******************************************************************************************************************
* ## Functions
*/
/// ### Public and external
}