tx · CqQyoaBgcUWSLSt3WHWNGEgCK2vf4qhu17BwAtZJeQ24 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL: -0.01000000 Waves 2021.08.31 23:48 [1683019] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves
{ "type": 13, "id": "CqQyoaBgcUWSLSt3WHWNGEgCK2vf4qhu17BwAtZJeQ24", "fee": 1000000, "feeAssetId": null, "timestamp": 1630443002471, "version": 2, "chainId": 84, "sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL", "senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx", "proofs": [ "3JrkXABmJswx3eMrzZtgoGu68vCaSAwsrLLbTXh3sB4rz3gm4rAuEJ9vLGX8bQ7jjK5Xj9TB2XSFV92JkzrXnc6q" ], "script": "base64:AAIFAAAAAAAAAl4IAhIGCgQYEQIBGgcKAmExEgFpGhAKAmEyEgpleGNoYW5nZXJzGgoKAmEzEgRhcmdzGhQKAmE0Eg5yZWNlaXZlQXNzZXRJZBoYCgJhNRISbWluQW1vdW50VG9SZWNlaXZlGhEKAmE2Egtyb3V0aW5nU2l6ZRoSCgJhNxIMZXhjaGFuZ2VGb2xkGhEKAmE4EgthY2N1bXVsYXRlZBoPCgJhORIJZXhjaGFuZ2VyGg8KAmIxEgkkdDA5MzU5OTgaFQoCYjISD2V4Y2hhbmdlQ291bnRlchoUCgJiMxIOYW1vdW50c1dpdGhGZWUaEgoCYjQSDGFzc2V0c0lkU2VuZBoWCgJiNRIQZXhjaGFuZ2VyQWRkcmVzcxoRCgJiNhILJHQwMTExODExOTIaDwoCYjcSCXBtdEFtb3VudBoQCgJiOBIKcG10QXNzZXRJZBoJCgJiORIDaW52Gg0KAmMxEgckbWF0Y2gwGhEKAmMyEgskdDAxNDIwMTQ1OBoTCgJjMxINYW1vdW50V2l0aEZlZRoRCgJjNBILYXNzZXRJZFNlbmQaEQo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gAAABJMaXN0IHNpemUgZXhjZWVkIDMEAAAAAmIyCAUAAAACYzUAAAACXzEEAAAAAmIzCAUAAAACYzUAAAACXzIEAAAAAmI0CAUAAAACYzUAAAACXzMEAAAAAmQ0CQAD8AAAAAIFAAAABHRoaXMFAAAAAmE0AwMJAAAAAAAAAgUAAAACYjIFAAAAAmE2CQAAZwAAAAIFAAAAAmQ0BQAAAAJhNQcJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAmExAAAABmNhbGxlcgUAAAACZDQFAAAAAmE0BQAAAANuaWwJAAACAAAAAQIAAAA+cm91dGluZyAhPSByb3V0aW5nU2l6ZSBvciBhbW91bnRUb1JlY2lldmUgPCBtaW5BbW91bnRUb1JlY2VpdmUAAAAAeK+Omw==", "height": 1683019, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Eex18D8BYFBPnqRLQKrg5yMj4Wow2uSkap5XsGFEsLK6 Next: 6pY4yMBpLk5GE1MkQnhFkaPwuk5Y6BVPt7FEDKV6pebE Diff:
Old | New | Differences | |
---|---|---|---|
33 | 33 | else if (if ((exchangeCounter > 0)) | |
34 | 34 | then (routingSize > exchangeCounter) | |
35 | 35 | else false) | |
36 | - | then { | |
37 | - | let exchangerAddress = addressFromStringValue(exchanger) | |
38 | - | let $t018041956 = $Tuple2(assetsIdSend, amountsWithFee) | |
39 | - | let pmtAssetId = $t018041956._1 | |
40 | - | let pmtAmount = $t018041956._2 | |
41 | - | let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
42 | - | if ((inv == inv)) | |
43 | - | then match inv { | |
44 | - | case inv: (Int, ByteVector) => | |
45 | - | let $t021842222 = inv | |
46 | - | let amountWithFee = $t021842222._1 | |
47 | - | let assetIdSend = $t021842222._2 | |
48 | - | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
49 | - | case _ => | |
50 | - | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
51 | - | } | |
52 | - | else throw("Strict value is not equal to itself.") | |
53 | - | } | |
36 | + | then throw(((((toString(exchangeCounter) + " ") + toBase58String(assetsIdSend)) + " ") + toString(amountsWithFee))) | |
54 | 37 | else accumulated | |
55 | 38 | } | |
56 | 39 | ||
57 | - | let $ | |
58 | - | let $ | |
59 | - | let $ | |
60 | - | let $ | |
61 | - | if (($ | |
62 | - | then $ | |
40 | + | let $t026012702 = { | |
41 | + | let $list26532702 = exchangers | |
42 | + | let $size26532702 = size($list26532702) | |
43 | + | let $acc026532702 = $Tuple3(0, 0, base58'') | |
44 | + | if (($size26532702 == 0)) | |
45 | + | then $acc026532702 | |
63 | 46 | else { | |
64 | - | let $ | |
65 | - | if (($ | |
66 | - | then $ | |
47 | + | let $acc126532702 = exchangeFold($acc026532702, $list26532702[0]) | |
48 | + | if (($size26532702 == 1)) | |
49 | + | then $acc126532702 | |
67 | 50 | else { | |
68 | - | let $ | |
69 | - | if (($ | |
70 | - | then $ | |
51 | + | let $acc226532702 = exchangeFold($acc126532702, $list26532702[1]) | |
52 | + | if (($size26532702 == 2)) | |
53 | + | then $acc226532702 | |
71 | 54 | else { | |
72 | - | let $ | |
73 | - | if (($ | |
74 | - | then $ | |
55 | + | let $acc326532702 = exchangeFold($acc226532702, $list26532702[2]) | |
56 | + | if (($size26532702 == 3)) | |
57 | + | then $acc326532702 | |
75 | 58 | else { | |
76 | - | let $ | |
59 | + | let $acc426532702 = exchangeFold($acc326532702, $list26532702[3]) | |
77 | 60 | throw("List size exceed 3") | |
78 | 61 | } | |
79 | 62 | } | |
80 | 63 | } | |
81 | 64 | } | |
82 | 65 | } | |
83 | - | let exchangeCounter = $ | |
84 | - | let amountsWithFee = $ | |
85 | - | let assetsIdSend = $ | |
66 | + | let exchangeCounter = $t026012702._1 | |
67 | + | let amountsWithFee = $t026012702._2 | |
68 | + | let assetsIdSend = $t026012702._3 | |
86 | 69 | let amountToRecieve = assetBalance(this, receiveAssetId) | |
87 | 70 | if (if ((exchangeCounter == routingSize)) | |
88 | 71 | 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 | 33 | else if (if ((exchangeCounter > 0)) | |
34 | 34 | then (routingSize > exchangeCounter) | |
35 | 35 | else false) | |
36 | - | then { | |
37 | - | let exchangerAddress = addressFromStringValue(exchanger) | |
38 | - | let $t018041956 = $Tuple2(assetsIdSend, amountsWithFee) | |
39 | - | let pmtAssetId = $t018041956._1 | |
40 | - | let pmtAmount = $t018041956._2 | |
41 | - | let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
42 | - | if ((inv == inv)) | |
43 | - | then match inv { | |
44 | - | case inv: (Int, ByteVector) => | |
45 | - | let $t021842222 = inv | |
46 | - | let amountWithFee = $t021842222._1 | |
47 | - | let assetIdSend = $t021842222._2 | |
48 | - | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
49 | - | case _ => | |
50 | - | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
51 | - | } | |
52 | - | else throw("Strict value is not equal to itself.") | |
53 | - | } | |
36 | + | then throw(((((toString(exchangeCounter) + " ") + toBase58String(assetsIdSend)) + " ") + toString(amountsWithFee))) | |
54 | 37 | else accumulated | |
55 | 38 | } | |
56 | 39 | ||
57 | - | let $ | |
58 | - | let $ | |
59 | - | let $ | |
60 | - | let $ | |
61 | - | if (($ | |
62 | - | then $ | |
40 | + | let $t026012702 = { | |
41 | + | let $list26532702 = exchangers | |
42 | + | let $size26532702 = size($list26532702) | |
43 | + | let $acc026532702 = $Tuple3(0, 0, base58'') | |
44 | + | if (($size26532702 == 0)) | |
45 | + | then $acc026532702 | |
63 | 46 | else { | |
64 | - | let $ | |
65 | - | if (($ | |
66 | - | then $ | |
47 | + | let $acc126532702 = exchangeFold($acc026532702, $list26532702[0]) | |
48 | + | if (($size26532702 == 1)) | |
49 | + | then $acc126532702 | |
67 | 50 | else { | |
68 | - | let $ | |
69 | - | if (($ | |
70 | - | then $ | |
51 | + | let $acc226532702 = exchangeFold($acc126532702, $list26532702[1]) | |
52 | + | if (($size26532702 == 2)) | |
53 | + | then $acc226532702 | |
71 | 54 | else { | |
72 | - | let $ | |
73 | - | if (($ | |
74 | - | then $ | |
55 | + | let $acc326532702 = exchangeFold($acc226532702, $list26532702[2]) | |
56 | + | if (($size26532702 == 3)) | |
57 | + | then $acc326532702 | |
75 | 58 | else { | |
76 | - | let $ | |
59 | + | let $acc426532702 = exchangeFold($acc326532702, $list26532702[3]) | |
77 | 60 | throw("List size exceed 3") | |
78 | 61 | } | |
79 | 62 | } | |
80 | 63 | } | |
81 | 64 | } | |
82 | 65 | } | |
83 | - | let exchangeCounter = $ | |
84 | - | let amountsWithFee = $ | |
85 | - | let assetsIdSend = $ | |
66 | + | let exchangeCounter = $t026012702._1 | |
67 | + | let amountsWithFee = $t026012702._2 | |
68 | + | let assetsIdSend = $t026012702._3 | |
86 | 69 | let amountToRecieve = assetBalance(this, receiveAssetId) | |
87 | 70 | if (if ((exchangeCounter == routingSize)) | |
88 | 71 | then (amountToRecieve >= minAmountToReceive) | |
89 | 72 | else false) | |
90 | 73 | then [ScriptTransfer(i.caller, amountToRecieve, receiveAssetId)] | |
91 | 74 | else throw("routing != routingSize or amountToRecieve < minAmountToReceive") | |
92 | 75 | } | |
93 | 76 | ||
94 | 77 |
github/deemru/w8io/026f985 50.42 ms ◑