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