tx · HvuQNpjYC9Qz1tyJoRiELRgvoLz6WfWdHj5AR9ArzZa5 3N74cvawpTtuuCbAasBo7oMJYrohgZYFCTj: -0.01400000 Waves 2021.11.18 19:47 [1796729] smart account 3N74cvawpTtuuCbAasBo7oMJYrohgZYFCTj > SELF 0.00000000 Waves
{ "type": 13, "id": "HvuQNpjYC9Qz1tyJoRiELRgvoLz6WfWdHj5AR9ArzZa5", "fee": 1400000, "feeAssetId": null, "timestamp": 1637254083260, "version": 1, "sender": "3N74cvawpTtuuCbAasBo7oMJYrohgZYFCTj", "senderPublicKey": "BgnyKECwUvFW1ThWpgKbmHMmJXJRgg5K56jKHZwVMbXL", "proofs": [ "5Jq5cdpQWXPpuZrYUFUb2uPPyskLzXdsXqN5U1Hrpx4vLKrii8Yb5CrePZPPic5y68NejSfoVAQFPfsZuRoXCZhT" ], "script": "base64:AAIFAAAAAAAAAC4IAhIHCgUCAQEBARIAEgASBwoFAgEBAQESABIDCgEIEgUKAwEBARIGCgQICAgBAAAAJQAAAAALcmV2aXNpb25OdW0CAAAAAAAAAAADU0VQAgAAAAJfXwAAAAAITUFYREVQVEgAAAAAAAAAABEAAAAACVVTRVJERVBUSAAAAAAAAAAAGgAAAAAFU0NBTEUAAAAAAAAAA+gBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AAAAAAAAAAAAAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5CQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQIAAAAAAQAAAA9nZXRTdHJpbmdPckZhaWwAAAABAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEIgAAAAEFAAAAA2tleQkAASwAAAACCQABLAAAAAICAAAAD21hbmRhdG9yeSB0aGlzLgUAAAADa2V5AgAAAA8gaXMgbm90IGR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RpbmdDb250cmFjdEFkZHJlc3NTdHIAAAAIbWF4RGVwdGgDCQEAAAACIT0AAAACBQAAAAR0aGlzCAUAAAABaQAAAAZjYWxsZXIJAAACAAAAAQIAAAAObm90IGF1dGhvcml6ZWQJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAACWtleUNvbmZpZwAAAAAJAQAAAAxmb3JtYXRDb25maWcAAAAEBQAAAAx3eEFzc2V0SWRTdHIFAAAAGm1hdGNoZXJQYWNlbWFrZXJBZGRyZXNzU3RyBQAAABpib29zdGluZ0NvbnRyYWN0QWRkcmVzc1N0cgUAAAAIbWF4RGVwdGgFAAAAA25pbAAAAADiy0XY", "chainId": 84, "height": 1796729, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FsB89Pp8n6eSv2e2e2TKbPvR7MhkiF46SfS7yh7Tycor Next: D6GLY9gYQZkDJVecwJrXyrhsktQuPmBR1mzChqvVWbNM Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | ||
10 | 10 | let USERDEPTH = 26 | |
11 | 11 | ||
12 | - | let | |
12 | + | let SCALE = 1000 | |
13 | 13 | ||
14 | 14 | func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0) | |
15 | 15 | ||
26 | 26 | ||
27 | 27 | let IdxCfgBoostingContract = 3 | |
28 | 28 | ||
29 | + | let IdxCfgMaxDepth = 4 | |
30 | + | ||
29 | 31 | func keyConfig () = "%s__config" | |
30 | 32 | ||
31 | 33 | ||
32 | 34 | func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP) | |
33 | 35 | ||
34 | 36 | ||
35 | - | func formatConfig (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr) = makeString(["%s%s%s", wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr], SEP) | |
37 | + | func formatConfig (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr,maxDepth) = makeString(["%s%s%s%d", wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr, toString(maxDepth)], SEP) | |
36 | 38 | ||
37 | 39 | ||
38 | - | func keyUsersCount () = | |
40 | + | func keyUsersCount () = "%s__nextUserNum" | |
39 | 41 | ||
40 | 42 | ||
41 | - | func keyNextProcessedUser () = | |
43 | + | func keyNextProcessedUser () = "%s__nextProcessedUser" | |
42 | 44 | ||
43 | 45 | ||
44 | - | func keyLatestPeriod () = | |
46 | + | func keyLatestPeriod () = "%s__latestPeriod" | |
45 | 47 | ||
46 | 48 | ||
47 | - | func keyNextPeriod () = | |
49 | + | func keyNextPeriod () = "%s__nextPeriod" | |
48 | 50 | ||
49 | 51 | ||
50 | - | func keyNextProcessedPeriod () = | |
52 | + | func keyNextProcessedPeriod () = "%s__nextProcessedPeriod" | |
51 | 53 | ||
52 | 54 | ||
53 | - | func keyNextUnlaimedPeriodOfUser (userIndex) = makeString(["%s%d | |
55 | + | func keyNextUnlaimedPeriodOfUser (userIndex) = makeString(["%s%d__nextClaimedPeriod", toString(userIndex)], SEP) | |
54 | 56 | ||
55 | 57 | ||
56 | - | func keyLastProcessedPeriodOfUser (userIndex) = makeString(["%s%d | |
58 | + | func keyLastProcessedPeriodOfUser (userIndex) = makeString(["%s%d__lastProcessedPeriod", toString(userIndex)], SEP) | |
57 | 59 | ||
58 | 60 | ||
59 | - | func keyHeightForPeriod (period) = makeString(["%s%d | |
61 | + | func keyHeightForPeriod (period) = makeString(["%s%d__startHeightForPeriod", toString(period)], SEP) | |
60 | 62 | ||
61 | 63 | ||
62 | - | func keyTotalAmountForPeriod (period) = makeString(["%s%d | |
64 | + | func keyTotalAmountForPeriod (period) = makeString(["%s%d__totalAmountForPeriod", toString(period)], SEP) | |
63 | 65 | ||
64 | 66 | ||
65 | - | func keyTotalWeightForPeriod (period) = makeString(["%s%d | |
67 | + | func keyTotalWeightForPeriod (period) = makeString(["%s%d__totalWeightForPeriod", toString(period)], SEP) | |
66 | 68 | ||
67 | 69 | ||
68 | - | func keyUserKValueForPeriod (period,userIndex) = makeString(["%s%d%s%d | |
70 | + | func keyUserKValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "k", toString(period)], SEP) | |
69 | 71 | ||
70 | 72 | ||
71 | - | func keyUserBValueForPeriod (period,userIndex) = makeString(["%s%d%s%d", "paramByPeriod", toString(userIndex), "b", toString(period)], SEP) | |
73 | + | func keyUserBValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "b", toString(period)], SEP) | |
74 | + | ||
75 | + | ||
76 | + | func HistoryEntry (type,user,amount,currentPeriod,latestPeriod,i) = { | |
77 | + | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
78 | + | let historyDATA = makeString(["%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount), toString(currentPeriod), toString(latestPeriod)], SEP) | |
79 | + | StringEntry(historyKEY, historyDATA) | |
80 | + | } | |
72 | 81 | ||
73 | 82 | ||
74 | 83 | func calcUserWeight (boostingContractAddress,heightForPeriod,period,userIndex) = { | |
81 | 90 | let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(period, userIndex))) | |
82 | 91 | let w = ((k * heightForPeriod) + b) | |
83 | 92 | if ((w > 0)) | |
84 | - | then $Tuple2((w / | |
93 | + | then $Tuple2((w / SCALE), [IntegerEntry(kLast, period)]) | |
85 | 94 | else $Tuple2(0, nil) | |
86 | 95 | } | |
87 | 96 | else { | |
93 | 102 | let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(pv, userIndex))) | |
94 | 103 | let w = ((k * heightForPeriod) + b) | |
95 | 104 | if ((w > 0)) | |
96 | - | then $Tuple2((w / | |
105 | + | then $Tuple2((w / SCALE), nil) | |
97 | 106 | else $Tuple2(0, nil) | |
98 | 107 | } | |
99 | 108 | else $Tuple2(0, nil) | |
110 | 119 | func nextPeriod () = getNumberByKey(keyNextPeriod()) | |
111 | 120 | ||
112 | 121 | ||
113 | - | func invokeProcess (boostingContract,period,user,depth,weight | |
122 | + | func invokeProcess (boostingContract,period,user,depth,weight) = { | |
114 | 123 | let result = invoke(this, "processNextBatch", [boostingContract, period, user, depth, weight], nil) | |
115 | 124 | if ((result == result)) | |
116 | 125 | then match result { | |
117 | 126 | case r: (Int, Int, Int) => | |
118 | - | | |
127 | + | r | |
119 | 128 | case _ => | |
120 | 129 | throw("Incorrect invoke result") | |
121 | 130 | } | |
124 | 133 | ||
125 | 134 | ||
126 | 135 | func checkLastPartOfPeriod (boostingContract,currentPeriod,latestPeriod,depth,totalWeightKey,weight) = if ((latestPeriod >= (currentPeriod + 1))) | |
127 | - | then invokeProcess(boostingContract, (currentPeriod + 1), 0, (depth - 1), 0 | |
128 | - | else $ | |
136 | + | then invokeProcess(boostingContract, (currentPeriod + 1), 0, (depth - 1), 0) | |
137 | + | else $Tuple3((currentPeriod + 1), 0, 0) | |
129 | 138 | ||
130 | 139 | ||
131 | 140 | func processNextBatchInternal (boostingContract,currentPeriod,currentUser,depth,totalWeight) = { | |
138 | 147 | then (latestPeriod >= currentPeriod) | |
139 | 148 | else false) | |
140 | 149 | then { | |
141 | - | let $t060846186 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, currentUser) | |
142 | - | let w0 = $t060846186._1 | |
143 | - | let save0 = $t060846186._2 | |
144 | - | let weight0 = (totalWeight + w0) | |
150 | + | let t0 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, currentUser) | |
151 | + | let weight0 = (totalWeight + t0._1) | |
145 | 152 | if ((usersCount > (currentUser + 1))) | |
146 | 153 | then { | |
147 | - | let $t062736384 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 1)) | |
148 | - | let weight1 = $t062736384._1 | |
149 | - | let save1 = $t062736384._2 | |
154 | + | let t1 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 1)) | |
155 | + | let weight1 = (weight0 + t1._1) | |
150 | 156 | if ((usersCount > (currentUser + 2))) | |
151 | 157 | then { | |
152 | - | let $t064406551 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 2)) | |
153 | - | let weight2 = $t064406551._1 | |
154 | - | let save2 = $t064406551._2 | |
158 | + | let t2 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 2)) | |
159 | + | let weight2 = (weight1 + t2._1) | |
155 | 160 | if ((usersCount > (currentUser + 3))) | |
156 | 161 | then { | |
157 | - | let $t066116722 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 3)) | |
158 | - | let weight3 = $t066116722._1 | |
159 | - | let save3 = $t066116722._2 | |
162 | + | let t3 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 3)) | |
163 | + | let weight3 = (weight2 + t3._1) | |
160 | 164 | if ((usersCount > (currentUser + 4))) | |
161 | 165 | then { | |
162 | - | let $t067866897 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 4)) | |
163 | - | let weight4 = $t067866897._1 | |
164 | - | let save4 = $t067866897._2 | |
166 | + | let t4 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 4)) | |
167 | + | let weight4 = (weight3 + t4._1) | |
165 | 168 | if ((usersCount > (currentUser + 5))) | |
166 | 169 | then { | |
167 | - | let $t069657076 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 5)) | |
168 | - | let weight5 = $t069657076._1 | |
169 | - | let save5 = $t069657076._2 | |
170 | + | let t5 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 5)) | |
171 | + | let weight5 = (weight4 + t5._1) | |
170 | 172 | if ((usersCount > (currentUser + 6))) | |
171 | 173 | then { | |
172 | - | let $t071957351 = invokeProcess(boostingContract, currentPeriod, (currentUser + 6), (depth - 1), (((((weight0 + weight1) + weight2) + weight3) + weight4) + weight5), nil) | |
173 | - | let a = $t071957351._1 | |
174 | - | let p = $t071957351._2 | |
175 | - | let u = $t071957351._3 | |
176 | - | let w = $t071957351._4 | |
177 | - | $Tuple4(((((((a ++ save0) ++ save1) ++ save2) ++ save3) ++ save4) ++ save5), p, u, w) | |
174 | + | let r5 = invokeProcess(boostingContract, currentPeriod, (currentUser + 6), (depth - 1), weight5) | |
175 | + | $Tuple4((((((t0._2 ++ t1._2) ++ t2._2) ++ t3._2) ++ t4._2) ++ t5._2), r5._1, r5._2, r5._3) | |
178 | 176 | } | |
179 | 177 | else { | |
180 | - | let $t075197688 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, (((((weight0 + weight1) + weight2) + weight3) + weight4) + weight5)) | |
181 | - | let a = $t075197688._1 | |
182 | - | let p = $t075197688._2 | |
183 | - | let u = $t075197688._3 | |
184 | - | let w = $t075197688._4 | |
185 | - | $Tuple4(((((((a ++ save0) ++ save1) ++ save2) ++ save3) ++ save4) ++ save5), p, u, w) | |
178 | + | let r5 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight5) | |
179 | + | $Tuple4((((((([IntegerEntry(totalWeightKey, weight5)] ++ t0._2) ++ t1._2) ++ t2._2) ++ t3._2) ++ t4._2) ++ t5._2), r5._1, r5._2, r5._3) | |
186 | 180 | } | |
187 | 181 | } | |
188 | 182 | else { | |
189 | - | let $t078688027 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, ((((weight0 + weight1) + weight2) + weight3) + weight4)) | |
190 | - | let a = $t078688027._1 | |
191 | - | let p = $t078688027._2 | |
192 | - | let u = $t078688027._3 | |
193 | - | let w = $t078688027._4 | |
194 | - | $Tuple4((((((a ++ save0) ++ save1) ++ save2) ++ save3) ++ save4), p, u, w) | |
183 | + | let r4 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight4) | |
184 | + | $Tuple4(((((([IntegerEntry(totalWeightKey, weight4)] ++ t0._2) ++ t1._2) ++ t2._2) ++ t3._2) ++ t4._2), r4._1, r4._2, r4._3) | |
195 | 185 | } | |
196 | 186 | } | |
197 | 187 | else { | |
198 | - | let $t081908339 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, (((weight0 + weight1) + weight2) + weight3)) | |
199 | - | let a = $t081908339._1 | |
200 | - | let p = $t081908339._2 | |
201 | - | let u = $t081908339._3 | |
202 | - | let w = $t081908339._4 | |
203 | - | $Tuple4(((((a ++ save0) ++ save1) ++ save2) ++ save3), p, u, w) | |
188 | + | let r3 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight3) | |
189 | + | $Tuple4((((([IntegerEntry(totalWeightKey, weight3)] ++ t0._2) ++ t1._2) ++ t2._2) ++ t3._2), r3._1, r3._2, r3._3) | |
204 | 190 | } | |
205 | 191 | } | |
206 | 192 | else { | |
207 | - | let $t084858624 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, ((weight0 + weight1) + weight2)) | |
208 | - | let a = $t084858624._1 | |
209 | - | let p = $t084858624._2 | |
210 | - | let u = $t084858624._3 | |
211 | - | let w = $t084858624._4 | |
212 | - | $Tuple4((((a ++ save0) ++ save1) ++ save2), p, u, w) | |
193 | + | let r2 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight2) | |
194 | + | $Tuple4(((([IntegerEntry(totalWeightKey, weight2)] ++ t0._2) ++ t1._2) ++ t2._2), r2._1, r2._2, r2._3) | |
213 | 195 | } | |
214 | 196 | } | |
215 | 197 | else { | |
216 | - | let $t087538882 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, (weight0 + weight1)) | |
217 | - | let a = $t087538882._1 | |
218 | - | let p = $t087538882._2 | |
219 | - | let u = $t087538882._3 | |
220 | - | let w = $t087538882._4 | |
221 | - | $Tuple4(((a ++ save0) ++ save1), p, u, w) | |
198 | + | let r1 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight1) | |
199 | + | $Tuple4((([IntegerEntry(totalWeightKey, weight1)] ++ t0._2) ++ t1._2), r1._1, r1._2, r1._3) | |
222 | 200 | } | |
223 | 201 | } | |
224 | 202 | else { | |
225 | - | let $t090239142 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight0) | |
226 | - | let a = $t090239142._1 | |
227 | - | let p = $t090239142._2 | |
228 | - | let u = $t090239142._3 | |
229 | - | let w = $t090239142._4 | |
230 | - | $Tuple4((a ++ save0), p, u, w) | |
203 | + | let r0 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight0) | |
204 | + | $Tuple4(([IntegerEntry(totalWeightKey, weight0)] ++ t0._2), r0._1, r0._2, r0._3) | |
231 | 205 | } | |
232 | 206 | } | |
233 | 207 | else if ((currentUser == 0)) | |
254 | 228 | let latestPeriod = getNumberByKey(keyNextProcessedPeriod()) | |
255 | 229 | let totalWeight = getNumberByKey(keyTotalWeightForPeriod(currentPeriod)) | |
256 | 230 | let heightForPeriod = getNumberByKey(keyHeightForPeriod(currentPeriod)) | |
257 | - | let $ | |
258 | - | let userWeight = $ | |
259 | - | let ignored = $ | |
260 | - | let | |
231 | + | let $t01069910811 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, currentUser) | |
232 | + | let userWeight = $t01069910811._1 | |
233 | + | let ignored = $t01069910811._2 | |
234 | + | let userAmountForPeriod = fraction(getNumberByKey(keyTotalAmountForPeriod(currentPeriod)), userWeight, totalWeight) | |
261 | 235 | if (if ((0 >= depth)) | |
262 | 236 | then true | |
263 | 237 | else ((currentPeriod + 1) >= latestPeriod)) | |
264 | - | then $Tuple2((currentPeriod + 1), (userAccumulated + | |
265 | - | else invokeClaim(boostingContract, (currentPeriod + 1), currentUser, (depth - 1), (userAccumulated + | |
238 | + | then $Tuple2((currentPeriod + 1), (userAccumulated + userAmountForPeriod)) | |
239 | + | else invokeClaim(boostingContract, (currentPeriod + 1), currentUser, (depth - 1), (userAccumulated + userAmountForPeriod)) | |
266 | 240 | } | |
267 | 241 | ||
268 | 242 | ||
270 | 244 | let cfgArray = readConfigArrayOrFail() | |
271 | 245 | let userIdx = getUserIndexByAddress(cfgArray[IdxCfgBoostingContract], userAddress) | |
272 | 246 | let currentPeriod = getNumberByKey(keyNextUnlaimedPeriodOfUser(userIdx)) | |
273 | - | if ((currentPeriod >= getNumberByKey(keyNextProcessedPeriod()))) | |
247 | + | let latestPeriod = getNumberByKey(keyNextProcessedPeriod()) | |
248 | + | if ((currentPeriod >= latestPeriod)) | |
274 | 249 | then throw("Nothing to claim") | |
275 | 250 | else { | |
276 | 251 | let boostingContract = fromBase58String(cfgArray[IdxCfgBoostingContract]) | |
277 | - | $Tuple3(claimInternal(boostingContract, currentPeriod, userIdx, USERDEPTH, 0), userIdx, cfgArray) | |
252 | + | let $t01173211824 = claimInternal(boostingContract, currentPeriod, userIdx, USERDEPTH, 0) | |
253 | + | let period = $t01173211824._1 | |
254 | + | let amount = $t01173211824._2 | |
255 | + | $Tuple5(period, amount, userIdx, cfgArray, latestPeriod) | |
278 | 256 | } | |
279 | 257 | } | |
280 | 258 | ||
290 | 268 | ||
291 | 269 | ||
292 | 270 | @Callable(i) | |
293 | - | func processPendingPeriodsAndUsers (depth) = if ((depth > MAXDEPTH)) | |
294 | - | then throw("Depth exceeds MAXDEPTH") | |
295 | - | else { | |
296 | - | let currentPeriod = getNumberByKey(keyNextProcessedPeriod()) | |
297 | - | if ((currentPeriod > getNumberByKey(keyLatestPeriod()))) | |
298 | - | then throw("Nothing to process") | |
299 | - | else { | |
300 | - | let boostingContract = fromBase58String(readConfigArrayOrFail()[IdxCfgBoostingContract]) | |
301 | - | let currentUser = getNumberByKey(keyNextProcessedUser()) | |
302 | - | let totalWeight = getNumberByKey(keyTotalWeightForPeriod(currentPeriod)) | |
303 | - | let r = processNextBatchInternal(boostingContract, currentPeriod, currentUser, depth, totalWeight) | |
304 | - | ((r._1 :+ IntegerEntry(keyNextProcessedPeriod(), r._2)) :+ IntegerEntry(keyNextProcessedUser(), r._3)) | |
305 | - | } | |
306 | - | } | |
271 | + | func processPendingPeriodsAndUsers () = { | |
272 | + | let currentPeriod = getNumberByKey(keyNextProcessedPeriod()) | |
273 | + | if ((currentPeriod > getNumberByKey(keyLatestPeriod()))) | |
274 | + | then throw("Nothing to process") | |
275 | + | else { | |
276 | + | let cfgArray = readConfigArrayOrFail() | |
277 | + | let depth = parseIntValue(cfgArray[IdxCfgMaxDepth]) | |
278 | + | if ((depth > MAXDEPTH)) | |
279 | + | then throw("Depth exceeds MAXDEPTH") | |
280 | + | else { | |
281 | + | let boostingContract = fromBase58String(cfgArray[IdxCfgBoostingContract]) | |
282 | + | let currentUser = getNumberByKey(keyNextProcessedUser()) | |
283 | + | let totalWeight = getNumberByKey(keyTotalWeightForPeriod(currentPeriod)) | |
284 | + | let r = processNextBatchInternal(boostingContract, currentPeriod, currentUser, depth, totalWeight) | |
285 | + | ((r._1 :+ IntegerEntry(keyNextProcessedPeriod(), r._2)) :+ IntegerEntry(keyNextProcessedUser(), r._3)) | |
286 | + | } | |
287 | + | } | |
288 | + | } | |
307 | 289 | ||
308 | 290 | ||
309 | 291 | ||
310 | 292 | @Callable(i) | |
311 | 293 | func deposit () = { | |
312 | 294 | let cfgArray = readConfigArrayOrFail() | |
313 | - | let assetId = value(value(i.payments[0]).assetId) | |
314 | - | if ((assetId != fromBase58String(cfgArray[IdxCfgAssetId]))) | |
315 | - | then throw("Wrong payment asset") | |
295 | + | if ((i.caller != Address(fromBase58String(cfgArray[IdxCfgPacemakerAddress])))) | |
296 | + | then throw("Wrong caller address") | |
316 | 297 | else { | |
317 | - | let period = nextPeriod() | |
298 | + | let assetId = value(value(i.payments[0]).assetId) | |
299 | + | if ((assetId != fromBase58String(cfgArray[IdxCfgAssetId]))) | |
300 | + | then throw("Wrong payment asset") | |
301 | + | else { | |
302 | + | let period = nextPeriod() | |
318 | 303 | [IntegerEntry(keyLatestPeriod(), period), IntegerEntry(keyHeightForPeriod(period), height), IntegerEntry(keyTotalAmountForPeriod(period), value(i.payments[0]).amount), IntegerEntry(keyNextPeriod(), (period + 1))] | |
304 | + | } | |
319 | 305 | } | |
320 | 306 | } | |
321 | 307 | ||
334 | 320 | @Callable(i) | |
335 | 321 | func claimReward () = { | |
336 | 322 | let address = toString(i.caller) | |
337 | - | let commonResults = commonClaimReward(address) | |
338 | - | let r = commonResults._1 | |
339 | - | let userIdx = commonResults._2 | |
340 | - | let cfgArray = commonResults._3 | |
341 | - | $Tuple2([IntegerEntry(keyNextUnlaimedPeriodOfUser(userIdx), r._1), ScriptTransfer(i.caller, r._2, fromBase58String(cfgArray[IdxCfgAssetId]))], r._2) | |
323 | + | let claimResults = commonClaimReward(address) | |
324 | + | let period = claimResults._1 | |
325 | + | let amount = claimResults._2 | |
326 | + | let userIdx = claimResults._3 | |
327 | + | let cfgArray = claimResults._4 | |
328 | + | let latestPeriod = claimResults._5 | |
329 | + | $Tuple2([IntegerEntry(keyNextUnlaimedPeriodOfUser(userIdx), period), ScriptTransfer(i.caller, amount, fromBase58String(cfgArray[IdxCfgAssetId])), HistoryEntry("claim", address, amount, period, latestPeriod, i)], amount) | |
342 | 330 | } | |
343 | 331 | ||
344 | 332 | ||
345 | 333 | ||
346 | 334 | @Callable(i) | |
347 | - | func claimRewardREADONLY (userAddress) = { | |
348 | - | let commonResults = commonClaimReward(userAddress) | |
349 | - | let r = commonResults._1 | |
350 | - | let userIdx = commonResults._2 | |
351 | - | let cfgArray = commonResults._3 | |
352 | - | $Tuple2(nil, r._2) | |
335 | + | func claimRewardREADONLY (address) = { | |
336 | + | let claimResults = commonClaimReward(address) | |
337 | + | let amount = claimResults._2 | |
338 | + | $Tuple2(nil, amount) | |
353 | 339 | } | |
354 | 340 | ||
355 | 341 | ||
357 | 343 | @Callable(i) | |
358 | 344 | func calcGwxParamsREADONLY (wxAmount,lockStartHeight,lockDurationBlocks) = { | |
359 | 345 | let lockEndHeight = (lockStartHeight + lockDurationBlocks) | |
360 | - | let scale8ParamK = -(fraction(wxAmount, | |
361 | - | let scale8ParamB = (fraction(wxAmount, | |
346 | + | let scale8ParamK = -(fraction(wxAmount, SCALE, lockDurationBlocks)) | |
347 | + | let scale8ParamB = (fraction(wxAmount, SCALE, lockDurationBlocks) * lockEndHeight) | |
362 | 348 | $Tuple2(nil, [scale8ParamK, scale8ParamB, nextPeriod()]) | |
363 | 349 | } | |
364 | 350 | ||
365 | 351 | ||
366 | 352 | ||
367 | 353 | @Callable(i) | |
368 | - | func constructor (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr) = if ((this != i.caller)) | |
354 | + | func constructor (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr,maxDepth) = if ((this != i.caller)) | |
369 | 355 | then throw("not authorized") | |
370 | - | else [StringEntry(keyConfig(), formatConfig(wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr))] | |
356 | + | else [StringEntry(keyConfig(), formatConfig(wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr, maxDepth))] | |
371 | 357 | ||
372 | 358 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let revisionNum = "" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let MAXDEPTH = 17 | |
9 | 9 | ||
10 | 10 | let USERDEPTH = 26 | |
11 | 11 | ||
12 | - | let | |
12 | + | let SCALE = 1000 | |
13 | 13 | ||
14 | 14 | func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | let IdxCfgAssetId = 1 | |
24 | 24 | ||
25 | 25 | let IdxCfgPacemakerAddress = 2 | |
26 | 26 | ||
27 | 27 | let IdxCfgBoostingContract = 3 | |
28 | 28 | ||
29 | + | let IdxCfgMaxDepth = 4 | |
30 | + | ||
29 | 31 | func keyConfig () = "%s__config" | |
30 | 32 | ||
31 | 33 | ||
32 | 34 | func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP) | |
33 | 35 | ||
34 | 36 | ||
35 | - | func formatConfig (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr) = makeString(["%s%s%s", wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr], SEP) | |
37 | + | func formatConfig (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr,maxDepth) = makeString(["%s%s%s%d", wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr, toString(maxDepth)], SEP) | |
36 | 38 | ||
37 | 39 | ||
38 | - | func keyUsersCount () = | |
40 | + | func keyUsersCount () = "%s__nextUserNum" | |
39 | 41 | ||
40 | 42 | ||
41 | - | func keyNextProcessedUser () = | |
43 | + | func keyNextProcessedUser () = "%s__nextProcessedUser" | |
42 | 44 | ||
43 | 45 | ||
44 | - | func keyLatestPeriod () = | |
46 | + | func keyLatestPeriod () = "%s__latestPeriod" | |
45 | 47 | ||
46 | 48 | ||
47 | - | func keyNextPeriod () = | |
49 | + | func keyNextPeriod () = "%s__nextPeriod" | |
48 | 50 | ||
49 | 51 | ||
50 | - | func keyNextProcessedPeriod () = | |
52 | + | func keyNextProcessedPeriod () = "%s__nextProcessedPeriod" | |
51 | 53 | ||
52 | 54 | ||
53 | - | func keyNextUnlaimedPeriodOfUser (userIndex) = makeString(["%s%d | |
55 | + | func keyNextUnlaimedPeriodOfUser (userIndex) = makeString(["%s%d__nextClaimedPeriod", toString(userIndex)], SEP) | |
54 | 56 | ||
55 | 57 | ||
56 | - | func keyLastProcessedPeriodOfUser (userIndex) = makeString(["%s%d | |
58 | + | func keyLastProcessedPeriodOfUser (userIndex) = makeString(["%s%d__lastProcessedPeriod", toString(userIndex)], SEP) | |
57 | 59 | ||
58 | 60 | ||
59 | - | func keyHeightForPeriod (period) = makeString(["%s%d | |
61 | + | func keyHeightForPeriod (period) = makeString(["%s%d__startHeightForPeriod", toString(period)], SEP) | |
60 | 62 | ||
61 | 63 | ||
62 | - | func keyTotalAmountForPeriod (period) = makeString(["%s%d | |
64 | + | func keyTotalAmountForPeriod (period) = makeString(["%s%d__totalAmountForPeriod", toString(period)], SEP) | |
63 | 65 | ||
64 | 66 | ||
65 | - | func keyTotalWeightForPeriod (period) = makeString(["%s%d | |
67 | + | func keyTotalWeightForPeriod (period) = makeString(["%s%d__totalWeightForPeriod", toString(period)], SEP) | |
66 | 68 | ||
67 | 69 | ||
68 | - | func keyUserKValueForPeriod (period,userIndex) = makeString(["%s%d%s%d | |
70 | + | func keyUserKValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "k", toString(period)], SEP) | |
69 | 71 | ||
70 | 72 | ||
71 | - | func keyUserBValueForPeriod (period,userIndex) = makeString(["%s%d%s%d", "paramByPeriod", toString(userIndex), "b", toString(period)], SEP) | |
73 | + | func keyUserBValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "b", toString(period)], SEP) | |
74 | + | ||
75 | + | ||
76 | + | func HistoryEntry (type,user,amount,currentPeriod,latestPeriod,i) = { | |
77 | + | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
78 | + | let historyDATA = makeString(["%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount), toString(currentPeriod), toString(latestPeriod)], SEP) | |
79 | + | StringEntry(historyKEY, historyDATA) | |
80 | + | } | |
72 | 81 | ||
73 | 82 | ||
74 | 83 | func calcUserWeight (boostingContractAddress,heightForPeriod,period,userIndex) = { | |
75 | 84 | let kLast = keyLastProcessedPeriodOfUser(userIndex) | |
76 | 85 | let kKey = keyUserKValueForPeriod(period, userIndex) | |
77 | 86 | let kRaw = getInteger(boostingContractAddress, kKey) | |
78 | 87 | if (isDefined(kRaw)) | |
79 | 88 | then { | |
80 | 89 | let k = value(kRaw) | |
81 | 90 | let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(period, userIndex))) | |
82 | 91 | let w = ((k * heightForPeriod) + b) | |
83 | 92 | if ((w > 0)) | |
84 | - | then $Tuple2((w / | |
93 | + | then $Tuple2((w / SCALE), [IntegerEntry(kLast, period)]) | |
85 | 94 | else $Tuple2(0, nil) | |
86 | 95 | } | |
87 | 96 | else { | |
88 | 97 | let p = getInteger(this, kLast) | |
89 | 98 | if (isDefined(p)) | |
90 | 99 | then { | |
91 | 100 | let pv = value(p) | |
92 | 101 | let k = value(getInteger(boostingContractAddress, keyUserKValueForPeriod(pv, userIndex))) | |
93 | 102 | let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(pv, userIndex))) | |
94 | 103 | let w = ((k * heightForPeriod) + b) | |
95 | 104 | if ((w > 0)) | |
96 | - | then $Tuple2((w / | |
105 | + | then $Tuple2((w / SCALE), nil) | |
97 | 106 | else $Tuple2(0, nil) | |
98 | 107 | } | |
99 | 108 | else $Tuple2(0, nil) | |
100 | 109 | } | |
101 | 110 | } | |
102 | 111 | ||
103 | 112 | ||
104 | 113 | func getUserIndexByAddress (boostingContractAddressStr,userAddress) = { | |
105 | 114 | let key = makeString(["%s%s%s", "mapping", "user2num", userAddress], SEP) | |
106 | 115 | parseIntValue(valueOrErrorMessage(getString(Address(fromBase58String(boostingContractAddressStr)), key), ((("User address " + userAddress) + " is not found in boosting contract data, key=") + key))) | |
107 | 116 | } | |
108 | 117 | ||
109 | 118 | ||
110 | 119 | func nextPeriod () = getNumberByKey(keyNextPeriod()) | |
111 | 120 | ||
112 | 121 | ||
113 | - | func invokeProcess (boostingContract,period,user,depth,weight | |
122 | + | func invokeProcess (boostingContract,period,user,depth,weight) = { | |
114 | 123 | let result = invoke(this, "processNextBatch", [boostingContract, period, user, depth, weight], nil) | |
115 | 124 | if ((result == result)) | |
116 | 125 | then match result { | |
117 | 126 | case r: (Int, Int, Int) => | |
118 | - | | |
127 | + | r | |
119 | 128 | case _ => | |
120 | 129 | throw("Incorrect invoke result") | |
121 | 130 | } | |
122 | 131 | else throw("Strict value is not equal to itself.") | |
123 | 132 | } | |
124 | 133 | ||
125 | 134 | ||
126 | 135 | func checkLastPartOfPeriod (boostingContract,currentPeriod,latestPeriod,depth,totalWeightKey,weight) = if ((latestPeriod >= (currentPeriod + 1))) | |
127 | - | then invokeProcess(boostingContract, (currentPeriod + 1), 0, (depth - 1), 0 | |
128 | - | else $ | |
136 | + | then invokeProcess(boostingContract, (currentPeriod + 1), 0, (depth - 1), 0) | |
137 | + | else $Tuple3((currentPeriod + 1), 0, 0) | |
129 | 138 | ||
130 | 139 | ||
131 | 140 | func processNextBatchInternal (boostingContract,currentPeriod,currentUser,depth,totalWeight) = { | |
132 | 141 | let boostingContractAddress = Address(boostingContract) | |
133 | 142 | let latestPeriod = getNumberByKey(keyLatestPeriod()) | |
134 | 143 | let usersCount = valueOrElse(getInteger(boostingContractAddress, keyUsersCount()), 0) | |
135 | 144 | let totalWeightKey = keyTotalWeightForPeriod(currentPeriod) | |
136 | 145 | let heightForPeriod = getNumberByKey(keyHeightForPeriod(currentPeriod)) | |
137 | 146 | if (if ((depth > 0)) | |
138 | 147 | then (latestPeriod >= currentPeriod) | |
139 | 148 | else false) | |
140 | 149 | then { | |
141 | - | let $t060846186 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, currentUser) | |
142 | - | let w0 = $t060846186._1 | |
143 | - | let save0 = $t060846186._2 | |
144 | - | let weight0 = (totalWeight + w0) | |
150 | + | let t0 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, currentUser) | |
151 | + | let weight0 = (totalWeight + t0._1) | |
145 | 152 | if ((usersCount > (currentUser + 1))) | |
146 | 153 | then { | |
147 | - | let $t062736384 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 1)) | |
148 | - | let weight1 = $t062736384._1 | |
149 | - | let save1 = $t062736384._2 | |
154 | + | let t1 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 1)) | |
155 | + | let weight1 = (weight0 + t1._1) | |
150 | 156 | if ((usersCount > (currentUser + 2))) | |
151 | 157 | then { | |
152 | - | let $t064406551 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 2)) | |
153 | - | let weight2 = $t064406551._1 | |
154 | - | let save2 = $t064406551._2 | |
158 | + | let t2 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 2)) | |
159 | + | let weight2 = (weight1 + t2._1) | |
155 | 160 | if ((usersCount > (currentUser + 3))) | |
156 | 161 | then { | |
157 | - | let $t066116722 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 3)) | |
158 | - | let weight3 = $t066116722._1 | |
159 | - | let save3 = $t066116722._2 | |
162 | + | let t3 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 3)) | |
163 | + | let weight3 = (weight2 + t3._1) | |
160 | 164 | if ((usersCount > (currentUser + 4))) | |
161 | 165 | then { | |
162 | - | let $t067866897 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 4)) | |
163 | - | let weight4 = $t067866897._1 | |
164 | - | let save4 = $t067866897._2 | |
166 | + | let t4 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 4)) | |
167 | + | let weight4 = (weight3 + t4._1) | |
165 | 168 | if ((usersCount > (currentUser + 5))) | |
166 | 169 | then { | |
167 | - | let $t069657076 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 5)) | |
168 | - | let weight5 = $t069657076._1 | |
169 | - | let save5 = $t069657076._2 | |
170 | + | let t5 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, (currentUser + 5)) | |
171 | + | let weight5 = (weight4 + t5._1) | |
170 | 172 | if ((usersCount > (currentUser + 6))) | |
171 | 173 | then { | |
172 | - | let $t071957351 = invokeProcess(boostingContract, currentPeriod, (currentUser + 6), (depth - 1), (((((weight0 + weight1) + weight2) + weight3) + weight4) + weight5), nil) | |
173 | - | let a = $t071957351._1 | |
174 | - | let p = $t071957351._2 | |
175 | - | let u = $t071957351._3 | |
176 | - | let w = $t071957351._4 | |
177 | - | $Tuple4(((((((a ++ save0) ++ save1) ++ save2) ++ save3) ++ save4) ++ save5), p, u, w) | |
174 | + | let r5 = invokeProcess(boostingContract, currentPeriod, (currentUser + 6), (depth - 1), weight5) | |
175 | + | $Tuple4((((((t0._2 ++ t1._2) ++ t2._2) ++ t3._2) ++ t4._2) ++ t5._2), r5._1, r5._2, r5._3) | |
178 | 176 | } | |
179 | 177 | else { | |
180 | - | let $t075197688 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, (((((weight0 + weight1) + weight2) + weight3) + weight4) + weight5)) | |
181 | - | let a = $t075197688._1 | |
182 | - | let p = $t075197688._2 | |
183 | - | let u = $t075197688._3 | |
184 | - | let w = $t075197688._4 | |
185 | - | $Tuple4(((((((a ++ save0) ++ save1) ++ save2) ++ save3) ++ save4) ++ save5), p, u, w) | |
178 | + | let r5 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight5) | |
179 | + | $Tuple4((((((([IntegerEntry(totalWeightKey, weight5)] ++ t0._2) ++ t1._2) ++ t2._2) ++ t3._2) ++ t4._2) ++ t5._2), r5._1, r5._2, r5._3) | |
186 | 180 | } | |
187 | 181 | } | |
188 | 182 | else { | |
189 | - | let $t078688027 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, ((((weight0 + weight1) + weight2) + weight3) + weight4)) | |
190 | - | let a = $t078688027._1 | |
191 | - | let p = $t078688027._2 | |
192 | - | let u = $t078688027._3 | |
193 | - | let w = $t078688027._4 | |
194 | - | $Tuple4((((((a ++ save0) ++ save1) ++ save2) ++ save3) ++ save4), p, u, w) | |
183 | + | let r4 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight4) | |
184 | + | $Tuple4(((((([IntegerEntry(totalWeightKey, weight4)] ++ t0._2) ++ t1._2) ++ t2._2) ++ t3._2) ++ t4._2), r4._1, r4._2, r4._3) | |
195 | 185 | } | |
196 | 186 | } | |
197 | 187 | else { | |
198 | - | let $t081908339 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, (((weight0 + weight1) + weight2) + weight3)) | |
199 | - | let a = $t081908339._1 | |
200 | - | let p = $t081908339._2 | |
201 | - | let u = $t081908339._3 | |
202 | - | let w = $t081908339._4 | |
203 | - | $Tuple4(((((a ++ save0) ++ save1) ++ save2) ++ save3), p, u, w) | |
188 | + | let r3 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight3) | |
189 | + | $Tuple4((((([IntegerEntry(totalWeightKey, weight3)] ++ t0._2) ++ t1._2) ++ t2._2) ++ t3._2), r3._1, r3._2, r3._3) | |
204 | 190 | } | |
205 | 191 | } | |
206 | 192 | else { | |
207 | - | let $t084858624 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, ((weight0 + weight1) + weight2)) | |
208 | - | let a = $t084858624._1 | |
209 | - | let p = $t084858624._2 | |
210 | - | let u = $t084858624._3 | |
211 | - | let w = $t084858624._4 | |
212 | - | $Tuple4((((a ++ save0) ++ save1) ++ save2), p, u, w) | |
193 | + | let r2 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight2) | |
194 | + | $Tuple4(((([IntegerEntry(totalWeightKey, weight2)] ++ t0._2) ++ t1._2) ++ t2._2), r2._1, r2._2, r2._3) | |
213 | 195 | } | |
214 | 196 | } | |
215 | 197 | else { | |
216 | - | let $t087538882 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, (weight0 + weight1)) | |
217 | - | let a = $t087538882._1 | |
218 | - | let p = $t087538882._2 | |
219 | - | let u = $t087538882._3 | |
220 | - | let w = $t087538882._4 | |
221 | - | $Tuple4(((a ++ save0) ++ save1), p, u, w) | |
198 | + | let r1 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight1) | |
199 | + | $Tuple4((([IntegerEntry(totalWeightKey, weight1)] ++ t0._2) ++ t1._2), r1._1, r1._2, r1._3) | |
222 | 200 | } | |
223 | 201 | } | |
224 | 202 | else { | |
225 | - | let $t090239142 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight0) | |
226 | - | let a = $t090239142._1 | |
227 | - | let p = $t090239142._2 | |
228 | - | let u = $t090239142._3 | |
229 | - | let w = $t090239142._4 | |
230 | - | $Tuple4((a ++ save0), p, u, w) | |
203 | + | let r0 = checkLastPartOfPeriod(boostingContract, currentPeriod, latestPeriod, depth, totalWeightKey, weight0) | |
204 | + | $Tuple4(([IntegerEntry(totalWeightKey, weight0)] ++ t0._2), r0._1, r0._2, r0._3) | |
231 | 205 | } | |
232 | 206 | } | |
233 | 207 | else if ((currentUser == 0)) | |
234 | 208 | then $Tuple4(nil, currentPeriod, 0, 0) | |
235 | 209 | else $Tuple4([IntegerEntry(totalWeightKey, totalWeight)], currentPeriod, currentUser, 0) | |
236 | 210 | } | |
237 | 211 | ||
238 | 212 | ||
239 | 213 | func invokeClaim (boostingContract,period,user,depth,total) = { | |
240 | 214 | let result = invoke(this, "claimNextBatch", [boostingContract, period, user, depth, total], nil) | |
241 | 215 | if ((result == result)) | |
242 | 216 | then match result { | |
243 | 217 | case r: (Int, Int) => | |
244 | 218 | r | |
245 | 219 | case _ => | |
246 | 220 | throw("Incorrect invoke result") | |
247 | 221 | } | |
248 | 222 | else throw("Strict value is not equal to itself.") | |
249 | 223 | } | |
250 | 224 | ||
251 | 225 | ||
252 | 226 | func claimInternal (boostingContract,currentPeriod,currentUser,depth,userAccumulated) = { | |
253 | 227 | let boostingContractAddress = Address(boostingContract) | |
254 | 228 | let latestPeriod = getNumberByKey(keyNextProcessedPeriod()) | |
255 | 229 | let totalWeight = getNumberByKey(keyTotalWeightForPeriod(currentPeriod)) | |
256 | 230 | let heightForPeriod = getNumberByKey(keyHeightForPeriod(currentPeriod)) | |
257 | - | let $ | |
258 | - | let userWeight = $ | |
259 | - | let ignored = $ | |
260 | - | let | |
231 | + | let $t01069910811 = calcUserWeight(boostingContractAddress, heightForPeriod, currentPeriod, currentUser) | |
232 | + | let userWeight = $t01069910811._1 | |
233 | + | let ignored = $t01069910811._2 | |
234 | + | let userAmountForPeriod = fraction(getNumberByKey(keyTotalAmountForPeriod(currentPeriod)), userWeight, totalWeight) | |
261 | 235 | if (if ((0 >= depth)) | |
262 | 236 | then true | |
263 | 237 | else ((currentPeriod + 1) >= latestPeriod)) | |
264 | - | then $Tuple2((currentPeriod + 1), (userAccumulated + | |
265 | - | else invokeClaim(boostingContract, (currentPeriod + 1), currentUser, (depth - 1), (userAccumulated + | |
238 | + | then $Tuple2((currentPeriod + 1), (userAccumulated + userAmountForPeriod)) | |
239 | + | else invokeClaim(boostingContract, (currentPeriod + 1), currentUser, (depth - 1), (userAccumulated + userAmountForPeriod)) | |
266 | 240 | } | |
267 | 241 | ||
268 | 242 | ||
269 | 243 | func commonClaimReward (userAddress) = { | |
270 | 244 | let cfgArray = readConfigArrayOrFail() | |
271 | 245 | let userIdx = getUserIndexByAddress(cfgArray[IdxCfgBoostingContract], userAddress) | |
272 | 246 | let currentPeriod = getNumberByKey(keyNextUnlaimedPeriodOfUser(userIdx)) | |
273 | - | if ((currentPeriod >= getNumberByKey(keyNextProcessedPeriod()))) | |
247 | + | let latestPeriod = getNumberByKey(keyNextProcessedPeriod()) | |
248 | + | if ((currentPeriod >= latestPeriod)) | |
274 | 249 | then throw("Nothing to claim") | |
275 | 250 | else { | |
276 | 251 | let boostingContract = fromBase58String(cfgArray[IdxCfgBoostingContract]) | |
277 | - | $Tuple3(claimInternal(boostingContract, currentPeriod, userIdx, USERDEPTH, 0), userIdx, cfgArray) | |
252 | + | let $t01173211824 = claimInternal(boostingContract, currentPeriod, userIdx, USERDEPTH, 0) | |
253 | + | let period = $t01173211824._1 | |
254 | + | let amount = $t01173211824._2 | |
255 | + | $Tuple5(period, amount, userIdx, cfgArray, latestPeriod) | |
278 | 256 | } | |
279 | 257 | } | |
280 | 258 | ||
281 | 259 | ||
282 | 260 | @Callable(i) | |
283 | 261 | func processNextBatch (boostingContract,currentPeriod,currentUser,depth,totalWeight) = if ((i.caller != this)) | |
284 | 262 | then throw("Should be called by this script only") | |
285 | 263 | else { | |
286 | 264 | let tpl = processNextBatchInternal(boostingContract, currentPeriod, currentUser, depth, totalWeight) | |
287 | 265 | $Tuple2(tpl._1, $Tuple3(tpl._2, tpl._3, tpl._4)) | |
288 | 266 | } | |
289 | 267 | ||
290 | 268 | ||
291 | 269 | ||
292 | 270 | @Callable(i) | |
293 | - | func processPendingPeriodsAndUsers (depth) = if ((depth > MAXDEPTH)) | |
294 | - | then throw("Depth exceeds MAXDEPTH") | |
295 | - | else { | |
296 | - | let currentPeriod = getNumberByKey(keyNextProcessedPeriod()) | |
297 | - | if ((currentPeriod > getNumberByKey(keyLatestPeriod()))) | |
298 | - | then throw("Nothing to process") | |
299 | - | else { | |
300 | - | let boostingContract = fromBase58String(readConfigArrayOrFail()[IdxCfgBoostingContract]) | |
301 | - | let currentUser = getNumberByKey(keyNextProcessedUser()) | |
302 | - | let totalWeight = getNumberByKey(keyTotalWeightForPeriod(currentPeriod)) | |
303 | - | let r = processNextBatchInternal(boostingContract, currentPeriod, currentUser, depth, totalWeight) | |
304 | - | ((r._1 :+ IntegerEntry(keyNextProcessedPeriod(), r._2)) :+ IntegerEntry(keyNextProcessedUser(), r._3)) | |
305 | - | } | |
306 | - | } | |
271 | + | func processPendingPeriodsAndUsers () = { | |
272 | + | let currentPeriod = getNumberByKey(keyNextProcessedPeriod()) | |
273 | + | if ((currentPeriod > getNumberByKey(keyLatestPeriod()))) | |
274 | + | then throw("Nothing to process") | |
275 | + | else { | |
276 | + | let cfgArray = readConfigArrayOrFail() | |
277 | + | let depth = parseIntValue(cfgArray[IdxCfgMaxDepth]) | |
278 | + | if ((depth > MAXDEPTH)) | |
279 | + | then throw("Depth exceeds MAXDEPTH") | |
280 | + | else { | |
281 | + | let boostingContract = fromBase58String(cfgArray[IdxCfgBoostingContract]) | |
282 | + | let currentUser = getNumberByKey(keyNextProcessedUser()) | |
283 | + | let totalWeight = getNumberByKey(keyTotalWeightForPeriod(currentPeriod)) | |
284 | + | let r = processNextBatchInternal(boostingContract, currentPeriod, currentUser, depth, totalWeight) | |
285 | + | ((r._1 :+ IntegerEntry(keyNextProcessedPeriod(), r._2)) :+ IntegerEntry(keyNextProcessedUser(), r._3)) | |
286 | + | } | |
287 | + | } | |
288 | + | } | |
307 | 289 | ||
308 | 290 | ||
309 | 291 | ||
310 | 292 | @Callable(i) | |
311 | 293 | func deposit () = { | |
312 | 294 | let cfgArray = readConfigArrayOrFail() | |
313 | - | let assetId = value(value(i.payments[0]).assetId) | |
314 | - | if ((assetId != fromBase58String(cfgArray[IdxCfgAssetId]))) | |
315 | - | then throw("Wrong payment asset") | |
295 | + | if ((i.caller != Address(fromBase58String(cfgArray[IdxCfgPacemakerAddress])))) | |
296 | + | then throw("Wrong caller address") | |
316 | 297 | else { | |
317 | - | let period = nextPeriod() | |
298 | + | let assetId = value(value(i.payments[0]).assetId) | |
299 | + | if ((assetId != fromBase58String(cfgArray[IdxCfgAssetId]))) | |
300 | + | then throw("Wrong payment asset") | |
301 | + | else { | |
302 | + | let period = nextPeriod() | |
318 | 303 | [IntegerEntry(keyLatestPeriod(), period), IntegerEntry(keyHeightForPeriod(period), height), IntegerEntry(keyTotalAmountForPeriod(period), value(i.payments[0]).amount), IntegerEntry(keyNextPeriod(), (period + 1))] | |
304 | + | } | |
319 | 305 | } | |
320 | 306 | } | |
321 | 307 | ||
322 | 308 | ||
323 | 309 | ||
324 | 310 | @Callable(i) | |
325 | 311 | func claimNextBatch (boostingContract,currentPeriod,currentUser,depth,totalWeight) = if ((i.caller != this)) | |
326 | 312 | then throw("Should be called by this script only") | |
327 | 313 | else { | |
328 | 314 | let periodAndTotal = claimInternal(boostingContract, currentPeriod, currentUser, depth, totalWeight) | |
329 | 315 | $Tuple2(nil, periodAndTotal) | |
330 | 316 | } | |
331 | 317 | ||
332 | 318 | ||
333 | 319 | ||
334 | 320 | @Callable(i) | |
335 | 321 | func claimReward () = { | |
336 | 322 | let address = toString(i.caller) | |
337 | - | let commonResults = commonClaimReward(address) | |
338 | - | let r = commonResults._1 | |
339 | - | let userIdx = commonResults._2 | |
340 | - | let cfgArray = commonResults._3 | |
341 | - | $Tuple2([IntegerEntry(keyNextUnlaimedPeriodOfUser(userIdx), r._1), ScriptTransfer(i.caller, r._2, fromBase58String(cfgArray[IdxCfgAssetId]))], r._2) | |
323 | + | let claimResults = commonClaimReward(address) | |
324 | + | let period = claimResults._1 | |
325 | + | let amount = claimResults._2 | |
326 | + | let userIdx = claimResults._3 | |
327 | + | let cfgArray = claimResults._4 | |
328 | + | let latestPeriod = claimResults._5 | |
329 | + | $Tuple2([IntegerEntry(keyNextUnlaimedPeriodOfUser(userIdx), period), ScriptTransfer(i.caller, amount, fromBase58String(cfgArray[IdxCfgAssetId])), HistoryEntry("claim", address, amount, period, latestPeriod, i)], amount) | |
342 | 330 | } | |
343 | 331 | ||
344 | 332 | ||
345 | 333 | ||
346 | 334 | @Callable(i) | |
347 | - | func claimRewardREADONLY (userAddress) = { | |
348 | - | let commonResults = commonClaimReward(userAddress) | |
349 | - | let r = commonResults._1 | |
350 | - | let userIdx = commonResults._2 | |
351 | - | let cfgArray = commonResults._3 | |
352 | - | $Tuple2(nil, r._2) | |
335 | + | func claimRewardREADONLY (address) = { | |
336 | + | let claimResults = commonClaimReward(address) | |
337 | + | let amount = claimResults._2 | |
338 | + | $Tuple2(nil, amount) | |
353 | 339 | } | |
354 | 340 | ||
355 | 341 | ||
356 | 342 | ||
357 | 343 | @Callable(i) | |
358 | 344 | func calcGwxParamsREADONLY (wxAmount,lockStartHeight,lockDurationBlocks) = { | |
359 | 345 | let lockEndHeight = (lockStartHeight + lockDurationBlocks) | |
360 | - | let scale8ParamK = -(fraction(wxAmount, | |
361 | - | let scale8ParamB = (fraction(wxAmount, | |
346 | + | let scale8ParamK = -(fraction(wxAmount, SCALE, lockDurationBlocks)) | |
347 | + | let scale8ParamB = (fraction(wxAmount, SCALE, lockDurationBlocks) * lockEndHeight) | |
362 | 348 | $Tuple2(nil, [scale8ParamK, scale8ParamB, nextPeriod()]) | |
363 | 349 | } | |
364 | 350 | ||
365 | 351 | ||
366 | 352 | ||
367 | 353 | @Callable(i) | |
368 | - | func constructor (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr) = if ((this != i.caller)) | |
354 | + | func constructor (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr,maxDepth) = if ((this != i.caller)) | |
369 | 355 | then throw("not authorized") | |
370 | - | else [StringEntry(keyConfig(), formatConfig(wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr))] | |
356 | + | else [StringEntry(keyConfig(), formatConfig(wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr, maxDepth))] | |
371 | 357 | ||
372 | 358 |
github/deemru/w8io/026f985 60.95 ms ◑