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