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