tx · 245Zgqi48EM9x3hhYngypJJcLpkb8cYBDKYsnNGjVHmB 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL: -0.01000000 Waves 2021.09.09 23:39 [1696003] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves
{ "type": 13, "id": "245Zgqi48EM9x3hhYngypJJcLpkb8cYBDKYsnNGjVHmB", "fee": 1000000, "feeAssetId": null, "timestamp": 1631220032965, "version": 2, "chainId": 84, "sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL", "senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx", "proofs": [ "4fT8JagLtS5GQRJcDocARjJnF9p6uMZxmTRuLpcS45txPXByYXuLGbFQjS6wr62yY55zbFqi4SQZXXbTimPjAKWm" ], "script": "base64:AAIFAAAAAAAAA+EIAhIICgYYGBEYAgEaFQoCYTESD2NoZWNrUG9zc2liaWx0eRoPCgJhMhIJcG10QW1vdW50GhgKAmEzEhJtaW5BbW91bnRUb1JlY2VpdmUaEAoCYTQSCmV4Y2hhbmdlcnMaFAoCYTUSDmV4Y2hhbmdlcnNUeXBlGhcKAmE2EhFyb3V0aW5nQXNzZXRzS2V5cxoQCgJhNxIKY29tbWlzc2lvbhoeCgJhOBIYY29tbWlzc2lvblNjYWxlRGVsaW1pdGVyGhMKAmE5Eg1kQXBwMVRva2VuUGF5GhMKAmIxEg1kQXBwMVRva2VuR2V0GhMKAmIyEg1kQXBwMlRva2VuUGF5GhMKAmIzEg1kQXBwMlRva2VuR2V0GhMKAmI0Eg1nZXRGcm9tMVRyYWRlGhoKAmI1EhRnZXRGcm9tMVRyYWRlV2l0aEZlZRoTCgJiNhINZ2V0RnJvbTJUcmFkZRoaCgJiNxIUZ2V0RnJvbTJUcmFkZVdpdGhGZWUaBwoCYjgSAWkaCgoCYjkSBGFyZ3MaFAoCYzESDnJlY2VpdmVBc3NldElkGhEKAmMyEgsk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AAAAAAAAAAABBQAAAAJlOAQAAAACZTkJAQAAAAJjNQAAAAIFAAAAAmU4CQABkQAAAAIFAAAAAmU1AAAAAAAAAAABAwkAAAAAAAACBQAAAAJlNgAAAAAAAAAAAgUAAAACZTkEAAAAAmYxCQEAAAACYzUAAAACBQAAAAJlOQkAAZEAAAACBQAAAAJlNQAAAAAAAAAAAgMJAAAAAAAAAgUAAAACZTYAAAAAAAAAAAMFAAAAAmYxBAAAAAJmMgkBAAAAAmM1AAAAAgUAAAACZjEJAAGRAAAAAgUAAAACZTUAAAAAAAAAAAMJAAACAAAAAQIAAAASTGlzdCBzaXplIGV4Y2VlZCAzBAAAAAJjOQgFAAAAAmU0AAAAAl8xBAAAAAJkMQgFAAAAAmU0AAAAAl8yBAAAAAJkMggFAAAAAmU0AAAAAl8zBAAAAAJmMwkAA/AAAAACBQAAAAR0aGlzBQAAAAJjMQMDCQAAAAAAAAIFAAAAAmM5BQAAAAJjNAkAAGcAAAACBQAAAAJmMwUAAAACYTMHCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAJiOAAAAAZjYWxsZXIFAAAAAmYzBQAAAAJjMQUAAAADbmlsCQAAAgAAAAECAAAAPnJvdXRpbmcgIT0gcm91dGluZ1NpemUgb3IgYW1vdW50VG9SZWNpZXZlIDwgbWluQW1vdW50VG9SZWNlaXZlAAAAANZhrTU=", "height": 1696003, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AFgjdJ8KPYJ1GxHUBzDr46QjQDmadxvV29n1ncVtt4eq Next: 9nRz3prEFDzBQh5ucKzU9hKDdxb8cFGJsRjtacjsum3 Diff:
Old | New | Differences | |
---|---|---|---|
13 | 13 | let getFrom2Trade = fraction(dApp2TokenGet, getFrom1TradeWithFee, (getFrom1TradeWithFee + dApp2TokenPay)) | |
14 | 14 | let getFrom2TradeWithFee = fraction(getFrom2Trade, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
15 | 15 | if (true) | |
16 | - | then throw(toString( | |
16 | + | then throw(((((((toString(dApp1TokenPay) + " ") + toString(dApp1TokenGet)) + " ") + toString(dApp2TokenPay)) + " ") + toString(dApp2TokenGet))) | |
17 | 17 | else if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
18 | 18 | then true | |
19 | 19 | else false | |
22 | 22 | ||
23 | 23 | @Callable(i) | |
24 | 24 | func routingTrade (exchangers,exchangersType,args,routingAssetsKeys,receiveAssetId,minAmountToReceive) = { | |
25 | - | let $ | |
26 | - | let pmtAmount = $ | |
27 | - | let pmtAssetId = $ | |
25 | + | let $t021192193 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
26 | + | let pmtAmount = $t021192193._1 | |
27 | + | let pmtAssetId = $t021192193._2 | |
28 | 28 | if (!(checkPossibilty(pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys))) | |
29 | 29 | then throw("Check transaction possibilty: declined") | |
30 | 30 | else { | |
31 | 31 | let routingSize = size(exchangers) | |
32 | 32 | func exchangeFold (accumulated,exchanger) = { | |
33 | - | let $ | |
34 | - | let exchangeCounter = $ | |
35 | - | let amountsWithFee = $ | |
36 | - | let assetsIdSend = $ | |
33 | + | let $t024832546 = accumulated | |
34 | + | let exchangeCounter = $t024832546._1 | |
35 | + | let amountsWithFee = $t024832546._2 | |
36 | + | let assetsIdSend = $t024832546._3 | |
37 | 37 | if ((exchangeCounter == 0)) | |
38 | 38 | then { | |
39 | 39 | let exchangerAddress = addressFromStringValue(exchanger) | |
41 | 41 | if ((inv == inv)) | |
42 | 42 | then match inv { | |
43 | 43 | case inv: (Int, ByteVector) => | |
44 | - | let $ | |
45 | - | let amountWithFee = $ | |
46 | - | let assetIdSend = $ | |
44 | + | let $t028812919 = inv | |
45 | + | let amountWithFee = $t028812919._1 | |
46 | + | let assetIdSend = $t028812919._2 | |
47 | 47 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
48 | 48 | case _ => | |
49 | 49 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
55 | 55 | else false) | |
56 | 56 | then { | |
57 | 57 | let exchangerAddress = addressFromStringValue(exchanger) | |
58 | - | let $ | |
59 | - | let pmtAssetIdRout = $ | |
60 | - | let pmtAmountRout = $ | |
58 | + | let $t032653331 = $Tuple2(assetsIdSend, amountsWithFee) | |
59 | + | let pmtAssetIdRout = $t032653331._1 | |
60 | + | let pmtAmountRout = $t032653331._2 | |
61 | 61 | let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
62 | 62 | if ((inv == inv)) | |
63 | 63 | then match inv { | |
64 | 64 | case inv: (Int, ByteVector) => | |
65 | - | let $ | |
66 | - | let amountWithFee = $ | |
67 | - | let assetIdSend = $ | |
65 | + | let $t035803618 = inv | |
66 | + | let amountWithFee = $t035803618._1 | |
67 | + | let assetIdSend = $t035803618._2 | |
68 | 68 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
69 | 69 | case _ => | |
70 | 70 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
74 | 74 | else accumulated | |
75 | 75 | } | |
76 | 76 | ||
77 | - | let $ | |
78 | - | let $ | |
79 | - | let $ | |
80 | - | let $ | |
81 | - | if (($ | |
82 | - | then $ | |
77 | + | let $t038563957 = { | |
78 | + | let $list39083957 = exchangers | |
79 | + | let $size39083957 = size($list39083957) | |
80 | + | let $acc039083957 = $Tuple3(0, 0, base58'') | |
81 | + | if (($size39083957 == 0)) | |
82 | + | then $acc039083957 | |
83 | 83 | else { | |
84 | - | let $ | |
85 | - | if (($ | |
86 | - | then $ | |
84 | + | let $acc139083957 = exchangeFold($acc039083957, $list39083957[0]) | |
85 | + | if (($size39083957 == 1)) | |
86 | + | then $acc139083957 | |
87 | 87 | else { | |
88 | - | let $ | |
89 | - | if (($ | |
90 | - | then $ | |
88 | + | let $acc239083957 = exchangeFold($acc139083957, $list39083957[1]) | |
89 | + | if (($size39083957 == 2)) | |
90 | + | then $acc239083957 | |
91 | 91 | else { | |
92 | - | let $ | |
93 | - | if (($ | |
94 | - | then $ | |
92 | + | let $acc339083957 = exchangeFold($acc239083957, $list39083957[2]) | |
93 | + | if (($size39083957 == 3)) | |
94 | + | then $acc339083957 | |
95 | 95 | else { | |
96 | - | let $ | |
96 | + | let $acc439083957 = exchangeFold($acc339083957, $list39083957[3]) | |
97 | 97 | throw("List size exceed 3") | |
98 | 98 | } | |
99 | 99 | } | |
100 | 100 | } | |
101 | 101 | } | |
102 | 102 | } | |
103 | - | let exchangeCounter = $ | |
104 | - | let amountsWithFee = $ | |
105 | - | let assetsIdSend = $ | |
103 | + | let exchangeCounter = $t038563957._1 | |
104 | + | let amountsWithFee = $t038563957._2 | |
105 | + | let assetsIdSend = $t038563957._3 | |
106 | 106 | let amountToRecieve = assetBalance(this, receiveAssetId) | |
107 | 107 | if (if ((exchangeCounter == routingSize)) | |
108 | 108 | then (amountToRecieve >= minAmountToReceive) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func checkPossibilty (pmtAmount,minAmountToReceive,exchangers,exchangersType,routingAssetsKeys) = { | |
5 | 5 | let commission = 3000 | |
6 | 6 | let commissionScaleDelimiter = 1000000 | |
7 | 7 | let dApp1TokenPay = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[0]) | |
8 | 8 | let dApp1TokenGet = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[1]) | |
9 | 9 | let dApp2TokenPay = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[2]) | |
10 | 10 | let dApp2TokenGet = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[3]) | |
11 | 11 | let getFrom1Trade = fraction(dApp1TokenGet, pmtAmount, (pmtAmount + dApp1TokenPay)) | |
12 | 12 | let getFrom1TradeWithFee = fraction(getFrom1Trade, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
13 | 13 | let getFrom2Trade = fraction(dApp2TokenGet, getFrom1TradeWithFee, (getFrom1TradeWithFee + dApp2TokenPay)) | |
14 | 14 | let getFrom2TradeWithFee = fraction(getFrom2Trade, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
15 | 15 | if (true) | |
16 | - | then throw(toString( | |
16 | + | then throw(((((((toString(dApp1TokenPay) + " ") + toString(dApp1TokenGet)) + " ") + toString(dApp2TokenPay)) + " ") + toString(dApp2TokenGet))) | |
17 | 17 | else if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
18 | 18 | then true | |
19 | 19 | else false | |
20 | 20 | } | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | @Callable(i) | |
24 | 24 | func routingTrade (exchangers,exchangersType,args,routingAssetsKeys,receiveAssetId,minAmountToReceive) = { | |
25 | - | let $ | |
26 | - | let pmtAmount = $ | |
27 | - | let pmtAssetId = $ | |
25 | + | let $t021192193 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
26 | + | let pmtAmount = $t021192193._1 | |
27 | + | let pmtAssetId = $t021192193._2 | |
28 | 28 | if (!(checkPossibilty(pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys))) | |
29 | 29 | then throw("Check transaction possibilty: declined") | |
30 | 30 | else { | |
31 | 31 | let routingSize = size(exchangers) | |
32 | 32 | func exchangeFold (accumulated,exchanger) = { | |
33 | - | let $ | |
34 | - | let exchangeCounter = $ | |
35 | - | let amountsWithFee = $ | |
36 | - | let assetsIdSend = $ | |
33 | + | let $t024832546 = accumulated | |
34 | + | let exchangeCounter = $t024832546._1 | |
35 | + | let amountsWithFee = $t024832546._2 | |
36 | + | let assetsIdSend = $t024832546._3 | |
37 | 37 | if ((exchangeCounter == 0)) | |
38 | 38 | then { | |
39 | 39 | let exchangerAddress = addressFromStringValue(exchanger) | |
40 | 40 | let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
41 | 41 | if ((inv == inv)) | |
42 | 42 | then match inv { | |
43 | 43 | case inv: (Int, ByteVector) => | |
44 | - | let $ | |
45 | - | let amountWithFee = $ | |
46 | - | let assetIdSend = $ | |
44 | + | let $t028812919 = inv | |
45 | + | let amountWithFee = $t028812919._1 | |
46 | + | let assetIdSend = $t028812919._2 | |
47 | 47 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
48 | 48 | case _ => | |
49 | 49 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
50 | 50 | } | |
51 | 51 | else throw("Strict value is not equal to itself.") | |
52 | 52 | } | |
53 | 53 | else if (if ((exchangeCounter > 0)) | |
54 | 54 | then (routingSize > exchangeCounter) | |
55 | 55 | else false) | |
56 | 56 | then { | |
57 | 57 | let exchangerAddress = addressFromStringValue(exchanger) | |
58 | - | let $ | |
59 | - | let pmtAssetIdRout = $ | |
60 | - | let pmtAmountRout = $ | |
58 | + | let $t032653331 = $Tuple2(assetsIdSend, amountsWithFee) | |
59 | + | let pmtAssetIdRout = $t032653331._1 | |
60 | + | let pmtAmountRout = $t032653331._2 | |
61 | 61 | let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
62 | 62 | if ((inv == inv)) | |
63 | 63 | then match inv { | |
64 | 64 | case inv: (Int, ByteVector) => | |
65 | - | let $ | |
66 | - | let amountWithFee = $ | |
67 | - | let assetIdSend = $ | |
65 | + | let $t035803618 = inv | |
66 | + | let amountWithFee = $t035803618._1 | |
67 | + | let assetIdSend = $t035803618._2 | |
68 | 68 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
69 | 69 | case _ => | |
70 | 70 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
71 | 71 | } | |
72 | 72 | else throw("Strict value is not equal to itself.") | |
73 | 73 | } | |
74 | 74 | else accumulated | |
75 | 75 | } | |
76 | 76 | ||
77 | - | let $ | |
78 | - | let $ | |
79 | - | let $ | |
80 | - | let $ | |
81 | - | if (($ | |
82 | - | then $ | |
77 | + | let $t038563957 = { | |
78 | + | let $list39083957 = exchangers | |
79 | + | let $size39083957 = size($list39083957) | |
80 | + | let $acc039083957 = $Tuple3(0, 0, base58'') | |
81 | + | if (($size39083957 == 0)) | |
82 | + | then $acc039083957 | |
83 | 83 | else { | |
84 | - | let $ | |
85 | - | if (($ | |
86 | - | then $ | |
84 | + | let $acc139083957 = exchangeFold($acc039083957, $list39083957[0]) | |
85 | + | if (($size39083957 == 1)) | |
86 | + | then $acc139083957 | |
87 | 87 | else { | |
88 | - | let $ | |
89 | - | if (($ | |
90 | - | then $ | |
88 | + | let $acc239083957 = exchangeFold($acc139083957, $list39083957[1]) | |
89 | + | if (($size39083957 == 2)) | |
90 | + | then $acc239083957 | |
91 | 91 | else { | |
92 | - | let $ | |
93 | - | if (($ | |
94 | - | then $ | |
92 | + | let $acc339083957 = exchangeFold($acc239083957, $list39083957[2]) | |
93 | + | if (($size39083957 == 3)) | |
94 | + | then $acc339083957 | |
95 | 95 | else { | |
96 | - | let $ | |
96 | + | let $acc439083957 = exchangeFold($acc339083957, $list39083957[3]) | |
97 | 97 | throw("List size exceed 3") | |
98 | 98 | } | |
99 | 99 | } | |
100 | 100 | } | |
101 | 101 | } | |
102 | 102 | } | |
103 | - | let exchangeCounter = $ | |
104 | - | let amountsWithFee = $ | |
105 | - | let assetsIdSend = $ | |
103 | + | let exchangeCounter = $t038563957._1 | |
104 | + | let amountsWithFee = $t038563957._2 | |
105 | + | let assetsIdSend = $t038563957._3 | |
106 | 106 | let amountToRecieve = assetBalance(this, receiveAssetId) | |
107 | 107 | if (if ((exchangeCounter == routingSize)) | |
108 | 108 | then (amountToRecieve >= minAmountToReceive) | |
109 | 109 | else false) | |
110 | 110 | then [ScriptTransfer(i.caller, amountToRecieve, receiveAssetId)] | |
111 | 111 | else throw("routing != routingSize or amountToRecieve < minAmountToReceive") | |
112 | 112 | } | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 |
github/deemru/w8io/026f985 60.18 ms ◑