tx · HR7iWwCxPc8HbX878WDmwLj9JY3RCAkJZTrcLwokNHFm

3MtV1AQ8fEPk76tjKgvrufuMe5aA3q4TviQ:  -0.10000000 Waves

2020.11.30 20:18 [1288446] smart account 3MtV1AQ8fEPk76tjKgvrufuMe5aA3q4TviQ > SELF 0.00000000 Waves

{ "type": 13, "id": "HR7iWwCxPc8HbX878WDmwLj9JY3RCAkJZTrcLwokNHFm", "fee": 10000000, "feeAssetId": null, "timestamp": 1606756729555, "version": 2, "chainId": 84, "sender": "3MtV1AQ8fEPk76tjKgvrufuMe5aA3q4TviQ", "senderPublicKey": "3Fjao2FW1JXSPd5EkP7C3uerW18HYacYsaMYALFMGA6N", "proofs": [ "3LD9wGYKDwHopJxTAhkcAZtgJcfKLtDSnAEVC4DwRs847NorW1UADVjkRe2S5384fpE8AJrLG9zaNoe8JcY5v6KL" ], "script": "base64:AAIDAAAAAAAAAC4IARIECgIICBIECgIIARIDCgEIEgQKAggBEgMKAQgSAwoBCBIDCgEIEgQKAggIAAAACQAAAAAGUVVPUlVNAAAAAAAAAAABAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAUAAAADdmFsAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAAFAAAAA3ZhbAAAAAAMbWFpbkNvbnRyYWN0BQAAAAR0aGlzAQAAAAdpc093bmVyAAAAAQAAAAdhZGRyZXNzCQAAAAAAAAIFAAAAB2FkZHJlc3MFAAAABHRoaXM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AAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAALdGVhbUFkZHJlc3MFAAAADHJld2FyZEFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAAD5jh+k=", "height": 1288446, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5PCnFypGYzFyQDDeSAKVcua3qAfnjdXBkx2BVVymKftH Next: 5uBktXog3ByE1idHffyb4MYdrjQcr9nEfqceXndzDaVm Diff:
OldNewDifferences
2727
2828 let mainContract = this
2929
30-func isOwner (address) = if ((address == this))
31- then true
32- else (address == mainContract)
30+func isOwner (address) = (address == this)
3331
3432
3533 func getGroup () = {
7775
7876
7977 @Callable(i)
80-func addTask (title,link) = if (!(isGroupMember(i.caller)))
81- then throw("grants working group access only")
82- else WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)])
78+func addTask (title,link) = WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)])
8379
8480
8581
8682 @Callable(i)
87-func addTaskDetails (taskId,detailsLink) = if (!(isGroupMember(i.caller)))
83+func addTaskDetails (taskId,reward) = {
84+ let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer"))
85+ if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader"))))
86+ then throw("team leader only")
87+ else WriteSet([DataEntry((("tasks_" + taskId) + "_requestedreward"), reward)])
88+ }
89+
90+
91+
92+@Callable(i)
93+func initTaskVoting (taskId) = if (!(isGroupMember(i.caller)))
8894 then throw("grants working group access only")
89- else {
90- let reward = extract(i.payment).amount
91- WriteSet([DataEntry((("tasks_" + taskId) + "_reward"), reward), DataEntry((("tasks_" + taskId) + "_details"), detailsLink), DataEntry((("tasks_" + taskId) + "_status"), "proposed")])
92- }
95+ else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "voting_started")])
9396
9497
9598
129132 let votingState = tryGetInteger(votingKey)
130133 if ((votingState > 0))
131134 then {
132- let votingResult = "ready_to_apply"
135+ let votingResult = "approved"
133136 WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)])
134137 }
135138 else {
141144
142145
143146 @Callable(i)
144-func applyForTask (taskId,teamName,link) = {
145- let status = tryGetString((("tasks_" + taskId) + "_status"))
146- if ((status != "ready_to_apply"))
147- then throw("This grant has not yet been approved")
148- else {
149- let listKey = (("tasks_" + taskId) + "_applicants")
150- let currentApplicantsList = tryGetString(listKey)
151- let applicantKey = drop(toString(i.caller), 10)
152- let leader = toString(i.caller)
153- let newApplicantsList = ((currentApplicantsList + ";") + leader)
154- WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_name"), teamName), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_link"), link), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_leader"), leader), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_id"), applicantKey), DataEntry(listKey, newApplicantsList)])
155- }
147+func startWork (taskId) = {
148+ let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer"))
149+ if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader"))))
150+ then throw("team leader only")
151+ else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started")])
156152 }
157-
158-
159-
160-@Callable(i)
161-func voteForApplicant (taskId,teamIdentifier,voteValue) = if (!(canMemberVote(i)))
162- then throw("you can't vote")
163- else {
164- let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10))
165- let voteKey = ((("tasks_" + taskId) + "_vote_") + voteHash)
166- let vote = tryGetInteger(voteKey)
167- if ((vote != 0))
168- then throw("you have already voted on this team")
169- else {
170- let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes")
171- let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score")
172- let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey))
173- let newTeamScore = (voteValue + tryGetInteger(teamScoreKey))
174- WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)])
175- }
176- }
177-
178-
179-
180-@Callable(i)
181-func finishApplicantsVoting (taskId) = {
182- let minVotesToApproveApplicant = 1
183- if (!(isGroupMember(i.caller)))
184- then throw("grants working group access only")
185- else {
186- let listKeys = tryGetString((("tasks_" + taskId) + "_applicants"))
187- let applicantsList = split(listKeys, ";")
188- if ((size(applicantsList) == 0))
189- then throw("No one has applied to the hackathon, yet")
190- else WriteSet([DataEntry((("tasks_" + taskId) + "_performer"), listKeys), DataEntry((("tasks_" + taskId) + "_status"), "ready_to_submit")])
191- }
192- }
193-
194-
195-
196-@Callable(i)
197-func enableSubmissions (taskId,juryList) = if (!(isGroupMember(i.caller)))
198- then throw("grants working group access only")
199- else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started"), DataEntry((("tasks_" + taskId) + "_jury"), juryList)])
200-
201-
202-
203-@Callable(i)
204-func submitSolution (taskId,solutionLink) = {
205- func areSubmissionsEnabled (taskId) = (tryGetString((("tasks_" + taskId) + "_status")) == "work_started")
206-
207- let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer"))
208- if (!(areSubmissionsEnabled(taskId)))
209- then throw("not possible to upload solution now")
210- else if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader"))))
211- then throw("team leader only")
212- else WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_submitted"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solution"), solutionLink)])
213- }
214-
215-
216-
217-@Callable(i)
218-func stopSubmissions (taskId) = if (!(isGroupMember(i.caller)))
219- then throw("grants working group access only")
220- else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished")])
221-
222-
223-
224-@Callable(i)
225-func voteForSolution (taskId,teamIdentifier,voteValue) = {
226- func isJuryMember (i,taskId) = true
227-
228- if (!(isJuryMember(i, taskId)))
229- then throw("you can't vote")
230- else {
231- let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10))
232- let voteKey = ((("tasks_" + taskId) + "_solutionvote_") + voteHash)
233- let vote = tryGetInteger(voteKey)
234- if ((vote != 0))
235- then throw("you have already voted on this solution")
236- else {
237- let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionvotes")
238- let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionscore")
239- let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey))
240- let newTeamScore = (voteValue + tryGetInteger(teamScoreKey))
241- WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)])
242- }
243- }
244- }
245-
246-
247-
248-@Callable(i)
249-func acceptWorkResult (taskId,winnerIdentifier,reportLink) = if (!(isGroupMember(i.caller)))
250- then throw("grants working group access only")
251- else {
252- let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward"))
253- let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_leader"))
254- ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished"), DataEntry((((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_process"), "winner"), DataEntry((("tasks_" + taskId) + "_report"), reportLink)]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)]))
255- }
256153
257154
258155
261158 then throw("grants working group access only")
262159 else {
263160 let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer"))
264- WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected")])
161+ WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "rejected")])
162+ }
163+
164+
165+
166+@Callable(i)
167+func acceptWorkResult (taskId,reportLink) = if (!(isGroupMember(i.caller)))
168+ then throw("grants working group access only")
169+ else {
170+ let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward"))
171+ let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer"))
172+ let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader"))
173+ ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_report"), reportLink)]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)]))
265174 }
266175
267176
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let QUORUM = 1
55
66 func tryGetInteger (key) = {
77 let val = match getInteger(this, key) {
88 case b: Int =>
99 b
1010 case _ =>
1111 0
1212 }
1313 val
1414 }
1515
1616
1717 func tryGetString (key) = {
1818 let val = match getString(this, key) {
1919 case b: String =>
2020 b
2121 case _ =>
2222 ""
2323 }
2424 val
2525 }
2626
2727
2828 let mainContract = this
2929
30-func isOwner (address) = if ((address == this))
31- then true
32- else (address == mainContract)
30+func isOwner (address) = (address == this)
3331
3432
3533 func getGroup () = {
3634 let val = match getString(mainContract, "working_group_members") {
3735 case b: String =>
3836 b
3937 case _ =>
4038 ""
4139 }
4240 val
4341 }
4442
4543
4644 func getMembers () = {
4745 let val = match getString(mainContract, "dao_members") {
4846 case b: String =>
4947 b
5048 case _ =>
5149 ""
5250 }
5351 val
5452 }
5553
5654
5755 func isGroupMember (a) = {
5856 let val = match getInteger(mainContract, (("working_group_member_" + toString(a)) + "_weight")) {
5957 case b: Int =>
6058 b
6159 case _ =>
6260 0
6361 }
6462 (val > 0)
6563 }
6664
6765
6866 func canMemberVote (i) = {
6967 let val = match getInteger(mainContract, (("dao_member_" + toString(i.caller)) + "_weight")) {
7068 case b: Int =>
7169 b
7270 case _ =>
7371 0
7472 }
7573 (val > 0)
7674 }
7775
7876
7977 @Callable(i)
80-func addTask (title,link) = if (!(isGroupMember(i.caller)))
81- then throw("grants working group access only")
82- else WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)])
78+func addTask (title,link) = WriteSet([DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("tasks_" + toBase58String(i.transactionId)) + "_link"), link)])
8379
8480
8581
8682 @Callable(i)
87-func addTaskDetails (taskId,detailsLink) = if (!(isGroupMember(i.caller)))
83+func addTaskDetails (taskId,reward) = {
84+ let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer"))
85+ if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader"))))
86+ then throw("team leader only")
87+ else WriteSet([DataEntry((("tasks_" + taskId) + "_requestedreward"), reward)])
88+ }
89+
90+
91+
92+@Callable(i)
93+func initTaskVoting (taskId) = if (!(isGroupMember(i.caller)))
8894 then throw("grants working group access only")
89- else {
90- let reward = extract(i.payment).amount
91- WriteSet([DataEntry((("tasks_" + taskId) + "_reward"), reward), DataEntry((("tasks_" + taskId) + "_details"), detailsLink), DataEntry((("tasks_" + taskId) + "_status"), "proposed")])
92- }
95+ else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "voting_started")])
9396
9497
9598
9699 @Callable(i)
97100 func voteForTaskProposal (taskId,voteValue) = if (!(canMemberVote(i)))
98101 then throw("you can't vote")
99102 else if ((getStringValue(this, (("tasks_" + taskId) + "_status")) != "proposed"))
100103 then throw("voting is closed or not started")
101104 else if (if ((voteValue != -1))
102105 then (voteValue != 1)
103106 else false)
104107 then throw("you need to vote 1 or -1")
105108 else {
106109 let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller))
107110 let previousVote = tryGetInteger(voteKey)
108111 if (!((previousVote == 0)))
109112 then throw("you have already voted")
110113 else {
111114 let votingKey = (("tasks_" + taskId) + "_voting_state")
112115 let votingState = tryGetInteger(votingKey)
113116 let votesAmountKey = (("tasks_" + taskId) + "_voting_amount")
114117 let votesAmountState = (tryGetInteger(votingKey) + 1)
115118 let newVotingState = (votingState + voteValue)
116119 ScriptResult(WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, voteValue), DataEntry(votesAmountKey, votesAmountState)]), TransferSet([ScriptTransfer(i.caller, 500000, unit)]))
117120 }
118121 }
119122
120123
121124
122125 @Callable(i)
123126 func finishTaskProposalVoting (taskId) = if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / tryGetInteger("dao_size"))))
124127 then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting"))
125128 else if (!(isGroupMember(i.caller)))
126129 then throw("grants working group access only")
127130 else {
128131 let votingKey = (("tasks_" + taskId) + "_voting_state")
129132 let votingState = tryGetInteger(votingKey)
130133 if ((votingState > 0))
131134 then {
132- let votingResult = "ready_to_apply"
135+ let votingResult = "approved"
133136 WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)])
134137 }
135138 else {
136139 let votingResult = "rejected"
137140 WriteSet([DataEntry((("tasks_" + taskId) + "_status"), votingResult)])
138141 }
139142 }
140143
141144
142145
143146 @Callable(i)
144-func applyForTask (taskId,teamName,link) = {
145- let status = tryGetString((("tasks_" + taskId) + "_status"))
146- if ((status != "ready_to_apply"))
147- then throw("This grant has not yet been approved")
148- else {
149- let listKey = (("tasks_" + taskId) + "_applicants")
150- let currentApplicantsList = tryGetString(listKey)
151- let applicantKey = drop(toString(i.caller), 10)
152- let leader = toString(i.caller)
153- let newApplicantsList = ((currentApplicantsList + ";") + leader)
154- WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_name"), teamName), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_link"), link), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_leader"), leader), DataEntry((((("tasks_" + taskId) + "_app_") + applicantKey) + "_id"), applicantKey), DataEntry(listKey, newApplicantsList)])
155- }
147+func startWork (taskId) = {
148+ let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer"))
149+ if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader"))))
150+ then throw("team leader only")
151+ else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started")])
156152 }
157-
158-
159-
160-@Callable(i)
161-func voteForApplicant (taskId,teamIdentifier,voteValue) = if (!(canMemberVote(i)))
162- then throw("you can't vote")
163- else {
164- let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10))
165- let voteKey = ((("tasks_" + taskId) + "_vote_") + voteHash)
166- let vote = tryGetInteger(voteKey)
167- if ((vote != 0))
168- then throw("you have already voted on this team")
169- else {
170- let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_votes")
171- let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_score")
172- let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey))
173- let newTeamScore = (voteValue + tryGetInteger(teamScoreKey))
174- WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)])
175- }
176- }
177-
178-
179-
180-@Callable(i)
181-func finishApplicantsVoting (taskId) = {
182- let minVotesToApproveApplicant = 1
183- if (!(isGroupMember(i.caller)))
184- then throw("grants working group access only")
185- else {
186- let listKeys = tryGetString((("tasks_" + taskId) + "_applicants"))
187- let applicantsList = split(listKeys, ";")
188- if ((size(applicantsList) == 0))
189- then throw("No one has applied to the hackathon, yet")
190- else WriteSet([DataEntry((("tasks_" + taskId) + "_performer"), listKeys), DataEntry((("tasks_" + taskId) + "_status"), "ready_to_submit")])
191- }
192- }
193-
194-
195-
196-@Callable(i)
197-func enableSubmissions (taskId,juryList) = if (!(isGroupMember(i.caller)))
198- then throw("grants working group access only")
199- else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_started"), DataEntry((("tasks_" + taskId) + "_jury"), juryList)])
200-
201-
202-
203-@Callable(i)
204-func submitSolution (taskId,solutionLink) = {
205- func areSubmissionsEnabled (taskId) = (tryGetString((("tasks_" + taskId) + "_status")) == "work_started")
206-
207- let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer"))
208- if (!(areSubmissionsEnabled(taskId)))
209- then throw("not possible to upload solution now")
210- else if ((toString(i.caller) != getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader"))))
211- then throw("team leader only")
212- else WriteSet([DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "work_submitted"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solution"), solutionLink)])
213- }
214-
215-
216-
217-@Callable(i)
218-func stopSubmissions (taskId) = if (!(isGroupMember(i.caller)))
219- then throw("grants working group access only")
220- else WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished")])
221-
222-
223-
224-@Callable(i)
225-func voteForSolution (taskId,teamIdentifier,voteValue) = {
226- func isJuryMember (i,taskId) = true
227-
228- if (!(isJuryMember(i, taskId)))
229- then throw("you can't vote")
230- else {
231- let voteHash = (drop(toString(i.caller), 10) + drop(teamIdentifier, 10))
232- let voteKey = ((("tasks_" + taskId) + "_solutionvote_") + voteHash)
233- let vote = tryGetInteger(voteKey)
234- if ((vote != 0))
235- then throw("you have already voted on this solution")
236- else {
237- let teamVotesAmountKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionvotes")
238- let teamScoreKey = (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_solutionscore")
239- let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey))
240- let newTeamScore = (voteValue + tryGetInteger(teamScoreKey))
241- WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)])
242- }
243- }
244- }
245-
246-
247-
248-@Callable(i)
249-func acceptWorkResult (taskId,winnerIdentifier,reportLink) = if (!(isGroupMember(i.caller)))
250- then throw("grants working group access only")
251- else {
252- let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward"))
253- let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_leader"))
254- ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished"), DataEntry((((("tasks_" + taskId) + "_app_") + winnerIdentifier) + "_process"), "winner"), DataEntry((("tasks_" + taskId) + "_report"), reportLink)]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)]))
255- }
256153
257154
258155
259156 @Callable(i)
260157 func rejectTask (taskId) = if (!(isGroupMember(i.caller)))
261158 then throw("grants working group access only")
262159 else {
263160 let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer"))
264- WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected")])
161+ WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_process"), "rejected")])
162+ }
163+
164+
165+
166+@Callable(i)
167+func acceptWorkResult (taskId,reportLink) = if (!(isGroupMember(i.caller)))
168+ then throw("grants working group access only")
169+ else {
170+ let rewardAmount = tryGetInteger((("tasks_" + taskId) + "_reward"))
171+ let teamIdentifier = getStringValue(this, (("tasks_" + taskId) + "_performer"))
172+ let teamAddress = getStringValue(this, (((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_leader"))
173+ ScriptResult(WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "work_finished"), DataEntry((((("tasks_" + taskId) + "_app_") + teamIdentifier) + "_report"), reportLink)]), TransferSet([ScriptTransfer(addressFromStringValue(teamAddress), rewardAmount, unit)]))
265174 }
266175
267176

github/deemru/w8io/169f3d6 
54.78 ms