tx · F8fzYKNcQ2gMF5Gyyog8wKjraqosJnTFMht4iBL2t2vx 3MutoJzdTrUrDBhCu1qU6FRgAADLadZEL9D: -0.10000000 Waves 2020.12.28 04:12 [1327864] smart account 3MutoJzdTrUrDBhCu1qU6FRgAADLadZEL9D > SELF 0.00000000 Waves
{ "type": 13, "id": "F8fzYKNcQ2gMF5Gyyog8wKjraqosJnTFMht4iBL2t2vx", "fee": 10000000, "feeAssetId": null, "timestamp": 1609117958124, "version": 2, "chainId": 84, "sender": "3MutoJzdTrUrDBhCu1qU6FRgAADLadZEL9D", "senderPublicKey": "AwtL5awdRAD38g4rSetUxgc11P6TfxbJg11rKmX4hXSo", "proofs": [ "4dTBoFP3m62eJSMesMUM53n9WnKn9p9cW3BamnRgvm4t51VSjjgMwnwEieQ7z14bE2NJSkcJHm1nai7qLHLT6KYq" ], "script": "base64:AAIDAAAAAAAAAE8IARIECgIICBIDCgEIEgQKAggIEgMKAQgSBQoDCAgIEgUKAwgICBIDCgEIEgQKAggIEgQKAggIEgMKAQgSBQoDCAgIEgUKAwgICBIDCgEIAAAAGAAAAAAGUVVPUlVNAAAAAAAAAAABAAAAAAxtYWluQ29udHJhY3QJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQIAAAAjM013UnppMkJtcVpaWFdyQ0dDd2NSUUxzbmljMkFvZDZ6aFMBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAADHRyeUdldFN0cmluZwAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAA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VN0cmluZykAAAABBQAAAAt0ZWFtQWRkcmVzcwUAAAAMcmV3YXJkQW1vdW50BQAAAAR1bml0BQAAAANuaWwJAAACAAAAAQIAAAAVY2hlY2tzIGFyZSBub3QgcGFzc2VkAAAAAWkBAAAACnJlamVjdFRhc2sAAAABAAAABnRhc2tJZAMJAQAAAAEhAAAAAQkBAAAADWlzR3JvdXBNZW1iZXIAAAABCAUAAAABaQAAAAZjYWxsZXIJAAACAAAAAQIAAAAgZ3JhbnRzIHdvcmtpbmcgZ3JvdXAgYWNjZXNzIG9ubHkJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAZ0YXNrc18FAAAABnRhc2tJZAIAAAAHX3N0YXR1cwIAAAAIcmVqZWN0ZWQFAAAAA25pbAAAAADvFp/K", "height": 1327864, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HhncNDBscXDaUGpseEJBXqpnowq32ALr7kpVAWgwxKzk Next: 7MT2S9gofWjsk5APPPkgRJGLypzsgawdLSbpeGvpYk8r Diff:
Old | New | Differences | |
---|---|---|---|
71 | 71 | } | |
72 | 72 | ||
73 | 73 | ||
74 | - | func canMemberVote ( | |
75 | - | let val = match getInteger(mainContract, (("dao_member_" + toString( | |
74 | + | func canMemberVote (address) = { | |
75 | + | let val = match getInteger(mainContract, (("dao_member_" + toString(address)) + "_weight")) { | |
76 | 76 | case b: Int => | |
77 | 77 | b | |
78 | 78 | case _ => | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 | ||
85 | + | func isJuryMember (address,taskId) = canMemberVote(address) | |
86 | + | ||
87 | + | ||
88 | + | func getVoteValue (s) = if ((s == "like")) | |
89 | + | then 1 | |
90 | + | else if ((s == "dislike")) | |
91 | + | then -1 | |
92 | + | else throw("you need to vote with 'like' or 'dislike' value") | |
93 | + | ||
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,winnerIdentifier) = if (!(isGroupMember(address))) | |
161 | + | then throw("grants working group access only") | |
162 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "work_finished")) | |
163 | + | then throw("work is not finished") | |
164 | + | else if ((tryGetInteger((((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_score_solution")) > 1)) | |
165 | + | then throw("negative assessment") | |
166 | + | else true | |
167 | + | ||
168 | + | ||
169 | + | func enableSubmissionsConditions (address,taskId) = if (!(isGroupMember(address))) | |
170 | + | then throw("grants working group access only") | |
171 | + | else true | |
172 | + | ||
173 | + | ||
174 | + | func submitSolutionConditions (address,taskId,teamIdentifier) = if ((tryGetString((("tasks_" + taskId) + "_status")) != "work_started")) | |
175 | + | then throw("work is not started") | |
176 | + | else if ((toString(address) != tryGetString((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
177 | + | then throw("team leader only") | |
178 | + | else if ((1 > tryGetInteger((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score_applicant")))) | |
179 | + | then throw("your team is not approved") | |
180 | + | else if ((tryGetString((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process")) == "work_submitted")) | |
181 | + | then throw("you have already presented the solution") | |
182 | + | else true | |
183 | + | ||
184 | + | ||
185 | + | func stopSubmissionsConditions (address,taskId) = if (!(isGroupMember(address))) | |
186 | + | then throw("grants working group access only") | |
187 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "work_started")) | |
188 | + | then throw("work is not started") | |
189 | + | else true | |
190 | + | ||
191 | + | ||
192 | + | func voteForSolutionConditions (address,taskId) = if (!(isJuryMember(address, taskId))) | |
193 | + | then throw("you can't vote") | |
194 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "work_finished")) | |
195 | + | then throw("work is not started") | |
196 | + | else true | |
197 | + | ||
198 | + | ||
85 | 199 | @Callable(i) | |
86 | - | func addTask (title,link) = if ( | |
87 | - | then | |
88 | - | else | |
200 | + | func addTask (title,link) = if (addTaskConditions(i.caller)) | |
201 | + | then WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)]) | |
202 | + | else throw("checks are not passed") | |
89 | 203 | ||
90 | 204 | ||
91 | 205 | ||
92 | 206 | @Callable(i) | |
93 | - | func addReward (taskId) = if (!(isGroupMember(i.caller))) | |
94 | - | then throw("grants working group access only") | |
95 | - | else { | |
207 | + | func addReward (taskId) = if (addRewardConditions(i.caller, taskId)) | |
208 | + | then { | |
96 | 209 | let reward = extract(i.payment).amount | |
97 | 210 | WriteSet([DataEntry((("tasks_" + taskId) + "_reward"), reward), DataEntry((("tasks_" + taskId) + "_status"), "proposed")]) | |
98 | 211 | } | |
212 | + | else throw("checks are not passed") | |
99 | 213 | ||
100 | 214 | ||
101 | 215 | ||
102 | 216 | @Callable(i) | |
103 | - | func voteForTaskProposal (taskId,voteValue) = if (!(canMemberVote(i))) | |
104 | - | then throw("you can't vote") | |
105 | - | else if ((getStringValue(this, (("tasks_" + taskId) + "_status")) != "proposed")) | |
106 | - | then throw("voting is closed or not started") | |
107 | - | else if (if ((voteValue != -1)) | |
108 | - | then (voteValue != 1) | |
109 | - | else false) | |
110 | - | then throw("you need to vote 1 or -1") | |
111 | - | else { | |
112 | - | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
113 | - | let previousVote = tryGetInteger(voteKey) | |
114 | - | if (!((previousVote == 0))) | |
115 | - | then throw("you have already voted") | |
116 | - | else { | |
117 | - | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
118 | - | let votingState = tryGetInteger(votingKey) | |
119 | - | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
120 | - | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
121 | - | let newVotingState = (votingState + voteValue) | |
122 | - | ScriptResult(WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, voteValue), DataEntry(votesAmountKey, votesAmountState)]), TransferSet([ScriptTransfer(i.caller, 500000, unit)])) | |
123 | - | } | |
124 | - | } | |
217 | + | func voteForTaskProposal (taskId,voteValue) = if (voteForTaskProposalConditions(i.caller, taskId)) | |
218 | + | then { | |
219 | + | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
220 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
221 | + | let votingState = tryGetInteger(votingKey) | |
222 | + | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
223 | + | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
224 | + | let voteValueInt = getVoteValue(voteValue) | |
225 | + | let newVotingState = (votingState + voteValueInt) | |
226 | + | WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, voteValueInt), DataEntry(votesAmountKey, votesAmountState)]) | |
227 | + | } | |
228 | + | else throw("checks are not passed") | |
125 | 229 | ||
126 | 230 | ||
127 | 231 | ||
128 | 232 | @Callable(i) | |
129 | - | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / getDAOSize()))) | |
130 | - | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
131 | - | else if (!(isGroupMember(i.caller))) | |
132 | - | then throw("grants working group access only") | |
133 | - | else { | |
134 | - | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
135 | - | let votingState = tryGetInteger(votingKey) | |
136 | - | if ((votingState > 0)) | |
137 | - | then { | |
138 | - | let votingResult = "ready_to_apply" | |
139 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
140 | - | } | |
141 | - | else { | |
142 | - | let votingResult = "rejected" | |
143 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
144 | - | } | |
145 | - | } | |
233 | + | func finishTaskProposalVoting (taskId) = if (finishTaskProposalVotingConditions(i.caller, taskId)) | |
234 | + | then { | |
235 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
236 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), if ((tryGetInteger(votingKey) > 0)) | |
237 | + | then "ready_to_apply" | |
238 | + | else "rejected")]) | |
239 | + | } | |
240 | + | else throw("checks are not passed") | |
146 | 241 | ||
147 | 242 | ||
148 | 243 | ||
149 | 244 | @Callable(i) | |
150 | 245 | func applyForTask (taskId,teamName,link) = { | |
151 | - | let status = tryGetString((("tasks_" + taskId) + "_status")) | |
152 | - | if ((status != "ready_to_apply")) | |
153 | - | then throw("This grant has not yet been approved") | |
154 | - | else { | |
246 | + | let teamIdentifier = drop(toString(i.caller), 10) | |
247 | + | if (applyForTaskConditions(i.caller, taskId, teamIdentifier)) | |
248 | + | then { | |
155 | 249 | let listKey = (("tasks_" + taskId) + "_applicants") | |
156 | 250 | let currentApplicantsList = tryGetString(listKey) | |
157 | - | let applicantKey = drop(toString(i.caller), 10) | |
158 | - | let leader = toString(i.caller) | |
159 | - | let newApplicantsList = ((currentApplicantsList + ";") + leader) | |
160 | - | WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_name"), teamName), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_link"), link), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_leader"), leader), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_id"), applicantKey), DataEntry(listKey, newApplicantsList)]) | |
251 | + | let newApplicantsList = ((currentApplicantsList + ";") + toString(i.caller)) | |
252 | + | 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)]) | |
161 | 253 | } | |
254 | + | else throw("checks are not passed") | |
162 | 255 | } | |
163 | 256 | ||
164 | 257 | ||
165 | 258 | ||
166 | 259 | @Callable(i) | |
167 | - | func voteForApplicant (taskId,teamIdentifier,voteValue) = if ( | |
168 | - | then | |
169 | - | | |
170 | - | let | |
171 | - | let | |
172 | - | let | |
173 | - | if (( | |
260 | + | func voteForApplicant (taskId,teamIdentifier,voteValue) = if (voteForApplicantConditions(i.caller, taskId, teamIdentifier)) | |
261 | + | then { | |
262 | + | let listKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_voted_applicant") | |
263 | + | let newApplicantsList = ((tryGetString(listKey) + ";") + toString(i.caller)) | |
264 | + | let voteHash = (drop(toString(i.caller), 20) + teamIdentifier) | |
265 | + | let voteKey = ((("tasks_" + taskId) + "_vh_") + voteHash) | |
266 | + | if ((tryGetString(voteKey) == toString(i.caller))) | |
174 | 267 | then throw("you have already voted on this team") | |
175 | 268 | else { | |
176 | - | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
177 | - | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score") | |
269 | + | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes_applicant") | |
270 | + | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score_applicant") | |
178 | 271 | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
179 | - | let newTeamScore = (voteValue + tryGetInteger(teamScoreKey)) | |
180 | - | WriteSet([DataEntry(voteKey, | |
272 | + | let newTeamScore = (getVoteValue(voteValue) + tryGetInteger(teamScoreKey)) | |
273 | + | WriteSet([DataEntry(listKey, newApplicantsList), DataEntry(voteKey, toString(i.caller)), DataEntry(teamVotesAmountKey, teamVotesAmount), DataEntry(teamScoreKey, newTeamScore)]) | |
181 | 274 | } | |
182 | 275 | } | |
276 | + | else throw("checks are not passed") | |
183 | 277 | ||
184 | 278 | ||
185 | 279 | ||
186 | 280 | @Callable(i) | |
187 | 281 | func finishApplicantsVoting (taskId) = { | |
188 | - | let minVotesToApproveApplicant = 1 | |
189 | - | if (!(isGroupMember(i.caller))) | |
190 | - | then throw("grants working group access only") | |
191 | - | else { | |
192 | - | let listKeys = tryGetString((("tasks_" + taskId) + "_applicants")) | |
193 | - | let applicantsList = split(listKeys, ";") | |
194 | - | if ((size(applicantsList) == 0)) | |
195 | - | then throw("No one has applied to the hackathon, yet") | |
196 | - | else WriteSet([DataEntry((("tasks_" + taskId) + "_performer"), listKeys), DataEntry((("tasks_" + taskId) + "_status"), "ready_to_submit")]) | |
197 | - | } | |
282 | + | let listKeys = tryGetString((("tasks_" + taskId) + "_applicants")) | |
283 | + | let applicantsList = split(listKeys, ";") | |
284 | + | if (finishApplicantsVotingConditions(i.caller, taskId, applicantsList)) | |
285 | + | then WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "ready_to_submit")]) | |
286 | + | else throw("checks are not passed") | |
198 | 287 | } | |
199 | 288 | ||
200 | 289 | ||
201 | 290 | ||
202 | 291 | @Callable(i) | |
203 | - | func enableSubmissions (taskId,juryList) = if ( | |
204 | - | then | |
205 | - | else | |
292 | + | func enableSubmissions (taskId,juryList) = if (enableSubmissionsConditions(i.caller, taskId)) | |
293 | + | then WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started"), DataEntry((("tasks_" + taskId) + "_jury"), juryList)]) | |
294 | + | else throw("checks are not passed") | |
206 | 295 | ||
207 | 296 | ||
208 | 297 | ||
209 | 298 | @Callable(i) | |
210 | 299 | func submitSolution (taskId,solutionLink) = { | |
211 | - | func areSubmissionsEnabled (taskId) = (tryGetString((("tasks_" + taskId) + "_status")) == "work_started") | |
212 | - | ||
213 | - | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
214 | - | if (!(areSubmissionsEnabled(taskId))) | |
215 | - | then throw("not possible to upload solution now") | |
216 | - | else if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
217 | - | then throw("team leader only") | |
218 | - | else WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_submitted"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solution"), solutionLink)]) | |
300 | + | let teamIdentifier = drop(toString(i.caller), 10) | |
301 | + | if (submitSolutionConditions(i.caller, taskId, teamIdentifier)) | |
302 | + | then WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_submitted"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solution"), solutionLink)]) | |
303 | + | else throw("checks are not passed") | |
219 | 304 | } | |
220 | 305 | ||
221 | 306 | ||
222 | 307 | ||
223 | 308 | @Callable(i) | |
224 | - | func stopSubmissions (taskId) = if ( | |
225 | - | then | |
226 | - | else | |
309 | + | func stopSubmissions (taskId) = if (stopSubmissionsConditions(i.caller, taskId)) | |
310 | + | then WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished")]) | |
311 | + | else throw("checks are not passed") | |
227 | 312 | ||
228 | 313 | ||
229 | 314 | ||
230 | 315 | @Callable(i) | |
231 | - | func voteForSolution (taskId,teamIdentifier,voteValue) = { | |
232 | - | func isJuryMember (i,taskId) = true | |
233 | - | ||
234 | - | if (!(isJuryMember(i, taskId))) | |
235 | - | then throw("you can't vote") | |
236 | - | else { | |
237 | - | let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10)) | |
238 | - | let voteKey = ((("tasks_" + taskId) + "_solutionvote_") + voteHash) | |
239 | - | let vote = tryGetInteger(voteKey) | |
240 | - | if ((vote != 0)) | |
241 | - | then throw("you have already voted on this solution") | |
242 | - | else { | |
243 | - | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionvotes") | |
244 | - | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionscore") | |
245 | - | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
246 | - | let newTeamScore = (voteValue + tryGetInteger(teamScoreKey)) | |
247 | - | WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)]) | |
248 | - | } | |
249 | - | } | |
250 | - | } | |
316 | + | func voteForSolution (taskId,teamIdentifier,voteValue) = if (voteForSolutionConditions(i.caller, taskId)) | |
317 | + | then { | |
318 | + | let listKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_voted_solution") | |
319 | + | let newVotedList = ((tryGetString(listKey) + ";") + toString(i.caller)) | |
320 | + | let voteHash = (drop(toString(i.caller), 20) + teamIdentifier) | |
321 | + | let voteKey = ((("tasks_" + taskId) + "_vs_") + voteHash) | |
322 | + | if ((tryGetString(voteKey) == toString(i.caller))) | |
323 | + | then throw("you have already voted on this team") | |
324 | + | else { | |
325 | + | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes_solution") | |
326 | + | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score_solution") | |
327 | + | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
328 | + | let newTeamScore = (getVoteValue(voteValue) + tryGetInteger(teamScoreKey)) | |
329 | + | WriteSet([DataEntry(listKey, newVotedList), DataEntry(voteKey, toString(i.caller)), DataEntry(teamVotesAmountKey, teamVotesAmount), DataEntry(teamScoreKey, newTeamScore)]) | |
330 | + | } | |
331 | + | } | |
332 | + | else throw("checks are not passed") | |
251 | 333 | ||
252 | 334 | ||
253 | 335 | ||
254 | 336 | @Callable(i) | |
255 | - | func acceptWorkResult (taskId,winnerIdentifier,reportLink) = if (!(isGroupMember(i.caller))) | |
256 | - | then throw("grants working group access only") | |
257 | - | else { | |
337 | + | func acceptWorkResult (taskId,winnerIdentifier,reportLink) = if (acceptWorkResultConditions(i.caller, taskId, winnerIdentifier)) | |
338 | + | then { | |
258 | 339 | let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward")) | |
259 | 340 | let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_leader")) | |
260 | - | ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), " | |
341 | + | ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "team_choosen"), DataEntry((((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_process"), "winner"), DataEntry((("tasks_" + taskId) + "_report"), reportLink)]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)])) | |
261 | 342 | } | |
343 | + | else throw("checks are not passed") | |
262 | 344 | ||
263 | 345 | ||
264 | 346 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let QUORUM = 1 | |
5 | 5 | ||
6 | 6 | let mainContract = addressFromStringValue("3MwRzi2BmqZZXWrCGCwcRQLsnic2Aod6zhS") | |
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 getGroup () = { | |
31 | 31 | let val = match getString(mainContract, "working_group_members") { | |
32 | 32 | case b: String => | |
33 | 33 | b | |
34 | 34 | case _ => | |
35 | 35 | "" | |
36 | 36 | } | |
37 | 37 | val | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func getMembers () = { | |
42 | 42 | let val = match getString(mainContract, "dao_members") { | |
43 | 43 | case b: String => | |
44 | 44 | b | |
45 | 45 | case _ => | |
46 | 46 | "" | |
47 | 47 | } | |
48 | 48 | val | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func getDAOSize () = { | |
53 | 53 | let val = match getInteger(mainContract, "dao_size") { | |
54 | 54 | case b: Int => | |
55 | 55 | b | |
56 | 56 | case _ => | |
57 | 57 | 0 | |
58 | 58 | } | |
59 | 59 | val | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func isGroupMember (a) = { | |
64 | 64 | let val = match getInteger(mainContract, (("working_group_member_" + toString(a)) + "_weight")) { | |
65 | 65 | case b: Int => | |
66 | 66 | b | |
67 | 67 | case _ => | |
68 | 68 | 0 | |
69 | 69 | } | |
70 | 70 | (val > 0) | |
71 | 71 | } | |
72 | 72 | ||
73 | 73 | ||
74 | - | func canMemberVote ( | |
75 | - | let val = match getInteger(mainContract, (("dao_member_" + toString( | |
74 | + | func canMemberVote (address) = { | |
75 | + | let val = match getInteger(mainContract, (("dao_member_" + toString(address)) + "_weight")) { | |
76 | 76 | case b: Int => | |
77 | 77 | b | |
78 | 78 | case _ => | |
79 | 79 | 0 | |
80 | 80 | } | |
81 | 81 | (val > 0) | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 | ||
85 | + | func isJuryMember (address,taskId) = canMemberVote(address) | |
86 | + | ||
87 | + | ||
88 | + | func getVoteValue (s) = if ((s == "like")) | |
89 | + | then 1 | |
90 | + | else if ((s == "dislike")) | |
91 | + | then -1 | |
92 | + | else throw("you need to vote with 'like' or 'dislike' value") | |
93 | + | ||
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,winnerIdentifier) = if (!(isGroupMember(address))) | |
161 | + | then throw("grants working group access only") | |
162 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "work_finished")) | |
163 | + | then throw("work is not finished") | |
164 | + | else if ((tryGetInteger((((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_score_solution")) > 1)) | |
165 | + | then throw("negative assessment") | |
166 | + | else true | |
167 | + | ||
168 | + | ||
169 | + | func enableSubmissionsConditions (address,taskId) = if (!(isGroupMember(address))) | |
170 | + | then throw("grants working group access only") | |
171 | + | else true | |
172 | + | ||
173 | + | ||
174 | + | func submitSolutionConditions (address,taskId,teamIdentifier) = if ((tryGetString((("tasks_" + taskId) + "_status")) != "work_started")) | |
175 | + | then throw("work is not started") | |
176 | + | else if ((toString(address) != tryGetString((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
177 | + | then throw("team leader only") | |
178 | + | else if ((1 > tryGetInteger((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score_applicant")))) | |
179 | + | then throw("your team is not approved") | |
180 | + | else if ((tryGetString((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process")) == "work_submitted")) | |
181 | + | then throw("you have already presented the solution") | |
182 | + | else true | |
183 | + | ||
184 | + | ||
185 | + | func stopSubmissionsConditions (address,taskId) = if (!(isGroupMember(address))) | |
186 | + | then throw("grants working group access only") | |
187 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "work_started")) | |
188 | + | then throw("work is not started") | |
189 | + | else true | |
190 | + | ||
191 | + | ||
192 | + | func voteForSolutionConditions (address,taskId) = if (!(isJuryMember(address, taskId))) | |
193 | + | then throw("you can't vote") | |
194 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "work_finished")) | |
195 | + | then throw("work is not started") | |
196 | + | else true | |
197 | + | ||
198 | + | ||
85 | 199 | @Callable(i) | |
86 | - | func addTask (title,link) = if ( | |
87 | - | then | |
88 | - | else | |
200 | + | func addTask (title,link) = if (addTaskConditions(i.caller)) | |
201 | + | then WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)]) | |
202 | + | else throw("checks are not passed") | |
89 | 203 | ||
90 | 204 | ||
91 | 205 | ||
92 | 206 | @Callable(i) | |
93 | - | func addReward (taskId) = if (!(isGroupMember(i.caller))) | |
94 | - | then throw("grants working group access only") | |
95 | - | else { | |
207 | + | func addReward (taskId) = if (addRewardConditions(i.caller, taskId)) | |
208 | + | then { | |
96 | 209 | let reward = extract(i.payment).amount | |
97 | 210 | WriteSet([DataEntry((("tasks_" + taskId) + "_reward"), reward), DataEntry((("tasks_" + taskId) + "_status"), "proposed")]) | |
98 | 211 | } | |
212 | + | else throw("checks are not passed") | |
99 | 213 | ||
100 | 214 | ||
101 | 215 | ||
102 | 216 | @Callable(i) | |
103 | - | func voteForTaskProposal (taskId,voteValue) = if (!(canMemberVote(i))) | |
104 | - | then throw("you can't vote") | |
105 | - | else if ((getStringValue(this, (("tasks_" + taskId) + "_status")) != "proposed")) | |
106 | - | then throw("voting is closed or not started") | |
107 | - | else if (if ((voteValue != -1)) | |
108 | - | then (voteValue != 1) | |
109 | - | else false) | |
110 | - | then throw("you need to vote 1 or -1") | |
111 | - | else { | |
112 | - | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
113 | - | let previousVote = tryGetInteger(voteKey) | |
114 | - | if (!((previousVote == 0))) | |
115 | - | then throw("you have already voted") | |
116 | - | else { | |
117 | - | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
118 | - | let votingState = tryGetInteger(votingKey) | |
119 | - | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
120 | - | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
121 | - | let newVotingState = (votingState + voteValue) | |
122 | - | ScriptResult(WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, voteValue), DataEntry(votesAmountKey, votesAmountState)]), TransferSet([ScriptTransfer(i.caller, 500000, unit)])) | |
123 | - | } | |
124 | - | } | |
217 | + | func voteForTaskProposal (taskId,voteValue) = if (voteForTaskProposalConditions(i.caller, taskId)) | |
218 | + | then { | |
219 | + | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
220 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
221 | + | let votingState = tryGetInteger(votingKey) | |
222 | + | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
223 | + | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
224 | + | let voteValueInt = getVoteValue(voteValue) | |
225 | + | let newVotingState = (votingState + voteValueInt) | |
226 | + | WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, voteValueInt), DataEntry(votesAmountKey, votesAmountState)]) | |
227 | + | } | |
228 | + | else throw("checks are not passed") | |
125 | 229 | ||
126 | 230 | ||
127 | 231 | ||
128 | 232 | @Callable(i) | |
129 | - | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / getDAOSize()))) | |
130 | - | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
131 | - | else if (!(isGroupMember(i.caller))) | |
132 | - | then throw("grants working group access only") | |
133 | - | else { | |
134 | - | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
135 | - | let votingState = tryGetInteger(votingKey) | |
136 | - | if ((votingState > 0)) | |
137 | - | then { | |
138 | - | let votingResult = "ready_to_apply" | |
139 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
140 | - | } | |
141 | - | else { | |
142 | - | let votingResult = "rejected" | |
143 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
144 | - | } | |
145 | - | } | |
233 | + | func finishTaskProposalVoting (taskId) = if (finishTaskProposalVotingConditions(i.caller, taskId)) | |
234 | + | then { | |
235 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
236 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), if ((tryGetInteger(votingKey) > 0)) | |
237 | + | then "ready_to_apply" | |
238 | + | else "rejected")]) | |
239 | + | } | |
240 | + | else throw("checks are not passed") | |
146 | 241 | ||
147 | 242 | ||
148 | 243 | ||
149 | 244 | @Callable(i) | |
150 | 245 | func applyForTask (taskId,teamName,link) = { | |
151 | - | let status = tryGetString((("tasks_" + taskId) + "_status")) | |
152 | - | if ((status != "ready_to_apply")) | |
153 | - | then throw("This grant has not yet been approved") | |
154 | - | else { | |
246 | + | let teamIdentifier = drop(toString(i.caller), 10) | |
247 | + | if (applyForTaskConditions(i.caller, taskId, teamIdentifier)) | |
248 | + | then { | |
155 | 249 | let listKey = (("tasks_" + taskId) + "_applicants") | |
156 | 250 | let currentApplicantsList = tryGetString(listKey) | |
157 | - | let applicantKey = drop(toString(i.caller), 10) | |
158 | - | let leader = toString(i.caller) | |
159 | - | let newApplicantsList = ((currentApplicantsList + ";") + leader) | |
160 | - | WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_name"), teamName), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_link"), link), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_leader"), leader), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_id"), applicantKey), DataEntry(listKey, newApplicantsList)]) | |
251 | + | let newApplicantsList = ((currentApplicantsList + ";") + toString(i.caller)) | |
252 | + | 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)]) | |
161 | 253 | } | |
254 | + | else throw("checks are not passed") | |
162 | 255 | } | |
163 | 256 | ||
164 | 257 | ||
165 | 258 | ||
166 | 259 | @Callable(i) | |
167 | - | func voteForApplicant (taskId,teamIdentifier,voteValue) = if ( | |
168 | - | then | |
169 | - | | |
170 | - | let | |
171 | - | let | |
172 | - | let | |
173 | - | if (( | |
260 | + | func voteForApplicant (taskId,teamIdentifier,voteValue) = if (voteForApplicantConditions(i.caller, taskId, teamIdentifier)) | |
261 | + | then { | |
262 | + | let listKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_voted_applicant") | |
263 | + | let newApplicantsList = ((tryGetString(listKey) + ";") + toString(i.caller)) | |
264 | + | let voteHash = (drop(toString(i.caller), 20) + teamIdentifier) | |
265 | + | let voteKey = ((("tasks_" + taskId) + "_vh_") + voteHash) | |
266 | + | if ((tryGetString(voteKey) == toString(i.caller))) | |
174 | 267 | then throw("you have already voted on this team") | |
175 | 268 | else { | |
176 | - | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
177 | - | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score") | |
269 | + | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes_applicant") | |
270 | + | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score_applicant") | |
178 | 271 | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
179 | - | let newTeamScore = (voteValue + tryGetInteger(teamScoreKey)) | |
180 | - | WriteSet([DataEntry(voteKey, | |
272 | + | let newTeamScore = (getVoteValue(voteValue) + tryGetInteger(teamScoreKey)) | |
273 | + | WriteSet([DataEntry(listKey, newApplicantsList), DataEntry(voteKey, toString(i.caller)), DataEntry(teamVotesAmountKey, teamVotesAmount), DataEntry(teamScoreKey, newTeamScore)]) | |
181 | 274 | } | |
182 | 275 | } | |
276 | + | else throw("checks are not passed") | |
183 | 277 | ||
184 | 278 | ||
185 | 279 | ||
186 | 280 | @Callable(i) | |
187 | 281 | func finishApplicantsVoting (taskId) = { | |
188 | - | let minVotesToApproveApplicant = 1 | |
189 | - | if (!(isGroupMember(i.caller))) | |
190 | - | then throw("grants working group access only") | |
191 | - | else { | |
192 | - | let listKeys = tryGetString((("tasks_" + taskId) + "_applicants")) | |
193 | - | let applicantsList = split(listKeys, ";") | |
194 | - | if ((size(applicantsList) == 0)) | |
195 | - | then throw("No one has applied to the hackathon, yet") | |
196 | - | else WriteSet([DataEntry((("tasks_" + taskId) + "_performer"), listKeys), DataEntry((("tasks_" + taskId) + "_status"), "ready_to_submit")]) | |
197 | - | } | |
282 | + | let listKeys = tryGetString((("tasks_" + taskId) + "_applicants")) | |
283 | + | let applicantsList = split(listKeys, ";") | |
284 | + | if (finishApplicantsVotingConditions(i.caller, taskId, applicantsList)) | |
285 | + | then WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "ready_to_submit")]) | |
286 | + | else throw("checks are not passed") | |
198 | 287 | } | |
199 | 288 | ||
200 | 289 | ||
201 | 290 | ||
202 | 291 | @Callable(i) | |
203 | - | func enableSubmissions (taskId,juryList) = if ( | |
204 | - | then | |
205 | - | else | |
292 | + | func enableSubmissions (taskId,juryList) = if (enableSubmissionsConditions(i.caller, taskId)) | |
293 | + | then WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started"), DataEntry((("tasks_" + taskId) + "_jury"), juryList)]) | |
294 | + | else throw("checks are not passed") | |
206 | 295 | ||
207 | 296 | ||
208 | 297 | ||
209 | 298 | @Callable(i) | |
210 | 299 | func submitSolution (taskId,solutionLink) = { | |
211 | - | func areSubmissionsEnabled (taskId) = (tryGetString((("tasks_" + taskId) + "_status")) == "work_started") | |
212 | - | ||
213 | - | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
214 | - | if (!(areSubmissionsEnabled(taskId))) | |
215 | - | then throw("not possible to upload solution now") | |
216 | - | else if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
217 | - | then throw("team leader only") | |
218 | - | else WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_submitted"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solution"), solutionLink)]) | |
300 | + | let teamIdentifier = drop(toString(i.caller), 10) | |
301 | + | if (submitSolutionConditions(i.caller, taskId, teamIdentifier)) | |
302 | + | then WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_submitted"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solution"), solutionLink)]) | |
303 | + | else throw("checks are not passed") | |
219 | 304 | } | |
220 | 305 | ||
221 | 306 | ||
222 | 307 | ||
223 | 308 | @Callable(i) | |
224 | - | func stopSubmissions (taskId) = if ( | |
225 | - | then | |
226 | - | else | |
309 | + | func stopSubmissions (taskId) = if (stopSubmissionsConditions(i.caller, taskId)) | |
310 | + | then WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished")]) | |
311 | + | else throw("checks are not passed") | |
227 | 312 | ||
228 | 313 | ||
229 | 314 | ||
230 | 315 | @Callable(i) | |
231 | - | func voteForSolution (taskId,teamIdentifier,voteValue) = { | |
232 | - | func isJuryMember (i,taskId) = true | |
233 | - | ||
234 | - | if (!(isJuryMember(i, taskId))) | |
235 | - | then throw("you can't vote") | |
236 | - | else { | |
237 | - | let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10)) | |
238 | - | let voteKey = ((("tasks_" + taskId) + "_solutionvote_") + voteHash) | |
239 | - | let vote = tryGetInteger(voteKey) | |
240 | - | if ((vote != 0)) | |
241 | - | then throw("you have already voted on this solution") | |
242 | - | else { | |
243 | - | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionvotes") | |
244 | - | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionscore") | |
245 | - | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
246 | - | let newTeamScore = (voteValue + tryGetInteger(teamScoreKey)) | |
247 | - | WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)]) | |
248 | - | } | |
249 | - | } | |
250 | - | } | |
316 | + | func voteForSolution (taskId,teamIdentifier,voteValue) = if (voteForSolutionConditions(i.caller, taskId)) | |
317 | + | then { | |
318 | + | let listKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_voted_solution") | |
319 | + | let newVotedList = ((tryGetString(listKey) + ";") + toString(i.caller)) | |
320 | + | let voteHash = (drop(toString(i.caller), 20) + teamIdentifier) | |
321 | + | let voteKey = ((("tasks_" + taskId) + "_vs_") + voteHash) | |
322 | + | if ((tryGetString(voteKey) == toString(i.caller))) | |
323 | + | then throw("you have already voted on this team") | |
324 | + | else { | |
325 | + | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes_solution") | |
326 | + | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score_solution") | |
327 | + | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
328 | + | let newTeamScore = (getVoteValue(voteValue) + tryGetInteger(teamScoreKey)) | |
329 | + | WriteSet([DataEntry(listKey, newVotedList), DataEntry(voteKey, toString(i.caller)), DataEntry(teamVotesAmountKey, teamVotesAmount), DataEntry(teamScoreKey, newTeamScore)]) | |
330 | + | } | |
331 | + | } | |
332 | + | else throw("checks are not passed") | |
251 | 333 | ||
252 | 334 | ||
253 | 335 | ||
254 | 336 | @Callable(i) | |
255 | - | func acceptWorkResult (taskId,winnerIdentifier,reportLink) = if (!(isGroupMember(i.caller))) | |
256 | - | then throw("grants working group access only") | |
257 | - | else { | |
337 | + | func acceptWorkResult (taskId,winnerIdentifier,reportLink) = if (acceptWorkResultConditions(i.caller, taskId, winnerIdentifier)) | |
338 | + | then { | |
258 | 339 | let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward")) | |
259 | 340 | let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_leader")) | |
260 | - | ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), " | |
341 | + | ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "team_choosen"), DataEntry((((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_process"), "winner"), DataEntry((("tasks_" + taskId) + "_report"), reportLink)]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)])) | |
261 | 342 | } | |
343 | + | else throw("checks are not passed") | |
262 | 344 | ||
263 | 345 | ||
264 | 346 | ||
265 | 347 | @Callable(i) | |
266 | 348 | func rejectTask (taskId) = if (!(isGroupMember(i.caller))) | |
267 | 349 | then throw("grants working group access only") | |
268 | 350 | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected")]) | |
269 | 351 | ||
270 | 352 |
github/deemru/w8io/169f3d6 77.74 ms ◑