tx · HR7iWwCxPc8HbX878WDmwLj9JY3RCAkJZTrcLwokNHFm 3MtV1AQ8fEPk76tjKgvrufuMe5aA3q4TviQ: -0.10000000 Waves 2020.11.30 20:18 [1288446] smart account 3MtV1AQ8fEPk76tjKgvrufuMe5aA3q4TviQ > SELF 0.00000000 Waves
{ "type": 13, "id": "HR7iWwCxPc8HbX878WDmwLj9JY3RCAkJZTrcLwokNHFm", "fee": 10000000, "feeAssetId": null, "timestamp": 1606756729555, "version": 2, "chainId": 84, "sender": "3MtV1AQ8fEPk76tjKgvrufuMe5aA3q4TviQ", "senderPublicKey": "3Fjao2FW1JXSPd5EkP7C3uerW18HYacYsaMYALFMGA6N", "proofs": [ "3LD9wGYKDwHopJxTAhkcAZtgJcfKLtDSnAEVC4DwRs847NorW1UADVjkRe2S5384fpE8AJrLG9zaNoe8JcY5v6KL" ], "script": "base64:AAIDAAAAAAAAAC4IARIECgIICBIECgIIARIDCgEIEgQKAggBEgMKAQgSAwoBCBIDCgEIEgQKAggIAAAACQAAAAAGUVVPUlVNAAAAAAAAAAABAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAUAAAADdmFsAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAAFAAAAA3ZhbAAAAAAMbWFpbkNvbnRyYWN0BQAAAAR0aGlzAQAAAAdpc093bmVyAAAAAQAAAAdhZGRyZXNzCQAAAAAAAAIFAAAAB2FkZHJlc3MFAAAABHRoaXMB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AAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAALdGVhbUFkZHJlc3MFAAAADHJld2FyZEFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAAD5jh+k=", "height": 1288446, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5PCnFypGYzFyQDDeSAKVcua3qAfnjdXBkx2BVVymKftH Next: 5uBktXog3ByE1idHffyb4MYdrjQcr9nEfqceXndzDaVm Diff:
Old | New | Differences | |
---|---|---|---|
27 | 27 | ||
28 | 28 | let mainContract = this | |
29 | 29 | ||
30 | - | func isOwner (address) = if ((address == this)) | |
31 | - | then true | |
32 | - | else (address == mainContract) | |
30 | + | func isOwner (address) = (address == this) | |
33 | 31 | ||
34 | 32 | ||
35 | 33 | func getGroup () = { | |
77 | 75 | ||
78 | 76 | ||
79 | 77 | @Callable(i) | |
80 | - | func addTask (title,link) = if (!(isGroupMember(i.caller))) | |
81 | - | then throw("grants working group access only") | |
82 | - | else WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)]) | |
78 | + | func addTask (title,link) = WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)]) | |
83 | 79 | ||
84 | 80 | ||
85 | 81 | ||
86 | 82 | @Callable(i) | |
87 | - | func addTaskDetails (taskId,detailsLink) = if (!(isGroupMember(i.caller))) | |
83 | + | func addTaskDetails (taskId,reward) = { | |
84 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
85 | + | if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
86 | + | then throw("team leader only") | |
87 | + | else WriteSet([DataEntry((("tasks_" + taskId) + "_requestedreward"), reward)]) | |
88 | + | } | |
89 | + | ||
90 | + | ||
91 | + | ||
92 | + | @Callable(i) | |
93 | + | func initTaskVoting (taskId) = if (!(isGroupMember(i.caller))) | |
88 | 94 | then throw("grants working group access only") | |
89 | - | else { | |
90 | - | let reward = extract(i.payment).amount | |
91 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_reward"), reward), DataEntry((("tasks_" + taskId) + "_details"), detailsLink), DataEntry((("tasks_" + taskId) + "_status"), "proposed")]) | |
92 | - | } | |
95 | + | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "voting_started")]) | |
93 | 96 | ||
94 | 97 | ||
95 | 98 | ||
129 | 132 | let votingState = tryGetInteger(votingKey) | |
130 | 133 | if ((votingState > 0)) | |
131 | 134 | then { | |
132 | - | let votingResult = " | |
135 | + | let votingResult = "approved" | |
133 | 136 | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
134 | 137 | } | |
135 | 138 | else { | |
141 | 144 | ||
142 | 145 | ||
143 | 146 | @Callable(i) | |
144 | - | func applyForTask (taskId,teamName,link) = { | |
145 | - | let status = tryGetString((("tasks_" + taskId) + "_status")) | |
146 | - | if ((status != "ready_to_apply")) | |
147 | - | then throw("This grant has not yet been approved") | |
148 | - | else { | |
149 | - | let listKey = (("tasks_" + taskId) + "_applicants") | |
150 | - | let currentApplicantsList = tryGetString(listKey) | |
151 | - | let applicantKey = drop(toString(i.caller), 10) | |
152 | - | let leader = toString(i.caller) | |
153 | - | let newApplicantsList = ((currentApplicantsList + ";") + leader) | |
154 | - | 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)]) | |
155 | - | } | |
147 | + | func startWork (taskId) = { | |
148 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
149 | + | if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
150 | + | then throw("team leader only") | |
151 | + | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started")]) | |
156 | 152 | } | |
157 | - | ||
158 | - | ||
159 | - | ||
160 | - | @Callable(i) | |
161 | - | func voteForApplicant (taskId,teamIdentifier,voteValue) = if (!(canMemberVote(i))) | |
162 | - | then throw("you can't vote") | |
163 | - | else { | |
164 | - | let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10)) | |
165 | - | let voteKey = ((("tasks_" + taskId) + "_vote_") + voteHash) | |
166 | - | let vote = tryGetInteger(voteKey) | |
167 | - | if ((vote != 0)) | |
168 | - | then throw("you have already voted on this team") | |
169 | - | else { | |
170 | - | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
171 | - | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score") | |
172 | - | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
173 | - | let newTeamScore = (voteValue + tryGetInteger(teamScoreKey)) | |
174 | - | WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)]) | |
175 | - | } | |
176 | - | } | |
177 | - | ||
178 | - | ||
179 | - | ||
180 | - | @Callable(i) | |
181 | - | func finishApplicantsVoting (taskId) = { | |
182 | - | let minVotesToApproveApplicant = 1 | |
183 | - | if (!(isGroupMember(i.caller))) | |
184 | - | then throw("grants working group access only") | |
185 | - | else { | |
186 | - | let listKeys = tryGetString((("tasks_" + taskId) + "_applicants")) | |
187 | - | let applicantsList = split(listKeys, ";") | |
188 | - | if ((size(applicantsList) == 0)) | |
189 | - | then throw("No one has applied to the hackathon, yet") | |
190 | - | else WriteSet([DataEntry((("tasks_" + taskId) + "_performer"), listKeys), DataEntry((("tasks_" + taskId) + "_status"), "ready_to_submit")]) | |
191 | - | } | |
192 | - | } | |
193 | - | ||
194 | - | ||
195 | - | ||
196 | - | @Callable(i) | |
197 | - | func enableSubmissions (taskId,juryList) = if (!(isGroupMember(i.caller))) | |
198 | - | then throw("grants working group access only") | |
199 | - | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started"), DataEntry((("tasks_" + taskId) + "_jury"), juryList)]) | |
200 | - | ||
201 | - | ||
202 | - | ||
203 | - | @Callable(i) | |
204 | - | func submitSolution (taskId,solutionLink) = { | |
205 | - | func areSubmissionsEnabled (taskId) = (tryGetString((("tasks_" + taskId) + "_status")) == "work_started") | |
206 | - | ||
207 | - | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
208 | - | if (!(areSubmissionsEnabled(taskId))) | |
209 | - | then throw("not possible to upload solution now") | |
210 | - | else if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
211 | - | then throw("team leader only") | |
212 | - | else WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_submitted"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solution"), solutionLink)]) | |
213 | - | } | |
214 | - | ||
215 | - | ||
216 | - | ||
217 | - | @Callable(i) | |
218 | - | func stopSubmissions (taskId) = if (!(isGroupMember(i.caller))) | |
219 | - | then throw("grants working group access only") | |
220 | - | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished")]) | |
221 | - | ||
222 | - | ||
223 | - | ||
224 | - | @Callable(i) | |
225 | - | func voteForSolution (taskId,teamIdentifier,voteValue) = { | |
226 | - | func isJuryMember (i,taskId) = true | |
227 | - | ||
228 | - | if (!(isJuryMember(i, taskId))) | |
229 | - | then throw("you can't vote") | |
230 | - | else { | |
231 | - | let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10)) | |
232 | - | let voteKey = ((("tasks_" + taskId) + "_solutionvote_") + voteHash) | |
233 | - | let vote = tryGetInteger(voteKey) | |
234 | - | if ((vote != 0)) | |
235 | - | then throw("you have already voted on this solution") | |
236 | - | else { | |
237 | - | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionvotes") | |
238 | - | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionscore") | |
239 | - | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
240 | - | let newTeamScore = (voteValue + tryGetInteger(teamScoreKey)) | |
241 | - | WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)]) | |
242 | - | } | |
243 | - | } | |
244 | - | } | |
245 | - | ||
246 | - | ||
247 | - | ||
248 | - | @Callable(i) | |
249 | - | func acceptWorkResult (taskId,winnerIdentifier,reportLink) = if (!(isGroupMember(i.caller))) | |
250 | - | then throw("grants working group access only") | |
251 | - | else { | |
252 | - | let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward")) | |
253 | - | let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_leader")) | |
254 | - | 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)])) | |
255 | - | } | |
256 | 153 | ||
257 | 154 | ||
258 | 155 | ||
261 | 158 | then throw("grants working group access only") | |
262 | 159 | else { | |
263 | 160 | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
264 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected")]) | |
161 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "rejected")]) | |
162 | + | } | |
163 | + | ||
164 | + | ||
165 | + | ||
166 | + | @Callable(i) | |
167 | + | func acceptWorkResult (taskId,reportLink) = if (!(isGroupMember(i.caller))) | |
168 | + | then throw("grants working group access only") | |
169 | + | else { | |
170 | + | let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward")) | |
171 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
172 | + | let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")) | |
173 | + | ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_report"), reportLink)]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)])) | |
265 | 174 | } | |
266 | 175 | ||
267 | 176 |
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 | let mainContract = this | |
29 | 29 | ||
30 | - | func isOwner (address) = if ((address == this)) | |
31 | - | then true | |
32 | - | else (address == mainContract) | |
30 | + | func isOwner (address) = (address == this) | |
33 | 31 | ||
34 | 32 | ||
35 | 33 | func getGroup () = { | |
36 | 34 | let val = match getString(mainContract, "working_group_members") { | |
37 | 35 | case b: String => | |
38 | 36 | b | |
39 | 37 | case _ => | |
40 | 38 | "" | |
41 | 39 | } | |
42 | 40 | val | |
43 | 41 | } | |
44 | 42 | ||
45 | 43 | ||
46 | 44 | func getMembers () = { | |
47 | 45 | let val = match getString(mainContract, "dao_members") { | |
48 | 46 | case b: String => | |
49 | 47 | b | |
50 | 48 | case _ => | |
51 | 49 | "" | |
52 | 50 | } | |
53 | 51 | val | |
54 | 52 | } | |
55 | 53 | ||
56 | 54 | ||
57 | 55 | func isGroupMember (a) = { | |
58 | 56 | let val = match getInteger(mainContract, (("working_group_member_" + toString(a)) + "_weight")) { | |
59 | 57 | case b: Int => | |
60 | 58 | b | |
61 | 59 | case _ => | |
62 | 60 | 0 | |
63 | 61 | } | |
64 | 62 | (val > 0) | |
65 | 63 | } | |
66 | 64 | ||
67 | 65 | ||
68 | 66 | func canMemberVote (i) = { | |
69 | 67 | let val = match getInteger(mainContract, (("dao_member_" + toString(i.caller)) + "_weight")) { | |
70 | 68 | case b: Int => | |
71 | 69 | b | |
72 | 70 | case _ => | |
73 | 71 | 0 | |
74 | 72 | } | |
75 | 73 | (val > 0) | |
76 | 74 | } | |
77 | 75 | ||
78 | 76 | ||
79 | 77 | @Callable(i) | |
80 | - | func addTask (title,link) = if (!(isGroupMember(i.caller))) | |
81 | - | then throw("grants working group access only") | |
82 | - | else WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)]) | |
78 | + | func addTask (title,link) = WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)]) | |
83 | 79 | ||
84 | 80 | ||
85 | 81 | ||
86 | 82 | @Callable(i) | |
87 | - | func addTaskDetails (taskId,detailsLink) = if (!(isGroupMember(i.caller))) | |
83 | + | func addTaskDetails (taskId,reward) = { | |
84 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
85 | + | if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
86 | + | then throw("team leader only") | |
87 | + | else WriteSet([DataEntry((("tasks_" + taskId) + "_requestedreward"), reward)]) | |
88 | + | } | |
89 | + | ||
90 | + | ||
91 | + | ||
92 | + | @Callable(i) | |
93 | + | func initTaskVoting (taskId) = if (!(isGroupMember(i.caller))) | |
88 | 94 | then throw("grants working group access only") | |
89 | - | else { | |
90 | - | let reward = extract(i.payment).amount | |
91 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_reward"), reward), DataEntry((("tasks_" + taskId) + "_details"), detailsLink), DataEntry((("tasks_" + taskId) + "_status"), "proposed")]) | |
92 | - | } | |
95 | + | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "voting_started")]) | |
93 | 96 | ||
94 | 97 | ||
95 | 98 | ||
96 | 99 | @Callable(i) | |
97 | 100 | func voteForTaskProposal (taskId,voteValue) = if (!(canMemberVote(i))) | |
98 | 101 | then throw("you can't vote") | |
99 | 102 | else if ((getStringValue(this, (("tasks_" + taskId) + "_status")) != "proposed")) | |
100 | 103 | then throw("voting is closed or not started") | |
101 | 104 | else if (if ((voteValue != -1)) | |
102 | 105 | then (voteValue != 1) | |
103 | 106 | else false) | |
104 | 107 | then throw("you need to vote 1 or -1") | |
105 | 108 | else { | |
106 | 109 | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
107 | 110 | let previousVote = tryGetInteger(voteKey) | |
108 | 111 | if (!((previousVote == 0))) | |
109 | 112 | then throw("you have already voted") | |
110 | 113 | else { | |
111 | 114 | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
112 | 115 | let votingState = tryGetInteger(votingKey) | |
113 | 116 | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
114 | 117 | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
115 | 118 | let newVotingState = (votingState + voteValue) | |
116 | 119 | ScriptResult(WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, voteValue), DataEntry(votesAmountKey, votesAmountState)]), TransferSet([ScriptTransfer(i.caller, 500000, unit)])) | |
117 | 120 | } | |
118 | 121 | } | |
119 | 122 | ||
120 | 123 | ||
121 | 124 | ||
122 | 125 | @Callable(i) | |
123 | 126 | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / tryGetInteger("dao_size")))) | |
124 | 127 | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
125 | 128 | else if (!(isGroupMember(i.caller))) | |
126 | 129 | then throw("grants working group access only") | |
127 | 130 | else { | |
128 | 131 | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
129 | 132 | let votingState = tryGetInteger(votingKey) | |
130 | 133 | if ((votingState > 0)) | |
131 | 134 | then { | |
132 | - | let votingResult = " | |
135 | + | let votingResult = "approved" | |
133 | 136 | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
134 | 137 | } | |
135 | 138 | else { | |
136 | 139 | let votingResult = "rejected" | |
137 | 140 | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
138 | 141 | } | |
139 | 142 | } | |
140 | 143 | ||
141 | 144 | ||
142 | 145 | ||
143 | 146 | @Callable(i) | |
144 | - | func applyForTask (taskId,teamName,link) = { | |
145 | - | let status = tryGetString((("tasks_" + taskId) + "_status")) | |
146 | - | if ((status != "ready_to_apply")) | |
147 | - | then throw("This grant has not yet been approved") | |
148 | - | else { | |
149 | - | let listKey = (("tasks_" + taskId) + "_applicants") | |
150 | - | let currentApplicantsList = tryGetString(listKey) | |
151 | - | let applicantKey = drop(toString(i.caller), 10) | |
152 | - | let leader = toString(i.caller) | |
153 | - | let newApplicantsList = ((currentApplicantsList + ";") + leader) | |
154 | - | 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)]) | |
155 | - | } | |
147 | + | func startWork (taskId) = { | |
148 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
149 | + | if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
150 | + | then throw("team leader only") | |
151 | + | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started")]) | |
156 | 152 | } | |
157 | - | ||
158 | - | ||
159 | - | ||
160 | - | @Callable(i) | |
161 | - | func voteForApplicant (taskId,teamIdentifier,voteValue) = if (!(canMemberVote(i))) | |
162 | - | then throw("you can't vote") | |
163 | - | else { | |
164 | - | let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10)) | |
165 | - | let voteKey = ((("tasks_" + taskId) + "_vote_") + voteHash) | |
166 | - | let vote = tryGetInteger(voteKey) | |
167 | - | if ((vote != 0)) | |
168 | - | then throw("you have already voted on this team") | |
169 | - | else { | |
170 | - | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
171 | - | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score") | |
172 | - | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
173 | - | let newTeamScore = (voteValue + tryGetInteger(teamScoreKey)) | |
174 | - | WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)]) | |
175 | - | } | |
176 | - | } | |
177 | - | ||
178 | - | ||
179 | - | ||
180 | - | @Callable(i) | |
181 | - | func finishApplicantsVoting (taskId) = { | |
182 | - | let minVotesToApproveApplicant = 1 | |
183 | - | if (!(isGroupMember(i.caller))) | |
184 | - | then throw("grants working group access only") | |
185 | - | else { | |
186 | - | let listKeys = tryGetString((("tasks_" + taskId) + "_applicants")) | |
187 | - | let applicantsList = split(listKeys, ";") | |
188 | - | if ((size(applicantsList) == 0)) | |
189 | - | then throw("No one has applied to the hackathon, yet") | |
190 | - | else WriteSet([DataEntry((("tasks_" + taskId) + "_performer"), listKeys), DataEntry((("tasks_" + taskId) + "_status"), "ready_to_submit")]) | |
191 | - | } | |
192 | - | } | |
193 | - | ||
194 | - | ||
195 | - | ||
196 | - | @Callable(i) | |
197 | - | func enableSubmissions (taskId,juryList) = if (!(isGroupMember(i.caller))) | |
198 | - | then throw("grants working group access only") | |
199 | - | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started"), DataEntry((("tasks_" + taskId) + "_jury"), juryList)]) | |
200 | - | ||
201 | - | ||
202 | - | ||
203 | - | @Callable(i) | |
204 | - | func submitSolution (taskId,solutionLink) = { | |
205 | - | func areSubmissionsEnabled (taskId) = (tryGetString((("tasks_" + taskId) + "_status")) == "work_started") | |
206 | - | ||
207 | - | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
208 | - | if (!(areSubmissionsEnabled(taskId))) | |
209 | - | then throw("not possible to upload solution now") | |
210 | - | else if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
211 | - | then throw("team leader only") | |
212 | - | else WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_submitted"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solution"), solutionLink)]) | |
213 | - | } | |
214 | - | ||
215 | - | ||
216 | - | ||
217 | - | @Callable(i) | |
218 | - | func stopSubmissions (taskId) = if (!(isGroupMember(i.caller))) | |
219 | - | then throw("grants working group access only") | |
220 | - | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished")]) | |
221 | - | ||
222 | - | ||
223 | - | ||
224 | - | @Callable(i) | |
225 | - | func voteForSolution (taskId,teamIdentifier,voteValue) = { | |
226 | - | func isJuryMember (i,taskId) = true | |
227 | - | ||
228 | - | if (!(isJuryMember(i, taskId))) | |
229 | - | then throw("you can't vote") | |
230 | - | else { | |
231 | - | let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10)) | |
232 | - | let voteKey = ((("tasks_" + taskId) + "_solutionvote_") + voteHash) | |
233 | - | let vote = tryGetInteger(voteKey) | |
234 | - | if ((vote != 0)) | |
235 | - | then throw("you have already voted on this solution") | |
236 | - | else { | |
237 | - | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionvotes") | |
238 | - | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionscore") | |
239 | - | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
240 | - | let newTeamScore = (voteValue + tryGetInteger(teamScoreKey)) | |
241 | - | WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)]) | |
242 | - | } | |
243 | - | } | |
244 | - | } | |
245 | - | ||
246 | - | ||
247 | - | ||
248 | - | @Callable(i) | |
249 | - | func acceptWorkResult (taskId,winnerIdentifier,reportLink) = if (!(isGroupMember(i.caller))) | |
250 | - | then throw("grants working group access only") | |
251 | - | else { | |
252 | - | let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward")) | |
253 | - | let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_leader")) | |
254 | - | 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)])) | |
255 | - | } | |
256 | 153 | ||
257 | 154 | ||
258 | 155 | ||
259 | 156 | @Callable(i) | |
260 | 157 | func rejectTask (taskId) = if (!(isGroupMember(i.caller))) | |
261 | 158 | then throw("grants working group access only") | |
262 | 159 | else { | |
263 | 160 | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
264 | - | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected")]) | |
161 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "rejected")]) | |
162 | + | } | |
163 | + | ||
164 | + | ||
165 | + | ||
166 | + | @Callable(i) | |
167 | + | func acceptWorkResult (taskId,reportLink) = if (!(isGroupMember(i.caller))) | |
168 | + | then throw("grants working group access only") | |
169 | + | else { | |
170 | + | let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward")) | |
171 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
172 | + | let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")) | |
173 | + | ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_report"), reportLink)]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)])) | |
265 | 174 | } | |
266 | 175 | ||
267 | 176 |
github/deemru/w8io/169f3d6 56.34 ms ◑