-
Notifications
You must be signed in to change notification settings - Fork 0
/
FilesFolder.sol
executable file
·141 lines (114 loc) · 4.15 KB
/
FilesFolder.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
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
// SPDX-License-Identifier: UNLICENSED
/* *
* Copyright (c) 2021-2024 LI LI @ JINGTIAN & GONGCHENG.
*
* This WORK is licensed under ComBoox SoftWare License 1.0, a copy of which
* can be obtained at:
* [https://github.com/paul-lee-attorney/comboox]
*
* THIS WORK IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
* WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. IN NO
* EVENT SHALL ANY CONTRIBUTOR BE LIABLE TO YOU FOR ANY DAMAGES.
*
* YOU ARE PROHIBITED FROM DEPLOYING THE SMART CONTRACTS OF THIS WORK, IN WHOLE
* OR IN PART, FOR WHATEVER PURPOSE, ON ANY BLOCKCHAIN NETWORK THAT HAS ONE OR
* MORE NODES THAT ARE OUT OF YOUR CONTROL.
* */
pragma solidity ^0.8.8;
import "./IFilesFolder.sol";
import "../access/AccessControl.sol";
contract FilesFolder is IFilesFolder, AccessControl {
using FilesRepo for FilesRepo.Repo;
FilesRepo.Repo internal _repo;
//##################
//## Write I/O ##
//##################
function regFile(bytes32 snOfDoc, address body)
external onlyKeeper
{
if (_repo.regFile(snOfDoc, body))
emit UpdateStateOfFile(body, uint8(FilesRepo.StateOfFile.Created));
}
function circulateFile(
address body,
uint16 signingDays,
uint16 closingDays,
RulesParser.VotingRule memory vr,
bytes32 docUrl,
bytes32 docHash
) external onlyKeeper {
_repo.circulateFile(body, signingDays, closingDays, vr, docUrl, docHash);
emit UpdateStateOfFile(body, uint8(FilesRepo.StateOfFile.Circulated));
}
function proposeFile(
address body,
uint64 seqOfMotion
) external onlyKeeper {
_repo.proposeFile(body, seqOfMotion);
emit UpdateStateOfFile(body, uint8(FilesRepo.StateOfFile.Proposed));
}
function voteCountingForFile(
address body,
bool approved
) external onlyKeeper {
_repo.voteCountingForFile(body, approved);
emit UpdateStateOfFile(body, approved ?
uint8(FilesRepo.StateOfFile.Approved) :
uint8(FilesRepo.StateOfFile.Rejected));
}
function execFile(
address body
) public onlyDK {
_repo.execFile(body);
emit UpdateStateOfFile(body, uint8(FilesRepo.StateOfFile.Closed));
}
function terminateFile(
address body
) public onlyDK {
_repo.terminateFile(body);
emit UpdateStateOfFile(body, uint8(FilesRepo.StateOfFile.Revoked));
}
function setStateOfFile(address body, uint state) public onlyKeeper {
_repo.setStateOfFile(body, state);
emit UpdateStateOfFile(body, state);
}
//##################
//## read I/O ##
//##################
function signingDeadline(address body) external view returns (uint48) {
return _repo.signingDeadline(body);
}
function closingDeadline(address body) external view returns (uint48) {
return _repo.closingDeadline(body);
}
function frExecDeadline(address body) external view returns (uint48) {
return _repo.frExecDeadline(body);
}
function dtExecDeadline(address body) external view returns (uint48) {
return _repo.dtExecDeadline(body);
}
function terminateStartpoint(address body) external view returns (uint48) {
return _repo.terminateStartpoint(body);
}
function votingDeadline(address body) external view returns (uint48) {
return _repo.votingDeadline(body);
}
function isRegistered(address body) external view returns (bool) {
return _repo.isRegistered(body);
}
function qtyOfFiles() external view returns (uint256) {
return _repo.qtyOfFiles();
}
function getFilesList() external view returns (address[] memory) {
return _repo.getFilesList();
}
function getFile(address body) external view returns (FilesRepo.File memory) {
return _repo.getFile(body);
}
function getHeadOfFile(address body)
public view returns (FilesRepo.Head memory head)
{
head = _repo.getHeadOfFile(body);
}
}