tx · FtF2bR4vkEcAYznJEojvHBjTbdtSXf3GPcjJujzzRHMA 3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP: -0.01200000 Waves 2023.06.09 12:14 [2614940] smart account 3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP > SELF 0.00000000 Waves
{ "type": 13, "id": "FtF2bR4vkEcAYznJEojvHBjTbdtSXf3GPcjJujzzRHMA", "fee": 1200000, "feeAssetId": null, "timestamp": 1686302085126, "version": 2, "chainId": 84, "sender": "3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP", "senderPublicKey": "AoKo4segKHU4DeJnxXQYJj2u7J6XJeux6r8KLW52cd2Q", "proofs": [ "51UobAr2Gp8BAqhAJM3HX1YAfYXXyHbZWxCygwXDE2WU5NzWkhCpjAsBWBRMqdzgb5G1dPtn8L6zEpFeEoAfbY4j" ], "script": "base64:BwIqCAISAwoBAhIGCgQBAQEBEgMKAQISAwoBAhIECgICAhIECgICAhIDCgECHgADU0VQAgJfXwANQ09OVFJBQ1RfTkFNRQIPY2FsY3VsYXRvci5yaWRlAAZTQ0FMRTgAgMLXLwAHUEVORElORwIHUEVORElORwAIRklOSVNIRUQCCEZJTklTSEVEAQd3cmFwRXJyAQFzCQCsAgIJAKwCAgUNQ09OVFJBQ1RfTkFNRQICOiAFAXMBCHRocm93RXJyAQFzCQACAQkBB3dyYXBFcnIBBQFzARFrZXlGYWN0b3J5QWRkcmVzcwAJALkJAgkAzAgCAgIlcwkAzAgCAgdmYWN0b3J5BQNuaWwFA1NFUAEMa2V5THBBc3NldElkAAkAuQkCCQDMCAICAiVzCQDMCAICCWxwQXNzZXRJZAUDbmlsBQNTRVABEmtleVRyZWFzdXJ5QWRkcmVzcwAJALkJAgkAzAgCAgIlcwkAzAgCAgh0cmVhc3VyeQUDbmlsBQNTRVABDGtleUF2YWlsYWJsZQELdXNlckFkZHJlc3MJALkJAgkAzAgCAgQlcyVzCQDMCAICCWF2YWlsYWJsZQkAzAgCCQClCA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BdmFpbGFibGUBBQlnZW5lcmF0b3IJAMwIAgkAZAIFCWF2YWlsYWJsZQUNbHBBc3NldEFtb3VudAUDbmlsBQNuaWwJAMwIAgkA/AcEBRRmYWN0b3J5QWRkcmVzc09yRmFpbAINdHJhbnNmZXJXYXZlcwkAzAgCBRB1c2VyQWRkcmVzc0J5dGVzCQDMCAIFG2Jsb2NrUHJvY2Vzc2luZ1Jld2FyZE9yRmFpbAUDbmlsBQNuaWwFA25pbAkAlAoCBQNuaWwFDmZhY3RvcnlBY3Rpb25zCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleajqA08=", "height": 2614940, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7JXzeDFWqgY2daX9NLoh4A2HbXQ7nigjVxcbGUFQU3Vh Next: G3AFXw36cGdNo4g61Ds1njQrrZrhGSA1VScd5uaThvJF Diff:
Old | New | Differences | |
---|---|---|---|
172 | 172 | let claimed = valueOrElse(getInteger(factoryAddressOrFail, keyClaimed(userAddress)), 0) | |
173 | 173 | let factoryActions = if ((available > 0)) | |
174 | 174 | then [invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, available, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(userAddress), 0], nil), invoke(factoryAddressOrFail, "stringEntry", [keyClaimed(userAddress), (claimed + available)], nil)] | |
175 | - | else | |
175 | + | else throwErr("nothing to claim") | |
176 | 176 | $Tuple2(nil, factoryActions) | |
177 | 177 | } | |
178 | 178 | else throw("Strict value is not equal to itself.") | |
271 | 271 | then { | |
272 | 272 | let userAddress = Address(userAddressBytes) | |
273 | 273 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
274 | - | let $ | |
275 | - | let status = $ | |
276 | - | let lpAssetAmount = $ | |
277 | - | let targetPeriod = $ | |
278 | - | let claimTxId = $ | |
274 | + | let $t086058718 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
275 | + | let status = $t086058718._1 | |
276 | + | let lpAssetAmount = $t086058718._2 | |
277 | + | let targetPeriod = $t086058718._3 | |
278 | + | let claimTxId = $t086058718._4 | |
279 | 279 | if ((status == PENDING)) | |
280 | 280 | then { | |
281 | 281 | let factoryActions = [invoke(factoryAddressOrFail, "deleteEntry", [keyWithdrawalRequest(userAddress, txId)], nil), invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, lpAssetAmount, lpAssetIdOrFail], nil)] | |
298 | 298 | let userAddress = Address(userAddressBytes) | |
299 | 299 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
300 | 300 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
301 | - | let $ | |
302 | - | let status = $ | |
303 | - | let lpAssetAmount = $ | |
304 | - | let targetPeriod = $ | |
305 | - | let claimTxId = $ | |
301 | + | let $t095899702 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
302 | + | let status = $t095899702._1 | |
303 | + | let lpAssetAmount = $t095899702._2 | |
304 | + | let targetPeriod = $t095899702._3 | |
305 | + | let claimTxId = $t095899702._4 | |
306 | 306 | if ((status == FINISHED)) | |
307 | 307 | then throwErr("invalid withdrawal request status") | |
308 | 308 | 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 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 keyWithdrawalRequest (userAddress,txId) = makeString(["%s%s%s", "withdrawal", toString(userAddress), toBase58String(txId)], SEP) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func valueWithdrawalRequest (status,lpAssetAmount,targetPeriod,claimTxId) = { | |
57 | 57 | let claimTxIdStr = match claimTxId { | |
58 | 58 | case b: ByteVector => | |
59 | 59 | toBase58String(b) | |
60 | 60 | case _: Unit => | |
61 | 61 | "SOON" | |
62 | 62 | case _ => | |
63 | 63 | throw("Match error") | |
64 | 64 | } | |
65 | 65 | makeString(["%s%d%d%s", status, toString(lpAssetAmount), toString(targetPeriod), claimTxIdStr], SEP) | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func parseWithdrawalRequestValueOrFail (s) = { | |
70 | 70 | let parts = split(s, SEP) | |
71 | 71 | if ((size(parts) == 5)) | |
72 | 72 | then { | |
73 | 73 | let status = parts[1] | |
74 | 74 | let lpAssetAmount = valueOrErrorMessage(parseInt(parts[2]), wrapErr("invalid lpAssetAmount")) | |
75 | 75 | let targetPeriod = valueOrErrorMessage(parseInt(parts[3]), wrapErr("invalid targetPeriod")) | |
76 | 76 | let claimTxId = parts[4] | |
77 | 77 | $Tuple4(status, lpAssetAmount, targetPeriod, claimTxId) | |
78 | 78 | } | |
79 | 79 | else throwErr("invalid withdrawal request value") | |
80 | 80 | } | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | let factoryAddressOption = match getString(this, keyFactoryAddress()) { | |
84 | 84 | case s: String => | |
85 | 85 | addressFromString(s) | |
86 | 86 | case _: Unit => | |
87 | 87 | unit | |
88 | 88 | case _ => | |
89 | 89 | throw("Match error") | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | let factoryAddressOrFail = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address")) | |
93 | 93 | ||
94 | 94 | let lpAssetIdOption = match factoryAddressOption { | |
95 | 95 | case a: Address => | |
96 | 96 | match getString(a, keyLpAssetId()) { | |
97 | 97 | case s: String => | |
98 | 98 | fromBase58String(s) | |
99 | 99 | case _: Unit => | |
100 | 100 | unit | |
101 | 101 | case _ => | |
102 | 102 | throw("Match error") | |
103 | 103 | } | |
104 | 104 | case _: Unit => | |
105 | 105 | unit | |
106 | 106 | case _ => | |
107 | 107 | throw("Match error") | |
108 | 108 | } | |
109 | 109 | ||
110 | 110 | let lpAssetIdOrFail = valueOrErrorMessage(lpAssetIdOption, wrapErr("invalid lpAssetId")) | |
111 | 111 | ||
112 | 112 | let treasuryAddressOption = match factoryAddressOption { | |
113 | 113 | case a: Address => | |
114 | 114 | match getString(a, keyTreasuryAddress()) { | |
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 | case _: Unit => | |
123 | 123 | unit | |
124 | 124 | case _ => | |
125 | 125 | throw("Match error") | |
126 | 126 | } | |
127 | 127 | ||
128 | 128 | let treasuryAddressOrFail = valueOrErrorMessage(treasuryAddressOption, wrapErr("invalid treasury address")) | |
129 | 129 | ||
130 | 130 | func onlyAddress (i,address) = if ((i.caller == address)) | |
131 | 131 | then true | |
132 | 132 | else throwErr("permission denied") | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func onlyFactory (i) = onlyAddress(i, factoryAddressOrFail) | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func rewardForOption (rewards,target) = { | |
139 | 139 | let s = size(rewards) | |
140 | 140 | let $t032473272 = rewards[0] | |
141 | 141 | let a0 = $t032473272._1 | |
142 | 142 | let r0 = $t032473272._2 | |
143 | 143 | let $t032753300 = rewards[1] | |
144 | 144 | let a1 = $t032753300._1 | |
145 | 145 | let r1 = $t032753300._2 | |
146 | 146 | let $t033033328 = rewards[2] | |
147 | 147 | let a2 = $t033033328._1 | |
148 | 148 | let r2 = $t033033328._2 | |
149 | 149 | if (if ((s > 0)) | |
150 | 150 | then (a0 == target) | |
151 | 151 | else false) | |
152 | 152 | then r0 | |
153 | 153 | else if (if ((s > 1)) | |
154 | 154 | then (a1 == target) | |
155 | 155 | else false) | |
156 | 156 | then r1 | |
157 | 157 | else if (if ((s > 2)) | |
158 | 158 | then (a2 == target) | |
159 | 159 | else false) | |
160 | 160 | then r2 | |
161 | 161 | else unit | |
162 | 162 | } | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | @Callable(i) | |
166 | 166 | func claimLP (userAddressBytes) = { | |
167 | 167 | let checkCaller = onlyFactory(i) | |
168 | 168 | if ((checkCaller == checkCaller)) | |
169 | 169 | then { | |
170 | 170 | let userAddress = Address(userAddressBytes) | |
171 | 171 | let available = valueOrElse(getInteger(factoryAddressOrFail, keyAvailable(userAddress)), 0) | |
172 | 172 | let claimed = valueOrElse(getInteger(factoryAddressOrFail, keyClaimed(userAddress)), 0) | |
173 | 173 | let factoryActions = if ((available > 0)) | |
174 | 174 | then [invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, available, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(userAddress), 0], nil), invoke(factoryAddressOrFail, "stringEntry", [keyClaimed(userAddress), (claimed + available)], nil)] | |
175 | - | else | |
175 | + | else throwErr("nothing to claim") | |
176 | 176 | $Tuple2(nil, factoryActions) | |
177 | 177 | } | |
178 | 178 | else throw("Strict value is not equal to itself.") | |
179 | 179 | } | |
180 | 180 | ||
181 | 181 | ||
182 | 182 | ||
183 | 183 | @Callable(i) | |
184 | 184 | func finalize (newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = { | |
185 | 185 | let checks = [if ((i.originCaller == factoryAddressOrFail)) | |
186 | 186 | then true | |
187 | 187 | else throwErr("permission denied"), if ((newTreasuryVolumeInWaves >= 0)) | |
188 | 188 | then true | |
189 | 189 | else throwErr("invalid new treasury volume"), if ((xtnPrice >= 0)) | |
190 | 190 | then true | |
191 | 191 | else throwErr("invalid XTN price"), if (if ((pwrManagersBonus >= 0)) | |
192 | 192 | then (SCALE8 >= pwrManagersBonus) | |
193 | 193 | else false) | |
194 | 194 | then true | |
195 | 195 | else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8))) | |
196 | 196 | then (SCALE8 >= treasuryVolumeDiffAllocationCoef) | |
197 | 197 | else false) | |
198 | 198 | then true | |
199 | 199 | else throwErr("invalid treasury volume diff allocation coefficient")] | |
200 | 200 | if ((checks == checks)) | |
201 | 201 | then { | |
202 | 202 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
203 | 203 | let newPeriod = (currentPeriodOrFail + 1) | |
204 | 204 | let newPrice = SCALE8 | |
205 | 205 | let lpAssetAmountToBurn = 0 | |
206 | 206 | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyCurrentPeriod(), newPeriod], nil), invoke(factoryAddressOrFail, "integerEntry", [keyPriceForPeriod(newPeriod), newPrice], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmountToBurn], nil)] | |
207 | 207 | $Tuple2(nil, factoryActions) | |
208 | 208 | } | |
209 | 209 | else throw("Strict value is not equal to itself.") | |
210 | 210 | } | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | ||
214 | 214 | @Callable(i) | |
215 | 215 | func invest (userAddressBytes) = { | |
216 | 216 | let checkCaller = onlyFactory(i) | |
217 | 217 | if ((checkCaller == checkCaller)) | |
218 | 218 | then { | |
219 | 219 | let userAddress = Address(userAddressBytes) | |
220 | 220 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
221 | 221 | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
222 | 222 | let payment = if ((size(i.payments) == 1)) | |
223 | 223 | then i.payments[0] | |
224 | 224 | else throwErr("invalid payments") | |
225 | 225 | let paymentAmount = if (if ((payment.assetId == unit)) | |
226 | 226 | then (payment.amount > 0) | |
227 | 227 | else false) | |
228 | 228 | then payment.amount | |
229 | 229 | else throwErr("invalid payment amount") | |
230 | 230 | let lpAssetAmount = if ((currentPriceOrFail > 0)) | |
231 | 231 | then fraction(paymentAmount, SCALE8, currentPriceOrFail) | |
232 | 232 | else 0 | |
233 | 233 | 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)])] | |
234 | 234 | $Tuple2(nil, factoryActions) | |
235 | 235 | } | |
236 | 236 | else throw("Strict value is not equal to itself.") | |
237 | 237 | } | |
238 | 238 | ||
239 | 239 | ||
240 | 240 | ||
241 | 241 | @Callable(i) | |
242 | 242 | func withdraw (userAddressBytes) = { | |
243 | 243 | let checkCaller = onlyFactory(i) | |
244 | 244 | if ((checkCaller == checkCaller)) | |
245 | 245 | then { | |
246 | 246 | let userAddress = Address(userAddressBytes) | |
247 | 247 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
248 | 248 | let payment = if ((size(i.payments) == 1)) | |
249 | 249 | then i.payments[0] | |
250 | 250 | else throwErr(wrapErr("invalid payments")) | |
251 | 251 | let paymentAssetId = if ((payment.assetId == lpAssetIdOrFail)) | |
252 | 252 | then lpAssetIdOrFail | |
253 | 253 | else throwErr("invalid payment asset") | |
254 | 254 | let paymentAmount = if ((payment.amount > 0)) | |
255 | 255 | then payment.amount | |
256 | 256 | else throwErr("invalid payment amount") | |
257 | 257 | let factoryActions = [invoke(factoryAddressOrFail, "stringEntry", [keyWithdrawalRequest(userAddress, i.transactionId), valueWithdrawalRequest(PENDING, paymentAmount, (currentPeriodOrFail + 1), unit)], nil)] | |
258 | 258 | if ((factoryActions == factoryActions)) | |
259 | 259 | then $Tuple2([ScriptTransfer(factoryAddressOrFail, paymentAmount, paymentAssetId)], factoryActions) | |
260 | 260 | else throw("Strict value is not equal to itself.") | |
261 | 261 | } | |
262 | 262 | else throw("Strict value is not equal to itself.") | |
263 | 263 | } | |
264 | 264 | ||
265 | 265 | ||
266 | 266 | ||
267 | 267 | @Callable(i) | |
268 | 268 | func cancelWithdraw (userAddressBytes,txId) = { | |
269 | 269 | let checkCaller = onlyFactory(i) | |
270 | 270 | if ((checkCaller == checkCaller)) | |
271 | 271 | then { | |
272 | 272 | let userAddress = Address(userAddressBytes) | |
273 | 273 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
274 | - | let $ | |
275 | - | let status = $ | |
276 | - | let lpAssetAmount = $ | |
277 | - | let targetPeriod = $ | |
278 | - | let claimTxId = $ | |
274 | + | let $t086058718 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
275 | + | let status = $t086058718._1 | |
276 | + | let lpAssetAmount = $t086058718._2 | |
277 | + | let targetPeriod = $t086058718._3 | |
278 | + | let claimTxId = $t086058718._4 | |
279 | 279 | if ((status == PENDING)) | |
280 | 280 | then { | |
281 | 281 | let factoryActions = [invoke(factoryAddressOrFail, "deleteEntry", [keyWithdrawalRequest(userAddress, txId)], nil), invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, lpAssetAmount, lpAssetIdOrFail], nil)] | |
282 | 282 | if ((factoryActions == factoryActions)) | |
283 | 283 | then $Tuple2(nil, factoryActions) | |
284 | 284 | else throw("Strict value is not equal to itself.") | |
285 | 285 | } | |
286 | 286 | else throwErr("invalid withdrawal request status") | |
287 | 287 | } | |
288 | 288 | else throw("Strict value is not equal to itself.") | |
289 | 289 | } | |
290 | 290 | ||
291 | 291 | ||
292 | 292 | ||
293 | 293 | @Callable(i) | |
294 | 294 | func claimWaves (userAddressBytes,txId) = { | |
295 | 295 | let checkCaller = onlyFactory(i) | |
296 | 296 | if ((checkCaller == checkCaller)) | |
297 | 297 | then { | |
298 | 298 | let userAddress = Address(userAddressBytes) | |
299 | 299 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
300 | 300 | let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request")) | |
301 | - | let $ | |
302 | - | let status = $ | |
303 | - | let lpAssetAmount = $ | |
304 | - | let targetPeriod = $ | |
305 | - | let claimTxId = $ | |
301 | + | let $t095899702 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption) | |
302 | + | let status = $t095899702._1 | |
303 | + | let lpAssetAmount = $t095899702._2 | |
304 | + | let targetPeriod = $t095899702._3 | |
305 | + | let claimTxId = $t095899702._4 | |
306 | 306 | if ((status == FINISHED)) | |
307 | 307 | then throwErr("invalid withdrawal request status") | |
308 | 308 | else if ((targetPeriod > currentPeriodOrFail)) | |
309 | 309 | then throwErr("invalid withdrawal request period") | |
310 | 310 | else { | |
311 | 311 | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
312 | 312 | let amount = if ((currentPriceOrFail > 0)) | |
313 | 313 | then fraction(lpAssetAmount, currentPriceOrFail, SCALE8) | |
314 | 314 | else 0 | |
315 | 315 | 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)] | |
316 | 316 | $Tuple2(nil, factoryActions) | |
317 | 317 | } | |
318 | 318 | } | |
319 | 319 | else throw("Strict value is not equal to itself.") | |
320 | 320 | } | |
321 | 321 | ||
322 | 322 | ||
323 | 323 | ||
324 | 324 | @Callable(i) | |
325 | 325 | func processBlocks (userAddressBytes) = { | |
326 | 326 | let checkCaller = onlyFactory(i) | |
327 | 327 | if ((checkCaller == checkCaller)) | |
328 | 328 | then { | |
329 | 329 | let userAddress = Address(userAddressBytes) | |
330 | 330 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
331 | 331 | let periodLength = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPeriodLength()), wrapErr("invalid period length")) | |
332 | 332 | let currentStartHeight = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyStartHeight(currentPeriodOrFail)), wrapErr("invalid start height")) | |
333 | 333 | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
334 | 334 | let nextBlockToProcess = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyNextBlockToProcess()), wrapErr("invalid next block to process")) | |
335 | 335 | let targetBlockInfo = if (if (if ((height >= nextBlockToProcess)) | |
336 | 336 | then if ((nextBlockToProcess >= currentStartHeight)) | |
337 | 337 | then true | |
338 | 338 | else (currentPeriodOrFail == 0) | |
339 | 339 | else false) | |
340 | 340 | then ((currentStartHeight + periodLength) > nextBlockToProcess) | |
341 | 341 | else false) | |
342 | 342 | then valueOrErrorMessage(blockInfoByHeight(nextBlockToProcess), wrapErr("invalid block info")) | |
343 | 343 | else throwErr(wrapErr("invalid target block")) | |
344 | 344 | let treasuryRewardOrFail = valueOrErrorMessage(rewardForOption(targetBlockInfo.rewards, treasuryAddressOrFail), wrapErr("invalid treasury reward")) | |
345 | 345 | let generator = targetBlockInfo.generator | |
346 | 346 | let blockProcessingRewardOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyBlockProcessingReward()), wrapErr("invalid block processing reward")) | |
347 | 347 | let available = valueOrElse(getInteger(factoryAddressOrFail, keyAvailable(generator)), 0) | |
348 | 348 | let lpAssetAmount = if ((currentPriceOrFail > 0)) | |
349 | 349 | then fraction((treasuryRewardOrFail - blockProcessingRewardOrFail), SCALE8, currentPriceOrFail) | |
350 | 350 | else 0 | |
351 | 351 | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyNextBlockToProcess(), (nextBlockToProcess + 1)], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(generator), (available + lpAssetAmount)], nil), invoke(factoryAddressOrFail, "transferWaves", [userAddressBytes, blockProcessingRewardOrFail], nil)] | |
352 | 352 | $Tuple2(nil, factoryActions) | |
353 | 353 | } | |
354 | 354 | else throw("Strict value is not equal to itself.") | |
355 | 355 | } | |
356 | 356 | ||
357 | 357 | ||
358 | 358 | @Verifier(tx) | |
359 | 359 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
360 | 360 |
github/deemru/w8io/169f3d6 64.44 ms ◑