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