tx · 78NbqZdbrxJJ3mEwD3VkjP2SdzaRFumByabG2VeKndFo 3N71MDc3kPD6cnbdWp6iEuDY8ghgZ9DiVan: -0.10000000 Waves 2020.12.22 13:21 [1319781] smart account 3N71MDc3kPD6cnbdWp6iEuDY8ghgZ9DiVan > SELF 0.00000000 Waves
{ "type": 13, "id": "78NbqZdbrxJJ3mEwD3VkjP2SdzaRFumByabG2VeKndFo", "fee": 10000000, "feeAssetId": null, "timestamp": 1608632470872, "version": 2, "chainId": 84, "sender": "3N71MDc3kPD6cnbdWp6iEuDY8ghgZ9DiVan", "senderPublicKey": "5tBY17DiYVDP2QCBiAPKpjhmn1hCu1rS4XbwiY9zchFf", "proofs": [ "4x2JTV8vqMYL9XLSBPRapvhzktR5i7RdhkH3QNFScXctkM5p44WVmH2kQmWW1EWf38Hognovtf7keXLuJcTMHXzZ" ], "script": "base64:AAIDAAAAAAAAADUIARIECgIICBIDCgEIEgQKAggIEgMKAQgSBQoDCAgIEgUKAwgICBIDCgEIEgMKAQgSAwoBCAAAAAsAAAAADG1haW5Db250cmFjdAkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTXdSemkyQm1xWlpYV3JDR0N3Y1JRTHNuaWMyQW9kNnpoUwAAAAAGUVVPUlVNAAAAAAAAAAABAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAUAAAADdmFsAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAA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": 1319781, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8ynjQRFoVBWP1BLnwmJc6cXQuLz59TzgZDHGW6ApdXMA Next: ExKu3epok3HftYVTofmZcZtJEGa1yRXmaXouePmyiEmq 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 | - | } | |
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 | + | } | |
71 | 86 | ||
72 | 87 | ||
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 | - | ||
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") | |
87 | 93 | ||
88 | 94 | ||
89 | 95 | @Callable(i) | |
94 | 100 | ||
95 | 101 | ||
96 | 102 | @Callable(i) | |
97 | - | func | |
103 | + | func addReward (taskId) = if (!(isGroupMember(i.caller))) | |
98 | 104 | then throw("grants working group access only") | |
99 | 105 | else { | |
100 | 106 | let reward = extract(i.payment).amount | |
108 | 114 | then throw("you can't vote") | |
109 | 115 | else if ((getStringValue(this, (("tasks_" + taskId) + "_status")) != "proposed")) | |
110 | 116 | then throw("voting is closed or not started") | |
111 | - | else if (if ((voteValue != | |
112 | - | then (voteValue != | |
117 | + | else if (if ((voteValue != "like")) | |
118 | + | then (voteValue != "dislike") | |
113 | 119 | else false) | |
114 | - | then throw("you need to vote | |
120 | + | then throw("you need to vote like or dislike") | |
115 | 121 | else { | |
122 | + | let valueVoteInt = getVoteValue(voteValue) | |
116 | 123 | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
117 | 124 | let previousVote = tryGetInteger(voteKey) | |
118 | 125 | if (!((previousVote == 0))) | |
122 | 129 | let votingState = tryGetInteger(votingKey) | |
123 | 130 | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
124 | 131 | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
125 | - | let newVotingState = (votingState + | |
126 | - | 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)])) | |
127 | 134 | } | |
128 | 135 | } | |
129 | 136 | ||
130 | 137 | ||
131 | 138 | ||
132 | 139 | @Callable(i) | |
133 | - | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / | |
140 | + | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / getDAOSize()))) | |
134 | 141 | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
135 | 142 | else if (!(isGroupMember(i.caller))) | |
136 | 143 | then throw("grants working group access only") | |
176 | 183 | if ((vote != 0)) | |
177 | 184 | then throw("you have already voted on this team") | |
178 | 185 | else { | |
186 | + | let valueVoteInt = getVoteValue(voteValue) | |
179 | 187 | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
180 | 188 | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score") | |
181 | 189 | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
182 | - | let newTeamScore = ( | |
183 | - | WriteSet([DataEntry(voteKey, | |
190 | + | let newTeamScore = (valueVoteInt + tryGetInteger(teamScoreKey)) | |
191 | + | WriteSet([DataEntry(voteKey, valueVoteInt), DataEntry(teamScoreKey, newTeamScore)]) | |
184 | 192 | } | |
185 | 193 | } | |
186 | 194 | ||
222 | 230 | then throw("No one has yet responded to the grant") | |
223 | 231 | else { | |
224 | 232 | let chosenTeamId = { | |
225 | - | let $ | |
226 | - | let $ | |
227 | - | let $ | |
228 | - | if (($ | |
229 | - | then $ | |
233 | + | let $list98869917 = [0, 1] | |
234 | + | let $size98869917 = size($list98869917) | |
235 | + | let $acc098869917 = 0 | |
236 | + | if (($size98869917 == 0)) | |
237 | + | then $acc098869917 | |
230 | 238 | else { | |
231 | - | let $ | |
232 | - | if (($ | |
233 | - | then $ | |
239 | + | let $acc198869917 = hasMoreVotes($acc098869917, $list98869917[0]) | |
240 | + | if (($size98869917 == 1)) | |
241 | + | then $acc198869917 | |
234 | 242 | else { | |
235 | - | let $ | |
236 | - | if (($ | |
237 | - | then $ | |
243 | + | let $acc298869917 = hasMoreVotes($acc198869917, $list98869917[1]) | |
244 | + | if (($size98869917 == 2)) | |
245 | + | then $acc298869917 | |
238 | 246 | else { | |
239 | - | let $ | |
247 | + | let $acc398869917 = hasMoreVotes($acc298869917, $list98869917[2]) | |
240 | 248 | throw("List size exceed 2") | |
241 | 249 | } | |
242 | 250 | } |
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 | - | } | |
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 | + | } | |
71 | 86 | ||
72 | 87 | ||
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 | - | ||
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") | |
87 | 93 | ||
88 | 94 | ||
89 | 95 | @Callable(i) | |
90 | 96 | func addTask (title,link) = if (!(isGroupMember(i.caller))) | |
91 | 97 | then throw("grants working group access only") | |
92 | 98 | else WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)]) | |
93 | 99 | ||
94 | 100 | ||
95 | 101 | ||
96 | 102 | @Callable(i) | |
97 | - | func | |
103 | + | func addReward (taskId) = if (!(isGroupMember(i.caller))) | |
98 | 104 | then throw("grants working group access only") | |
99 | 105 | else { | |
100 | 106 | let reward = extract(i.payment).amount | |
101 | 107 | WriteSet([DataEntry((("tasks_" + taskId) + "_reward"), reward), DataEntry((("tasks_" + taskId) + "_status"), "proposed")]) | |
102 | 108 | } | |
103 | 109 | ||
104 | 110 | ||
105 | 111 | ||
106 | 112 | @Callable(i) | |
107 | 113 | func voteForTaskProposal (taskId,voteValue) = if (!(canMemberVote(i))) | |
108 | 114 | then throw("you can't vote") | |
109 | 115 | else if ((getStringValue(this, (("tasks_" + taskId) + "_status")) != "proposed")) | |
110 | 116 | then throw("voting is closed or not started") | |
111 | - | else if (if ((voteValue != | |
112 | - | then (voteValue != | |
117 | + | else if (if ((voteValue != "like")) | |
118 | + | then (voteValue != "dislike") | |
113 | 119 | else false) | |
114 | - | then throw("you need to vote | |
120 | + | then throw("you need to vote like or dislike") | |
115 | 121 | else { | |
122 | + | let valueVoteInt = getVoteValue(voteValue) | |
116 | 123 | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
117 | 124 | let previousVote = tryGetInteger(voteKey) | |
118 | 125 | if (!((previousVote == 0))) | |
119 | 126 | then throw("you have already voted") | |
120 | 127 | else { | |
121 | 128 | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
122 | 129 | let votingState = tryGetInteger(votingKey) | |
123 | 130 | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
124 | 131 | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
125 | - | let newVotingState = (votingState + | |
126 | - | 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)])) | |
127 | 134 | } | |
128 | 135 | } | |
129 | 136 | ||
130 | 137 | ||
131 | 138 | ||
132 | 139 | @Callable(i) | |
133 | - | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / | |
140 | + | func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / getDAOSize()))) | |
134 | 141 | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
135 | 142 | else if (!(isGroupMember(i.caller))) | |
136 | 143 | then throw("grants working group access only") | |
137 | 144 | else { | |
138 | 145 | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
139 | 146 | let votingState = tryGetInteger(votingKey) | |
140 | 147 | if ((votingState > 0)) | |
141 | 148 | then { | |
142 | 149 | let votingResult = "ready_to_apply" | |
143 | 150 | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
144 | 151 | } | |
145 | 152 | else { | |
146 | 153 | let votingResult = "rejected" | |
147 | 154 | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)]) | |
148 | 155 | } | |
149 | 156 | } | |
150 | 157 | ||
151 | 158 | ||
152 | 159 | ||
153 | 160 | @Callable(i) | |
154 | 161 | func applyForTask (taskId,teamName,link) = { | |
155 | 162 | let status = tryGetString((("tasks_" + taskId) + "_status")) | |
156 | 163 | if ((status != "ready_to_apply")) | |
157 | 164 | then throw("This grant has not yet been approved") | |
158 | 165 | else { | |
159 | 166 | let listKey = (("tasks_" + taskId) + "_applicants") | |
160 | 167 | let currentApplicantsList = tryGetString(listKey) | |
161 | 168 | let applicantKey = drop(toString(i.caller), 10) | |
162 | 169 | let newApplicantsList = ((currentApplicantsList + ";") + toString(i.caller)) | |
163 | 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)]) | |
164 | 171 | } | |
165 | 172 | } | |
166 | 173 | ||
167 | 174 | ||
168 | 175 | ||
169 | 176 | @Callable(i) | |
170 | 177 | func voteForApplicant (taskId,teamIdentifier,voteValue) = if (!(canMemberVote(i))) | |
171 | 178 | then throw("you can't vote") | |
172 | 179 | else { | |
173 | 180 | let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10)) | |
174 | 181 | let voteKey = ((("tasks_" + taskId) + "_vote_") + voteHash) | |
175 | 182 | let vote = tryGetInteger(voteKey) | |
176 | 183 | if ((vote != 0)) | |
177 | 184 | then throw("you have already voted on this team") | |
178 | 185 | else { | |
186 | + | let valueVoteInt = getVoteValue(voteValue) | |
179 | 187 | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
180 | 188 | let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score") | |
181 | 189 | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
182 | - | let newTeamScore = ( | |
183 | - | WriteSet([DataEntry(voteKey, | |
190 | + | let newTeamScore = (valueVoteInt + tryGetInteger(teamScoreKey)) | |
191 | + | WriteSet([DataEntry(voteKey, valueVoteInt), DataEntry(teamScoreKey, newTeamScore)]) | |
184 | 192 | } | |
185 | 193 | } | |
186 | 194 | ||
187 | 195 | ||
188 | 196 | ||
189 | 197 | @Callable(i) | |
190 | 198 | func finishApplicantsVoting (taskId) = { | |
191 | 199 | func isApplicantVotedEnough (aid,aid2) = { | |
192 | 200 | let listKey = (("tasks_" + taskId) + "_applicants") | |
193 | 201 | let applicantsList = split(getStringValue(this, listKey), ";") | |
194 | 202 | let teamIdentifier = applicantsList[aid] | |
195 | 203 | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
196 | 204 | let teamVotesAmount = tryGetInteger(teamVotesAmountKey) | |
197 | 205 | if ((teamVotesAmount > 0)) | |
198 | 206 | then 1 | |
199 | 207 | else throw(("not enough votes to make decision on " + teamIdentifier)) | |
200 | 208 | } | |
201 | 209 | ||
202 | 210 | func hasMoreVotes (aid,aid2) = { | |
203 | 211 | let listKey = (("tasks_" + taskId) + "_applicants") | |
204 | 212 | let applicantsList = split(getStringValue(this, listKey), ";") | |
205 | 213 | let teamIdentifier = applicantsList[aid] | |
206 | 214 | let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes") | |
207 | 215 | let teamVotesAmount = tryGetInteger(teamVotesAmountKey) | |
208 | 216 | let team2Identifier = applicantsList[aid2] | |
209 | 217 | let team2VotesAmountKey = (((("tasks_" + taskId) + "_app_") + team2Identifier) + "_votes") | |
210 | 218 | let team2VotesAmount = tryGetInteger(team2VotesAmountKey) | |
211 | 219 | if ((teamVotesAmount > team2VotesAmount)) | |
212 | 220 | then aid | |
213 | 221 | else aid2 | |
214 | 222 | } | |
215 | 223 | ||
216 | 224 | if (!(isGroupMember(i.caller))) | |
217 | 225 | then throw("grants working group access only") | |
218 | 226 | else { | |
219 | 227 | let listKeys = tryGetString((("tasks_" + taskId) + "_applicants")) | |
220 | 228 | let applicantsList = split(listKeys, ";") | |
221 | 229 | if ((size(applicantsList) == 0)) | |
222 | 230 | then throw("No one has yet responded to the grant") | |
223 | 231 | else { | |
224 | 232 | let chosenTeamId = { | |
225 | - | let $ | |
226 | - | let $ | |
227 | - | let $ | |
228 | - | if (($ | |
229 | - | then $ | |
233 | + | let $list98869917 = [0, 1] | |
234 | + | let $size98869917 = size($list98869917) | |
235 | + | let $acc098869917 = 0 | |
236 | + | if (($size98869917 == 0)) | |
237 | + | then $acc098869917 | |
230 | 238 | else { | |
231 | - | let $ | |
232 | - | if (($ | |
233 | - | then $ | |
239 | + | let $acc198869917 = hasMoreVotes($acc098869917, $list98869917[0]) | |
240 | + | if (($size98869917 == 1)) | |
241 | + | then $acc198869917 | |
234 | 242 | else { | |
235 | - | let $ | |
236 | - | if (($ | |
237 | - | then $ | |
243 | + | let $acc298869917 = hasMoreVotes($acc198869917, $list98869917[1]) | |
244 | + | if (($size98869917 == 2)) | |
245 | + | then $acc298869917 | |
238 | 246 | else { | |
239 | - | let $ | |
247 | + | let $acc398869917 = hasMoreVotes($acc298869917, $list98869917[2]) | |
240 | 248 | throw("List size exceed 2") | |
241 | 249 | } | |
242 | 250 | } | |
243 | 251 | } | |
244 | 252 | } | |
245 | 253 | let teamIdentifier = applicantsList[chosenTeamId] | |
246 | 254 | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "team_chosen"), DataEntry((("tasks_" + taskId) + "_performer"), teamIdentifier), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "can_begin")]) | |
247 | 255 | } | |
248 | 256 | } | |
249 | 257 | } | |
250 | 258 | ||
251 | 259 | ||
252 | 260 | ||
253 | 261 | @Callable(i) | |
254 | 262 | func startWork (taskId) = { | |
255 | 263 | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
256 | 264 | if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")))) | |
257 | 265 | then throw("team leader only") | |
258 | 266 | else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_started")]) | |
259 | 267 | } | |
260 | 268 | ||
261 | 269 | ||
262 | 270 | ||
263 | 271 | @Callable(i) | |
264 | 272 | func acceptWorkResult (taskId) = if (!(isGroupMember(i.caller))) | |
265 | 273 | then throw("grants working group access only") | |
266 | 274 | else { | |
267 | 275 | let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward")) | |
268 | 276 | let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer")) | |
269 | 277 | let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader")) | |
270 | 278 | ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_finished")]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)])) | |
271 | 279 | } | |
272 | 280 | ||
273 | 281 |
github/deemru/w8io/169f3d6 103.93 ms ◑