tx · 8DJxVc5323yCZgvFKWrnBybmMb23Cr8fVDR7A2ZBiprq 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL: -0.01000000 Waves 2021.08.15 13:37 [1659360] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves
{ "type": 13, "id": "8DJxVc5323yCZgvFKWrnBybmMb23Cr8fVDR7A2ZBiprq", "fee": 1000000, "feeAssetId": null, "timestamp": 1629023870291, "version": 2, "chainId": 84, "sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL", "senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx", "proofs": [ "4baHqzHNtejDe13PborfrrrfZcbdHwwyx8cWNzXaFsGUhCE3M2WHXNTqVMdP9Li6uX4sBGbNNozTUF1rNTAW7b6w" ], "script": "base64:AAIFAAAAAAAAAf0IAhIHCgUYERICARoHCgJhMRIBaRoQCgJhMhIKZXhjaGFuZ2VycxoKCgJhMxIEYXJncxoRCgJhNBILYXNzZXRzVG9QYXkaFQoCYTUSD2Fzc2V0VG9Vc2VyU2VuZBoYCgJhNhISbWluQW1vdW50VG9SZWNlaXZlGhEKAmE3Egtyb3V0aW5nU2l6ZRoSCgJhOBIMZXhjaGFuZ2VGb2xkGhEKAmE5EgthY2N1bXVsYXRlZBoPCgJiMRIJZXhjaGFuZ2VyGhYKAmIyEhBleGNoYW5nZXJBZGRyZXNzGhAKAmIzEgokdDA5ODQxMDU4Gg8KAmI0EglwbXRBbW91bnQaEAoCYjUSCnBtdEFzc2V0SWQaCQoCYjYSA2ludhoNCgJiNxIHcm91dGluZxoTCgJiOBINJGxpc3QxODA3MTg0MxoTCgJiORINJHNpemUxODA3MTg0MxoTCgJjMRINJGFjYzAxODA3MTg0MxoTCgJjMhINJGFjYzExODA3MTg0MxoTCgJjMxINJGFjYzIxODA3MTg0MxoTCgJjNBINJGFjYzMxODA3MTg0MxoTCgJjNRINJGFjYz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AwkAAAAAAAACBQAAAAJiOQAAAAAAAAAABQUAAAACYzYEAAAAAmM3CQEAAAACYTgAAAACBQAAAAJjNgkAAZEAAAACBQAAAAJiOAAAAAAAAAAABQkAAAIAAAABAgAAABJMaXN0IHNpemUgZXhjZWVkIDUDCQAAAAAAAAIFAAAAAmI3BQAAAAJhNwMGCQAAAgAAAAECAAAAATEEAAAAAmM4CQAD8AAAAAIFAAAABHRoaXMFAAAAAmE1CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAJhMQAAAAZjYWxsZXIFAAAAAmM4BQAAAAJhNQUAAAADbmlsBQAAAANuaWwAAAAAqtvOqQ==", "height": 1659360, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G6N6qMWympRgLtpxzywXhkhHsSCcGWDGjGwAeeh8bxr3 Next: CQfUzppQx18V1ZvAZZGZJFWtFVQh65jpniwwoqhDNgGh Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | @Callable(i) | |
7 | 7 | func routingTrade (exchangers,args,assetsToPay,assetToUserSend,minAmountToReceive) = { | |
8 | 8 | let routingSize = size(exchangers) | |
9 | - | func exchangeFold (accumulated,exchanger) = if ((accumulated == 0)) | |
10 | - | then { | |
11 | - | let exchangerAddress = addressFromStringValue(exchanger) | |
12 | - | let $t09321006 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
13 | - | let pmtAmount = $t09321006._1 | |
14 | - | let pmtAssetId = $t09321006._2 | |
15 | - | if ((assetsToPay[0] != pmtAssetId)) | |
16 | - | then throw("Incorrect payment and assetsToPay array") | |
17 | - | else { | |
18 | - | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
19 | - | if ((inv == inv)) | |
20 | - | then (accumulated + 1) | |
21 | - | else throw("Strict value is not equal to itself.") | |
9 | + | if (true) | |
10 | + | then throw(toString(routingSize)) | |
11 | + | else { | |
12 | + | func exchangeFold (accumulated,exchanger) = if ((accumulated == 0)) | |
13 | + | then { | |
14 | + | let exchangerAddress = addressFromStringValue(exchanger) | |
15 | + | let $t09841058 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
16 | + | let pmtAmount = $t09841058._1 | |
17 | + | let pmtAssetId = $t09841058._2 | |
18 | + | if ((assetsToPay[0] != pmtAssetId)) | |
19 | + | then throw("Incorrect payment and assetsToPay array") | |
20 | + | else { | |
21 | + | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
22 | + | if ((inv == inv)) | |
23 | + | then (accumulated + 1) | |
24 | + | else throw("Strict value is not equal to itself.") | |
25 | + | } | |
22 | 26 | } | |
23 | - | } | |
24 | - | else if (if ((accumulated > 0)) | |
25 | - | then (routingSize > accumulated) | |
26 | - | else false) | |
27 | - | then { | |
28 | - | let exchangerAddress = addressFromStringValue(exchanger) | |
29 | - | let pmtAssetId = assetsToPay[accumulated] | |
30 | - | let pmtAmount = assetBalance(this, pmtAssetId) | |
31 | - | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
32 | - | if ((inv == inv)) | |
33 | - | then (accumulated + 1) | |
34 | - | else throw("Strict value is not equal to itself.") | |
35 | - | } | |
36 | - | else accumulated | |
27 | + | else if (if ((accumulated > 0)) | |
28 | + | then (routingSize > accumulated) | |
29 | + | else false) | |
30 | + | then { | |
31 | + | let exchangerAddress = addressFromStringValue(exchanger) | |
32 | + | let pmtAssetId = assetsToPay[accumulated] | |
33 | + | let pmtAmount = assetBalance(this, pmtAssetId) | |
34 | + | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
35 | + | if ((inv == inv)) | |
36 | + | then (accumulated + 1) | |
37 | + | else throw("Strict value is not equal to itself.") | |
38 | + | } | |
39 | + | else accumulated | |
37 | 40 | ||
38 | - | let routing = { | |
39 | - | let $list17551791 = exchangers | |
40 | - | let $size17551791 = size($list17551791) | |
41 | - | let $acc017551791 = 0 | |
42 | - | if (($size17551791 == 0)) | |
43 | - | then $acc017551791 | |
44 | - | else { | |
45 | - | let $acc117551791 = exchangeFold($acc017551791, $list17551791[0]) | |
46 | - | if (($size17551791 == 1)) | |
47 | - | then $acc117551791 | |
41 | + | let routing = { | |
42 | + | let $list18071843 = exchangers | |
43 | + | let $size18071843 = size($list18071843) | |
44 | + | let $acc018071843 = 0 | |
45 | + | if (($size18071843 == 0)) | |
46 | + | then $acc018071843 | |
48 | 47 | else { | |
49 | - | let $ | |
50 | - | if (($ | |
51 | - | then $ | |
48 | + | let $acc118071843 = exchangeFold($acc018071843, $list18071843[0]) | |
49 | + | if (($size18071843 == 1)) | |
50 | + | then $acc118071843 | |
52 | 51 | else { | |
53 | - | let $ | |
54 | - | if (($ | |
55 | - | then $ | |
52 | + | let $acc218071843 = exchangeFold($acc118071843, $list18071843[1]) | |
53 | + | if (($size18071843 == 2)) | |
54 | + | then $acc218071843 | |
56 | 55 | else { | |
57 | - | let $ | |
58 | - | if (($ | |
59 | - | then $ | |
56 | + | let $acc318071843 = exchangeFold($acc218071843, $list18071843[2]) | |
57 | + | if (($size18071843 == 3)) | |
58 | + | then $acc318071843 | |
60 | 59 | else { | |
61 | - | let $ | |
62 | - | if (($ | |
63 | - | then $ | |
60 | + | let $acc418071843 = exchangeFold($acc318071843, $list18071843[3]) | |
61 | + | if (($size18071843 == 4)) | |
62 | + | then $acc418071843 | |
64 | 63 | else { | |
65 | - | let $acc617551791 = exchangeFold($acc517551791, $list17551791[5]) | |
66 | - | throw("List size exceed 5") | |
64 | + | let $acc518071843 = exchangeFold($acc418071843, $list18071843[4]) | |
65 | + | if (($size18071843 == 5)) | |
66 | + | then $acc518071843 | |
67 | + | else { | |
68 | + | let $acc618071843 = exchangeFold($acc518071843, $list18071843[5]) | |
69 | + | throw("List size exceed 5") | |
70 | + | } | |
67 | 71 | } | |
68 | 72 | } | |
69 | 73 | } | |
70 | 74 | } | |
71 | 75 | } | |
72 | 76 | } | |
73 | - | } | |
74 | - | if ((routing == routingSize)) | |
75 | - | then if (true) | |
76 | - | then throw("1") | |
77 | - | else { | |
78 | - | let ammountToRecieve = assetBalance(this, assetToUserSend) | |
77 | + | if ((routing == routingSize)) | |
78 | + | then if (true) | |
79 | + | then throw("1") | |
80 | + | else { | |
81 | + | let ammountToRecieve = assetBalance(this, assetToUserSend) | |
79 | 82 | [ScriptTransfer(i.caller, ammountToRecieve, assetToUserSend)] | |
80 | - | } | |
81 | - | else nil | |
83 | + | } | |
84 | + | else nil | |
85 | + | } | |
82 | 86 | } | |
83 | 87 | ||
84 | 88 |
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,assetsToPay,assetToUserSend,minAmountToReceive) = { | |
8 | 8 | let routingSize = size(exchangers) | |
9 | - | func exchangeFold (accumulated,exchanger) = if ((accumulated == 0)) | |
10 | - | then { | |
11 | - | let exchangerAddress = addressFromStringValue(exchanger) | |
12 | - | let $t09321006 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
13 | - | let pmtAmount = $t09321006._1 | |
14 | - | let pmtAssetId = $t09321006._2 | |
15 | - | if ((assetsToPay[0] != pmtAssetId)) | |
16 | - | then throw("Incorrect payment and assetsToPay array") | |
17 | - | else { | |
18 | - | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
19 | - | if ((inv == inv)) | |
20 | - | then (accumulated + 1) | |
21 | - | else throw("Strict value is not equal to itself.") | |
9 | + | if (true) | |
10 | + | then throw(toString(routingSize)) | |
11 | + | else { | |
12 | + | func exchangeFold (accumulated,exchanger) = if ((accumulated == 0)) | |
13 | + | then { | |
14 | + | let exchangerAddress = addressFromStringValue(exchanger) | |
15 | + | let $t09841058 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
16 | + | let pmtAmount = $t09841058._1 | |
17 | + | let pmtAssetId = $t09841058._2 | |
18 | + | if ((assetsToPay[0] != pmtAssetId)) | |
19 | + | then throw("Incorrect payment and assetsToPay array") | |
20 | + | else { | |
21 | + | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
22 | + | if ((inv == inv)) | |
23 | + | then (accumulated + 1) | |
24 | + | else throw("Strict value is not equal to itself.") | |
25 | + | } | |
22 | 26 | } | |
23 | - | } | |
24 | - | else if (if ((accumulated > 0)) | |
25 | - | then (routingSize > accumulated) | |
26 | - | else false) | |
27 | - | then { | |
28 | - | let exchangerAddress = addressFromStringValue(exchanger) | |
29 | - | let pmtAssetId = assetsToPay[accumulated] | |
30 | - | let pmtAmount = assetBalance(this, pmtAssetId) | |
31 | - | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
32 | - | if ((inv == inv)) | |
33 | - | then (accumulated + 1) | |
34 | - | else throw("Strict value is not equal to itself.") | |
35 | - | } | |
36 | - | else accumulated | |
27 | + | else if (if ((accumulated > 0)) | |
28 | + | then (routingSize > accumulated) | |
29 | + | else false) | |
30 | + | then { | |
31 | + | let exchangerAddress = addressFromStringValue(exchanger) | |
32 | + | let pmtAssetId = assetsToPay[accumulated] | |
33 | + | let pmtAmount = assetBalance(this, pmtAssetId) | |
34 | + | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
35 | + | if ((inv == inv)) | |
36 | + | then (accumulated + 1) | |
37 | + | else throw("Strict value is not equal to itself.") | |
38 | + | } | |
39 | + | else accumulated | |
37 | 40 | ||
38 | - | let routing = { | |
39 | - | let $list17551791 = exchangers | |
40 | - | let $size17551791 = size($list17551791) | |
41 | - | let $acc017551791 = 0 | |
42 | - | if (($size17551791 == 0)) | |
43 | - | then $acc017551791 | |
44 | - | else { | |
45 | - | let $acc117551791 = exchangeFold($acc017551791, $list17551791[0]) | |
46 | - | if (($size17551791 == 1)) | |
47 | - | then $acc117551791 | |
41 | + | let routing = { | |
42 | + | let $list18071843 = exchangers | |
43 | + | let $size18071843 = size($list18071843) | |
44 | + | let $acc018071843 = 0 | |
45 | + | if (($size18071843 == 0)) | |
46 | + | then $acc018071843 | |
48 | 47 | else { | |
49 | - | let $ | |
50 | - | if (($ | |
51 | - | then $ | |
48 | + | let $acc118071843 = exchangeFold($acc018071843, $list18071843[0]) | |
49 | + | if (($size18071843 == 1)) | |
50 | + | then $acc118071843 | |
52 | 51 | else { | |
53 | - | let $ | |
54 | - | if (($ | |
55 | - | then $ | |
52 | + | let $acc218071843 = exchangeFold($acc118071843, $list18071843[1]) | |
53 | + | if (($size18071843 == 2)) | |
54 | + | then $acc218071843 | |
56 | 55 | else { | |
57 | - | let $ | |
58 | - | if (($ | |
59 | - | then $ | |
56 | + | let $acc318071843 = exchangeFold($acc218071843, $list18071843[2]) | |
57 | + | if (($size18071843 == 3)) | |
58 | + | then $acc318071843 | |
60 | 59 | else { | |
61 | - | let $ | |
62 | - | if (($ | |
63 | - | then $ | |
60 | + | let $acc418071843 = exchangeFold($acc318071843, $list18071843[3]) | |
61 | + | if (($size18071843 == 4)) | |
62 | + | then $acc418071843 | |
64 | 63 | else { | |
65 | - | let $acc617551791 = exchangeFold($acc517551791, $list17551791[5]) | |
66 | - | throw("List size exceed 5") | |
64 | + | let $acc518071843 = exchangeFold($acc418071843, $list18071843[4]) | |
65 | + | if (($size18071843 == 5)) | |
66 | + | then $acc518071843 | |
67 | + | else { | |
68 | + | let $acc618071843 = exchangeFold($acc518071843, $list18071843[5]) | |
69 | + | throw("List size exceed 5") | |
70 | + | } | |
67 | 71 | } | |
68 | 72 | } | |
69 | 73 | } | |
70 | 74 | } | |
71 | 75 | } | |
72 | 76 | } | |
73 | - | } | |
74 | - | if ((routing == routingSize)) | |
75 | - | then if (true) | |
76 | - | then throw("1") | |
77 | - | else { | |
78 | - | let ammountToRecieve = assetBalance(this, assetToUserSend) | |
77 | + | if ((routing == routingSize)) | |
78 | + | then if (true) | |
79 | + | then throw("1") | |
80 | + | else { | |
81 | + | let ammountToRecieve = assetBalance(this, assetToUserSend) | |
79 | 82 | [ScriptTransfer(i.caller, ammountToRecieve, assetToUserSend)] | |
80 | - | } | |
81 | - | else nil | |
83 | + | } | |
84 | + | else nil | |
85 | + | } | |
82 | 86 | } | |
83 | 87 | ||
84 | 88 |
github/deemru/w8io/026f985 42.41 ms ◑