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