tx · ExKu3epok3HftYVTofmZcZtJEGa1yRXmaXouePmyiEmq 3N71MDc3kPD6cnbdWp6iEuDY8ghgZ9DiVan: -0.10000000 Waves 2020.12.27 06:13 [1326554] smart account 3N71MDc3kPD6cnbdWp6iEuDY8ghgZ9DiVan > SELF 0.00000000 Waves
{ "type": 13, "id": "ExKu3epok3HftYVTofmZcZtJEGa1yRXmaXouePmyiEmq", "fee": 10000000, "feeAssetId": null, "timestamp": 1609038849759, "version": 2, "chainId": 84, "sender": "3N71MDc3kPD6cnbdWp6iEuDY8ghgZ9DiVan", "senderPublicKey": "5tBY17DiYVDP2QCBiAPKpjhmn1hCu1rS4XbwiY9zchFf", "proofs": [ "4r9rKCmsZJjoJcw5ptTQrqMS7tkzhowME6WCdLJERJ8xjM3wRjAd5S4UB23oYVUpRZnNePdKyxyXbabqQTwCtnkJ" ], "script": "base64:AAIDAAAAAAAAADsIARIECgIICBIDCgEIEgQKAggIEgMKAQgSBQoDCAgIEgUKAwgICBIDCgEIEgMKAQgSBAoCCAgSAwoBCAAAABQAAAAADG1haW5Db250cmFjdAkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTXdSemkyQm1xWlpYV3JDR0N3Y1JRTHNuaWMyQW9kNnpoUwAAAAAGUVVPUlVNAAAAAAAAAAABAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAUAAAADdmFsAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gw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AAAACCQABLAAAAAIJAAEsAAAAAgIAAAAGdGFza3NfBQAAAAZ0YXNrSWQCAAAABV9hcHBfBQAAAA50ZWFtSWRlbnRpZmllcgIAAAAIX3Byb2Nlc3MCAAAADXdvcmtfZmluaXNoZWQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAZ0YXNrc18FAAAABnRhc2tJZAIAAAAHX3JlcG9ydAUAAAAKcmVwb3J0TGluawUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAALdGVhbUFkZHJlc3MFAAAADHJld2FyZEFtb3VudAUAAAAEdW5pdAUAAAADbmlsCQAAAgAAAAECAAAAFWNoZWNrcyBhcmUgbm90IHBhc3NlZAAAAAFpAQAAAApyZWplY3RUYXNrAAAAAQAAAAZ0YXNrSWQDCQEAAAANaXNHcm91cE1lbWJlcgAAAAEIBQAAAAFpAAAABmNhbGxlcgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAICAAAABnRhc2tzXwUAAAAGdGFza0lkAgAAAAdfc3RhdHVzAgAAAAhyZWplY3RlZAUAAAADbmlsCQAAAgAAAAECAAAAIGdyYW50cyB3b3JraW5nIGdyb3VwIGFjY2VzcyBvbmx5AAAAALk9Lwc=", "height": 1326554, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 78NbqZdbrxJJ3mEwD3VkjP2SdzaRFumByabG2VeKndFo Next: 9teDRiCPuSouZjmoh5jtoPM1D7jUshnzWVZ4ZgX5WHx2 Diff:
Old | New | Differences | |
---|---|---|---|
74 | 74 | } | |
75 | 75 | ||
76 | 76 | ||
77 | - | func canMemberVote ( | |
78 | - | let val = match getInteger(mainContract, (("dao_member_" + toString( | |
77 | + | func canMemberVote (address) = { | |
78 | + | let val = match getInteger(mainContract, (("dao_member_" + toString(address)) + "_weight")) { | |
79 | 79 | case b: Int => | |
80 | 80 | b | |
81 | 81 | case _ => | |
92 | 92 | else throw("you need to vote with 'like' or 'dislike' value") | |
93 | 93 | ||
94 | 94 | ||
95 | + | func addTaskConditions (address) = if (!(isGroupMember(address))) | |
96 | + | then throw("grants working group access only") | |
97 | + | else true | |
98 | + | ||
99 | + | ||
100 | + | func addRewardConditions (address,taskId) = if (!(isGroupMember(address))) | |
101 | + | then throw("grants working group access only") | |
102 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "")) | |
103 | + | then throw("grant isn`t new") | |
104 | + | else true | |
105 | + | ||
106 | + | ||
107 | + | func voteForTaskProposalConditions (address,taskId) = if (!(canMemberVote(address))) | |
108 | + | then throw("you can't vote") | |
109 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "proposed")) | |
110 | + | then throw("voting is closed or not started") | |
111 | + | else if ((tryGetInteger(((("tasks_" + taskId) + "_voted_") + toString(address))) != 0)) | |
112 | + | then throw("you have already voted") | |
113 | + | else true | |
114 | + | ||
115 | + | ||
116 | + | func finishTaskProposalVotingConditions (address,taskId) = if (!(isGroupMember(address))) | |
117 | + | then throw("grants working group access only") | |
118 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "proposed")) | |
119 | + | then throw("voting is not active") | |
120 | + | else if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / getDAOSize()))) | |
121 | + | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
122 | + | else true | |
123 | + | ||
124 | + | ||
125 | + | func applyForTaskConditions (address,taskId,teamIdentifier) = if ((tryGetString((("tasks_" + taskId) + "_status")) != "ready_to_apply")) | |
126 | + | then throw("this grant has not yet been approved") | |
127 | + | else if ((tryGetString((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")) == toString(address))) | |
128 | + | then throw("you are applied") | |
129 | + | else true | |
130 | + | ||
131 | + | ||
132 | + | func voteForApplicantConditions (address,taskId,teamIdentifier) = { | |
133 | + | let voteHash = (drop(toString(address), 10) + drop(teamIdentifier, 10)) | |
134 | + | if (!(canMemberVote(address))) | |
135 | + | then throw("you can't vote") | |
136 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "ready_to_apply")) | |
137 | + | then throw("voting is not active") | |
138 | + | else if ((tryGetInteger(((("tasks_" + taskId) + "_vote_") + voteHash)) != 0)) | |
139 | + | then throw("you have already voted on this team") | |
140 | + | else true | |
141 | + | } | |
142 | + | ||
143 | + | ||
144 | + | func finishApplicantsVotingConditions (address,taskId,applicantsList) = if (!(isGroupMember(address))) | |
145 | + | then throw("grants working group access only") | |
146 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "ready_to_apply")) | |
147 | + | then throw("voting is not active") | |
148 | + | else if ((size(applicantsList) == 0)) | |
149 | + | then throw("no one has yet responded to the grant") | |
150 | + | else true | |
151 | + | ||
152 | + | ||
153 | + | func startWorkConditions (address,taskId,teamIdentifier) = if ((tryGetString((("tasks_" + taskId) + "_status")) != "team_chosen")) | |
154 | + | then throw("winner is not define") | |
155 | + | else if ((toString(address) != tryGetString((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
156 | + | then throw("team leader only") | |
157 | + | else true | |
158 | + | ||
159 | + | ||
160 | + | func acceptWorkResultConditions (address,taskId) = if (!(isGroupMember(address))) | |
161 | + | then throw("grants working group access only") | |
162 | + | else true | |
163 | + | ||
164 | + | ||
95 | 165 | @Callable(i) | |
96 | - | func addTask (title,link) = if ( | |
97 | - | then | |
98 | - | else | |
166 | + | func addTask (title,link) = if (addTaskConditions(i.caller)) | |
167 | + | then WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)]) | |
168 | + | else throw("checks are not passed") | |
99 | 169 | ||
100 | 170 | ||
101 | 171 | ||
102 | 172 | @Callable(i) | |
103 | - | func addReward (taskId) = if (!(isGroupMember(i.caller))) | |
104 | - | then throw("grants working group access only") | |
105 | - | else { | |
173 | + | func addReward (taskId) = if (addRewardConditions(i.caller, taskId)) | |
174 | + | then { | |
106 | 175 | let reward = extract(i.payment).amount | |
107 | 176 | WriteSet([DataEntry((("tasks_" + taskId) + "_reward"), reward), DataEntry((("tasks_" + taskId) + "_status"), "proposed")]) | |
108 | 177 | } | |
178 | + | else throw("checks are not passed") | |
109 | 179 | ||
110 | 180 | ||
111 | 181 | ||
112 | 182 | @Callable(i) | |
113 | - | func voteForTaskProposal (taskId,voteValue) = if (!(canMemberVote(i))) | |
114 | - | then throw("you can't vote") | |
115 | - | else if ((getStringValue(this, (("tasks_" + taskId) + "_status")) != "proposed")) | |
116 | - | then throw("voting is closed or not started") | |
117 | - | else if (if ((voteValue != "like")) | |
118 | - | then (voteValue != "dislike") | |
119 | - | else false) | |
120 | - | then throw("you need to vote like or dislike") | |
121 | - | else { | |
122 | - | let valueVoteInt = getVoteValue(voteValue) | |
123 | - | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
124 | - | let previousVote = tryGetInteger(voteKey) | |
125 | - | if (!((previousVote == 0))) | |
126 | - | then throw("you have already voted") | |
127 | - | else { | |
128 | - | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
129 | - | let votingState = tryGetInteger(votingKey) | |
130 | - | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
131 | - | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
132 | - | let newVotingState = (votingState + valueVoteInt) | |
133 | - | ScriptResult(WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, valueVoteInt), DataEntry(votesAmountKey, votesAmountState)]), TransferSet([ScriptTransfer(i.caller, 500000, unit)])) | |
134 | - | } | |
135 | - | } | |
183 | + | func voteForTaskProposal (taskId,voteValue) = if (voteForTaskProposalConditions(i.caller, taskId)) | |
184 | + | then { | |
185 | + | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
186 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
187 | + | let votingState = tryGetInteger(votingKey) | |
188 | + | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
189 | + | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
190 | + | let voteValueInt = getVoteValue(voteValue) | |
191 | + | let newVotingState = (votingState + voteValueInt) | |
192 | + | WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, voteValueInt), DataEntry(votesAmountKey, votesAmountState)]) | |
193 | + | } | |
194 | + | else throw("checks are not passed") | |
136 | 195 | ||
137 | 196 | ||
138 | 197 | ||
139 | 198 | @Callable(i) | |
140 | - | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / getDAOSize()))) | |
141 | - | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
142 | - | else if (!(isGroupMember(i.caller))) | |
143 | - | then throw("grants working group access only") | |
144 | - | else { | |
145 | - | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
146 | - | let votingState = tryGetInteger(votingKey) | |
147 | - | if ((votingState > 0)) | |
148 | - | then { | |
149 | - | let votingResult = "ready_to_apply" | |
150 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
151 | - | } | |
152 | - | else { | |
153 | - | let votingResult = "rejected" | |
154 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
155 | - | } | |
156 | - | } | |
199 | + | func finishTaskProposalVoting (taskId) = if (finishTaskProposalVotingConditions(i.caller, taskId)) | |
200 | + | then { | |
201 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
202 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), if ((tryGetInteger(votingKey) > 0)) | |
203 | + | then "ready_to_apply" | |
204 | + | else "rejected")]) | |
205 | + | } | |
206 | + | else throw("checks are not passed") | |
157 | 207 | ||
158 | 208 | ||
159 | 209 | ||
160 | 210 | @Callable(i) | |
161 | 211 | func applyForTask (taskId,teamName,link) = { | |
162 | - | let status = tryGetString((("tasks_" + taskId) + "_status")) | |
163 | - | if ((status != "ready_to_apply")) | |
164 | - | then throw("This grant has not yet been approved") | |
165 | - | else { | |
212 | + | let teamIdentifier = drop(toString(i.caller), 10) | |
213 | + | if (applyForTaskConditions(i.caller, taskId, teamIdentifier)) | |
214 | + | then { | |
166 | 215 | let listKey = (("tasks_" + taskId) + "_applicants") | |
167 | 216 | let currentApplicantsList = tryGetString(listKey) | |
168 | - | let applicantKey = drop(toString(i.caller), 10) | |
169 | 217 | let newApplicantsList = ((currentApplicantsList + ";") + toString(i.caller)) | |
170 | - | WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + | |
218 | + | WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_name"), teamName), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_link"), link), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader"), toString(i.caller)), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_id"), teamIdentifier), DataEntry(listKey, newApplicantsList)]) | |
171 | 219 | } | |
220 | + | else throw("checks are not passed") | |
172 | 221 | } | |
173 | 222 | ||
174 | 223 | ||
175 | 224 | ||
176 | 225 | @Callable(i) | |
177 | - | func voteForApplicant (taskId,teamIdentifier,voteValue) = if ( | |
178 | - | then | |
179 | - | | |
180 | - | let | |
181 | - | let | |
182 | - | let | |
183 | - | if (( | |
226 | + | func voteForApplicant (taskId,teamIdentifier,voteValue) = if (voteForApplicantConditions(i.caller, taskId, teamIdentifier)) | |
227 | + | then { | |
228 | + | let listKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_voted") | |
229 | + | let newApplicantsList = ((tryGetString(listKey) + ";") + toString(i.caller)) | |
230 | + | let voteHash = (drop(toString(i.caller), 20) + teamIdentifier) | |
231 | + | let voteKey = ((("tasks_" + taskId) + "_vh_") + voteHash) | |
232 | + | if ((tryGetString(voteKey) == toString(i.caller))) | |
184 | 233 | then throw("you have already voted on this team") | |
185 | 234 | else { | |
186 | - | let valueVoteInt = getVoteValue(voteValue) | |
187 | 235 | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
188 | 236 | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score") | |
189 | 237 | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
190 | - | let newTeamScore = ( | |
191 | - | WriteSet([DataEntry(voteKey, | |
238 | + | let newTeamScore = (getVoteValue(voteValue) + tryGetInteger(teamScoreKey)) | |
239 | + | WriteSet([DataEntry(listKey, newApplicantsList), DataEntry(voteKey, toString(i.caller)), DataEntry(teamVotesAmountKey, teamVotesAmount), DataEntry(teamScoreKey, newTeamScore)]) | |
192 | 240 | } | |
193 | 241 | } | |
242 | + | else throw("checks are not passed") | |
194 | 243 | ||
195 | 244 | ||
196 | 245 | ||
197 | 246 | @Callable(i) | |
198 | 247 | func finishApplicantsVoting (taskId) = { | |
199 | - | func isApplicantVotedEnough (aid,aid2) = { | |
200 | - | let listKey = (("tasks_" + taskId) + "_applicants") | |
201 | - | let applicantsList = split(getStringValue(this, listKey), ";") | |
202 | - | let teamIdentifier = applicantsList[aid] | |
203 | - | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
204 | - | let teamVotesAmount = tryGetInteger(teamVotesAmountKey) | |
205 | - | if ((teamVotesAmount > 0)) | |
206 | - | then 1 | |
207 | - | else throw(("not enough votes to make decision on " + teamIdentifier)) | |
208 | - | } | |
209 | - | ||
210 | 248 | func hasMoreVotes (aid,aid2) = { | |
211 | 249 | let listKey = (("tasks_" + taskId) + "_applicants") | |
212 | 250 | let applicantsList = split(getStringValue(this, listKey), ";") | |
221 | 259 | else aid2 | |
222 | 260 | } | |
223 | 261 | ||
224 | - | | |
225 | - | | |
226 | - | | |
227 | - | | |
228 | - | let | |
229 | - | | |
230 | - | | |
231 | - | | |
232 | - | | |
233 | - | | |
234 | - | | |
235 | - | let $ | |
236 | - | if (($ | |
237 | - | then $ | |
262 | + | let listKeys = tryGetString((("tasks_" + taskId) + "_applicants")) | |
263 | + | let applicantsList = split(listKeys, ";") | |
264 | + | if (finishApplicantsVotingConditions(i.caller, taskId, applicantsList)) | |
265 | + | then { | |
266 | + | let chosenTeamId = { | |
267 | + | let $list1243712468 = [0, 1] | |
268 | + | let $size1243712468 = size($list1243712468) | |
269 | + | let $acc01243712468 = 0 | |
270 | + | if (($size1243712468 == 0)) | |
271 | + | then $acc01243712468 | |
272 | + | else { | |
273 | + | let $acc11243712468 = hasMoreVotes($acc01243712468, $list1243712468[0]) | |
274 | + | if (($size1243712468 == 1)) | |
275 | + | then $acc11243712468 | |
238 | 276 | else { | |
239 | - | let $ | |
240 | - | if (($ | |
241 | - | then $ | |
277 | + | let $acc21243712468 = hasMoreVotes($acc11243712468, $list1243712468[1]) | |
278 | + | if (($size1243712468 == 2)) | |
279 | + | then $acc21243712468 | |
242 | 280 | else { | |
243 | - | let $acc298869917 = hasMoreVotes($acc198869917, $list98869917[1]) | |
244 | - | if (($size98869917 == 2)) | |
245 | - | then $acc298869917 | |
246 | - | else { | |
247 | - | let $acc398869917 = hasMoreVotes($acc298869917, $list98869917[2]) | |
248 | - | throw("List size exceed 2") | |
249 | - | } | |
281 | + | let $acc31243712468 = hasMoreVotes($acc21243712468, $list1243712468[2]) | |
282 | + | throw("List size exceed 2") | |
250 | 283 | } | |
251 | 284 | } | |
252 | 285 | } | |
253 | - | | |
254 | - | | |
255 | - | | |
286 | + | } | |
287 | + | let teamIdentifier = drop(applicantsList[chosenTeamId], 10) | |
288 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "team_chosen"), DataEntry((("tasks_" + taskId) + "_performer"), teamIdentifier), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "can_begin")]) | |
256 | 289 | } | |
290 | + | else throw("checks are not passed") | |
257 | 291 | } | |
258 | 292 | ||
259 | 293 | ||
260 | 294 | ||
261 | 295 | @Callable(i) | |
262 | 296 | func startWork (taskId) = { | |
263 | - | let teamIdentifier = | |
264 | - | if ( | |
265 | - | then | |
266 | - | else | |
297 | + | let teamIdentifier = tryGetString((("tasks_" + taskId) + "_performer")) | |
298 | + | if (startWorkConditions(i.caller, taskId, teamIdentifier)) | |
299 | + | then WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_started")]) | |
300 | + | else throw("checks are not passed") | |
267 | 301 | } | |
268 | 302 | ||
269 | 303 | ||
270 | 304 | ||
271 | 305 | @Callable(i) | |
272 | - | func acceptWorkResult (taskId) = if (!(isGroupMember(i.caller))) | |
273 | - | then throw("grants working group access only") | |
274 | - | else { | |
306 | + | func acceptWorkResult (taskId,reportLink) = if (acceptWorkResultConditions(i.caller, taskId)) | |
307 | + | then { | |
275 | 308 | let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward")) | |
276 | - | let teamIdentifier = | |
277 | - | let teamAddress = | |
278 | - | ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_finished")]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)])) | |
309 | + | let teamIdentifier = tryGetString((("tasks_" + taskId) + "_performer")) | |
310 | + | let teamAddress = tryGetString((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")) | |
311 | + | ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_finished"), DataEntry((("tasks_" + taskId) + "_report"), reportLink)]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)])) | |
279 | 312 | } | |
313 | + | else throw("checks are not passed") | |
314 | + | ||
315 | + | ||
316 | + | ||
317 | + | @Callable(i) | |
318 | + | func rejectTask (taskId) = if (isGroupMember(i.caller)) | |
319 | + | then WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected")]) | |
320 | + | else throw("grants working group access only") | |
280 | 321 | ||
281 | 322 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let mainContract = addressFromStringValue("3MwRzi2BmqZZXWrCGCwcRQLsnic2Aod6zhS") | |
5 | 5 | ||
6 | 6 | let QUORUM = 1 | |
7 | 7 | ||
8 | 8 | func tryGetInteger (key) = { | |
9 | 9 | let val = match getInteger(this, key) { | |
10 | 10 | case b: Int => | |
11 | 11 | b | |
12 | 12 | case _ => | |
13 | 13 | 0 | |
14 | 14 | } | |
15 | 15 | val | |
16 | 16 | } | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func tryGetString (key) = { | |
20 | 20 | let val = match getString(this, key) { | |
21 | 21 | case b: String => | |
22 | 22 | b | |
23 | 23 | case _ => | |
24 | 24 | "" | |
25 | 25 | } | |
26 | 26 | val | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func isOwner (address) = (address == this) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func getGroup () = { | |
34 | 34 | let val = match getString(mainContract, "working_group_members") { | |
35 | 35 | case b: String => | |
36 | 36 | b | |
37 | 37 | case _ => | |
38 | 38 | "" | |
39 | 39 | } | |
40 | 40 | val | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func getMembers () = { | |
45 | 45 | let val = match getString(mainContract, "dao_members") { | |
46 | 46 | case b: String => | |
47 | 47 | b | |
48 | 48 | case _ => | |
49 | 49 | "" | |
50 | 50 | } | |
51 | 51 | val | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func getDAOSize () = { | |
56 | 56 | let val = match getInteger(mainContract, "dao_size") { | |
57 | 57 | case b: Int => | |
58 | 58 | b | |
59 | 59 | case _ => | |
60 | 60 | 0 | |
61 | 61 | } | |
62 | 62 | val | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func isGroupMember (a) = { | |
67 | 67 | let val = match getInteger(mainContract, (("working_group_member_" + toString(a)) + "_weight")) { | |
68 | 68 | case b: Int => | |
69 | 69 | b | |
70 | 70 | case _ => | |
71 | 71 | 0 | |
72 | 72 | } | |
73 | 73 | (val > 0) | |
74 | 74 | } | |
75 | 75 | ||
76 | 76 | ||
77 | - | func canMemberVote ( | |
78 | - | let val = match getInteger(mainContract, (("dao_member_" + toString( | |
77 | + | func canMemberVote (address) = { | |
78 | + | let val = match getInteger(mainContract, (("dao_member_" + toString(address)) + "_weight")) { | |
79 | 79 | case b: Int => | |
80 | 80 | b | |
81 | 81 | case _ => | |
82 | 82 | 0 | |
83 | 83 | } | |
84 | 84 | (val > 0) | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func getVoteValue (s) = if ((s == "like")) | |
89 | 89 | then 1 | |
90 | 90 | else if ((s == "dislike")) | |
91 | 91 | then -1 | |
92 | 92 | else throw("you need to vote with 'like' or 'dislike' value") | |
93 | 93 | ||
94 | 94 | ||
95 | + | func addTaskConditions (address) = if (!(isGroupMember(address))) | |
96 | + | then throw("grants working group access only") | |
97 | + | else true | |
98 | + | ||
99 | + | ||
100 | + | func addRewardConditions (address,taskId) = if (!(isGroupMember(address))) | |
101 | + | then throw("grants working group access only") | |
102 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "")) | |
103 | + | then throw("grant isn`t new") | |
104 | + | else true | |
105 | + | ||
106 | + | ||
107 | + | func voteForTaskProposalConditions (address,taskId) = if (!(canMemberVote(address))) | |
108 | + | then throw("you can't vote") | |
109 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "proposed")) | |
110 | + | then throw("voting is closed or not started") | |
111 | + | else if ((tryGetInteger(((("tasks_" + taskId) + "_voted_") + toString(address))) != 0)) | |
112 | + | then throw("you have already voted") | |
113 | + | else true | |
114 | + | ||
115 | + | ||
116 | + | func finishTaskProposalVotingConditions (address,taskId) = if (!(isGroupMember(address))) | |
117 | + | then throw("grants working group access only") | |
118 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "proposed")) | |
119 | + | then throw("voting is not active") | |
120 | + | else if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / getDAOSize()))) | |
121 | + | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
122 | + | else true | |
123 | + | ||
124 | + | ||
125 | + | func applyForTaskConditions (address,taskId,teamIdentifier) = if ((tryGetString((("tasks_" + taskId) + "_status")) != "ready_to_apply")) | |
126 | + | then throw("this grant has not yet been approved") | |
127 | + | else if ((tryGetString((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")) == toString(address))) | |
128 | + | then throw("you are applied") | |
129 | + | else true | |
130 | + | ||
131 | + | ||
132 | + | func voteForApplicantConditions (address,taskId,teamIdentifier) = { | |
133 | + | let voteHash = (drop(toString(address), 10) + drop(teamIdentifier, 10)) | |
134 | + | if (!(canMemberVote(address))) | |
135 | + | then throw("you can't vote") | |
136 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "ready_to_apply")) | |
137 | + | then throw("voting is not active") | |
138 | + | else if ((tryGetInteger(((("tasks_" + taskId) + "_vote_") + voteHash)) != 0)) | |
139 | + | then throw("you have already voted on this team") | |
140 | + | else true | |
141 | + | } | |
142 | + | ||
143 | + | ||
144 | + | func finishApplicantsVotingConditions (address,taskId,applicantsList) = if (!(isGroupMember(address))) | |
145 | + | then throw("grants working group access only") | |
146 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "ready_to_apply")) | |
147 | + | then throw("voting is not active") | |
148 | + | else if ((size(applicantsList) == 0)) | |
149 | + | then throw("no one has yet responded to the grant") | |
150 | + | else true | |
151 | + | ||
152 | + | ||
153 | + | func startWorkConditions (address,taskId,teamIdentifier) = if ((tryGetString((("tasks_" + taskId) + "_status")) != "team_chosen")) | |
154 | + | then throw("winner is not define") | |
155 | + | else if ((toString(address) != tryGetString((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
156 | + | then throw("team leader only") | |
157 | + | else true | |
158 | + | ||
159 | + | ||
160 | + | func acceptWorkResultConditions (address,taskId) = if (!(isGroupMember(address))) | |
161 | + | then throw("grants working group access only") | |
162 | + | else true | |
163 | + | ||
164 | + | ||
95 | 165 | @Callable(i) | |
96 | - | func addTask (title,link) = if ( | |
97 | - | then | |
98 | - | else | |
166 | + | func addTask (title,link) = if (addTaskConditions(i.caller)) | |
167 | + | then WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)]) | |
168 | + | else throw("checks are not passed") | |
99 | 169 | ||
100 | 170 | ||
101 | 171 | ||
102 | 172 | @Callable(i) | |
103 | - | func addReward (taskId) = if (!(isGroupMember(i.caller))) | |
104 | - | then throw("grants working group access only") | |
105 | - | else { | |
173 | + | func addReward (taskId) = if (addRewardConditions(i.caller, taskId)) | |
174 | + | then { | |
106 | 175 | let reward = extract(i.payment).amount | |
107 | 176 | WriteSet([DataEntry((("tasks_" + taskId) + "_reward"), reward), DataEntry((("tasks_" + taskId) + "_status"), "proposed")]) | |
108 | 177 | } | |
178 | + | else throw("checks are not passed") | |
109 | 179 | ||
110 | 180 | ||
111 | 181 | ||
112 | 182 | @Callable(i) | |
113 | - | func voteForTaskProposal (taskId,voteValue) = if (!(canMemberVote(i))) | |
114 | - | then throw("you can't vote") | |
115 | - | else if ((getStringValue(this, (("tasks_" + taskId) + "_status")) != "proposed")) | |
116 | - | then throw("voting is closed or not started") | |
117 | - | else if (if ((voteValue != "like")) | |
118 | - | then (voteValue != "dislike") | |
119 | - | else false) | |
120 | - | then throw("you need to vote like or dislike") | |
121 | - | else { | |
122 | - | let valueVoteInt = getVoteValue(voteValue) | |
123 | - | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
124 | - | let previousVote = tryGetInteger(voteKey) | |
125 | - | if (!((previousVote == 0))) | |
126 | - | then throw("you have already voted") | |
127 | - | else { | |
128 | - | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
129 | - | let votingState = tryGetInteger(votingKey) | |
130 | - | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
131 | - | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
132 | - | let newVotingState = (votingState + valueVoteInt) | |
133 | - | ScriptResult(WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, valueVoteInt), DataEntry(votesAmountKey, votesAmountState)]), TransferSet([ScriptTransfer(i.caller, 500000, unit)])) | |
134 | - | } | |
135 | - | } | |
183 | + | func voteForTaskProposal (taskId,voteValue) = if (voteForTaskProposalConditions(i.caller, taskId)) | |
184 | + | then { | |
185 | + | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
186 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
187 | + | let votingState = tryGetInteger(votingKey) | |
188 | + | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
189 | + | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
190 | + | let voteValueInt = getVoteValue(voteValue) | |
191 | + | let newVotingState = (votingState + voteValueInt) | |
192 | + | WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, voteValueInt), DataEntry(votesAmountKey, votesAmountState)]) | |
193 | + | } | |
194 | + | else throw("checks are not passed") | |
136 | 195 | ||
137 | 196 | ||
138 | 197 | ||
139 | 198 | @Callable(i) | |
140 | - | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / getDAOSize()))) | |
141 | - | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
142 | - | else if (!(isGroupMember(i.caller))) | |
143 | - | then throw("grants working group access only") | |
144 | - | else { | |
145 | - | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
146 | - | let votingState = tryGetInteger(votingKey) | |
147 | - | if ((votingState > 0)) | |
148 | - | then { | |
149 | - | let votingResult = "ready_to_apply" | |
150 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
151 | - | } | |
152 | - | else { | |
153 | - | let votingResult = "rejected" | |
154 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
155 | - | } | |
156 | - | } | |
199 | + | func finishTaskProposalVoting (taskId) = if (finishTaskProposalVotingConditions(i.caller, taskId)) | |
200 | + | then { | |
201 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
202 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), if ((tryGetInteger(votingKey) > 0)) | |
203 | + | then "ready_to_apply" | |
204 | + | else "rejected")]) | |
205 | + | } | |
206 | + | else throw("checks are not passed") | |
157 | 207 | ||
158 | 208 | ||
159 | 209 | ||
160 | 210 | @Callable(i) | |
161 | 211 | func applyForTask (taskId,teamName,link) = { | |
162 | - | let status = tryGetString((("tasks_" + taskId) + "_status")) | |
163 | - | if ((status != "ready_to_apply")) | |
164 | - | then throw("This grant has not yet been approved") | |
165 | - | else { | |
212 | + | let teamIdentifier = drop(toString(i.caller), 10) | |
213 | + | if (applyForTaskConditions(i.caller, taskId, teamIdentifier)) | |
214 | + | then { | |
166 | 215 | let listKey = (("tasks_" + taskId) + "_applicants") | |
167 | 216 | let currentApplicantsList = tryGetString(listKey) | |
168 | - | let applicantKey = drop(toString(i.caller), 10) | |
169 | 217 | let newApplicantsList = ((currentApplicantsList + ";") + toString(i.caller)) | |
170 | - | WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + | |
218 | + | WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_name"), teamName), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_link"), link), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader"), toString(i.caller)), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_id"), teamIdentifier), DataEntry(listKey, newApplicantsList)]) | |
171 | 219 | } | |
220 | + | else throw("checks are not passed") | |
172 | 221 | } | |
173 | 222 | ||
174 | 223 | ||
175 | 224 | ||
176 | 225 | @Callable(i) | |
177 | - | func voteForApplicant (taskId,teamIdentifier,voteValue) = if ( | |
178 | - | then | |
179 | - | | |
180 | - | let | |
181 | - | let | |
182 | - | let | |
183 | - | if (( | |
226 | + | func voteForApplicant (taskId,teamIdentifier,voteValue) = if (voteForApplicantConditions(i.caller, taskId, teamIdentifier)) | |
227 | + | then { | |
228 | + | let listKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_voted") | |
229 | + | let newApplicantsList = ((tryGetString(listKey) + ";") + toString(i.caller)) | |
230 | + | let voteHash = (drop(toString(i.caller), 20) + teamIdentifier) | |
231 | + | let voteKey = ((("tasks_" + taskId) + "_vh_") + voteHash) | |
232 | + | if ((tryGetString(voteKey) == toString(i.caller))) | |
184 | 233 | then throw("you have already voted on this team") | |
185 | 234 | else { | |
186 | - | let valueVoteInt = getVoteValue(voteValue) | |
187 | 235 | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
188 | 236 | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score") | |
189 | 237 | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
190 | - | let newTeamScore = ( | |
191 | - | WriteSet([DataEntry(voteKey, | |
238 | + | let newTeamScore = (getVoteValue(voteValue) + tryGetInteger(teamScoreKey)) | |
239 | + | WriteSet([DataEntry(listKey, newApplicantsList), DataEntry(voteKey, toString(i.caller)), DataEntry(teamVotesAmountKey, teamVotesAmount), DataEntry(teamScoreKey, newTeamScore)]) | |
192 | 240 | } | |
193 | 241 | } | |
242 | + | else throw("checks are not passed") | |
194 | 243 | ||
195 | 244 | ||
196 | 245 | ||
197 | 246 | @Callable(i) | |
198 | 247 | func finishApplicantsVoting (taskId) = { | |
199 | - | func isApplicantVotedEnough (aid,aid2) = { | |
200 | - | let listKey = (("tasks_" + taskId) + "_applicants") | |
201 | - | let applicantsList = split(getStringValue(this, listKey), ";") | |
202 | - | let teamIdentifier = applicantsList[aid] | |
203 | - | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
204 | - | let teamVotesAmount = tryGetInteger(teamVotesAmountKey) | |
205 | - | if ((teamVotesAmount > 0)) | |
206 | - | then 1 | |
207 | - | else throw(("not enough votes to make decision on " + teamIdentifier)) | |
208 | - | } | |
209 | - | ||
210 | 248 | func hasMoreVotes (aid,aid2) = { | |
211 | 249 | let listKey = (("tasks_" + taskId) + "_applicants") | |
212 | 250 | let applicantsList = split(getStringValue(this, listKey), ";") | |
213 | 251 | let teamIdentifier = applicantsList[aid] | |
214 | 252 | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
215 | 253 | let teamVotesAmount = tryGetInteger(teamVotesAmountKey) | |
216 | 254 | let team2Identifier = applicantsList[aid2] | |
217 | 255 | let team2VotesAmountKey = (((("tasks_" + taskId) + "_app_") + team2Identifier) + "_votes") | |
218 | 256 | let team2VotesAmount = tryGetInteger(team2VotesAmountKey) | |
219 | 257 | if ((teamVotesAmount > team2VotesAmount)) | |
220 | 258 | then aid | |
221 | 259 | else aid2 | |
222 | 260 | } | |
223 | 261 | ||
224 | - | | |
225 | - | | |
226 | - | | |
227 | - | | |
228 | - | let | |
229 | - | | |
230 | - | | |
231 | - | | |
232 | - | | |
233 | - | | |
234 | - | | |
235 | - | let $ | |
236 | - | if (($ | |
237 | - | then $ | |
262 | + | let listKeys = tryGetString((("tasks_" + taskId) + "_applicants")) | |
263 | + | let applicantsList = split(listKeys, ";") | |
264 | + | if (finishApplicantsVotingConditions(i.caller, taskId, applicantsList)) | |
265 | + | then { | |
266 | + | let chosenTeamId = { | |
267 | + | let $list1243712468 = [0, 1] | |
268 | + | let $size1243712468 = size($list1243712468) | |
269 | + | let $acc01243712468 = 0 | |
270 | + | if (($size1243712468 == 0)) | |
271 | + | then $acc01243712468 | |
272 | + | else { | |
273 | + | let $acc11243712468 = hasMoreVotes($acc01243712468, $list1243712468[0]) | |
274 | + | if (($size1243712468 == 1)) | |
275 | + | then $acc11243712468 | |
238 | 276 | else { | |
239 | - | let $ | |
240 | - | if (($ | |
241 | - | then $ | |
277 | + | let $acc21243712468 = hasMoreVotes($acc11243712468, $list1243712468[1]) | |
278 | + | if (($size1243712468 == 2)) | |
279 | + | then $acc21243712468 | |
242 | 280 | else { | |
243 | - | let $acc298869917 = hasMoreVotes($acc198869917, $list98869917[1]) | |
244 | - | if (($size98869917 == 2)) | |
245 | - | then $acc298869917 | |
246 | - | else { | |
247 | - | let $acc398869917 = hasMoreVotes($acc298869917, $list98869917[2]) | |
248 | - | throw("List size exceed 2") | |
249 | - | } | |
281 | + | let $acc31243712468 = hasMoreVotes($acc21243712468, $list1243712468[2]) | |
282 | + | throw("List size exceed 2") | |
250 | 283 | } | |
251 | 284 | } | |
252 | 285 | } | |
253 | - | | |
254 | - | | |
255 | - | | |
286 | + | } | |
287 | + | let teamIdentifier = drop(applicantsList[chosenTeamId], 10) | |
288 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "team_chosen"), DataEntry((("tasks_" + taskId) + "_performer"), teamIdentifier), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "can_begin")]) | |
256 | 289 | } | |
290 | + | else throw("checks are not passed") | |
257 | 291 | } | |
258 | 292 | ||
259 | 293 | ||
260 | 294 | ||
261 | 295 | @Callable(i) | |
262 | 296 | func startWork (taskId) = { | |
263 | - | let teamIdentifier = | |
264 | - | if ( | |
265 | - | then | |
266 | - | else | |
297 | + | let teamIdentifier = tryGetString((("tasks_" + taskId) + "_performer")) | |
298 | + | if (startWorkConditions(i.caller, taskId, teamIdentifier)) | |
299 | + | then WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_started")]) | |
300 | + | else throw("checks are not passed") | |
267 | 301 | } | |
268 | 302 | ||
269 | 303 | ||
270 | 304 | ||
271 | 305 | @Callable(i) | |
272 | - | func acceptWorkResult (taskId) = if (!(isGroupMember(i.caller))) | |
273 | - | then throw("grants working group access only") | |
274 | - | else { | |
306 | + | func acceptWorkResult (taskId,reportLink) = if (acceptWorkResultConditions(i.caller, taskId)) | |
307 | + | then { | |
275 | 308 | let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward")) | |
276 | - | let teamIdentifier = | |
277 | - | let teamAddress = | |
278 | - | ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_finished")]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)])) | |
309 | + | let teamIdentifier = tryGetString((("tasks_" + taskId) + "_performer")) | |
310 | + | let teamAddress = tryGetString((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")) | |
311 | + | ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_finished"), DataEntry((("tasks_" + taskId) + "_report"), reportLink)]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)])) | |
279 | 312 | } | |
313 | + | else throw("checks are not passed") | |
314 | + | ||
315 | + | ||
316 | + | ||
317 | + | @Callable(i) | |
318 | + | func rejectTask (taskId) = if (isGroupMember(i.caller)) | |
319 | + | then WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected")]) | |
320 | + | else throw("grants working group access only") | |
280 | 321 | ||
281 | 322 |
github/deemru/w8io/169f3d6 74.46 ms ◑