tx · 8gaphknMrVdP7CaGqJHDTPasBqsKdhjUvB2dteb7xDEi

3PRE5KH9oPGfFPs7fGnQcJ4wNshEDUPGj1t:  -0.01000000 Waves

2023.01.12 05:49 [3466656] smart account 3PRE5KH9oPGfFPs7fGnQcJ4wNshEDUPGj1t > SELF 0.00000000 Waves

{ "type": 13, "id": "8gaphknMrVdP7CaGqJHDTPasBqsKdhjUvB2dteb7xDEi", "fee": 1000000, "feeAssetId": null, "timestamp": 1673491726364, "version": 2, "chainId": 87, "sender": "3PRE5KH9oPGfFPs7fGnQcJ4wNshEDUPGj1t", "senderPublicKey": "Cr1ybL2JGg9GwJHA2JwqxBPfSW6Q7Jg4HvNrsEiCsHu6", "proofs": [ "4X2FpVaPuetG4smpPpkEa2mnDwGiHy69y5BRYALmyfED8S9Z1QanJ7qswNdEbg8VrrEJyXXs7Yhcstb5cJNARyo7" ], "script": null, "height": 3466656, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BDBZhHZemK9L41D2U4WTFXyvSLavgWZhvzDxFJDoVZxT Next: 6NsYautJ9DSnAHoxePo7xo5A1gGiDSYDBQtcUP2FysZB Full:
OldNewDifferences
1-{-# STDLIB_VERSION 6 #-}
2-{-# SCRIPT_TYPE ACCOUNT #-}
3-{-# CONTENT_TYPE DAPP #-}
4-let boss = addressFromStringValue("3PRE5KH9oPGfFPs7fGnQcJ4wNshEDUPGj1t")
5-
6-let usdtAssetIdString = "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ"
7-
8-let usdcAssetIdString = "6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ"
9-
10-let adminPublicKey = base58'Cr1ybL2JGg9GwJHA2JwqxBPfSW6Q7Jg4HvNrsEiCsHu6'
11-
12-func getStringByKey (key) = valueOrElse(getString(this, key), "")
13-
14-
15-func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 25)
16-
17-
18-let amt = getIntegerByKey("montant")
19-
20-let decimals_multi = [10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000]
21-
22-func getBase (func_name) = {
23- let data = split(getStringByKey(func_name), "_")
24- let p1 = addressFromStringValue(data[0])
25- let p2 = addressFromStringValue(data[1])
26- let lp = fromBase58String(data[2])
27- let aid = fromBase58String(data[3])
28- let aid2 = fromBase58String(data[4])
29- let waid = unit
30- let aids = if ((data[3] == "WAVES"))
31- then "WAVES"
32- else data[3]
33- let aid2s = if ((data[4] == "WAVES"))
34- then "WAVES"
35- else data[4]
36- $Tuple8(p1, p2, lp, aid, aid2, waid, aids, aid2s)
37- }
38-
39-
40-func getBaseBal (aid,aids,aid2,aid2s) = {
41- let aid2bb = if ((aid2s == "WAVES"))
42- then wavesBalance(this).available
43- else assetBalance(this, aid2)
44- if ((aid2bb == aid2bb))
45- then {
46- let aidbb = if ((aids == "WAVES"))
47- then wavesBalance(this).available
48- else assetBalance(this, aid)
49- if ((aidbb == aidbb))
50- then $Tuple2(aidbb, aid2bb)
51- else throw("Strict value is not equal to itself.")
52- }
53- else throw("Strict value is not equal to itself.")
54- }
55-
56-
57-func getPutGet (aids) = {
58- let putFunc = if (if ((usdtAssetIdString == aids))
59- then true
60- else (usdcAssetIdString == aids))
61- then "putOneTknV2"
62- else "putOneTkn"
63- let getFunc = if (if ((usdtAssetIdString == aids))
64- then true
65- else (usdcAssetIdString == aids))
66- then "getOneTknV2"
67- else "getOneTkn"
68- $Tuple2(putFunc, getFunc)
69- }
70-
71-
72-func finalize (aid2bb,aid2s,aid2,err_str,decimal) = {
73- let aid2ba = if ((aid2s == "WAVES"))
74- then wavesBalance(this).available
75- else assetBalance(this, aid2)
76- if ((aid2ba == aid2ba))
77- then if ((0 >= (aid2ba - aid2bb)))
78- then throw(err_str)
79- else {
80- let amount = (aid2ba - (amt * decimal))
81- if ((amount == amount))
82- then [ScriptTransfer(boss, amount, if ((aid2s == "WAVES"))
83- then unit
84- else aid2)]
85- else throw("Strict value is not equal to itself.")
86- }
87- else throw("Strict value is not equal to itself.")
88- }
89-
90-
91-func getBalToSwap (aid_str,aidbb,aid) = if ((aid_str == "WAVES"))
92- then (wavesBalance(this).available - aidbb)
93- else (assetBalance(this, aid) - aidbb)
94-
95-
96-func getAssetDecimal (aid) = {
97- let x = match assetInfo(aid) {
98- case asset: Asset =>
99-decimals_multi[(asset.decimals - 1)]
100- case _ =>
101-decimals_multi[7]
102- }
103- x
104- }
105-
106-
107-func pw (i,func_name) = {
108- let $t024902557 = getBase(func_name)
109- let p1 = $t024902557._1
110- let p2 = $t024902557._2
111- let lp = $t024902557._3
112- let aid = $t024902557._4
113- let aid2 = $t024902557._5
114- let waid = $t024902557._6
115- let aids = $t024902557._7
116- let aid2s = $t024902557._8
117- let aid2_decimal = getAssetDecimal(aid2)
118- if (if ((i.caller != this))
119- then (i.caller != boss)
120- else false)
121- then throw("you are not allowed to arb!")
122- else {
123- let $t027002759 = getBaseBal(aid, aids, aid2, aid2s)
124- if (($t027002759 == $t027002759))
125- then {
126- let aid2bb = $t027002759._2
127- let aidbb = $t027002759._1
128- let swap = invoke(p1, "swap", [aids, 1], [AttachedPayment(if ((aid2s == "WAVES"))
129- then waid
130- else aid2, (amt * aid2_decimal))])
131- if ((swap == swap))
132- then {
133- let balToSwap = getBalToSwap(aids, aidbb, aid)
134- let $t029512991 = getPutGet(aids)
135- let putFunc = $t029512991._1
136- let getFunc = $t029512991._2
137- let put = invoke(p2, putFunc, [1, false], [AttachedPayment(if ((aids == "WAVES"))
138- then waid
139- else aid, balToSwap)])
140- if ((put == put))
141- then {
142- let lpb = assetBalance(this, lp)
143- if ((lpb == lpb))
144- then {
145- let get = invoke(p2, getFunc, [aid2s, 1], [AttachedPayment(lp, lpb)])
146- if ((get == get))
147- then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal)
148- else throw("Strict value is not equal to itself.")
149- }
150- else throw("Strict value is not equal to itself.")
151- }
152- else throw("Strict value is not equal to itself.")
153- }
154- else throw("Strict value is not equal to itself.")
155- }
156- else throw("Strict value is not equal to itself.")
157- }
158- }
159-
160-
161-func wp (i,func_name) = {
162- let $t033603427 = getBase(func_name)
163- let p1 = $t033603427._1
164- let p2 = $t033603427._2
165- let lp = $t033603427._3
166- let aid = $t033603427._4
167- let aid2 = $t033603427._5
168- let waid = $t033603427._6
169- let aids = $t033603427._7
170- let aid2s = $t033603427._8
171- let aid2_decimal = getAssetDecimal(aid2)
172- if (if ((i.caller != this))
173- then (i.caller != boss)
174- else false)
175- then throw("you are not allowed to arb!")
176- else {
177- let $t035703629 = getBaseBal(aid, aids, aid2, aid2s)
178- if (($t035703629 == $t035703629))
179- then {
180- let aid2bb = $t035703629._2
181- let aidbb = $t035703629._1
182- let $t036343674 = getPutGet(aids)
183- let putFunc = $t036343674._1
184- let getFunc = $t036343674._2
185- let put = invoke(p1, putFunc, [1, false], [AttachedPayment(if ((aid2s == "WAVES"))
186- then waid
187- else aid2, (amt * aid2_decimal))])
188- if ((put == put))
189- then {
190- let lpb = assetBalance(this, lp)
191- if ((lpb == lpb))
192- then {
193- let get = invoke(p1, getFunc, [aids, 1], [AttachedPayment(lp, lpb)])
194- if ((get == get))
195- then {
196- let balToSwap = getBalToSwap(aids, aidbb, aid)
197- let swap = invoke(p2, "swap", [aid2s, 1], [AttachedPayment(if ((aids == "WAVES"))
198- then waid
199- else aid, balToSwap)])
200- if ((swap == swap))
201- then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal)
202- else throw("Strict value is not equal to itself.")
203- }
204- else throw("Strict value is not equal to itself.")
205- }
206- else throw("Strict value is not equal to itself.")
207- }
208- else throw("Strict value is not equal to itself.")
209- }
210- else throw("Strict value is not equal to itself.")
211- }
212- }
213-
214-
215-func ps (i,func_name) = {
216- let $t042324299 = getBase(func_name)
217- let p1 = $t042324299._1
218- let p2 = $t042324299._2
219- let lp = $t042324299._3
220- let aid = $t042324299._4
221- let aid2 = $t042324299._5
222- let waid = $t042324299._6
223- let aids = $t042324299._7
224- let aid2s = $t042324299._8
225- let aid2_decimal = getAssetDecimal(aid2)
226- if (if ((i.caller != this))
227- then (i.caller != boss)
228- else false)
229- then throw("you are not allowed to arb!")
230- else {
231- let $t044424501 = getBaseBal(aid, aids, aid2, aid2s)
232- if (($t044424501 == $t044424501))
233- then {
234- let aid2bb = $t044424501._2
235- let aidbb = $t044424501._1
236- let swap = invoke(p1, "swap", [aids, 1], [AttachedPayment(if ((aid2s == "WAVES"))
237- then waid
238- else aid2, (amt * aid2_decimal))])
239- if ((swap == swap))
240- then {
241- let balToSwap = getBalToSwap(aids, aidbb, aid)
242- let swap2 = invoke(p2, "exchange", [1], [AttachedPayment(if ((aids == "WAVES"))
243- then waid
244- else aid, balToSwap)])
245- if ((swap2 == swap2))
246- then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal)
247- else throw("Strict value is not equal to itself.")
248- }
249- else throw("Strict value is not equal to itself.")
250- }
251- else throw("Strict value is not equal to itself.")
252- }
253- }
254-
255-
256-func sp (i,func_name) = {
257- let $t049345001 = getBase(func_name)
258- let p1 = $t049345001._1
259- let p2 = $t049345001._2
260- let lp = $t049345001._3
261- let aid = $t049345001._4
262- let aid2 = $t049345001._5
263- let waid = $t049345001._6
264- let aids = $t049345001._7
265- let aid2s = $t049345001._8
266- let aid2_decimal = getAssetDecimal(aid2)
267- if (if ((i.caller != this))
268- then (i.caller != boss)
269- else false)
270- then throw("you are not allowed to arb!")
271- else {
272- let $t051445203 = getBaseBal(aid, aids, aid2, aid2s)
273- if (($t051445203 == $t051445203))
274- then {
275- let aid2bb = $t051445203._2
276- let aidbb = $t051445203._1
277- let swap = invoke(p1, "exchange", [1], [AttachedPayment(if ((aid2s == "WAVES"))
278- then waid
279- else aid2, (amt * aid2_decimal))])
280- if ((swap == swap))
281- then {
282- let balToSwap = getBalToSwap(aids, aidbb, aid)
283- let swap2 = invoke(p2, "swap", [aid2s, 1], [AttachedPayment(if ((aids == "WAVES"))
284- then waid
285- else aid, balToSwap)])
286- if ((swap2 == swap2))
287- then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal)
288- else throw("Strict value is not equal to itself.")
289- }
290- else throw("Strict value is not equal to itself.")
291- }
292- else throw("Strict value is not equal to itself.")
293- }
294- }
295-
296-
297-func ws (i,func_name) = {
298- let $t056335700 = getBase(func_name)
299- let p1 = $t056335700._1
300- let p2 = $t056335700._2
301- let lp = $t056335700._3
302- let aid = $t056335700._4
303- let aid2 = $t056335700._5
304- let waid = $t056335700._6
305- let aids = $t056335700._7
306- let aid2s = $t056335700._8
307- let aid2_decimal = getAssetDecimal(aid2)
308- if (if ((i.caller != this))
309- then (i.caller != boss)
310- else false)
311- then throw("you are not allowed to arb!")
312- else {
313- let $t058435902 = getBaseBal(aid, aids, aid2, aid2s)
314- if (($t058435902 == $t058435902))
315- then {
316- let aid2bb = $t058435902._2
317- let aidbb = $t058435902._1
318- let $t059075947 = getPutGet(aids)
319- let putFunc = $t059075947._1
320- let getFunc = $t059075947._2
321- let put = invoke(p1, putFunc, [1, false], [AttachedPayment(if ((aid2s == "WAVES"))
322- then waid
323- else aid2, (amt * aid2_decimal))])
324- if ((put == put))
325- then {
326- let lpb = assetBalance(this, lp)
327- if ((lpb == lpb))
328- then {
329- let get = invoke(p1, getFunc, [aids, 1], [AttachedPayment(lp, lpb)])
330- if ((get == get))
331- then {
332- let balToSwap = getBalToSwap(aids, aidbb, aid)
333- let swap = invoke(p2, "exchange", [1], [AttachedPayment(if ((aids == "WAVES"))
334- then waid
335- else aid, balToSwap)])
336- if ((swap == swap))
337- then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal)
338- else throw("Strict value is not equal to itself.")
339- }
340- else throw("Strict value is not equal to itself.")
341- }
342- else throw("Strict value is not equal to itself.")
343- }
344- else throw("Strict value is not equal to itself.")
345- }
346- else throw("Strict value is not equal to itself.")
347- }
348- }
349-
350-
351-func sw (i,func_name) = {
352- let $t064926559 = getBase(func_name)
353- let p1 = $t064926559._1
354- let p2 = $t064926559._2
355- let lp = $t064926559._3
356- let aid = $t064926559._4
357- let aid2 = $t064926559._5
358- let waid = $t064926559._6
359- let aids = $t064926559._7
360- let aid2s = $t064926559._8
361- let aid2_decimal = getAssetDecimal(aid2)
362- if (if ((i.caller != this))
363- then (i.caller != boss)
364- else false)
365- then throw("you are not allowed to arb!")
366- else {
367- let $t067026761 = getBaseBal(aid, aids, aid2, aid2s)
368- if (($t067026761 == $t067026761))
369- then {
370- let aid2bb = $t067026761._2
371- let aidbb = $t067026761._1
372- let $t067666806 = getPutGet(aids)
373- let putFunc = $t067666806._1
374- let getFunc = $t067666806._2
375- let swap = invoke(p1, "exchange", [1], [AttachedPayment(if ((aid2s == "WAVES"))
376- then waid
377- else aid2, (amt * aid2_decimal))])
378- if ((swap == swap))
379- then {
380- let balToSwap = getBalToSwap(aids, aidbb, aid)
381- let put = invoke(p2, putFunc, [1, false], [AttachedPayment(if ((aids == "WAVES"))
382- then waid
383- else aid, balToSwap)])
384- if ((put == put))
385- then {
386- let lpb = assetBalance(this, lp)
387- if ((lpb == lpb))
388- then {
389- let get = invoke(p2, getFunc, [aid2s, 1], [AttachedPayment(lp, lpb)])
390- if ((get == get))
391- then finalize(aid2bb, aid2s, aid2, func_name, aid2_decimal)
392- else throw("Strict value is not equal to itself.")
393- }
394- else throw("Strict value is not equal to itself.")
395- }
396- else throw("Strict value is not equal to itself.")
397- }
398- else throw("Strict value is not equal to itself.")
399- }
400- else throw("Strict value is not equal to itself.")
401- }
402- }
403-
404-
405-@Callable(i)
406-func setAmout (a) = if ((i.caller != this))
407- then throw("you are not allowed to set!")
408- else [IntegerEntry("montant", a)]
409-
410-
411-
412-@Callable(i)
413-func setKeyValString (key,val) = if ((i.caller != this))
414- then throw("you are not allowed to set!")
415- else [StringEntry(key, val)]
416-
417-
418-
419-@Callable(i)
420-func a (a,t) = if ((t == "pw"))
421- then pw(i, a)
422- else if ((t == "wp"))
423- then wp(i, a)
424- else if ((t == "ps"))
425- then ps(i, a)
426- else if ((t == "sp"))
427- then sp(i, a)
428- else if ((t == "ws"))
429- then ws(i, a)
430- else if ((t == "sw"))
431- then sw(i, a)
432- else throw("Type not found")
433-
434-
435-@Verifier(tx)
436-func verify () = if (sigVerify_128Kb(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
437- then true
438- else sigVerify_128Kb(tx.bodyBytes, tx.proofs[0], adminPublicKey)
439-
1+# no script

github/deemru/w8io/6500d08 
27.59 ms