tx · yUDjTK8Mxo6qXqBVphvznrfopTtYhCcAr7vuTir4cWQ 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL: -0.01000000 Waves 2021.08.31 23:57 [1683027] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves
{ "type": 13, "id": "yUDjTK8Mxo6qXqBVphvznrfopTtYhCcAr7vuTir4cWQ", "fee": 1000000, "feeAssetId": null, "timestamp": 1630443478742, "version": 2, "chainId": 84, "sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL", "senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx", "proofs": [ "4tTTHHfHtYUcGNLGvg3ovt3uw3WGPkxfo7wMnftvsuojKswJvZZqdkkUwPYwWv8bixYZvbQCbWR26Ywtev7Rmp5j" ], "script": "base64:AAIFAAAAAAAAAoQIAhIGCgQYEQIBGgcKAmExEgFpGhAKAmEyEgpleGNoYW5nZXJzGgoKAmEzEgRhcmdzGhQKAmE0Eg5yZWNlaXZlQXNzZXRJZBoYCgJhNRISbWluQW1vdW50VG9SZWNlaXZlGhEKAmE2Egtyb3V0aW5nU2l6ZRoSCgJhNxIMZXhjaGFuZ2VGb2xkGhEKAmE4EgthY2N1bXVsYXRlZBoPCgJhORIJZXhjaGFuZ2VyGg8KAmIxEgkkdDA5MzU5OTgaFQoCYjISD2V4Y2hhbmdlQ291bnRlchoUCgJiMxIOYW1vdW50c1dpdGhGZWUaEgoCYjQSDGFzc2V0c0lkU2VuZBoWCgJiNRIQZXhjaGFuZ2VyQWRkcmVzcxoRCgJiNhILJHQwMTExODExOTIaDwoCYjcSCXBtdEFtb3VudBoQCgJiOBIKcG10QXNzZXRJZBoJCgJiORIDaW52Gg0KAmMxEgckbWF0Y2gwGhEKAmMyEgskdDAxNDIwMTQ1OBoTCgJjMxINYW1vdW50V2l0aEZlZRoRCgJjNBILYXNzZXRJZFNlbmQaEQoCYzUSCy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AAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAACYTEAAAAGY2FsbGVyBQAAAAJkNgUAAAACYTQFAAAAA25pbAkAAAIAAAABAgAAAD5yb3V0aW5nICE9IHJvdXRpbmdTaXplIG9yIGFtb3VudFRvUmVjaWV2ZSA8IG1pbkFtb3VudFRvUmVjZWl2ZQAAAAD6xIl/", "height": 1683027, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 92LQnViqFimBstBSHFmNpj1Ck87neh2RQNus9pgfXVWy Next: A1ZDU2ANYWTXDxtW17in4oXu7pqJwECmePUDonYE9fF3 Diff:
Old | New | Differences | |
---|---|---|---|
30 | 30 | } | |
31 | 31 | else throw("Strict value is not equal to itself.") | |
32 | 32 | } | |
33 | - | else if ((exchangeCounter | |
33 | + | else if ((exchangeCounter == 1)) | |
34 | 34 | then throw(((((toString(exchangeCounter) + " ") + toBase58String(assetsIdSend)) + " ") + toString(amountsWithFee))) | |
35 | 35 | else if (if ((exchangeCounter > 0)) | |
36 | 36 | then (routingSize > exchangeCounter) | |
37 | 37 | else false) | |
38 | 38 | then { | |
39 | 39 | let exchangerAddress = addressFromStringValue(exchanger) | |
40 | - | let $ | |
41 | - | let pmtAssetId = $ | |
42 | - | let pmtAmount = $ | |
40 | + | let $t019642116 = $Tuple2(assetsIdSend, amountsWithFee) | |
41 | + | let pmtAssetId = $t019642116._1 | |
42 | + | let pmtAmount = $t019642116._2 | |
43 | 43 | let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
44 | 44 | if ((inv == inv)) | |
45 | 45 | then match inv { | |
46 | 46 | case inv: (Int, ByteVector) => | |
47 | - | let $ | |
48 | - | let amountWithFee = $ | |
49 | - | let assetIdSend = $ | |
47 | + | let $t023442382 = inv | |
48 | + | let amountWithFee = $t023442382._1 | |
49 | + | let assetIdSend = $t023442382._2 | |
50 | 50 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
51 | 51 | case _ => | |
52 | 52 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
56 | 56 | else accumulated | |
57 | 57 | } | |
58 | 58 | ||
59 | - | let $ | |
60 | - | let $ | |
61 | - | let $ | |
62 | - | let $ | |
63 | - | if (($ | |
64 | - | then $ | |
59 | + | let $t026202721 = { | |
60 | + | let $list26722721 = exchangers | |
61 | + | let $size26722721 = size($list26722721) | |
62 | + | let $acc026722721 = $Tuple3(0, 0, base58'') | |
63 | + | if (($size26722721 == 0)) | |
64 | + | then $acc026722721 | |
65 | 65 | else { | |
66 | - | let $ | |
67 | - | if (($ | |
68 | - | then $ | |
66 | + | let $acc126722721 = exchangeFold($acc026722721, $list26722721[0]) | |
67 | + | if (($size26722721 == 1)) | |
68 | + | then $acc126722721 | |
69 | 69 | else { | |
70 | - | let $ | |
71 | - | if (($ | |
72 | - | then $ | |
70 | + | let $acc226722721 = exchangeFold($acc126722721, $list26722721[1]) | |
71 | + | if (($size26722721 == 2)) | |
72 | + | then $acc226722721 | |
73 | 73 | else { | |
74 | - | let $ | |
75 | - | if (($ | |
76 | - | then $ | |
74 | + | let $acc326722721 = exchangeFold($acc226722721, $list26722721[2]) | |
75 | + | if (($size26722721 == 3)) | |
76 | + | then $acc326722721 | |
77 | 77 | else { | |
78 | - | let $ | |
78 | + | let $acc426722721 = exchangeFold($acc326722721, $list26722721[3]) | |
79 | 79 | throw("List size exceed 3") | |
80 | 80 | } | |
81 | 81 | } | |
82 | 82 | } | |
83 | 83 | } | |
84 | 84 | } | |
85 | - | let exchangeCounter = $ | |
86 | - | let amountsWithFee = $ | |
87 | - | let assetsIdSend = $ | |
85 | + | let exchangeCounter = $t026202721._1 | |
86 | + | let amountsWithFee = $t026202721._2 | |
87 | + | let assetsIdSend = $t026202721._3 | |
88 | 88 | let amountToRecieve = assetBalance(this, receiveAssetId) | |
89 | 89 | if (if ((exchangeCounter == routingSize)) | |
90 | 90 | then (amountToRecieve >= minAmountToReceive) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func routingTrade (exchangers,args,receiveAssetId,minAmountToReceive) = { | |
8 | 8 | let routingSize = size(exchangers) | |
9 | 9 | func exchangeFold (accumulated,exchanger) = { | |
10 | 10 | let $t0935998 = accumulated | |
11 | 11 | let exchangeCounter = $t0935998._1 | |
12 | 12 | let amountsWithFee = $t0935998._2 | |
13 | 13 | let assetsIdSend = $t0935998._3 | |
14 | 14 | if ((exchangeCounter == 0)) | |
15 | 15 | then { | |
16 | 16 | let exchangerAddress = addressFromStringValue(exchanger) | |
17 | 17 | let $t011181192 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
18 | 18 | let pmtAmount = $t011181192._1 | |
19 | 19 | let pmtAssetId = $t011181192._2 | |
20 | 20 | let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
21 | 21 | if ((inv == inv)) | |
22 | 22 | then match inv { | |
23 | 23 | case inv: (Int, ByteVector) => | |
24 | 24 | let $t014201458 = inv | |
25 | 25 | let amountWithFee = $t014201458._1 | |
26 | 26 | let assetIdSend = $t014201458._2 | |
27 | 27 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
28 | 28 | case _ => | |
29 | 29 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
30 | 30 | } | |
31 | 31 | else throw("Strict value is not equal to itself.") | |
32 | 32 | } | |
33 | - | else if ((exchangeCounter | |
33 | + | else if ((exchangeCounter == 1)) | |
34 | 34 | then throw(((((toString(exchangeCounter) + " ") + toBase58String(assetsIdSend)) + " ") + toString(amountsWithFee))) | |
35 | 35 | else if (if ((exchangeCounter > 0)) | |
36 | 36 | then (routingSize > exchangeCounter) | |
37 | 37 | else false) | |
38 | 38 | then { | |
39 | 39 | let exchangerAddress = addressFromStringValue(exchanger) | |
40 | - | let $ | |
41 | - | let pmtAssetId = $ | |
42 | - | let pmtAmount = $ | |
40 | + | let $t019642116 = $Tuple2(assetsIdSend, amountsWithFee) | |
41 | + | let pmtAssetId = $t019642116._1 | |
42 | + | let pmtAmount = $t019642116._2 | |
43 | 43 | let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
44 | 44 | if ((inv == inv)) | |
45 | 45 | then match inv { | |
46 | 46 | case inv: (Int, ByteVector) => | |
47 | - | let $ | |
48 | - | let amountWithFee = $ | |
49 | - | let assetIdSend = $ | |
47 | + | let $t023442382 = inv | |
48 | + | let amountWithFee = $t023442382._1 | |
49 | + | let assetIdSend = $t023442382._2 | |
50 | 50 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
51 | 51 | case _ => | |
52 | 52 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
53 | 53 | } | |
54 | 54 | else throw("Strict value is not equal to itself.") | |
55 | 55 | } | |
56 | 56 | else accumulated | |
57 | 57 | } | |
58 | 58 | ||
59 | - | let $ | |
60 | - | let $ | |
61 | - | let $ | |
62 | - | let $ | |
63 | - | if (($ | |
64 | - | then $ | |
59 | + | let $t026202721 = { | |
60 | + | let $list26722721 = exchangers | |
61 | + | let $size26722721 = size($list26722721) | |
62 | + | let $acc026722721 = $Tuple3(0, 0, base58'') | |
63 | + | if (($size26722721 == 0)) | |
64 | + | then $acc026722721 | |
65 | 65 | else { | |
66 | - | let $ | |
67 | - | if (($ | |
68 | - | then $ | |
66 | + | let $acc126722721 = exchangeFold($acc026722721, $list26722721[0]) | |
67 | + | if (($size26722721 == 1)) | |
68 | + | then $acc126722721 | |
69 | 69 | else { | |
70 | - | let $ | |
71 | - | if (($ | |
72 | - | then $ | |
70 | + | let $acc226722721 = exchangeFold($acc126722721, $list26722721[1]) | |
71 | + | if (($size26722721 == 2)) | |
72 | + | then $acc226722721 | |
73 | 73 | else { | |
74 | - | let $ | |
75 | - | if (($ | |
76 | - | then $ | |
74 | + | let $acc326722721 = exchangeFold($acc226722721, $list26722721[2]) | |
75 | + | if (($size26722721 == 3)) | |
76 | + | then $acc326722721 | |
77 | 77 | else { | |
78 | - | let $ | |
78 | + | let $acc426722721 = exchangeFold($acc326722721, $list26722721[3]) | |
79 | 79 | throw("List size exceed 3") | |
80 | 80 | } | |
81 | 81 | } | |
82 | 82 | } | |
83 | 83 | } | |
84 | 84 | } | |
85 | - | let exchangeCounter = $ | |
86 | - | let amountsWithFee = $ | |
87 | - | let assetsIdSend = $ | |
85 | + | let exchangeCounter = $t026202721._1 | |
86 | + | let amountsWithFee = $t026202721._2 | |
87 | + | let assetsIdSend = $t026202721._3 | |
88 | 88 | let amountToRecieve = assetBalance(this, receiveAssetId) | |
89 | 89 | if (if ((exchangeCounter == routingSize)) | |
90 | 90 | then (amountToRecieve >= minAmountToReceive) | |
91 | 91 | else false) | |
92 | 92 | then [ScriptTransfer(i.caller, amountToRecieve, receiveAssetId)] | |
93 | 93 | else throw("routing != routingSize or amountToRecieve < minAmountToReceive") | |
94 | 94 | } | |
95 | 95 | ||
96 | 96 |
github/deemru/w8io/026f985 32.82 ms ◑