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