tx · 7L2X6cEFBPWHmdncQoHzyT1DLNWebqc9YoU9TCWiuwVu 3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP: -0.01900000 Waves 2023.06.21 14:00 [2632312] smart account 3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP > SELF 0.00000000 Waves
{ "type": 13, "id": "7L2X6cEFBPWHmdncQoHzyT1DLNWebqc9YoU9TCWiuwVu", "fee": 1900000, "feeAssetId": null, "timestamp": 1687345329386, "version": 2, "chainId": 84, "sender": "3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP", "senderPublicKey": "AoKo4segKHU4DeJnxXQYJj2u7J6XJeux6r8KLW52cd2Q", "proofs": [ "32BCAHjMGVjebAACYshtHMPUetXwtJj2M1D89GcPk64E7CuavBTnitkxwrMKaDC2vgxDTgSrhrKgX59NGntJV9ZR" ], "script": "base64:BwIrCAISAwoBAhIHCgUCAQEBARIDCgECEgMKAQISBAoCAgISBAoCAgISAwoBAicAA1NFUAICX18ADUNPTlRSQUNUX05BTUUCD2NhbGN1bGF0b3IucmlkZQAGU0NBTEU4AIDC1y8AB1BFTkRJTkcCB1BFTkRJTkcACEZJTklTSEVEAghGSU5JU0hFRAAFV0FWRVMCBVdBVkVTAQd3cmFwRXJyAQFzCQCsAgIJAKwCAgUNQ09OVFJBQ1RfTkFNRQICOiAFAXMBCHRocm93RXJyAQFzCQACAQkBB3dyYXBFcnIBBQFzAQ9hc3NldElkVG9TdHJpbmcBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQBYgUHJG1hdGNoMAkA2AQBBQFiAwkAAQIFByRtYXRjaDACBFVuaXQFBVdBVkVTCQACAQILTWF0Y2ggZXJyb3IBA2FicwEBbgMJAGYCAAAFAW4JAQEtAQUBbgUBbgERa2V5RmFjdG9yeUFkZHJlc3MACQC5CQIJAMwIAgICJXMJAMwIAgIHZmFjdG9yeQUDbmlsBQNTRVABD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DAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5uwdghQ==", "height": 2632312, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2gXw4zBaDWfMqYvJ3C8MSDrbNddPqjuU1aPjMc33sAAY Next: 2BKD6hYCQoca8zJa9hG3XpSTYCvUDbYtsubAg9ger5b3 Diff:
Old | New | Differences | |
---|---|---|---|
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | + | func abs (n) = if ((0 > n)) | |
33 | + | then -(n) | |
34 | + | else n | |
35 | + | ||
36 | + | ||
32 | 37 | func keyFactoryAddress () = makeString(["%s", "factory"], SEP) | |
33 | 38 | ||
34 | 39 | ||
35 | 40 | func keyLpAssetId () = makeString(["%s", "lpAssetId"], SEP) | |
41 | + | ||
42 | + | ||
43 | + | func keyXtnAssetId () = makeString(["%s", "xtnAssetId"], SEP) | |
36 | 44 | ||
37 | 45 | ||
38 | 46 | func keyTreasuryAddress () = makeString(["%s", "treasury"], SEP) | |
130 | 138 | ||
131 | 139 | let lpAssetIdOrFail = valueOrErrorMessage(lpAssetIdOption, wrapErr("invalid lpAssetId")) | |
132 | 140 | ||
141 | + | let xtnAssetIdOption = match factoryAddressOption { | |
142 | + | case a: Address => | |
143 | + | match getString(a, keyXtnAssetId()) { | |
144 | + | case s: String => | |
145 | + | fromBase58String(s) | |
146 | + | case _: Unit => | |
147 | + | unit | |
148 | + | case _ => | |
149 | + | throw("Match error") | |
150 | + | } | |
151 | + | case _: Unit => | |
152 | + | unit | |
153 | + | case _ => | |
154 | + | throw("Match error") | |
155 | + | } | |
156 | + | ||
157 | + | let xtnAssetIdOrFail = valueOrErrorMessage(xtnAssetIdOption, wrapErr("invalid xtnAssetId")) | |
158 | + | ||
133 | 159 | let treasuryAddressOption = match factoryAddressOption { | |
134 | 160 | case a: Address => | |
135 | 161 | match getString(a, keyTreasuryAddress()) { | |
158 | 184 | ||
159 | 185 | func rewardForOption (rewards,target) = { | |
160 | 186 | let s = size(rewards) | |
161 | - | let $ | |
162 | - | let a0 = $ | |
163 | - | let r0 = $ | |
164 | - | let $ | |
165 | - | let a1 = $ | |
166 | - | let r1 = $ | |
167 | - | let $ | |
168 | - | let a2 = $ | |
169 | - | let r2 = $ | |
187 | + | let $t040734098 = rewards[0] | |
188 | + | let a0 = $t040734098._1 | |
189 | + | let r0 = $t040734098._2 | |
190 | + | let $t041014126 = rewards[1] | |
191 | + | let a1 = $t041014126._1 | |
192 | + | let r1 = $t041014126._2 | |
193 | + | let $t041294154 = rewards[2] | |
194 | + | let a2 = $t041294154._1 | |
195 | + | let r2 = $t041294154._2 | |
170 | 196 | if (if ((s > 0)) | |
171 | 197 | then (a0 == target) | |
172 | 198 | else false) | |
192 | 218 | let available = valueOrElse(getInteger(factoryAddressOrFail, keyAvailable(userAddress)), 0) | |
193 | 219 | let claimed = valueOrElse(getInteger(factoryAddressOrFail, keyClaimed(userAddress)), 0) | |
194 | 220 | let factoryActions = if ((available > 0)) | |
195 | - | then [invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, available, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(userAddress), 0], nil), invoke(factoryAddressOrFail, " | |
221 | + | then [invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, available, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(userAddress), 0], nil), invoke(factoryAddressOrFail, "integerEntry", [keyClaimed(userAddress), (claimed + available)], nil)] | |
196 | 222 | else throwErr("nothing to claim") | |
197 | 223 | $Tuple2(nil, factoryActions) | |
198 | 224 | } | |
202 | 228 | ||
203 | 229 | ||
204 | 230 | @Callable(i) | |
205 | - | func finalize (newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = { | |
206 | - | let checks = [if ((i.originCaller == factoryAddressOrFail)) | |
207 | - | then true | |
208 | - | else throwErr("permission denied"), if ((newTreasuryVolumeInWaves >= 0)) | |
209 | - | then true | |
210 | - | else throwErr("invalid new treasury volume"), if ((xtnPrice >= 0)) | |
211 | - | then true | |
212 | - | else throwErr("invalid XTN price"), if (if ((pwrManagersBonus >= 0)) | |
213 | - | then (SCALE8 >= pwrManagersBonus) | |
214 | - | else false) | |
215 | - | then true | |
216 | - | else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8))) | |
217 | - | then (SCALE8 >= treasuryVolumeDiffAllocationCoef) | |
218 | - | else false) | |
219 | - | then true | |
220 | - | else throwErr("invalid treasury volume diff allocation coefficient")] | |
221 | - | if ((checks == checks)) | |
231 | + | func finalize (userAddressBytes,newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = { | |
232 | + | let checkCaller = onlyFactory(i) | |
233 | + | if ((checkCaller == checkCaller)) | |
222 | 234 | then { | |
223 | 235 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
224 | - | let newPeriod = (currentPeriodOrFail + 1) | |
225 | - | let newPrice = SCALE8 | |
226 | - | let lpAssetAmountToBurn = 0 | |
227 | - | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyCurrentPeriod(), newPeriod], nil), invoke(factoryAddressOrFail, "integerEntry", [keyPriceForPeriod(newPeriod), newPrice], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmountToBurn], nil)] | |
228 | - | $Tuple2(nil, factoryActions) | |
236 | + | let periodLength = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPeriodLength()), wrapErr("invalid period length")) | |
237 | + | let currentStartHeight = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyStartHeight(currentPeriodOrFail)), wrapErr("invalid start height")) | |
238 | + | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
239 | + | let nextBlockToProcess = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyNextBlockToProcess()), wrapErr("invalid next block to process")) | |
240 | + | let periodEndHeight = ((currentStartHeight + periodLength) - 1) | |
241 | + | let checks = [if ((nextBlockToProcess > periodEndHeight)) | |
242 | + | then true | |
243 | + | else throwErr("unprocessed blocks"), if ((newTreasuryVolumeInWaves >= 0)) | |
244 | + | then true | |
245 | + | else throwErr("invalid new treasury volume"), if ((xtnPrice >= 0)) | |
246 | + | then true | |
247 | + | else throwErr("invalid XTN price"), if (if ((pwrManagersBonus >= 0)) | |
248 | + | then (SCALE8 >= pwrManagersBonus) | |
249 | + | else false) | |
250 | + | then true | |
251 | + | else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8))) | |
252 | + | then (SCALE8 >= treasuryVolumeDiffAllocationCoef) | |
253 | + | else false) | |
254 | + | then true | |
255 | + | else throwErr("invalid treasury volume diff allocation coefficient")] | |
256 | + | if ((checks == checks)) | |
257 | + | then { | |
258 | + | let investedXtnAmount = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(xtnAssetIdOrFail)), 0) | |
259 | + | let investedWavesAmount = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(unit)), 0) | |
260 | + | let investedXtnAmountInWaves = fraction(investedXtnAmount, xtnPrice, SCALE8) | |
261 | + | let currentTreasuryVolumeInWaves = (investedXtnAmountInWaves + investedWavesAmount) | |
262 | + | let profitRaw = (newTreasuryVolumeInWaves - currentTreasuryVolumeInWaves) | |
263 | + | let pwrManagersBonusAmount = if ((profitRaw > 0)) | |
264 | + | then fraction(profitRaw, pwrManagersBonus, SCALE8) | |
265 | + | else 0 | |
266 | + | let profit = (profitRaw - pwrManagersBonusAmount) | |
267 | + | let donationPart = if ((currentTreasuryVolumeInWaves > 0)) | |
268 | + | then fraction(investedXtnAmountInWaves, SCALE8, currentTreasuryVolumeInWaves) | |
269 | + | else 0 | |
270 | + | let donationProfitPartRaw = fraction(profit, donationPart, SCALE8) | |
271 | + | let investmentProfitPartRaw = (profit - donationProfitPartRaw) | |
272 | + | let treasuryVolumeDiffAllocationCoefAbs = abs(treasuryVolumeDiffAllocationCoef) | |
273 | + | let amountToDonation = fraction(investmentProfitPartRaw, if ((0 > treasuryVolumeDiffAllocationCoef)) | |
274 | + | then treasuryVolumeDiffAllocationCoefAbs | |
275 | + | else 0, SCALE8) | |
276 | + | let amountToInvestment = fraction(donationProfitPartRaw, if ((treasuryVolumeDiffAllocationCoef > 0)) | |
277 | + | then treasuryVolumeDiffAllocationCoefAbs | |
278 | + | else 0, SCALE8) | |
279 | + | let donationProfitPart = ((donationProfitPartRaw - amountToInvestment) + amountToDonation) | |
280 | + | let investmentProfitPart = ((investmentProfitPartRaw - amountToDonation) + amountToInvestment) | |
281 | + | let investedWavesAmountNew = (investedWavesAmount + investmentProfitPart) | |
282 | + | let investedXtnAmountNew = fraction((investedXtnAmountInWaves + donationProfitPart), SCALE8, xtnPrice) | |
283 | + | let newPeriod = (currentPeriodOrFail + 1) | |
284 | + | let lpAssetQuantity = valueOrErrorMessage(assetInfo(lpAssetIdOrFail), wrapErr("invalid lpAsset info")).quantity | |
285 | + | let newPrice = fraction(investedWavesAmountNew, SCALE8, lpAssetQuantity) | |
286 | + | let lpAssetAmountToBurn = valueOrElse(getInteger(factoryAddressOrFail, keyWithdrawal()), 0) | |
287 | + | let paymentAmountMin = fraction(lpAssetAmountToBurn, newPrice, SCALE8) | |
288 | + | let checkPaymentAmount = if (if (if ((size(i.payments) == 1)) | |
289 | + | then (i.payments[0].assetId == unit) | |
290 | + | else false) | |
291 | + | then (i.payments[0].amount >= paymentAmountMin) | |
292 | + | else false) | |
293 | + | then true | |
294 | + | else throwErr(("invalid payments, payment amount min: " + toString(paymentAmountMin))) | |
295 | + | if ((checkPaymentAmount == checkPaymentAmount)) | |
296 | + | then { | |
297 | + | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyCurrentPeriod(), newPeriod], nil), invoke(factoryAddressOrFail, "integerEntry", [keyPriceForPeriod(newPeriod), newPrice], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmountToBurn], nil), invoke(factoryAddressOrFail, "integerEntry", [keyWithdrawal(), 0], nil)] | |
298 | + | $Tuple2(nil, factoryActions) | |
299 | + | } | |
300 | + | else throw("Strict value is not equal to itself.") | |
301 | + | } | |
302 | + | else throw("Strict value is not equal to itself.") | |
229 | 303 | } | |
230 | 304 | else throw("Strict value is not equal to itself.") | |
231 | 305 | } | |
294 | 368 | then { | |
295 | 369 | let userAddress = Address(userAddressBytes) | |
296 | 370 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
297 | - | let $t093229435 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
298 | - | let status = $t093229435._1 | |
299 | - | let lpAssetAmount = $t093229435._2 | |
300 | - | let targetPeriod = $t093229435._3 | |
301 | - | let claimTxId = $t093229435._4 | |
302 | - | if ((status == PENDING)) | |
371 | + | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
372 | + | let $t01271312826 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
373 | + | let status = $t01271312826._1 | |
374 | + | let lpAssetAmount = $t01271312826._2 | |
375 | + | let targetPeriod = $t01271312826._3 | |
376 | + | let claimTxId = $t01271312826._4 | |
377 | + | let checks = [if ((status == PENDING)) | |
378 | + | then true | |
379 | + | else throwErr("invalid withdrawal request status"), if ((targetPeriod > currentPeriodOrFail)) | |
380 | + | then true | |
381 | + | else throwErr("invalid withdrawal request period")] | |
382 | + | if ((checks == checks)) | |
303 | 383 | then { | |
304 | 384 | let withdrawal = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyWithdrawal()), wrapErr("invalid total withdrawal amount")) | |
305 | 385 | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyWithdrawal(), if ((withdrawal >= lpAssetAmount)) | |
309 | 389 | then $Tuple2(nil, factoryActions) | |
310 | 390 | else throw("Strict value is not equal to itself.") | |
311 | 391 | } | |
312 | - | else | |
392 | + | else throw("Strict value is not equal to itself.") | |
313 | 393 | } | |
314 | 394 | else throw("Strict value is not equal to itself.") | |
315 | 395 | } | |
324 | 404 | let userAddress = Address(userAddressBytes) | |
325 | 405 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
326 | 406 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
327 | - | let $ | |
328 | - | let status = $ | |
329 | - | let lpAssetAmount = $ | |
330 | - | let targetPeriod = $ | |
331 | - | let claimTxId = $ | |
407 | + | let $t01415814271 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
408 | + | let status = $t01415814271._1 | |
409 | + | let lpAssetAmount = $t01415814271._2 | |
410 | + | let targetPeriod = $t01415814271._3 | |
411 | + | let claimTxId = $t01415814271._4 | |
332 | 412 | if ((status == FINISHED)) | |
333 | 413 | then throwErr("invalid withdrawal request status") | |
334 | 414 | else if ((targetPeriod > currentPeriodOrFail)) | |
335 | 415 | then throwErr("invalid withdrawal request period") | |
336 | 416 | else { | |
337 | - | let | |
338 | - | let amount = if (( | |
339 | - | then fraction(lpAssetAmount, | |
417 | + | let priceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(targetPeriod)), wrapErr("invalid price")) | |
418 | + | let amount = if ((priceOrFail > 0)) | |
419 | + | then fraction(lpAssetAmount, priceOrFail, SCALE8) | |
340 | 420 | else 0 | |
341 | 421 | let factoryActions = [invoke(factoryAddressOrFail, "stringEntry", [keyWithdrawalRequest(userAddress, txId), valueWithdrawalRequest(FINISHED, lpAssetAmount, targetPeriod, i.transactionId)], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmount], nil), invoke(factoryAddressOrFail, "transferWaves", [userAddressBytes, amount], nil)] | |
342 | 422 | $Tuple2(nil, factoryActions) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 7 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let CONTRACT_NAME = "calculator.ride" | |
7 | 7 | ||
8 | 8 | let SCALE8 = 100000000 | |
9 | 9 | ||
10 | 10 | let PENDING = "PENDING" | |
11 | 11 | ||
12 | 12 | let FINISHED = "FINISHED" | |
13 | 13 | ||
14 | 14 | let WAVES = "WAVES" | |
15 | 15 | ||
16 | 16 | func wrapErr (s) = ((CONTRACT_NAME + ": ") + s) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func throwErr (s) = throw(wrapErr(s)) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func assetIdToString (assetId) = match assetId { | |
23 | 23 | case b: ByteVector => | |
24 | 24 | toBase58String(b) | |
25 | 25 | case _: Unit => | |
26 | 26 | WAVES | |
27 | 27 | case _ => | |
28 | 28 | throw("Match error") | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | + | func abs (n) = if ((0 > n)) | |
33 | + | then -(n) | |
34 | + | else n | |
35 | + | ||
36 | + | ||
32 | 37 | func keyFactoryAddress () = makeString(["%s", "factory"], SEP) | |
33 | 38 | ||
34 | 39 | ||
35 | 40 | func keyLpAssetId () = makeString(["%s", "lpAssetId"], SEP) | |
41 | + | ||
42 | + | ||
43 | + | func keyXtnAssetId () = makeString(["%s", "xtnAssetId"], SEP) | |
36 | 44 | ||
37 | 45 | ||
38 | 46 | func keyTreasuryAddress () = makeString(["%s", "treasury"], SEP) | |
39 | 47 | ||
40 | 48 | ||
41 | 49 | func keyInvested (assetId) = makeString(["%s%s", "invested", assetIdToString(assetId)], SEP) | |
42 | 50 | ||
43 | 51 | ||
44 | 52 | func keyAvailable (userAddress) = makeString(["%s%s", "available", toString(userAddress)], SEP) | |
45 | 53 | ||
46 | 54 | ||
47 | 55 | func keyClaimed (userAddress) = makeString(["%s%s", "claimed", toString(userAddress)], SEP) | |
48 | 56 | ||
49 | 57 | ||
50 | 58 | func keyCurrentPeriod () = makeString(["%s", "currentPeriod"], SEP) | |
51 | 59 | ||
52 | 60 | ||
53 | 61 | func keyPriceForPeriod (period) = makeString(["%s%d", "price", toString(period)], SEP) | |
54 | 62 | ||
55 | 63 | ||
56 | 64 | func keyStartHeight (period) = makeString(["%s%d", "startHeight", toString(period)], SEP) | |
57 | 65 | ||
58 | 66 | ||
59 | 67 | func keyPeriodLength () = "%s__periodLength" | |
60 | 68 | ||
61 | 69 | ||
62 | 70 | func keyBlockProcessingReward () = "%s__blockProcessingReward" | |
63 | 71 | ||
64 | 72 | ||
65 | 73 | func keyNextBlockToProcess () = "%s__nextBlockToProcess" | |
66 | 74 | ||
67 | 75 | ||
68 | 76 | func keyBlockProcessed (height) = makeString(["%s%d", "blockProcessed", toString(height)], SEP) | |
69 | 77 | ||
70 | 78 | ||
71 | 79 | func keyWithdrawal () = "%s__withdrawal" | |
72 | 80 | ||
73 | 81 | ||
74 | 82 | func keyWithdrawalRequest (userAddress,txId) = makeString(["%s%s%s", "withdrawal", toString(userAddress), toBase58String(txId)], SEP) | |
75 | 83 | ||
76 | 84 | ||
77 | 85 | func valueWithdrawalRequest (status,lpAssetAmount,targetPeriod,claimTxId) = { | |
78 | 86 | let claimTxIdStr = match claimTxId { | |
79 | 87 | case b: ByteVector => | |
80 | 88 | toBase58String(b) | |
81 | 89 | case _: Unit => | |
82 | 90 | "SOON" | |
83 | 91 | case _ => | |
84 | 92 | throw("Match error") | |
85 | 93 | } | |
86 | 94 | makeString(["%s%d%d%s", status, toString(lpAssetAmount), toString(targetPeriod), claimTxIdStr], SEP) | |
87 | 95 | } | |
88 | 96 | ||
89 | 97 | ||
90 | 98 | func parseWithdrawalRequestValueOrFail (s) = { | |
91 | 99 | let parts = split(s, SEP) | |
92 | 100 | if ((size(parts) == 5)) | |
93 | 101 | then { | |
94 | 102 | let status = parts[1] | |
95 | 103 | let lpAssetAmount = valueOrErrorMessage(parseInt(parts[2]), wrapErr("invalid lpAssetAmount")) | |
96 | 104 | let targetPeriod = valueOrErrorMessage(parseInt(parts[3]), wrapErr("invalid targetPeriod")) | |
97 | 105 | let claimTxId = parts[4] | |
98 | 106 | $Tuple4(status, lpAssetAmount, targetPeriod, claimTxId) | |
99 | 107 | } | |
100 | 108 | else throwErr("invalid withdrawal request value") | |
101 | 109 | } | |
102 | 110 | ||
103 | 111 | ||
104 | 112 | let factoryAddressOption = match getString(this, keyFactoryAddress()) { | |
105 | 113 | case s: String => | |
106 | 114 | addressFromString(s) | |
107 | 115 | case _: Unit => | |
108 | 116 | unit | |
109 | 117 | case _ => | |
110 | 118 | throw("Match error") | |
111 | 119 | } | |
112 | 120 | ||
113 | 121 | let factoryAddressOrFail = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address")) | |
114 | 122 | ||
115 | 123 | let lpAssetIdOption = match factoryAddressOption { | |
116 | 124 | case a: Address => | |
117 | 125 | match getString(a, keyLpAssetId()) { | |
118 | 126 | case s: String => | |
119 | 127 | fromBase58String(s) | |
120 | 128 | case _: Unit => | |
121 | 129 | unit | |
122 | 130 | case _ => | |
123 | 131 | throw("Match error") | |
124 | 132 | } | |
125 | 133 | case _: Unit => | |
126 | 134 | unit | |
127 | 135 | case _ => | |
128 | 136 | throw("Match error") | |
129 | 137 | } | |
130 | 138 | ||
131 | 139 | let lpAssetIdOrFail = valueOrErrorMessage(lpAssetIdOption, wrapErr("invalid lpAssetId")) | |
132 | 140 | ||
141 | + | let xtnAssetIdOption = match factoryAddressOption { | |
142 | + | case a: Address => | |
143 | + | match getString(a, keyXtnAssetId()) { | |
144 | + | case s: String => | |
145 | + | fromBase58String(s) | |
146 | + | case _: Unit => | |
147 | + | unit | |
148 | + | case _ => | |
149 | + | throw("Match error") | |
150 | + | } | |
151 | + | case _: Unit => | |
152 | + | unit | |
153 | + | case _ => | |
154 | + | throw("Match error") | |
155 | + | } | |
156 | + | ||
157 | + | let xtnAssetIdOrFail = valueOrErrorMessage(xtnAssetIdOption, wrapErr("invalid xtnAssetId")) | |
158 | + | ||
133 | 159 | let treasuryAddressOption = match factoryAddressOption { | |
134 | 160 | case a: Address => | |
135 | 161 | match getString(a, keyTreasuryAddress()) { | |
136 | 162 | case s: String => | |
137 | 163 | addressFromString(s) | |
138 | 164 | case _: Unit => | |
139 | 165 | unit | |
140 | 166 | case _ => | |
141 | 167 | throw("Match error") | |
142 | 168 | } | |
143 | 169 | case _: Unit => | |
144 | 170 | unit | |
145 | 171 | case _ => | |
146 | 172 | throw("Match error") | |
147 | 173 | } | |
148 | 174 | ||
149 | 175 | let treasuryAddressOrFail = valueOrErrorMessage(treasuryAddressOption, wrapErr("invalid treasury address")) | |
150 | 176 | ||
151 | 177 | func onlyAddress (i,address) = if ((i.caller == address)) | |
152 | 178 | then true | |
153 | 179 | else throwErr("permission denied") | |
154 | 180 | ||
155 | 181 | ||
156 | 182 | func onlyFactory (i) = onlyAddress(i, factoryAddressOrFail) | |
157 | 183 | ||
158 | 184 | ||
159 | 185 | func rewardForOption (rewards,target) = { | |
160 | 186 | let s = size(rewards) | |
161 | - | let $ | |
162 | - | let a0 = $ | |
163 | - | let r0 = $ | |
164 | - | let $ | |
165 | - | let a1 = $ | |
166 | - | let r1 = $ | |
167 | - | let $ | |
168 | - | let a2 = $ | |
169 | - | let r2 = $ | |
187 | + | let $t040734098 = rewards[0] | |
188 | + | let a0 = $t040734098._1 | |
189 | + | let r0 = $t040734098._2 | |
190 | + | let $t041014126 = rewards[1] | |
191 | + | let a1 = $t041014126._1 | |
192 | + | let r1 = $t041014126._2 | |
193 | + | let $t041294154 = rewards[2] | |
194 | + | let a2 = $t041294154._1 | |
195 | + | let r2 = $t041294154._2 | |
170 | 196 | if (if ((s > 0)) | |
171 | 197 | then (a0 == target) | |
172 | 198 | else false) | |
173 | 199 | then r0 | |
174 | 200 | else if (if ((s > 1)) | |
175 | 201 | then (a1 == target) | |
176 | 202 | else false) | |
177 | 203 | then r1 | |
178 | 204 | else if (if ((s > 2)) | |
179 | 205 | then (a2 == target) | |
180 | 206 | else false) | |
181 | 207 | then r2 | |
182 | 208 | else unit | |
183 | 209 | } | |
184 | 210 | ||
185 | 211 | ||
186 | 212 | @Callable(i) | |
187 | 213 | func claimLP (userAddressBytes) = { | |
188 | 214 | let checkCaller = onlyFactory(i) | |
189 | 215 | if ((checkCaller == checkCaller)) | |
190 | 216 | then { | |
191 | 217 | let userAddress = Address(userAddressBytes) | |
192 | 218 | let available = valueOrElse(getInteger(factoryAddressOrFail, keyAvailable(userAddress)), 0) | |
193 | 219 | let claimed = valueOrElse(getInteger(factoryAddressOrFail, keyClaimed(userAddress)), 0) | |
194 | 220 | let factoryActions = if ((available > 0)) | |
195 | - | then [invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, available, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(userAddress), 0], nil), invoke(factoryAddressOrFail, " | |
221 | + | then [invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, available, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(userAddress), 0], nil), invoke(factoryAddressOrFail, "integerEntry", [keyClaimed(userAddress), (claimed + available)], nil)] | |
196 | 222 | else throwErr("nothing to claim") | |
197 | 223 | $Tuple2(nil, factoryActions) | |
198 | 224 | } | |
199 | 225 | else throw("Strict value is not equal to itself.") | |
200 | 226 | } | |
201 | 227 | ||
202 | 228 | ||
203 | 229 | ||
204 | 230 | @Callable(i) | |
205 | - | func finalize (newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = { | |
206 | - | let checks = [if ((i.originCaller == factoryAddressOrFail)) | |
207 | - | then true | |
208 | - | else throwErr("permission denied"), if ((newTreasuryVolumeInWaves >= 0)) | |
209 | - | then true | |
210 | - | else throwErr("invalid new treasury volume"), if ((xtnPrice >= 0)) | |
211 | - | then true | |
212 | - | else throwErr("invalid XTN price"), if (if ((pwrManagersBonus >= 0)) | |
213 | - | then (SCALE8 >= pwrManagersBonus) | |
214 | - | else false) | |
215 | - | then true | |
216 | - | else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8))) | |
217 | - | then (SCALE8 >= treasuryVolumeDiffAllocationCoef) | |
218 | - | else false) | |
219 | - | then true | |
220 | - | else throwErr("invalid treasury volume diff allocation coefficient")] | |
221 | - | if ((checks == checks)) | |
231 | + | func finalize (userAddressBytes,newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = { | |
232 | + | let checkCaller = onlyFactory(i) | |
233 | + | if ((checkCaller == checkCaller)) | |
222 | 234 | then { | |
223 | 235 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
224 | - | let newPeriod = (currentPeriodOrFail + 1) | |
225 | - | let newPrice = SCALE8 | |
226 | - | let lpAssetAmountToBurn = 0 | |
227 | - | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyCurrentPeriod(), newPeriod], nil), invoke(factoryAddressOrFail, "integerEntry", [keyPriceForPeriod(newPeriod), newPrice], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmountToBurn], nil)] | |
228 | - | $Tuple2(nil, factoryActions) | |
236 | + | let periodLength = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPeriodLength()), wrapErr("invalid period length")) | |
237 | + | let currentStartHeight = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyStartHeight(currentPeriodOrFail)), wrapErr("invalid start height")) | |
238 | + | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
239 | + | let nextBlockToProcess = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyNextBlockToProcess()), wrapErr("invalid next block to process")) | |
240 | + | let periodEndHeight = ((currentStartHeight + periodLength) - 1) | |
241 | + | let checks = [if ((nextBlockToProcess > periodEndHeight)) | |
242 | + | then true | |
243 | + | else throwErr("unprocessed blocks"), if ((newTreasuryVolumeInWaves >= 0)) | |
244 | + | then true | |
245 | + | else throwErr("invalid new treasury volume"), if ((xtnPrice >= 0)) | |
246 | + | then true | |
247 | + | else throwErr("invalid XTN price"), if (if ((pwrManagersBonus >= 0)) | |
248 | + | then (SCALE8 >= pwrManagersBonus) | |
249 | + | else false) | |
250 | + | then true | |
251 | + | else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8))) | |
252 | + | then (SCALE8 >= treasuryVolumeDiffAllocationCoef) | |
253 | + | else false) | |
254 | + | then true | |
255 | + | else throwErr("invalid treasury volume diff allocation coefficient")] | |
256 | + | if ((checks == checks)) | |
257 | + | then { | |
258 | + | let investedXtnAmount = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(xtnAssetIdOrFail)), 0) | |
259 | + | let investedWavesAmount = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(unit)), 0) | |
260 | + | let investedXtnAmountInWaves = fraction(investedXtnAmount, xtnPrice, SCALE8) | |
261 | + | let currentTreasuryVolumeInWaves = (investedXtnAmountInWaves + investedWavesAmount) | |
262 | + | let profitRaw = (newTreasuryVolumeInWaves - currentTreasuryVolumeInWaves) | |
263 | + | let pwrManagersBonusAmount = if ((profitRaw > 0)) | |
264 | + | then fraction(profitRaw, pwrManagersBonus, SCALE8) | |
265 | + | else 0 | |
266 | + | let profit = (profitRaw - pwrManagersBonusAmount) | |
267 | + | let donationPart = if ((currentTreasuryVolumeInWaves > 0)) | |
268 | + | then fraction(investedXtnAmountInWaves, SCALE8, currentTreasuryVolumeInWaves) | |
269 | + | else 0 | |
270 | + | let donationProfitPartRaw = fraction(profit, donationPart, SCALE8) | |
271 | + | let investmentProfitPartRaw = (profit - donationProfitPartRaw) | |
272 | + | let treasuryVolumeDiffAllocationCoefAbs = abs(treasuryVolumeDiffAllocationCoef) | |
273 | + | let amountToDonation = fraction(investmentProfitPartRaw, if ((0 > treasuryVolumeDiffAllocationCoef)) | |
274 | + | then treasuryVolumeDiffAllocationCoefAbs | |
275 | + | else 0, SCALE8) | |
276 | + | let amountToInvestment = fraction(donationProfitPartRaw, if ((treasuryVolumeDiffAllocationCoef > 0)) | |
277 | + | then treasuryVolumeDiffAllocationCoefAbs | |
278 | + | else 0, SCALE8) | |
279 | + | let donationProfitPart = ((donationProfitPartRaw - amountToInvestment) + amountToDonation) | |
280 | + | let investmentProfitPart = ((investmentProfitPartRaw - amountToDonation) + amountToInvestment) | |
281 | + | let investedWavesAmountNew = (investedWavesAmount + investmentProfitPart) | |
282 | + | let investedXtnAmountNew = fraction((investedXtnAmountInWaves + donationProfitPart), SCALE8, xtnPrice) | |
283 | + | let newPeriod = (currentPeriodOrFail + 1) | |
284 | + | let lpAssetQuantity = valueOrErrorMessage(assetInfo(lpAssetIdOrFail), wrapErr("invalid lpAsset info")).quantity | |
285 | + | let newPrice = fraction(investedWavesAmountNew, SCALE8, lpAssetQuantity) | |
286 | + | let lpAssetAmountToBurn = valueOrElse(getInteger(factoryAddressOrFail, keyWithdrawal()), 0) | |
287 | + | let paymentAmountMin = fraction(lpAssetAmountToBurn, newPrice, SCALE8) | |
288 | + | let checkPaymentAmount = if (if (if ((size(i.payments) == 1)) | |
289 | + | then (i.payments[0].assetId == unit) | |
290 | + | else false) | |
291 | + | then (i.payments[0].amount >= paymentAmountMin) | |
292 | + | else false) | |
293 | + | then true | |
294 | + | else throwErr(("invalid payments, payment amount min: " + toString(paymentAmountMin))) | |
295 | + | if ((checkPaymentAmount == checkPaymentAmount)) | |
296 | + | then { | |
297 | + | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyCurrentPeriod(), newPeriod], nil), invoke(factoryAddressOrFail, "integerEntry", [keyPriceForPeriod(newPeriod), newPrice], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmountToBurn], nil), invoke(factoryAddressOrFail, "integerEntry", [keyWithdrawal(), 0], nil)] | |
298 | + | $Tuple2(nil, factoryActions) | |
299 | + | } | |
300 | + | else throw("Strict value is not equal to itself.") | |
301 | + | } | |
302 | + | else throw("Strict value is not equal to itself.") | |
229 | 303 | } | |
230 | 304 | else throw("Strict value is not equal to itself.") | |
231 | 305 | } | |
232 | 306 | ||
233 | 307 | ||
234 | 308 | ||
235 | 309 | @Callable(i) | |
236 | 310 | func invest (userAddressBytes) = { | |
237 | 311 | let checkCaller = onlyFactory(i) | |
238 | 312 | if ((checkCaller == checkCaller)) | |
239 | 313 | then { | |
240 | 314 | let userAddress = Address(userAddressBytes) | |
241 | 315 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
242 | 316 | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
243 | 317 | let payment = if ((size(i.payments) == 1)) | |
244 | 318 | then i.payments[0] | |
245 | 319 | else throwErr("invalid payments") | |
246 | 320 | let paymentAmount = if (if ((payment.assetId == unit)) | |
247 | 321 | then (payment.amount > 0) | |
248 | 322 | else false) | |
249 | 323 | then payment.amount | |
250 | 324 | else throwErr("invalid payment amount") | |
251 | 325 | let lpAssetAmount = if ((currentPriceOrFail > 0)) | |
252 | 326 | then fraction(paymentAmount, SCALE8, currentPriceOrFail) | |
253 | 327 | else 0 | |
254 | 328 | let invested = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(unit)), 0) | |
255 | 329 | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyInvested(unit), (invested + paymentAmount)], nil), invoke(factoryAddressOrFail, "reissue", [lpAssetAmount], nil), invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, lpAssetAmount, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "transferWaves", [treasuryAddressOrFail.bytes, paymentAmount], [AttachedPayment(unit, paymentAmount)])] | |
256 | 330 | $Tuple2(nil, factoryActions) | |
257 | 331 | } | |
258 | 332 | else throw("Strict value is not equal to itself.") | |
259 | 333 | } | |
260 | 334 | ||
261 | 335 | ||
262 | 336 | ||
263 | 337 | @Callable(i) | |
264 | 338 | func withdraw (userAddressBytes) = { | |
265 | 339 | let checkCaller = onlyFactory(i) | |
266 | 340 | if ((checkCaller == checkCaller)) | |
267 | 341 | then { | |
268 | 342 | let userAddress = Address(userAddressBytes) | |
269 | 343 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
270 | 344 | let payment = if ((size(i.payments) == 1)) | |
271 | 345 | then i.payments[0] | |
272 | 346 | else throwErr(wrapErr("invalid payments")) | |
273 | 347 | let paymentAssetId = if ((payment.assetId == lpAssetIdOrFail)) | |
274 | 348 | then lpAssetIdOrFail | |
275 | 349 | else throwErr("invalid payment asset") | |
276 | 350 | let paymentAmount = if ((payment.amount > 0)) | |
277 | 351 | then payment.amount | |
278 | 352 | else throwErr("invalid payment amount") | |
279 | 353 | let withdrawal = valueOrElse(getInteger(factoryAddressOrFail, keyWithdrawal()), 0) | |
280 | 354 | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyWithdrawal(), (withdrawal + paymentAmount)], nil), invoke(factoryAddressOrFail, "stringEntry", [keyWithdrawalRequest(userAddress, i.transactionId), valueWithdrawalRequest(PENDING, paymentAmount, (currentPeriodOrFail + 1), unit)], nil)] | |
281 | 355 | if ((factoryActions == factoryActions)) | |
282 | 356 | then $Tuple2([ScriptTransfer(factoryAddressOrFail, paymentAmount, paymentAssetId)], factoryActions) | |
283 | 357 | else throw("Strict value is not equal to itself.") | |
284 | 358 | } | |
285 | 359 | else throw("Strict value is not equal to itself.") | |
286 | 360 | } | |
287 | 361 | ||
288 | 362 | ||
289 | 363 | ||
290 | 364 | @Callable(i) | |
291 | 365 | func cancelWithdraw (userAddressBytes,txId) = { | |
292 | 366 | let checkCaller = onlyFactory(i) | |
293 | 367 | if ((checkCaller == checkCaller)) | |
294 | 368 | then { | |
295 | 369 | let userAddress = Address(userAddressBytes) | |
296 | 370 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
297 | - | let $t093229435 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
298 | - | let status = $t093229435._1 | |
299 | - | let lpAssetAmount = $t093229435._2 | |
300 | - | let targetPeriod = $t093229435._3 | |
301 | - | let claimTxId = $t093229435._4 | |
302 | - | if ((status == PENDING)) | |
371 | + | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
372 | + | let $t01271312826 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
373 | + | let status = $t01271312826._1 | |
374 | + | let lpAssetAmount = $t01271312826._2 | |
375 | + | let targetPeriod = $t01271312826._3 | |
376 | + | let claimTxId = $t01271312826._4 | |
377 | + | let checks = [if ((status == PENDING)) | |
378 | + | then true | |
379 | + | else throwErr("invalid withdrawal request status"), if ((targetPeriod > currentPeriodOrFail)) | |
380 | + | then true | |
381 | + | else throwErr("invalid withdrawal request period")] | |
382 | + | if ((checks == checks)) | |
303 | 383 | then { | |
304 | 384 | let withdrawal = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyWithdrawal()), wrapErr("invalid total withdrawal amount")) | |
305 | 385 | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyWithdrawal(), if ((withdrawal >= lpAssetAmount)) | |
306 | 386 | then (withdrawal - lpAssetAmount) | |
307 | 387 | else throwErr("invalid withdrawal amount")], nil), invoke(factoryAddressOrFail, "deleteEntry", [keyWithdrawalRequest(userAddress, txId)], nil), invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, lpAssetAmount, lpAssetIdOrFail], nil)] | |
308 | 388 | if ((factoryActions == factoryActions)) | |
309 | 389 | then $Tuple2(nil, factoryActions) | |
310 | 390 | else throw("Strict value is not equal to itself.") | |
311 | 391 | } | |
312 | - | else | |
392 | + | else throw("Strict value is not equal to itself.") | |
313 | 393 | } | |
314 | 394 | else throw("Strict value is not equal to itself.") | |
315 | 395 | } | |
316 | 396 | ||
317 | 397 | ||
318 | 398 | ||
319 | 399 | @Callable(i) | |
320 | 400 | func claimWaves (userAddressBytes,txId) = { | |
321 | 401 | let checkCaller = onlyFactory(i) | |
322 | 402 | if ((checkCaller == checkCaller)) | |
323 | 403 | then { | |
324 | 404 | let userAddress = Address(userAddressBytes) | |
325 | 405 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
326 | 406 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
327 | - | let $ | |
328 | - | let status = $ | |
329 | - | let lpAssetAmount = $ | |
330 | - | let targetPeriod = $ | |
331 | - | let claimTxId = $ | |
407 | + | let $t01415814271 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
408 | + | let status = $t01415814271._1 | |
409 | + | let lpAssetAmount = $t01415814271._2 | |
410 | + | let targetPeriod = $t01415814271._3 | |
411 | + | let claimTxId = $t01415814271._4 | |
332 | 412 | if ((status == FINISHED)) | |
333 | 413 | then throwErr("invalid withdrawal request status") | |
334 | 414 | else if ((targetPeriod > currentPeriodOrFail)) | |
335 | 415 | then throwErr("invalid withdrawal request period") | |
336 | 416 | else { | |
337 | - | let | |
338 | - | let amount = if (( | |
339 | - | then fraction(lpAssetAmount, | |
417 | + | let priceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(targetPeriod)), wrapErr("invalid price")) | |
418 | + | let amount = if ((priceOrFail > 0)) | |
419 | + | then fraction(lpAssetAmount, priceOrFail, SCALE8) | |
340 | 420 | else 0 | |
341 | 421 | let factoryActions = [invoke(factoryAddressOrFail, "stringEntry", [keyWithdrawalRequest(userAddress, txId), valueWithdrawalRequest(FINISHED, lpAssetAmount, targetPeriod, i.transactionId)], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmount], nil), invoke(factoryAddressOrFail, "transferWaves", [userAddressBytes, amount], nil)] | |
342 | 422 | $Tuple2(nil, factoryActions) | |
343 | 423 | } | |
344 | 424 | } | |
345 | 425 | else throw("Strict value is not equal to itself.") | |
346 | 426 | } | |
347 | 427 | ||
348 | 428 | ||
349 | 429 | ||
350 | 430 | @Callable(i) | |
351 | 431 | func processBlocks (userAddressBytes) = { | |
352 | 432 | let checkCaller = onlyFactory(i) | |
353 | 433 | if ((checkCaller == checkCaller)) | |
354 | 434 | then { | |
355 | 435 | let userAddress = Address(userAddressBytes) | |
356 | 436 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
357 | 437 | let periodLength = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPeriodLength()), wrapErr("invalid period length")) | |
358 | 438 | let currentStartHeight = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyStartHeight(currentPeriodOrFail)), wrapErr("invalid start height")) | |
359 | 439 | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
360 | 440 | let nextBlockToProcess = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyNextBlockToProcess()), wrapErr("invalid next block to process")) | |
361 | 441 | let periodEndHeight = ((currentStartHeight + periodLength) - 1) | |
362 | 442 | let blocksProcessingBatchSizeMax = 40 | |
363 | 443 | let blocksProcessingBatchSize = if (if (if ((height >= nextBlockToProcess)) | |
364 | 444 | then if ((nextBlockToProcess >= currentStartHeight)) | |
365 | 445 | then true | |
366 | 446 | else (currentPeriodOrFail == 0) | |
367 | 447 | else false) | |
368 | 448 | then (periodEndHeight >= nextBlockToProcess) | |
369 | 449 | else false) | |
370 | 450 | then min([((periodEndHeight - nextBlockToProcess) + 1), blocksProcessingBatchSizeMax]) | |
371 | 451 | else throwErr(wrapErr("invalid target block")) | |
372 | 452 | let blockProcessingReward = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyBlockProcessingReward()), wrapErr("invalid block processing reward")) | |
373 | 453 | let blockProcessingRewardByGenerator = (blockProcessingReward / blocksProcessingBatchSize) | |
374 | 454 | let blockProcessingRewardByGeneratorRemainder = (blockProcessingReward - (blockProcessingRewardByGenerator * blocksProcessingBatchSize)) | |
375 | 455 | func map (acc,inc) = if ((inc >= blocksProcessingBatchSize)) | |
376 | 456 | then acc | |
377 | 457 | else { | |
378 | 458 | let targetBlockHeight = (nextBlockToProcess + inc) | |
379 | 459 | let targetBlockInfo = valueOrErrorMessage(blockInfoByHeight(targetBlockHeight), wrapErr("invalid block info")) | |
380 | 460 | let treasuryRewardOrFail = valueOrErrorMessage(rewardForOption(targetBlockInfo.rewards, treasuryAddressOrFail), wrapErr(("invalid treasury reward for height " + toString(targetBlockHeight)))) | |
381 | 461 | let generator = targetBlockInfo.generator | |
382 | 462 | let available = valueOrElse(getInteger(factoryAddressOrFail, keyAvailable(generator)), 0) | |
383 | 463 | let callerReward = if ((inc == (blocksProcessingBatchSize - 1))) | |
384 | 464 | then (blockProcessingRewardByGenerator + blockProcessingRewardByGeneratorRemainder) | |
385 | 465 | else blockProcessingRewardByGenerator | |
386 | 466 | let lpAssetAmount = if ((currentPriceOrFail > 0)) | |
387 | 467 | then fraction((treasuryRewardOrFail - callerReward), SCALE8, currentPriceOrFail) | |
388 | 468 | else 0 | |
389 | 469 | let factoryActionsSingle = [invoke(factoryAddressOrFail, "stringEntry", [keyBlockProcessed(targetBlockHeight), makeString([toBase58String(i.transactionId), toBase58String(userAddressBytes), toString(treasuryRewardOrFail), toString(callerReward), toString(lpAssetAmount)], SEP)], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(generator), (available + lpAssetAmount)], nil)] | |
390 | 470 | if ((factoryActionsSingle == factoryActionsSingle)) | |
391 | 471 | then (acc + lpAssetAmount) | |
392 | 472 | else throw("Strict value is not equal to itself.") | |
393 | 473 | } | |
394 | 474 | ||
395 | 475 | let list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39] | |
396 | 476 | let lpAssetAmountTotal = { | |
397 | 477 | let $l = list | |
398 | 478 | let $s = size($l) | |
399 | 479 | let $acc0 = 0 | |
400 | 480 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
401 | 481 | then $a | |
402 | 482 | else map($a, $l[$i]) | |
403 | 483 | ||
404 | 484 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
405 | 485 | then $a | |
406 | 486 | else throw("List size exceeds 40") | |
407 | 487 | ||
408 | 488 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40) | |
409 | 489 | } | |
410 | 490 | if ((lpAssetAmountTotal == lpAssetAmountTotal)) | |
411 | 491 | then { | |
412 | 492 | let actions = [invoke(factoryAddressOrFail, "transferWaves", [userAddressBytes, blockProcessingReward], nil), invoke(factoryAddressOrFail, "reissue", [lpAssetAmountTotal], nil), invoke(factoryAddressOrFail, "integerEntry", [keyNextBlockToProcess(), (nextBlockToProcess + blocksProcessingBatchSize)], nil)] | |
413 | 493 | if ((actions == actions)) | |
414 | 494 | then $Tuple2(nil, unit) | |
415 | 495 | else throw("Strict value is not equal to itself.") | |
416 | 496 | } | |
417 | 497 | else throw("Strict value is not equal to itself.") | |
418 | 498 | } | |
419 | 499 | else throw("Strict value is not equal to itself.") | |
420 | 500 | } | |
421 | 501 | ||
422 | 502 | ||
423 | 503 | @Verifier(tx) | |
424 | 504 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
425 | 505 |
github/deemru/w8io/026f985 85.77 ms ◑