-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnftwatchdao.inline.ts
190 lines (181 loc) · 6.82 KB
/
nftwatchdao.inline.ts
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
import { ActionData, InlineAction, Name, PermissionLevel } from 'proton-tsc';
/* LogBlacklistReview as ActionData */
@packer
export class LogBlacklistReview extends ActionData {
constructor(
public collection: Name = new Name(),
public reporter: Name = new Name(),
public reportReason: string = '',
public guard: Name = new Name(),
public guardComment: string = '',
) {
super();
}
}
/* LogRevocation as ActionData */
@packer
export class LogRevocation extends ActionData {
constructor(
public collection: Name = new Name(),
public guard: Name = new Name(),
public guardComment: string = '',
) {
super();
}
}
/* LogShieldingReview as ActionData */
@packer
export class LogShieldingReview extends ActionData {
constructor(
public collection: Name = new Name(),
public requestedBy: Name = new Name(),
public skipBasicCheck: boolean = false,
public skipReason: string = '',
public guard: Name = new Name(),
public reportCid: string = '',
) {
super();
}
}
/**
* Send the lognewblist action of the contract to the blockchain
* @param {Name} contractAndActor - contract and actor of the action
* @param {Name} collection - name/id of the collection that was added to blacklist
* @param {Name} reporter - account of the reporter
* @param {string} reportReason - reason for reporting the collection
* @param {Name} guard - account of the guard
* @param {string} guardComment - blacklisting info for the public
*/
export function sendLogNewBlacklistEntry(
contractAndActor: Name,
collection: Name,
reporter: Name,
reportReason: string,
guard: Name,
guardComment: string,
): void {
const LOG_NEW_BLACKLIST_ENTRY = new InlineAction<LogBlacklistReview>('lognewblist');
const action = LOG_NEW_BLACKLIST_ENTRY.act(contractAndActor, new PermissionLevel(contractAndActor));
const actionParams = new LogBlacklistReview(collection, reporter, reportReason, guard, guardComment);
action.send(actionParams);
}
/**
* Send the logreportrej action of the contract to the blockchain
* @param {Name} contractAndActor - contract and actor of the action
* @param {Name} collection - name/id of the collection that was rejected
* @param {Name} reporter - account of the reporter
* @param {string} reportReason - reason for reporting the collection
* @param {Name} guard - account of the guard
* @param {string} guardComment - rejection info for the public
*/
export function sendLogReportRejection(
contractAndActor: Name,
collection: Name,
reporter: Name,
reportReason: string,
guard: Name,
guardComment: string,
): void {
const LOG_REPORT_REJECTION = new InlineAction<LogBlacklistReview>('logreportrej');
const action = LOG_REPORT_REJECTION.act(contractAndActor, new PermissionLevel(contractAndActor));
const actionParams = new LogBlacklistReview(collection, reporter, reportReason, guard, guardComment);
action.send(actionParams);
}
/**
* Send the logblistldel action of the contract to the blockchain
* @param {Name} contractAndActor - contract and actor of the action
* @param {Name} collection - name/id of the collection that was removed from blacklist
* @param {Name} guard - account of the guard
* @param {string} guardComment - deletion info for the public
*/
export function sendLogBlacklistDeletion(
contractAndActor: Name,
collection: Name,
guard: Name,
guardComment: string,
): void {
const LOG_BLACKLIST_DELETION = new InlineAction<LogRevocation>('logblistldel');
const action = LOG_BLACKLIST_DELETION.act(contractAndActor, new PermissionLevel(contractAndActor));
const actionParams = new LogRevocation(collection, guard, guardComment);
action.send(actionParams);
}
/**
* Send the lognewshield action of the contract to the blockchain
* @param {Name} contractAndActor - contract and actor of the action
* @param {Name} collection - name/id of the collection that was shielded
* @param {Name} requestedBy - account of the requester
* @param {boolean} skipBasicCheck - info if skip of basic check was requested
* @param {string} skipReason - reason why basic check was skipped
* @param {Name} confirmedBy - account of the guard
* @param {string} reportCid - ipfs hash/cid of the shielding report
*/
export function sendLogNewShielding(
contractAndActor: Name,
collection: Name,
requestedBy: Name,
skipBasicCheck: boolean,
skipReason: string,
confirmedBy: Name,
reportCid: string,
): void {
const LOG_NEW_SHIELDING_ENTRY = new InlineAction<LogShieldingReview>('lognewshield');
const action = LOG_NEW_SHIELDING_ENTRY.act(contractAndActor, new PermissionLevel(contractAndActor));
const actionParams = new LogShieldingReview(
collection,
requestedBy,
skipBasicCheck,
skipReason,
confirmedBy,
reportCid,
);
action.send(actionParams);
}
/**
* Send the logshieldrej action of the contract to the blockchain
* @param {Name} contractAndActor - contract and actor of the action
* @param {Name} collection - name/id of the collection that was rejected
* @param {Name} requestedBy - account of the requester
* @param {boolean} skipBasicCheck - info if skip of basic check was requested
* @param {string} skipReason - reason why basic check should be skipped
* @param {Name} rejectedBy - account of the guard
* @param {string} reportCid - ipfs hash/cid of the shielding report
*/
export function sendLogShieldRejection(
contractAndActor: Name,
collection: Name,
requestedBy: Name,
skipBasicCheck: boolean,
skipReason: string,
rejectedBy: Name,
reportCid: string,
): void {
const LOG_SHIELD_REJECTION = new InlineAction<LogShieldingReview>('logshieldrej');
const action = LOG_SHIELD_REJECTION.act(contractAndActor, new PermissionLevel(contractAndActor));
const actionParams = new LogShieldingReview(
collection,
requestedBy,
skipBasicCheck,
skipReason,
rejectedBy,
reportCid,
);
action.send(actionParams);
}
/**
* Send the logshielddel action of the contract to the blockchain
* @param {Name} contractAndActor - contract and actor of the action
* @param {Name} collection - name/id of the collection that was removed from shieldings
* @param {Name} guard - account of the guard
* @param {string} guardComment - deletion info for the public
*/
export function sendLogShieldingDeletion(
contractAndActor: Name,
collection: Name,
guard: Name,
guardComment: string,
): void {
const LOG_SHIELDING_DELETION = new InlineAction<LogRevocation>('logshielddel');
const action = LOG_SHIELDING_DELETION.act(contractAndActor, new PermissionLevel(contractAndActor));
const actionParams = new LogRevocation(collection, guard, guardComment);
action.send(actionParams);
}