tx · G8eWeq8EnQwFWZSmKqeqRVCycJeTx2bRyA8zeGjs2iz 3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP: -0.01400000 Waves 2023.06.13 10:06 [2620583] smart account 3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP > SELF 0.00000000 Waves
{ "type": 13, "id": "G8eWeq8EnQwFWZSmKqeqRVCycJeTx2bRyA8zeGjs2iz", "fee": 1400000, "feeAssetId": null, "timestamp": 1686640021533, "version": 2, "chainId": 84, "sender": "3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP", "senderPublicKey": "AoKo4segKHU4DeJnxXQYJj2u7J6XJeux6r8KLW52cd2Q", "proofs": [ "41SGpyqkx8NE7QQgeC31h3QRvAWKamHqARxtJnDpUBhvTrV83uUi1DB4bfbUSGhjMBYFzkiD2Tb9Y9kstBqXTvPf" ], "script": "base64:BwIqCAISAwoBAhIGCgQBAQEBEgMKAQISAwoBAhIECgICAhIECgICAhIDCgECHwADU0VQAgJfXwANQ09OVFJBQ1RfTkFNRQIPY2FsY3VsYXRvci5yaWRlAAZTQ0FMRTgAgMLXLwAHUEVORElORwIHUEVORElORwAIRklOSVNIRUQCCEZJTklTSEVEAQd3cmFwRXJyAQFzCQCsAgIJAKwCAgUNQ09OVFJBQ1RfTkFNRQICOiAFAXMBCHRocm93RXJyAQFzCQACAQkBB3dyYXBFcnIBBQFzARFrZXlGYWN0b3J5QWRkcmVzcwAJALkJAgkAzAgCAgIlcwkAzAgCAgdmYWN0b3J5BQNuaWwFA1NFUAEMa2V5THBBc3NldElkAAkAuQkCCQDMCAICAiVzCQDMCAICCWxwQXNzZXRJZAUDbmlsBQNTRVABEmtleVRyZWFzdXJ5QWRkcmVzcwAJALkJAgkAzAgCAgIlcwkAzAgCAgh0cmVhc3VyeQUDbmlsBQNTRVABDGtleUF2YWlsYWJsZQELdXNlckFkZHJlc3MJALkJAgkAzAgCAgQlcyVzCQDMCAICCWF2YWlsYWJsZQkAzAgCCQClCA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5QWRkcmVzc09yRmFpbAIMaW50ZWdlckVudHJ5CQDMCAIJARVrZXlOZXh0QmxvY2tUb1Byb2Nlc3MACQDMCAIJAGQCBRJuZXh0QmxvY2tUb1Byb2Nlc3MFGWJsb2Nrc1Byb2Nlc3NpbmdCYXRjaFNpemUFA25pbAUDbmlsBQNuaWwDCQAAAgUHYWN0aW9ucwUHYWN0aW9ucwkAlAoCBQNuaWwFBHVuaXQJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5CfV1xQ==", "height": 2620583, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: tz3nT9mcifBtGM9EHoqUNR7EHkDqBzesv7z1o9jpRhv Next: APaDdYrnKcKN8UP4qsNRHFQwgpYxe6jDGUXofWumxoyL Diff:
Old | New | Differences | |
---|---|---|---|
274 | 274 | then { | |
275 | 275 | let userAddress = Address(userAddressBytes) | |
276 | 276 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
277 | - | let $ | |
278 | - | let status = $ | |
279 | - | let lpAssetAmount = $ | |
280 | - | let targetPeriod = $ | |
281 | - | let claimTxId = $ | |
277 | + | let $t086788791 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
278 | + | let status = $t086788791._1 | |
279 | + | let lpAssetAmount = $t086788791._2 | |
280 | + | let targetPeriod = $t086788791._3 | |
281 | + | let claimTxId = $t086788791._4 | |
282 | 282 | if ((status == PENDING)) | |
283 | 283 | then { | |
284 | 284 | let factoryActions = [invoke(factoryAddressOrFail, "deleteEntry", [keyWithdrawalRequest(userAddress, txId)], nil), invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, lpAssetAmount, lpAssetIdOrFail], nil)] | |
301 | 301 | let userAddress = Address(userAddressBytes) | |
302 | 302 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
303 | 303 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
304 | - | let $ | |
305 | - | let status = $ | |
306 | - | let lpAssetAmount = $ | |
307 | - | let targetPeriod = $ | |
308 | - | let claimTxId = $ | |
304 | + | let $t096629775 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
305 | + | let status = $t096629775._1 | |
306 | + | let lpAssetAmount = $t096629775._2 | |
307 | + | let targetPeriod = $t096629775._3 | |
308 | + | let claimTxId = $t096629775._4 | |
309 | 309 | if ((status == FINISHED)) | |
310 | 310 | then throwErr("invalid withdrawal request status") | |
311 | 311 | else if ((targetPeriod > currentPeriodOrFail)) | |
357 | 357 | let treasuryRewardOrFail = valueOrErrorMessage(rewardForOption(targetBlockInfo.rewards, treasuryAddressOrFail), wrapErr(("invalid treasury reward for height " + toString(targetBlockHeight)))) | |
358 | 358 | let generator = targetBlockInfo.generator | |
359 | 359 | let available = valueOrElse(getInteger(factoryAddressOrFail, keyAvailable(generator)), 0) | |
360 | - | let lpAssetAmount = if ((currentPriceOrFail > 0)) | |
361 | - | then fraction((treasuryRewardOrFail - blockProcessingRewardByGenerator), SCALE8, currentPriceOrFail) | |
362 | - | else 0 | |
363 | 360 | let callerReward = if ((inc == (blocksProcessingBatchSize - 1))) | |
364 | 361 | then (blockProcessingRewardByGenerator + blockProcessingRewardByGeneratorRemainder) | |
365 | 362 | else blockProcessingRewardByGenerator | |
363 | + | let lpAssetAmount = if ((currentPriceOrFail > 0)) | |
364 | + | then fraction((treasuryRewardOrFail - callerReward), SCALE8, currentPriceOrFail) | |
365 | + | else 0 | |
366 | 366 | 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)] | |
367 | 367 | if ((factoryActionsSingle == factoryActionsSingle)) | |
368 | - | then (acc + | |
368 | + | then (acc + lpAssetAmount) | |
369 | 369 | else throw("Strict value is not equal to itself.") | |
370 | 370 | } | |
371 | 371 | ||
372 | 372 | 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] | |
373 | - | let | |
373 | + | let lpAssetAmountTotal = { | |
374 | 374 | let $l = list | |
375 | 375 | let $s = size($l) | |
376 | 376 | let $acc0 = 0 | |
384 | 384 | ||
385 | 385 | $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) | |
386 | 386 | } | |
387 | - | if (( | |
387 | + | if ((lpAssetAmountTotal == lpAssetAmountTotal)) | |
388 | 388 | then { | |
389 | - | let actions = [invoke(factoryAddressOrFail, "transferWaves", [userAddressBytes, | |
389 | + | let actions = [invoke(factoryAddressOrFail, "transferWaves", [userAddressBytes, blockProcessingReward], nil), invoke(factoryAddressOrFail, "reissue", [lpAssetAmountTotal], nil), invoke(factoryAddressOrFail, "integerEntry", [keyNextBlockToProcess(), (nextBlockToProcess + blocksProcessingBatchSize)], nil)] | |
390 | 390 | if ((actions == actions)) | |
391 | 391 | then $Tuple2(nil, unit) | |
392 | 392 | else throw("Strict value is not equal to itself.") |
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 | func wrapErr (s) = ((CONTRACT_NAME + ": ") + s) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func throwErr (s) = throw(wrapErr(s)) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func keyFactoryAddress () = makeString(["%s", "factory"], SEP) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func keyLpAssetId () = makeString(["%s", "lpAssetId"], SEP) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func keyTreasuryAddress () = makeString(["%s", "treasury"], SEP) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func keyAvailable (userAddress) = makeString(["%s%s", "available", toString(userAddress)], SEP) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func keyClaimed (userAddress) = makeString(["%s%s", "claimed", toString(userAddress)], SEP) | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func keyCurrentPeriod () = makeString(["%s", "currentPeriod"], SEP) | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func keyPriceForPeriod (period) = makeString(["%s%d", "price", toString(period)], SEP) | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func keyStartHeight (period) = makeString(["%s%d", "startHeight", toString(period)], SEP) | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func keyPeriodLength () = "%s__periodLength" | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func keyBlockProcessingReward () = "%s__blockProcessingReward" | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func keyNextBlockToProcess () = "%s__nextBlockToProcess" | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func keyBlockProcessed (height) = makeString(["%s%d", "blockProcessed", toString(height)], SEP) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func keyWithdrawalRequest (userAddress,txId) = makeString(["%s%s%s", "withdrawal", toString(userAddress), toBase58String(txId)], SEP) | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func valueWithdrawalRequest (status,lpAssetAmount,targetPeriod,claimTxId) = { | |
60 | 60 | let claimTxIdStr = match claimTxId { | |
61 | 61 | case b: ByteVector => | |
62 | 62 | toBase58String(b) | |
63 | 63 | case _: Unit => | |
64 | 64 | "SOON" | |
65 | 65 | case _ => | |
66 | 66 | throw("Match error") | |
67 | 67 | } | |
68 | 68 | makeString(["%s%d%d%s", status, toString(lpAssetAmount), toString(targetPeriod), claimTxIdStr], SEP) | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func parseWithdrawalRequestValueOrFail (s) = { | |
73 | 73 | let parts = split(s, SEP) | |
74 | 74 | if ((size(parts) == 5)) | |
75 | 75 | then { | |
76 | 76 | let status = parts[1] | |
77 | 77 | let lpAssetAmount = valueOrErrorMessage(parseInt(parts[2]), wrapErr("invalid lpAssetAmount")) | |
78 | 78 | let targetPeriod = valueOrErrorMessage(parseInt(parts[3]), wrapErr("invalid targetPeriod")) | |
79 | 79 | let claimTxId = parts[4] | |
80 | 80 | $Tuple4(status, lpAssetAmount, targetPeriod, claimTxId) | |
81 | 81 | } | |
82 | 82 | else throwErr("invalid withdrawal request value") | |
83 | 83 | } | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | let factoryAddressOption = match getString(this, keyFactoryAddress()) { | |
87 | 87 | case s: String => | |
88 | 88 | addressFromString(s) | |
89 | 89 | case _: Unit => | |
90 | 90 | unit | |
91 | 91 | case _ => | |
92 | 92 | throw("Match error") | |
93 | 93 | } | |
94 | 94 | ||
95 | 95 | let factoryAddressOrFail = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address")) | |
96 | 96 | ||
97 | 97 | let lpAssetIdOption = match factoryAddressOption { | |
98 | 98 | case a: Address => | |
99 | 99 | match getString(a, keyLpAssetId()) { | |
100 | 100 | case s: String => | |
101 | 101 | fromBase58String(s) | |
102 | 102 | case _: Unit => | |
103 | 103 | unit | |
104 | 104 | case _ => | |
105 | 105 | throw("Match error") | |
106 | 106 | } | |
107 | 107 | case _: Unit => | |
108 | 108 | unit | |
109 | 109 | case _ => | |
110 | 110 | throw("Match error") | |
111 | 111 | } | |
112 | 112 | ||
113 | 113 | let lpAssetIdOrFail = valueOrErrorMessage(lpAssetIdOption, wrapErr("invalid lpAssetId")) | |
114 | 114 | ||
115 | 115 | let treasuryAddressOption = match factoryAddressOption { | |
116 | 116 | case a: Address => | |
117 | 117 | match getString(a, keyTreasuryAddress()) { | |
118 | 118 | case s: String => | |
119 | 119 | addressFromString(s) | |
120 | 120 | case _: Unit => | |
121 | 121 | unit | |
122 | 122 | case _ => | |
123 | 123 | throw("Match error") | |
124 | 124 | } | |
125 | 125 | case _: Unit => | |
126 | 126 | unit | |
127 | 127 | case _ => | |
128 | 128 | throw("Match error") | |
129 | 129 | } | |
130 | 130 | ||
131 | 131 | let treasuryAddressOrFail = valueOrErrorMessage(treasuryAddressOption, wrapErr("invalid treasury address")) | |
132 | 132 | ||
133 | 133 | func onlyAddress (i,address) = if ((i.caller == address)) | |
134 | 134 | then true | |
135 | 135 | else throwErr("permission denied") | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func onlyFactory (i) = onlyAddress(i, factoryAddressOrFail) | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func rewardForOption (rewards,target) = { | |
142 | 142 | let s = size(rewards) | |
143 | 143 | let $t033473372 = rewards[0] | |
144 | 144 | let a0 = $t033473372._1 | |
145 | 145 | let r0 = $t033473372._2 | |
146 | 146 | let $t033753400 = rewards[1] | |
147 | 147 | let a1 = $t033753400._1 | |
148 | 148 | let r1 = $t033753400._2 | |
149 | 149 | let $t034033428 = rewards[2] | |
150 | 150 | let a2 = $t034033428._1 | |
151 | 151 | let r2 = $t034033428._2 | |
152 | 152 | if (if ((s > 0)) | |
153 | 153 | then (a0 == target) | |
154 | 154 | else false) | |
155 | 155 | then r0 | |
156 | 156 | else if (if ((s > 1)) | |
157 | 157 | then (a1 == target) | |
158 | 158 | else false) | |
159 | 159 | then r1 | |
160 | 160 | else if (if ((s > 2)) | |
161 | 161 | then (a2 == target) | |
162 | 162 | else false) | |
163 | 163 | then r2 | |
164 | 164 | else unit | |
165 | 165 | } | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | @Callable(i) | |
169 | 169 | func claimLP (userAddressBytes) = { | |
170 | 170 | let checkCaller = onlyFactory(i) | |
171 | 171 | if ((checkCaller == checkCaller)) | |
172 | 172 | then { | |
173 | 173 | let userAddress = Address(userAddressBytes) | |
174 | 174 | let available = valueOrElse(getInteger(factoryAddressOrFail, keyAvailable(userAddress)), 0) | |
175 | 175 | let claimed = valueOrElse(getInteger(factoryAddressOrFail, keyClaimed(userAddress)), 0) | |
176 | 176 | let factoryActions = if ((available > 0)) | |
177 | 177 | then [invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, available, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(userAddress), 0], nil), invoke(factoryAddressOrFail, "stringEntry", [keyClaimed(userAddress), (claimed + available)], nil)] | |
178 | 178 | else throwErr("nothing to claim") | |
179 | 179 | $Tuple2(nil, factoryActions) | |
180 | 180 | } | |
181 | 181 | else throw("Strict value is not equal to itself.") | |
182 | 182 | } | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | ||
186 | 186 | @Callable(i) | |
187 | 187 | func finalize (newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = { | |
188 | 188 | let checks = [if ((i.originCaller == factoryAddressOrFail)) | |
189 | 189 | then true | |
190 | 190 | else throwErr("permission denied"), if ((newTreasuryVolumeInWaves >= 0)) | |
191 | 191 | then true | |
192 | 192 | else throwErr("invalid new treasury volume"), if ((xtnPrice >= 0)) | |
193 | 193 | then true | |
194 | 194 | else throwErr("invalid XTN price"), if (if ((pwrManagersBonus >= 0)) | |
195 | 195 | then (SCALE8 >= pwrManagersBonus) | |
196 | 196 | else false) | |
197 | 197 | then true | |
198 | 198 | else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8))) | |
199 | 199 | then (SCALE8 >= treasuryVolumeDiffAllocationCoef) | |
200 | 200 | else false) | |
201 | 201 | then true | |
202 | 202 | else throwErr("invalid treasury volume diff allocation coefficient")] | |
203 | 203 | if ((checks == checks)) | |
204 | 204 | then { | |
205 | 205 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
206 | 206 | let newPeriod = (currentPeriodOrFail + 1) | |
207 | 207 | let newPrice = SCALE8 | |
208 | 208 | let lpAssetAmountToBurn = 0 | |
209 | 209 | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyCurrentPeriod(), newPeriod], nil), invoke(factoryAddressOrFail, "integerEntry", [keyPriceForPeriod(newPeriod), newPrice], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmountToBurn], nil)] | |
210 | 210 | $Tuple2(nil, factoryActions) | |
211 | 211 | } | |
212 | 212 | else throw("Strict value is not equal to itself.") | |
213 | 213 | } | |
214 | 214 | ||
215 | 215 | ||
216 | 216 | ||
217 | 217 | @Callable(i) | |
218 | 218 | func invest (userAddressBytes) = { | |
219 | 219 | let checkCaller = onlyFactory(i) | |
220 | 220 | if ((checkCaller == checkCaller)) | |
221 | 221 | then { | |
222 | 222 | let userAddress = Address(userAddressBytes) | |
223 | 223 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
224 | 224 | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
225 | 225 | let payment = if ((size(i.payments) == 1)) | |
226 | 226 | then i.payments[0] | |
227 | 227 | else throwErr("invalid payments") | |
228 | 228 | let paymentAmount = if (if ((payment.assetId == unit)) | |
229 | 229 | then (payment.amount > 0) | |
230 | 230 | else false) | |
231 | 231 | then payment.amount | |
232 | 232 | else throwErr("invalid payment amount") | |
233 | 233 | let lpAssetAmount = if ((currentPriceOrFail > 0)) | |
234 | 234 | then fraction(paymentAmount, SCALE8, currentPriceOrFail) | |
235 | 235 | else 0 | |
236 | 236 | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", ["invested__WAVES", 0], nil), invoke(factoryAddressOrFail, "reissue", [lpAssetAmount], nil), invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, lpAssetAmount, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "transferWaves", [treasuryAddressOrFail.bytes, paymentAmount], [AttachedPayment(unit, paymentAmount)])] | |
237 | 237 | $Tuple2(nil, factoryActions) | |
238 | 238 | } | |
239 | 239 | else throw("Strict value is not equal to itself.") | |
240 | 240 | } | |
241 | 241 | ||
242 | 242 | ||
243 | 243 | ||
244 | 244 | @Callable(i) | |
245 | 245 | func withdraw (userAddressBytes) = { | |
246 | 246 | let checkCaller = onlyFactory(i) | |
247 | 247 | if ((checkCaller == checkCaller)) | |
248 | 248 | then { | |
249 | 249 | let userAddress = Address(userAddressBytes) | |
250 | 250 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
251 | 251 | let payment = if ((size(i.payments) == 1)) | |
252 | 252 | then i.payments[0] | |
253 | 253 | else throwErr(wrapErr("invalid payments")) | |
254 | 254 | let paymentAssetId = if ((payment.assetId == lpAssetIdOrFail)) | |
255 | 255 | then lpAssetIdOrFail | |
256 | 256 | else throwErr("invalid payment asset") | |
257 | 257 | let paymentAmount = if ((payment.amount > 0)) | |
258 | 258 | then payment.amount | |
259 | 259 | else throwErr("invalid payment amount") | |
260 | 260 | let factoryActions = [invoke(factoryAddressOrFail, "stringEntry", [keyWithdrawalRequest(userAddress, i.transactionId), valueWithdrawalRequest(PENDING, paymentAmount, (currentPeriodOrFail + 1), unit)], nil)] | |
261 | 261 | if ((factoryActions == factoryActions)) | |
262 | 262 | then $Tuple2([ScriptTransfer(factoryAddressOrFail, paymentAmount, paymentAssetId)], factoryActions) | |
263 | 263 | else throw("Strict value is not equal to itself.") | |
264 | 264 | } | |
265 | 265 | else throw("Strict value is not equal to itself.") | |
266 | 266 | } | |
267 | 267 | ||
268 | 268 | ||
269 | 269 | ||
270 | 270 | @Callable(i) | |
271 | 271 | func cancelWithdraw (userAddressBytes,txId) = { | |
272 | 272 | let checkCaller = onlyFactory(i) | |
273 | 273 | if ((checkCaller == checkCaller)) | |
274 | 274 | then { | |
275 | 275 | let userAddress = Address(userAddressBytes) | |
276 | 276 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
277 | - | let $ | |
278 | - | let status = $ | |
279 | - | let lpAssetAmount = $ | |
280 | - | let targetPeriod = $ | |
281 | - | let claimTxId = $ | |
277 | + | let $t086788791 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
278 | + | let status = $t086788791._1 | |
279 | + | let lpAssetAmount = $t086788791._2 | |
280 | + | let targetPeriod = $t086788791._3 | |
281 | + | let claimTxId = $t086788791._4 | |
282 | 282 | if ((status == PENDING)) | |
283 | 283 | then { | |
284 | 284 | let factoryActions = [invoke(factoryAddressOrFail, "deleteEntry", [keyWithdrawalRequest(userAddress, txId)], nil), invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, lpAssetAmount, lpAssetIdOrFail], nil)] | |
285 | 285 | if ((factoryActions == factoryActions)) | |
286 | 286 | then $Tuple2(nil, factoryActions) | |
287 | 287 | else throw("Strict value is not equal to itself.") | |
288 | 288 | } | |
289 | 289 | else throwErr("invalid withdrawal request status") | |
290 | 290 | } | |
291 | 291 | else throw("Strict value is not equal to itself.") | |
292 | 292 | } | |
293 | 293 | ||
294 | 294 | ||
295 | 295 | ||
296 | 296 | @Callable(i) | |
297 | 297 | func claimWaves (userAddressBytes,txId) = { | |
298 | 298 | let checkCaller = onlyFactory(i) | |
299 | 299 | if ((checkCaller == checkCaller)) | |
300 | 300 | then { | |
301 | 301 | let userAddress = Address(userAddressBytes) | |
302 | 302 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
303 | 303 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
304 | - | let $ | |
305 | - | let status = $ | |
306 | - | let lpAssetAmount = $ | |
307 | - | let targetPeriod = $ | |
308 | - | let claimTxId = $ | |
304 | + | let $t096629775 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
305 | + | let status = $t096629775._1 | |
306 | + | let lpAssetAmount = $t096629775._2 | |
307 | + | let targetPeriod = $t096629775._3 | |
308 | + | let claimTxId = $t096629775._4 | |
309 | 309 | if ((status == FINISHED)) | |
310 | 310 | then throwErr("invalid withdrawal request status") | |
311 | 311 | else if ((targetPeriod > currentPeriodOrFail)) | |
312 | 312 | then throwErr("invalid withdrawal request period") | |
313 | 313 | else { | |
314 | 314 | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
315 | 315 | let amount = if ((currentPriceOrFail > 0)) | |
316 | 316 | then fraction(lpAssetAmount, currentPriceOrFail, SCALE8) | |
317 | 317 | else 0 | |
318 | 318 | 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)] | |
319 | 319 | $Tuple2(nil, factoryActions) | |
320 | 320 | } | |
321 | 321 | } | |
322 | 322 | else throw("Strict value is not equal to itself.") | |
323 | 323 | } | |
324 | 324 | ||
325 | 325 | ||
326 | 326 | ||
327 | 327 | @Callable(i) | |
328 | 328 | func processBlocks (userAddressBytes) = { | |
329 | 329 | let checkCaller = onlyFactory(i) | |
330 | 330 | if ((checkCaller == checkCaller)) | |
331 | 331 | then { | |
332 | 332 | let userAddress = Address(userAddressBytes) | |
333 | 333 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
334 | 334 | let periodLength = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPeriodLength()), wrapErr("invalid period length")) | |
335 | 335 | let currentStartHeight = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyStartHeight(currentPeriodOrFail)), wrapErr("invalid start height")) | |
336 | 336 | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
337 | 337 | let nextBlockToProcess = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyNextBlockToProcess()), wrapErr("invalid next block to process")) | |
338 | 338 | let periodEndHeight = ((currentStartHeight + periodLength) - 1) | |
339 | 339 | let blocksProcessingBatchSizeMax = 40 | |
340 | 340 | let blocksProcessingBatchSize = if (if (if ((height >= nextBlockToProcess)) | |
341 | 341 | then if ((nextBlockToProcess >= currentStartHeight)) | |
342 | 342 | then true | |
343 | 343 | else (currentPeriodOrFail == 0) | |
344 | 344 | else false) | |
345 | 345 | then (periodEndHeight >= nextBlockToProcess) | |
346 | 346 | else false) | |
347 | 347 | then min([((periodEndHeight - nextBlockToProcess) + 1), blocksProcessingBatchSizeMax]) | |
348 | 348 | else throwErr(wrapErr("invalid target block")) | |
349 | 349 | let blockProcessingReward = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyBlockProcessingReward()), wrapErr("invalid block processing reward")) | |
350 | 350 | let blockProcessingRewardByGenerator = (blockProcessingReward / blocksProcessingBatchSize) | |
351 | 351 | let blockProcessingRewardByGeneratorRemainder = (blockProcessingReward - (blockProcessingRewardByGenerator * blocksProcessingBatchSize)) | |
352 | 352 | func map (acc,inc) = if ((inc >= blocksProcessingBatchSize)) | |
353 | 353 | then acc | |
354 | 354 | else { | |
355 | 355 | let targetBlockHeight = (nextBlockToProcess + inc) | |
356 | 356 | let targetBlockInfo = valueOrErrorMessage(blockInfoByHeight(targetBlockHeight), wrapErr("invalid block info")) | |
357 | 357 | let treasuryRewardOrFail = valueOrErrorMessage(rewardForOption(targetBlockInfo.rewards, treasuryAddressOrFail), wrapErr(("invalid treasury reward for height " + toString(targetBlockHeight)))) | |
358 | 358 | let generator = targetBlockInfo.generator | |
359 | 359 | let available = valueOrElse(getInteger(factoryAddressOrFail, keyAvailable(generator)), 0) | |
360 | - | let lpAssetAmount = if ((currentPriceOrFail > 0)) | |
361 | - | then fraction((treasuryRewardOrFail - blockProcessingRewardByGenerator), SCALE8, currentPriceOrFail) | |
362 | - | else 0 | |
363 | 360 | let callerReward = if ((inc == (blocksProcessingBatchSize - 1))) | |
364 | 361 | then (blockProcessingRewardByGenerator + blockProcessingRewardByGeneratorRemainder) | |
365 | 362 | else blockProcessingRewardByGenerator | |
363 | + | let lpAssetAmount = if ((currentPriceOrFail > 0)) | |
364 | + | then fraction((treasuryRewardOrFail - callerReward), SCALE8, currentPriceOrFail) | |
365 | + | else 0 | |
366 | 366 | 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)] | |
367 | 367 | if ((factoryActionsSingle == factoryActionsSingle)) | |
368 | - | then (acc + | |
368 | + | then (acc + lpAssetAmount) | |
369 | 369 | else throw("Strict value is not equal to itself.") | |
370 | 370 | } | |
371 | 371 | ||
372 | 372 | 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] | |
373 | - | let | |
373 | + | let lpAssetAmountTotal = { | |
374 | 374 | let $l = list | |
375 | 375 | let $s = size($l) | |
376 | 376 | let $acc0 = 0 | |
377 | 377 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
378 | 378 | then $a | |
379 | 379 | else map($a, $l[$i]) | |
380 | 380 | ||
381 | 381 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
382 | 382 | then $a | |
383 | 383 | else throw("List size exceeds 40") | |
384 | 384 | ||
385 | 385 | $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) | |
386 | 386 | } | |
387 | - | if (( | |
387 | + | if ((lpAssetAmountTotal == lpAssetAmountTotal)) | |
388 | 388 | then { | |
389 | - | let actions = [invoke(factoryAddressOrFail, "transferWaves", [userAddressBytes, | |
389 | + | let actions = [invoke(factoryAddressOrFail, "transferWaves", [userAddressBytes, blockProcessingReward], nil), invoke(factoryAddressOrFail, "reissue", [lpAssetAmountTotal], nil), invoke(factoryAddressOrFail, "integerEntry", [keyNextBlockToProcess(), (nextBlockToProcess + blocksProcessingBatchSize)], nil)] | |
390 | 390 | if ((actions == actions)) | |
391 | 391 | then $Tuple2(nil, unit) | |
392 | 392 | else throw("Strict value is not equal to itself.") | |
393 | 393 | } | |
394 | 394 | else throw("Strict value is not equal to itself.") | |
395 | 395 | } | |
396 | 396 | else throw("Strict value is not equal to itself.") | |
397 | 397 | } | |
398 | 398 | ||
399 | 399 | ||
400 | 400 | @Verifier(tx) | |
401 | 401 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
402 | 402 |
github/deemru/w8io/169f3d6 52.11 ms ◑