tx · 5TpwqYSbWw3yrqV8taWPud8oKtC3j97perB4hoVJHTCt 3MvqnYLwBErxGtKzeEjgWgr2RXgniokicR2: -0.01400000 Waves 2020.11.20 00:56 [1272805] smart account 3MvqnYLwBErxGtKzeEjgWgr2RXgniokicR2 > SELF 0.00000000 Waves
{ "type": 13, "id": "5TpwqYSbWw3yrqV8taWPud8oKtC3j97perB4hoVJHTCt", "fee": 1400000, "feeAssetId": null, "timestamp": 1605822996980, "version": 2, "chainId": 84, "sender": "3MvqnYLwBErxGtKzeEjgWgr2RXgniokicR2", "senderPublicKey": "3dxKqzB5AWentnFkyzLnbnRfN2iRWgE7Q4paMwfi9MoT", "proofs": [ "2XZNpnDCWiV4NTRZajyrNWJjPdoDhw14tgBimpnuUSfz6RsS9frDnTmEMQ7jm4ZXizphVsSueyLwiCo6ayApYhPC" ], "script": "base64:AAIDAAAAAAAAAEYIARIDCgEIEgMKAQgSBAoCCAgSBAoCCAgSBAoCCAESAwoBCBIFCgMICAgSBQoDCAgBEgMKAQgSAwoBCBIDCgEIEgQKAggIAAAACAAAAAAGUVVPUlVNAAAAAAAAAAABAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAUAAAADdmFsAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAAFAAAAA3ZhbAEAAAAHaXNPd25lcgAAAAEAAAAHYWRkcmVzcwkAAAAAAAACBQAAAAdhZGRyZXNzBQAAAAR0aGlzAQAAAAhn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ABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAGdGFza3NfBQAAAAZ0YXNrSWQCAAAABV9hcHBfBQAAAA50ZWFtSWRlbnRpZmllcgIAAAAHX2xlYWRlcgkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAZ0YXNrc18FAAAABnRhc2tJZAIAAAAHX3N0YXR1cwIAAAANd29ya19maW5pc2hlZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAZ0YXNrc18FAAAABnRhc2tJZAIAAAAFX2FwcF8FAAAADnRlYW1JZGVudGlmaWVyAgAAAAhfcHJvY2VzcwIAAAANd29ya19maW5pc2hlZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAZ0YXNrc18FAAAABnRhc2tJZAIAAAAFX2FwcF8FAAAADnRlYW1JZGVudGlmaWVyAgAAAAdfcmVwb3J0BQAAAApyZXBvcnRMaW5rBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAAt0ZWFtQWRkcmVzcwUAAAAMcmV3YXJkQW1vdW50BQAAAAR1bml0BQAAAANuaWwAAAAAOdsfJg==", "height": 1272805, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 25pk9sPbXUGhnRhfTSbeWTuypf9KAQnPKdMi6HGtk2we Next: FFUiSeMjjF2chK26uaofxuRkrM1cjqgLbUCcFWmbkyzk Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let QUORUM = 50 | |
5 | - | ||
6 | - | let WCTid = base58'4zfrrwDVjbGFM8wxbZGriVLY4XJsVD4oNMp21FnDnMAa' | |
4 | + | let QUORUM = 1 | |
7 | 5 | ||
8 | 6 | func tryGetInteger (key) = { | |
9 | 7 | let val = match getInteger(this, key) { | |
11 | 9 | b | |
12 | 10 | case _ => | |
13 | 11 | 0 | |
12 | + | } | |
13 | + | val | |
14 | + | } | |
15 | + | ||
16 | + | ||
17 | + | func tryGetString (key) = { | |
18 | + | let val = match getString(this, key) { | |
19 | + | case b: String => | |
20 | + | b | |
21 | + | case _ => | |
22 | + | "" | |
14 | 23 | } | |
15 | 24 | val | |
16 | 25 | } | |
41 | 50 | } | |
42 | 51 | ||
43 | 52 | ||
44 | - | func isGroupMember (a) = (tryGetInteger(("group_member | |
53 | + | func isGroupMember (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0) | |
45 | 54 | ||
46 | 55 | ||
47 | - | func canMemberVote (i) = (tryGetInteger(("dao_member | |
56 | + | func canMemberVote (i) = (tryGetInteger((("dao_member_" + toString(i.caller)) + "_weight")) > 0) | |
48 | 57 | ||
49 | 58 | ||
50 | 59 | @Callable(i) | |
51 | 60 | func addDAOMember (memberAddress) = if (!(isOwner(i.caller))) | |
52 | 61 | then throw("access only to the DAO owner") | |
53 | - | else { | |
54 | - | let group = getMembers() | |
55 | - | let newGroup = ((group + ";") + memberAddress) | |
56 | - | let groupSize = tryGetInteger("dao_size") | |
57 | - | let newGroupSize = (groupSize + 1) | |
58 | - | WriteSet([DataEntry("dao_members", newGroup), DataEntry("dao_size", newGroupSize), DataEntry(("dao_member_weight_" + memberAddress), 1)]) | |
59 | - | } | |
62 | + | else if ((tryGetInteger((("dao_member_" + memberAddress) + "_weight")) == 1)) | |
63 | + | then throw("This user already exists") | |
64 | + | else { | |
65 | + | let group = getMembers() | |
66 | + | let newGroup = ((group + ";") + memberAddress) | |
67 | + | let groupSize = tryGetInteger("dao_size") | |
68 | + | let newGroupSize = (groupSize + 1) | |
69 | + | WriteSet([DataEntry("dao_members", newGroup), DataEntry("dao_size", newGroupSize), DataEntry((("dao_member_" + memberAddress) + "_weight"), 1)]) | |
70 | + | } | |
60 | 71 | ||
61 | 72 | ||
62 | 73 | ||
63 | 74 | @Callable(i) | |
64 | 75 | func addGroupMember (memberAddress) = if (!(isOwner(i.caller))) | |
65 | 76 | then throw("access only to the DAO owner") | |
66 | - | else { | |
67 | - | let group = getGroup() | |
68 | - | let newGroup = ((group + ";") + memberAddress) | |
69 | - | let groupSize = tryGetInteger("working_group_size") | |
70 | - | let newGroupSize = (groupSize + 1) | |
71 | - | WriteSet([DataEntry("working_group", newGroup), DataEntry("working_group_size", newGroupSize), DataEntry(("group_member_weight_" + memberAddress), 1)]) | |
72 | - | } | |
77 | + | else if ((tryGetInteger((("working_group_member_" + memberAddress) + "_weight")) == 1)) | |
78 | + | then throw("This user already exists") | |
79 | + | else { | |
80 | + | let group = getGroup() | |
81 | + | let newGroup = ((group + ";") + memberAddress) | |
82 | + | let groupSize = tryGetInteger("working_group_size") | |
83 | + | let newGroupSize = (groupSize + 1) | |
84 | + | WriteSet([DataEntry("working_group_name", newGroup), DataEntry("working_group_size", newGroupSize), DataEntry((("working_group_member_" + memberAddress) + "_weight"), 1)]) | |
85 | + | } | |
73 | 86 | ||
74 | 87 | ||
75 | 88 | ||
76 | 89 | @Callable(i) | |
77 | - | func addTask (title) = if (!(isGroupMember(i.caller))) | |
90 | + | func addTask (title,link) = if (!(isGroupMember(i.caller))) | |
78 | 91 | then throw("grants working group access only") | |
79 | - | else WriteSet([DataEntry((toBase58String(i.transactionId) + "_ | |
92 | + | else WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)]) | |
80 | 93 | ||
81 | 94 | ||
82 | 95 | ||
83 | 96 | @Callable(i) | |
84 | - | func rateTask (taskId,rate) = if (!(if ((rate == 1)) | |
85 | - | then true | |
86 | - | else (rate == -1))) | |
87 | - | then throw("your rate needs to be +1 or -1") | |
88 | - | else { | |
89 | - | let pmt = extract(i.payment) | |
90 | - | if ((pmt.assetId != WCTid)) | |
91 | - | then throw("you need to vote using WCT") | |
92 | - | else { | |
93 | - | let weight = pmt.amount | |
94 | - | let vote = (rate * weight) | |
95 | - | let previousRate = tryGetInteger((taskId + "_community_rate")) | |
96 | - | ScriptResult(WriteSet([DataEntry((taskId + "_community_rate"), (previousRate + vote))]), TransferSet([ScriptTransfer(i.caller, pmt.amount, pmt.assetId)])) | |
97 | - | } | |
98 | - | } | |
99 | - | ||
100 | - | ||
101 | - | ||
102 | - | @Callable(i) | |
103 | - | func addTaskDetails (taskId) = if (!(isGroupMember(i.caller))) | |
97 | + | func addTaskDetails (taskId,detailsLink) = if (!(isGroupMember(i.caller))) | |
104 | 98 | then throw("grants working group access only") | |
105 | 99 | else { | |
106 | 100 | let reward = extract(i.payment).amount | |
107 | - | WriteSet([DataEntry((taskId + "_reward"), reward), DataEntry((taskId + "_status"), "proposed")]) | |
101 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_reward"), reward), DataEntry((("tasks_" + taskId) + "_details"), detailsLink), DataEntry((("tasks_" + taskId) + "_status"), "proposed")]) | |
108 | 102 | } | |
109 | 103 | ||
110 | 104 | ||
112 | 106 | @Callable(i) | |
113 | 107 | func voteForTaskProposal (taskId,voteValue) = if (!(canMemberVote(i))) | |
114 | 108 | then throw("you can't vote") | |
115 | - | else if ((getStringValue(this, (taskId + "_status")) != "proposed")) | |
109 | + | else if ((getStringValue(this, (("tasks_" + taskId) + "_status")) != "proposed")) | |
116 | 110 | then throw("voting is closed or not started") | |
117 | 111 | else if (if ((voteValue != -1)) | |
118 | 112 | then (voteValue != 1) | |
119 | 113 | else false) | |
120 | 114 | then throw("you need to vote 1 or -1") | |
121 | 115 | else { | |
122 | - | let voteKey = (((taskId + "_") + toString(i.caller)) | |
116 | + | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
123 | 117 | let previousVote = tryGetInteger(voteKey) | |
124 | 118 | if (!((previousVote == 0))) | |
125 | 119 | then throw("you have already voted") | |
126 | 120 | else { | |
127 | - | let votingKey = (taskId + "_ | |
121 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
128 | 122 | let votingState = tryGetInteger(votingKey) | |
129 | - | let votesAmountKey = (taskId + "_ | |
123 | + | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
130 | 124 | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
131 | 125 | let newVotingState = (votingState + voteValue) | |
132 | 126 | ScriptResult(WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, voteValue), DataEntry(votesAmountKey, votesAmountState)]), TransferSet([ScriptTransfer(i.caller, 500000, unit)])) | |
136 | 130 | ||
137 | 131 | ||
138 | 132 | @Callable(i) | |
139 | - | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((taskId + "_ | |
133 | + | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / tryGetInteger("dao_size")))) | |
140 | 134 | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
141 | 135 | else if (!(isGroupMember(i.caller))) | |
142 | 136 | then throw("grants working group access only") | |
143 | 137 | else { | |
144 | - | let votingKey = (taskId + "_ | |
138 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
145 | 139 | let votingState = tryGetInteger(votingKey) | |
146 | 140 | if ((votingState > 0)) | |
147 | 141 | then { | |
148 | 142 | let votingResult = "ready_to_apply" | |
149 | - | WriteSet([DataEntry((taskId + "_status"), votingResult)]) | |
143 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
150 | 144 | } | |
151 | 145 | else { | |
152 | 146 | let votingResult = "rejected" | |
153 | - | WriteSet([DataEntry((taskId + "_status"), votingResult)]) | |
147 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
154 | 148 | } | |
155 | 149 | } | |
156 | 150 | ||
157 | 151 | ||
158 | 152 | ||
159 | 153 | @Callable(i) | |
160 | - | func applyForTask (taskId,teamName) = { | |
161 | - | let listKey = (taskId + "_applicants") | |
162 | - | let currentApplicantsList = match getString(this, listKey) { | |
163 | - | case b: String => | |
164 | - | b | |
165 | - | case _ => | |
166 | - | "" | |
167 | - | } | |
168 | - | let newApplicantsList = ((currentApplicantsList + ";") + teamName) | |
169 | - | WriteSet([DataEntry((((taskId + "_applicant_") + teamName) + "_leader"), toString(i.caller)), DataEntry(listKey, newApplicantsList)]) | |
154 | + | func applyForTask (taskId,teamName,link) = { | |
155 | + | let status = tryGetString((("tasks_" + taskId) + "_status")) | |
156 | + | if ((status != "ready_to_apply")) | |
157 | + | then throw("This grant has not yet been approved") | |
158 | + | else { | |
159 | + | let listKey = (("tasks_" + taskId) + "_applicants") | |
160 | + | let currentApplicantsList = tryGetString(listKey) | |
161 | + | let applicantKey = drop(toString(i.caller), 10) | |
162 | + | let newApplicantsList = ((currentApplicantsList + ";") + toString(i.caller)) | |
163 | + | 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)]) | |
164 | + | } | |
170 | 165 | } | |
171 | 166 | ||
172 | 167 | ||
173 | 168 | ||
174 | 169 | @Callable(i) | |
175 | - | func voteForApplicant (taskId, | |
170 | + | func voteForApplicant (taskId,teamIdentifier,voteValue) = if (!(canMemberVote(i))) | |
176 | 171 | then throw("you can't vote") | |
177 | 172 | else { | |
178 | - | let voteKey = ((((taskId + "_") + toString(i.caller)) + "_vote_") + teamName) | |
173 | + | let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10)) | |
174 | + | let voteKey = ((("tasks_" + taskId) + "_vote_") + voteHash) | |
179 | 175 | let vote = tryGetInteger(voteKey) | |
180 | 176 | if ((vote != 0)) | |
181 | 177 | then throw("you have already voted on this team") | |
182 | 178 | else { | |
183 | - | let teamVotesAmountKey = (((taskId + "_ | |
184 | - | let teamScoreKey = (((taskId + "_ | |
179 | + | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
180 | + | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score") | |
185 | 181 | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
186 | 182 | let newTeamScore = (voteValue + tryGetInteger(teamScoreKey)) | |
187 | 183 | WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)]) | |
193 | 189 | @Callable(i) | |
194 | 190 | func finishApplicantsVoting (taskId) = { | |
195 | 191 | func isApplicantVotedEnough (aid,aid2) = { | |
196 | - | let listKey = (taskId + "_applicants") | |
192 | + | let listKey = (("tasks_" + taskId) + "_applicants") | |
197 | 193 | let applicantsList = split(getStringValue(this, listKey), ";") | |
198 | - | let | |
199 | - | let teamVotesAmountKey = (((taskId + "_ | |
194 | + | let teamIdentifier = applicantsList[aid] | |
195 | + | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
200 | 196 | let teamVotesAmount = tryGetInteger(teamVotesAmountKey) | |
201 | 197 | if ((teamVotesAmount > 0)) | |
202 | 198 | then 1 | |
203 | - | else throw(("not enough votes to make decision on " + | |
199 | + | else throw(("not enough votes to make decision on " + teamIdentifier)) | |
204 | 200 | } | |
205 | 201 | ||
206 | 202 | func hasMoreVotes (aid,aid2) = { | |
207 | - | let listKey = (taskId + "_applicants") | |
203 | + | let listKey = (("tasks_" + taskId) + "_applicants") | |
208 | 204 | let applicantsList = split(getStringValue(this, listKey), ";") | |
209 | - | let | |
210 | - | let teamVotesAmountKey = (((taskId + "_ | |
205 | + | let teamIdentifier = applicantsList[aid] | |
206 | + | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
211 | 207 | let teamVotesAmount = tryGetInteger(teamVotesAmountKey) | |
212 | - | let | |
213 | - | let team2VotesAmountKey = (((taskId + "_ | |
208 | + | let team2Identifier = applicantsList[aid2] | |
209 | + | let team2VotesAmountKey = (((("tasks_" + taskId) + "_app_") + team2Identifier) + "_votes") | |
214 | 210 | let team2VotesAmount = tryGetInteger(team2VotesAmountKey) | |
215 | 211 | if ((teamVotesAmount > team2VotesAmount)) | |
216 | 212 | then aid | |
220 | 216 | if (!(isGroupMember(i.caller))) | |
221 | 217 | then throw("grants working group access only") | |
222 | 218 | else { | |
223 | - | let chosenTeamId = { | |
224 | - | let $list85228553 = [0, 1] | |
225 | - | let $size85228553 = size($list85228553) | |
226 | - | let $acc085228553 = 0 | |
227 | - | if (($size85228553 == 0)) | |
228 | - | then $acc085228553 | |
229 | - | else { | |
230 | - | let $acc185228553 = hasMoreVotes($acc085228553, $list85228553[0]) | |
231 | - | if (($size85228553 == 1)) | |
232 | - | then $acc185228553 | |
219 | + | let listKeys = tryGetString((("tasks_" + taskId) + "_applicants")) | |
220 | + | let applicantsList = split(listKeys, ";") | |
221 | + | if ((size(applicantsList) == 0)) | |
222 | + | then throw("No one has yet responded to the grant") | |
223 | + | else { | |
224 | + | let chosenTeamId = { | |
225 | + | let $list1113111162 = [0, 1] | |
226 | + | let $size1113111162 = size($list1113111162) | |
227 | + | let $acc01113111162 = 0 | |
228 | + | if (($size1113111162 == 0)) | |
229 | + | then $acc01113111162 | |
233 | 230 | else { | |
234 | - | let $ | |
235 | - | if (($ | |
236 | - | then $ | |
231 | + | let $acc11113111162 = hasMoreVotes($acc01113111162, $list1113111162[0]) | |
232 | + | if (($size1113111162 == 1)) | |
233 | + | then $acc11113111162 | |
237 | 234 | else { | |
238 | - | let $acc385228553 = hasMoreVotes($acc285228553, $list85228553[2]) | |
239 | - | throw("List size exceed 2") | |
235 | + | let $acc21113111162 = hasMoreVotes($acc11113111162, $list1113111162[1]) | |
236 | + | if (($size1113111162 == 2)) | |
237 | + | then $acc21113111162 | |
238 | + | else { | |
239 | + | let $acc31113111162 = hasMoreVotes($acc21113111162, $list1113111162[2]) | |
240 | + | throw("List size exceed 2") | |
241 | + | } | |
240 | 242 | } | |
241 | 243 | } | |
242 | 244 | } | |
243 | - | } | |
244 | - | let listKey = (taskId + "_applicants") | |
245 | - | let applicantsList = split(getStringValue(this, listKey), ";") | |
246 | - | let teamName = applicantsList[chosenTeamId] | |
247 | - | WriteSet([DataEntry((taskId + "_status"), "team_chosen"), DataEntry((taskId + "_performer"), teamName), DataEntry((((taskId + "_applicant_") + teamName) + "_work_process"), "can_begin")]) | |
245 | + | let teamIdentifier = applicantsList[chosenTeamId] | |
246 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "team_chosen"), DataEntry((("tasks_" + taskId) + "_performer"), teamIdentifier), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "can_begin")]) | |
247 | + | } | |
248 | 248 | } | |
249 | 249 | } | |
250 | 250 | ||
252 | 252 | ||
253 | 253 | @Callable(i) | |
254 | 254 | func startWork (taskId) = { | |
255 | - | let | |
256 | - | if ((toString(i.caller) != getStringValue(this, (((taskId + "_ | |
255 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
256 | + | if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
257 | 257 | then throw("team leader only") | |
258 | - | else WriteSet([DataEntry((taskId + "_status"), "work_started"), DataEntry((((taskId + "_ | |
258 | + | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_started")]) | |
259 | 259 | } | |
260 | 260 | ||
261 | 261 | ||
262 | 262 | ||
263 | 263 | @Callable(i) | |
264 | - | func | |
264 | + | func rejectTask (taskId) = if (!(isGroupMember(i.caller))) | |
265 | 265 | then throw("grants working group access only") | |
266 | 266 | else { | |
267 | - | let rewardAmount = tryGetInteger((taskId + "_reward")) | |
268 | - | let teamName = getStringValue(this, (taskId + "_performer")) | |
269 | - | let teamAddress = getStringValue(this, (((taskId + "_applicant_") + teamName) + "_leader")) | |
270 | - | ScriptResult(WriteSet([DataEntry((taskId + "_status"), "work_finished"), DataEntry((((taskId + "_applicant_") + teamName) + "_work_process"), "work_finished")]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)])) | |
267 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
268 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "rejected")]) | |
269 | + | } | |
270 | + | ||
271 | + | ||
272 | + | ||
273 | + | @Callable(i) | |
274 | + | func acceptWorkResult (taskId,reportLink) = if (!(isGroupMember(i.caller))) | |
275 | + | then throw("grants working group access only") | |
276 | + | else { | |
277 | + | let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward")) | |
278 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
279 | + | let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")) | |
280 | + | 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)])) | |
271 | 281 | } | |
272 | 282 | ||
273 | 283 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let QUORUM = 50 | |
5 | - | ||
6 | - | let WCTid = base58'4zfrrwDVjbGFM8wxbZGriVLY4XJsVD4oNMp21FnDnMAa' | |
4 | + | let QUORUM = 1 | |
7 | 5 | ||
8 | 6 | func tryGetInteger (key) = { | |
9 | 7 | let val = match getInteger(this, key) { | |
10 | 8 | case b: Int => | |
11 | 9 | b | |
12 | 10 | case _ => | |
13 | 11 | 0 | |
12 | + | } | |
13 | + | val | |
14 | + | } | |
15 | + | ||
16 | + | ||
17 | + | func tryGetString (key) = { | |
18 | + | let val = match getString(this, key) { | |
19 | + | case b: String => | |
20 | + | b | |
21 | + | case _ => | |
22 | + | "" | |
14 | 23 | } | |
15 | 24 | val | |
16 | 25 | } | |
17 | 26 | ||
18 | 27 | ||
19 | 28 | func isOwner (address) = (address == this) | |
20 | 29 | ||
21 | 30 | ||
22 | 31 | func getGroup () = { | |
23 | 32 | let val = match getString(this, "working_group") { | |
24 | 33 | case b: String => | |
25 | 34 | b | |
26 | 35 | case _ => | |
27 | 36 | "" | |
28 | 37 | } | |
29 | 38 | val | |
30 | 39 | } | |
31 | 40 | ||
32 | 41 | ||
33 | 42 | func getMembers () = { | |
34 | 43 | let val = match getString(this, "dao_members") { | |
35 | 44 | case b: String => | |
36 | 45 | b | |
37 | 46 | case _ => | |
38 | 47 | "" | |
39 | 48 | } | |
40 | 49 | val | |
41 | 50 | } | |
42 | 51 | ||
43 | 52 | ||
44 | - | func isGroupMember (a) = (tryGetInteger(("group_member | |
53 | + | func isGroupMember (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0) | |
45 | 54 | ||
46 | 55 | ||
47 | - | func canMemberVote (i) = (tryGetInteger(("dao_member | |
56 | + | func canMemberVote (i) = (tryGetInteger((("dao_member_" + toString(i.caller)) + "_weight")) > 0) | |
48 | 57 | ||
49 | 58 | ||
50 | 59 | @Callable(i) | |
51 | 60 | func addDAOMember (memberAddress) = if (!(isOwner(i.caller))) | |
52 | 61 | then throw("access only to the DAO owner") | |
53 | - | else { | |
54 | - | let group = getMembers() | |
55 | - | let newGroup = ((group + ";") + memberAddress) | |
56 | - | let groupSize = tryGetInteger("dao_size") | |
57 | - | let newGroupSize = (groupSize + 1) | |
58 | - | WriteSet([DataEntry("dao_members", newGroup), DataEntry("dao_size", newGroupSize), DataEntry(("dao_member_weight_" + memberAddress), 1)]) | |
59 | - | } | |
62 | + | else if ((tryGetInteger((("dao_member_" + memberAddress) + "_weight")) == 1)) | |
63 | + | then throw("This user already exists") | |
64 | + | else { | |
65 | + | let group = getMembers() | |
66 | + | let newGroup = ((group + ";") + memberAddress) | |
67 | + | let groupSize = tryGetInteger("dao_size") | |
68 | + | let newGroupSize = (groupSize + 1) | |
69 | + | WriteSet([DataEntry("dao_members", newGroup), DataEntry("dao_size", newGroupSize), DataEntry((("dao_member_" + memberAddress) + "_weight"), 1)]) | |
70 | + | } | |
60 | 71 | ||
61 | 72 | ||
62 | 73 | ||
63 | 74 | @Callable(i) | |
64 | 75 | func addGroupMember (memberAddress) = if (!(isOwner(i.caller))) | |
65 | 76 | then throw("access only to the DAO owner") | |
66 | - | else { | |
67 | - | let group = getGroup() | |
68 | - | let newGroup = ((group + ";") + memberAddress) | |
69 | - | let groupSize = tryGetInteger("working_group_size") | |
70 | - | let newGroupSize = (groupSize + 1) | |
71 | - | WriteSet([DataEntry("working_group", newGroup), DataEntry("working_group_size", newGroupSize), DataEntry(("group_member_weight_" + memberAddress), 1)]) | |
72 | - | } | |
77 | + | else if ((tryGetInteger((("working_group_member_" + memberAddress) + "_weight")) == 1)) | |
78 | + | then throw("This user already exists") | |
79 | + | else { | |
80 | + | let group = getGroup() | |
81 | + | let newGroup = ((group + ";") + memberAddress) | |
82 | + | let groupSize = tryGetInteger("working_group_size") | |
83 | + | let newGroupSize = (groupSize + 1) | |
84 | + | WriteSet([DataEntry("working_group_name", newGroup), DataEntry("working_group_size", newGroupSize), DataEntry((("working_group_member_" + memberAddress) + "_weight"), 1)]) | |
85 | + | } | |
73 | 86 | ||
74 | 87 | ||
75 | 88 | ||
76 | 89 | @Callable(i) | |
77 | - | func addTask (title) = if (!(isGroupMember(i.caller))) | |
90 | + | func addTask (title,link) = if (!(isGroupMember(i.caller))) | |
78 | 91 | then throw("grants working group access only") | |
79 | - | else WriteSet([DataEntry((toBase58String(i.transactionId) + "_ | |
92 | + | else WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)]) | |
80 | 93 | ||
81 | 94 | ||
82 | 95 | ||
83 | 96 | @Callable(i) | |
84 | - | func rateTask (taskId,rate) = if (!(if ((rate == 1)) | |
85 | - | then true | |
86 | - | else (rate == -1))) | |
87 | - | then throw("your rate needs to be +1 or -1") | |
88 | - | else { | |
89 | - | let pmt = extract(i.payment) | |
90 | - | if ((pmt.assetId != WCTid)) | |
91 | - | then throw("you need to vote using WCT") | |
92 | - | else { | |
93 | - | let weight = pmt.amount | |
94 | - | let vote = (rate * weight) | |
95 | - | let previousRate = tryGetInteger((taskId + "_community_rate")) | |
96 | - | ScriptResult(WriteSet([DataEntry((taskId + "_community_rate"), (previousRate + vote))]), TransferSet([ScriptTransfer(i.caller, pmt.amount, pmt.assetId)])) | |
97 | - | } | |
98 | - | } | |
99 | - | ||
100 | - | ||
101 | - | ||
102 | - | @Callable(i) | |
103 | - | func addTaskDetails (taskId) = if (!(isGroupMember(i.caller))) | |
97 | + | func addTaskDetails (taskId,detailsLink) = if (!(isGroupMember(i.caller))) | |
104 | 98 | then throw("grants working group access only") | |
105 | 99 | else { | |
106 | 100 | let reward = extract(i.payment).amount | |
107 | - | WriteSet([DataEntry((taskId + "_reward"), reward), DataEntry((taskId + "_status"), "proposed")]) | |
101 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_reward"), reward), DataEntry((("tasks_" + taskId) + "_details"), detailsLink), DataEntry((("tasks_" + taskId) + "_status"), "proposed")]) | |
108 | 102 | } | |
109 | 103 | ||
110 | 104 | ||
111 | 105 | ||
112 | 106 | @Callable(i) | |
113 | 107 | func voteForTaskProposal (taskId,voteValue) = if (!(canMemberVote(i))) | |
114 | 108 | then throw("you can't vote") | |
115 | - | else if ((getStringValue(this, (taskId + "_status")) != "proposed")) | |
109 | + | else if ((getStringValue(this, (("tasks_" + taskId) + "_status")) != "proposed")) | |
116 | 110 | then throw("voting is closed or not started") | |
117 | 111 | else if (if ((voteValue != -1)) | |
118 | 112 | then (voteValue != 1) | |
119 | 113 | else false) | |
120 | 114 | then throw("you need to vote 1 or -1") | |
121 | 115 | else { | |
122 | - | let voteKey = (((taskId + "_") + toString(i.caller)) | |
116 | + | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
123 | 117 | let previousVote = tryGetInteger(voteKey) | |
124 | 118 | if (!((previousVote == 0))) | |
125 | 119 | then throw("you have already voted") | |
126 | 120 | else { | |
127 | - | let votingKey = (taskId + "_ | |
121 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
128 | 122 | let votingState = tryGetInteger(votingKey) | |
129 | - | let votesAmountKey = (taskId + "_ | |
123 | + | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
130 | 124 | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
131 | 125 | let newVotingState = (votingState + voteValue) | |
132 | 126 | ScriptResult(WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, voteValue), DataEntry(votesAmountKey, votesAmountState)]), TransferSet([ScriptTransfer(i.caller, 500000, unit)])) | |
133 | 127 | } | |
134 | 128 | } | |
135 | 129 | ||
136 | 130 | ||
137 | 131 | ||
138 | 132 | @Callable(i) | |
139 | - | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((taskId + "_ | |
133 | + | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / tryGetInteger("dao_size")))) | |
140 | 134 | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
141 | 135 | else if (!(isGroupMember(i.caller))) | |
142 | 136 | then throw("grants working group access only") | |
143 | 137 | else { | |
144 | - | let votingKey = (taskId + "_ | |
138 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
145 | 139 | let votingState = tryGetInteger(votingKey) | |
146 | 140 | if ((votingState > 0)) | |
147 | 141 | then { | |
148 | 142 | let votingResult = "ready_to_apply" | |
149 | - | WriteSet([DataEntry((taskId + "_status"), votingResult)]) | |
143 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
150 | 144 | } | |
151 | 145 | else { | |
152 | 146 | let votingResult = "rejected" | |
153 | - | WriteSet([DataEntry((taskId + "_status"), votingResult)]) | |
147 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
154 | 148 | } | |
155 | 149 | } | |
156 | 150 | ||
157 | 151 | ||
158 | 152 | ||
159 | 153 | @Callable(i) | |
160 | - | func applyForTask (taskId,teamName) = { | |
161 | - | let listKey = (taskId + "_applicants") | |
162 | - | let currentApplicantsList = match getString(this, listKey) { | |
163 | - | case b: String => | |
164 | - | b | |
165 | - | case _ => | |
166 | - | "" | |
167 | - | } | |
168 | - | let newApplicantsList = ((currentApplicantsList + ";") + teamName) | |
169 | - | WriteSet([DataEntry((((taskId + "_applicant_") + teamName) + "_leader"), toString(i.caller)), DataEntry(listKey, newApplicantsList)]) | |
154 | + | func applyForTask (taskId,teamName,link) = { | |
155 | + | let status = tryGetString((("tasks_" + taskId) + "_status")) | |
156 | + | if ((status != "ready_to_apply")) | |
157 | + | then throw("This grant has not yet been approved") | |
158 | + | else { | |
159 | + | let listKey = (("tasks_" + taskId) + "_applicants") | |
160 | + | let currentApplicantsList = tryGetString(listKey) | |
161 | + | let applicantKey = drop(toString(i.caller), 10) | |
162 | + | let newApplicantsList = ((currentApplicantsList + ";") + toString(i.caller)) | |
163 | + | 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)]) | |
164 | + | } | |
170 | 165 | } | |
171 | 166 | ||
172 | 167 | ||
173 | 168 | ||
174 | 169 | @Callable(i) | |
175 | - | func voteForApplicant (taskId, | |
170 | + | func voteForApplicant (taskId,teamIdentifier,voteValue) = if (!(canMemberVote(i))) | |
176 | 171 | then throw("you can't vote") | |
177 | 172 | else { | |
178 | - | let voteKey = ((((taskId + "_") + toString(i.caller)) + "_vote_") + teamName) | |
173 | + | let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10)) | |
174 | + | let voteKey = ((("tasks_" + taskId) + "_vote_") + voteHash) | |
179 | 175 | let vote = tryGetInteger(voteKey) | |
180 | 176 | if ((vote != 0)) | |
181 | 177 | then throw("you have already voted on this team") | |
182 | 178 | else { | |
183 | - | let teamVotesAmountKey = (((taskId + "_ | |
184 | - | let teamScoreKey = (((taskId + "_ | |
179 | + | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
180 | + | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score") | |
185 | 181 | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
186 | 182 | let newTeamScore = (voteValue + tryGetInteger(teamScoreKey)) | |
187 | 183 | WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)]) | |
188 | 184 | } | |
189 | 185 | } | |
190 | 186 | ||
191 | 187 | ||
192 | 188 | ||
193 | 189 | @Callable(i) | |
194 | 190 | func finishApplicantsVoting (taskId) = { | |
195 | 191 | func isApplicantVotedEnough (aid,aid2) = { | |
196 | - | let listKey = (taskId + "_applicants") | |
192 | + | let listKey = (("tasks_" + taskId) + "_applicants") | |
197 | 193 | let applicantsList = split(getStringValue(this, listKey), ";") | |
198 | - | let | |
199 | - | let teamVotesAmountKey = (((taskId + "_ | |
194 | + | let teamIdentifier = applicantsList[aid] | |
195 | + | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
200 | 196 | let teamVotesAmount = tryGetInteger(teamVotesAmountKey) | |
201 | 197 | if ((teamVotesAmount > 0)) | |
202 | 198 | then 1 | |
203 | - | else throw(("not enough votes to make decision on " + | |
199 | + | else throw(("not enough votes to make decision on " + teamIdentifier)) | |
204 | 200 | } | |
205 | 201 | ||
206 | 202 | func hasMoreVotes (aid,aid2) = { | |
207 | - | let listKey = (taskId + "_applicants") | |
203 | + | let listKey = (("tasks_" + taskId) + "_applicants") | |
208 | 204 | let applicantsList = split(getStringValue(this, listKey), ";") | |
209 | - | let | |
210 | - | let teamVotesAmountKey = (((taskId + "_ | |
205 | + | let teamIdentifier = applicantsList[aid] | |
206 | + | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
211 | 207 | let teamVotesAmount = tryGetInteger(teamVotesAmountKey) | |
212 | - | let | |
213 | - | let team2VotesAmountKey = (((taskId + "_ | |
208 | + | let team2Identifier = applicantsList[aid2] | |
209 | + | let team2VotesAmountKey = (((("tasks_" + taskId) + "_app_") + team2Identifier) + "_votes") | |
214 | 210 | let team2VotesAmount = tryGetInteger(team2VotesAmountKey) | |
215 | 211 | if ((teamVotesAmount > team2VotesAmount)) | |
216 | 212 | then aid | |
217 | 213 | else aid2 | |
218 | 214 | } | |
219 | 215 | ||
220 | 216 | if (!(isGroupMember(i.caller))) | |
221 | 217 | then throw("grants working group access only") | |
222 | 218 | else { | |
223 | - | let chosenTeamId = { | |
224 | - | let $list85228553 = [0, 1] | |
225 | - | let $size85228553 = size($list85228553) | |
226 | - | let $acc085228553 = 0 | |
227 | - | if (($size85228553 == 0)) | |
228 | - | then $acc085228553 | |
229 | - | else { | |
230 | - | let $acc185228553 = hasMoreVotes($acc085228553, $list85228553[0]) | |
231 | - | if (($size85228553 == 1)) | |
232 | - | then $acc185228553 | |
219 | + | let listKeys = tryGetString((("tasks_" + taskId) + "_applicants")) | |
220 | + | let applicantsList = split(listKeys, ";") | |
221 | + | if ((size(applicantsList) == 0)) | |
222 | + | then throw("No one has yet responded to the grant") | |
223 | + | else { | |
224 | + | let chosenTeamId = { | |
225 | + | let $list1113111162 = [0, 1] | |
226 | + | let $size1113111162 = size($list1113111162) | |
227 | + | let $acc01113111162 = 0 | |
228 | + | if (($size1113111162 == 0)) | |
229 | + | then $acc01113111162 | |
233 | 230 | else { | |
234 | - | let $ | |
235 | - | if (($ | |
236 | - | then $ | |
231 | + | let $acc11113111162 = hasMoreVotes($acc01113111162, $list1113111162[0]) | |
232 | + | if (($size1113111162 == 1)) | |
233 | + | then $acc11113111162 | |
237 | 234 | else { | |
238 | - | let $acc385228553 = hasMoreVotes($acc285228553, $list85228553[2]) | |
239 | - | throw("List size exceed 2") | |
235 | + | let $acc21113111162 = hasMoreVotes($acc11113111162, $list1113111162[1]) | |
236 | + | if (($size1113111162 == 2)) | |
237 | + | then $acc21113111162 | |
238 | + | else { | |
239 | + | let $acc31113111162 = hasMoreVotes($acc21113111162, $list1113111162[2]) | |
240 | + | throw("List size exceed 2") | |
241 | + | } | |
240 | 242 | } | |
241 | 243 | } | |
242 | 244 | } | |
243 | - | } | |
244 | - | let listKey = (taskId + "_applicants") | |
245 | - | let applicantsList = split(getStringValue(this, listKey), ";") | |
246 | - | let teamName = applicantsList[chosenTeamId] | |
247 | - | WriteSet([DataEntry((taskId + "_status"), "team_chosen"), DataEntry((taskId + "_performer"), teamName), DataEntry((((taskId + "_applicant_") + teamName) + "_work_process"), "can_begin")]) | |
245 | + | let teamIdentifier = applicantsList[chosenTeamId] | |
246 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "team_chosen"), DataEntry((("tasks_" + taskId) + "_performer"), teamIdentifier), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "can_begin")]) | |
247 | + | } | |
248 | 248 | } | |
249 | 249 | } | |
250 | 250 | ||
251 | 251 | ||
252 | 252 | ||
253 | 253 | @Callable(i) | |
254 | 254 | func startWork (taskId) = { | |
255 | - | let | |
256 | - | if ((toString(i.caller) != getStringValue(this, (((taskId + "_ | |
255 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
256 | + | if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
257 | 257 | then throw("team leader only") | |
258 | - | else WriteSet([DataEntry((taskId + "_status"), "work_started"), DataEntry((((taskId + "_ | |
258 | + | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_started")]) | |
259 | 259 | } | |
260 | 260 | ||
261 | 261 | ||
262 | 262 | ||
263 | 263 | @Callable(i) | |
264 | - | func | |
264 | + | func rejectTask (taskId) = if (!(isGroupMember(i.caller))) | |
265 | 265 | then throw("grants working group access only") | |
266 | 266 | else { | |
267 | - | let rewardAmount = tryGetInteger((taskId + "_reward")) | |
268 | - | let teamName = getStringValue(this, (taskId + "_performer")) | |
269 | - | let teamAddress = getStringValue(this, (((taskId + "_applicant_") + teamName) + "_leader")) | |
270 | - | ScriptResult(WriteSet([DataEntry((taskId + "_status"), "work_finished"), DataEntry((((taskId + "_applicant_") + teamName) + "_work_process"), "work_finished")]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)])) | |
267 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
268 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "rejected")]) | |
269 | + | } | |
270 | + | ||
271 | + | ||
272 | + | ||
273 | + | @Callable(i) | |
274 | + | func acceptWorkResult (taskId,reportLink) = if (!(isGroupMember(i.caller))) | |
275 | + | then throw("grants working group access only") | |
276 | + | else { | |
277 | + | let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward")) | |
278 | + | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
279 | + | let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")) | |
280 | + | 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)])) | |
271 | 281 | } | |
272 | 282 | ||
273 | 283 |
github/deemru/w8io/026f985 59.39 ms ◑