tx · 5P6aTYNSWLn5uR8Kfe2bFgf3t8qgtJMmgaixhRfNCX7w 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL: -0.01000000 Waves 2021.09.12 19:29 [1700076] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves
{ "type": 13, "id": "5P6aTYNSWLn5uR8Kfe2bFgf3t8qgtJMmgaixhRfNCX7w", "fee": 1000000, "feeAssetId": null, "timestamp": 1631464233900, "version": 2, "chainId": 84, "sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL", "senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx", "proofs": [ "39tXbPkKdvD3LiZ9zgdEQ1ZTdUyaxqLkmQ9TvYQxoR7JDGBKrYdModTJKeGJzasbFBBoo6ZXy4mZNBFJ8aaAH6Qm" ], "script": "base64:AAIFAAAAAAAAAA0IAhIJCgcYGBERGAIBAAAACQAAAAAHZGlnaXRzOAAAAAAAAAAACAAAAAAGc2NhbGU4AAAAAAAF9eEAAAAAAAdzY2FsZTEyAAAAAOjUpRAAAAAAAAVhbHBoYQAAAAAAAAAAMgAAAAALYWxwaGFEaWdpdHMAAAAAAAAAAAIAAAAABGJldGEAAAAAAAK954ABAAAACHNrZXduZXNzAAAAAgAAAAF4AAAAAXkJAABpAAAAAgkAAGkAAAACCQAAZAAAAAIJAABrAAAAAwUAAAAHc2NhbGUxMgUAAAABeAUAAAABeQkAAGsAAAADBQAAAAdzY2FsZTEyBQAAAAF5BQAAAAF4AAAAAAAAAAACAAAAAAAAACcQAQAAAA1pbnZhcmlhbnRDYWxjAAAAAgAAAAF4AAAAAXkEAAAAAnNrCQEAAAAIc2tld25lc3MAAAACBQAAAAF4BQAAAAF5CQAAZAAAAAIJAABrAAAAAwkAAGQAAAACBQAAAAF4BQAAAAF5BQAAAAZzY2FsZTgJAABsAAAABgUAAAACc2sFAAAAB2RpZ2l0czgFAAAABWFsc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RUb1JlY2lldmUJAAPwAAAAAgUAAAAEdGhpcwUAAAAOcmVjZWl2ZUFzc2V0SWQDAwkAAAAAAAACBQAAAA9leGNoYW5nZUNvdW50ZXIFAAAAC3JvdXRpbmdTaXplCQAAZwAAAAIFAAAAD2Ftb3VudFRvUmVjaWV2ZQUAAAASbWluQW1vdW50VG9SZWNlaXZlBwkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAD2Ftb3VudFRvUmVjaWV2ZQUAAAAOcmVjZWl2ZUFzc2V0SWQFAAAAA25pbAkAAAIAAAABAgAAAD5yb3V0aW5nICE9IHJvdXRpbmdTaXplIG9yIGFtb3VudFRvUmVjaWV2ZSA8IG1pbkFtb3VudFRvUmVjZWl2ZQAAAADwc2eq", "height": 1700076, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EoLSyHsy6moCym4RV4mYKg7iTAZCuhgXRVzQYzRvsJBZ Next: 71YJEweK67rjxvvDYer71kh5dJn9obugja5EL5Y9MFZK Diff:
Old | New | Differences | |
---|---|---|---|
53 | 53 | args2[1] | |
54 | 54 | } | |
55 | 55 | else throw("Incorrect exchange type") | |
56 | - | if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
57 | - | then true | |
58 | - | else false | |
56 | + | if (true) | |
57 | + | then throw(toString(getFrom2TradeWithFee)) | |
58 | + | else if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
59 | + | then true | |
60 | + | else false | |
59 | 61 | } | |
60 | 62 | ||
61 | 63 | ||
62 | 64 | @Callable(i) | |
63 | 65 | func routingTrade (exchangers,exchangersType,args1,args2,routingAssetsKeys,receiveAssetId,minAmountToReceive) = { | |
64 | - | let $ | |
65 | - | let pmtAmount = $ | |
66 | - | let pmtAssetId = $ | |
66 | + | let $t035133587 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
67 | + | let pmtAmount = $t035133587._1 | |
68 | + | let pmtAssetId = $t035133587._2 | |
67 | 69 | if (!(checkPossibilty(pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys, args1, args2))) | |
68 | 70 | then throw("Check transaction possibilty: declined") | |
69 | 71 | else { | |
70 | 72 | let routingSize = size(exchangers) | |
71 | 73 | func exchangeFold (accumulated,exchanger) = { | |
72 | - | let $ | |
73 | - | let exchangeCounter = $ | |
74 | - | let amountsWithFee = $ | |
75 | - | let assetsIdSend = $ | |
74 | + | let $t038863949 = accumulated | |
75 | + | let exchangeCounter = $t038863949._1 | |
76 | + | let amountsWithFee = $t038863949._2 | |
77 | + | let assetsIdSend = $t038863949._3 | |
76 | 78 | if ((exchangeCounter == 0)) | |
77 | 79 | then { | |
78 | 80 | let exchangerAddress = addressFromStringValue(exchanger) | |
84 | 86 | if ((inv == inv)) | |
85 | 87 | then match inv { | |
86 | 88 | case inv: (Int, ByteVector) => | |
87 | - | let $ | |
88 | - | let amountWithFee = $ | |
89 | - | let assetIdSend = $ | |
89 | + | let $t046454683 = inv | |
90 | + | let amountWithFee = $t046454683._1 | |
91 | + | let assetIdSend = $t046454683._2 | |
90 | 92 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
91 | 93 | case _ => | |
92 | 94 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
98 | 100 | else false) | |
99 | 101 | then { | |
100 | 102 | let exchangerAddress = addressFromStringValue(exchanger) | |
101 | - | let $ | |
102 | - | let pmtAssetIdRout = $ | |
103 | - | let pmtAmountRout = $ | |
103 | + | let $t050295095 = $Tuple2(assetsIdSend, amountsWithFee) | |
104 | + | let pmtAssetIdRout = $t050295095._1 | |
105 | + | let pmtAmountRout = $t050295095._2 | |
104 | 106 | let inv = if ((exchangersType[exchangeCounter] == "cpmm")) | |
105 | 107 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
106 | 108 | else if ((exchangersType[exchangeCounter] == "flat")) | |
109 | 111 | if ((inv == inv)) | |
110 | 112 | then match inv { | |
111 | 113 | case inv: (Int, ByteVector) => | |
112 | - | let $ | |
113 | - | let amountWithFee = $ | |
114 | - | let assetIdSend = $ | |
114 | + | let $t057005738 = inv | |
115 | + | let amountWithFee = $t057005738._1 | |
116 | + | let assetIdSend = $t057005738._2 | |
115 | 117 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
116 | 118 | case _ => | |
117 | 119 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
121 | 123 | else accumulated | |
122 | 124 | } | |
123 | 125 | ||
124 | - | let $ | |
125 | - | let $ | |
126 | - | let $ | |
127 | - | let $ | |
128 | - | if (($ | |
129 | - | then $ | |
126 | + | let $t059766077 = { | |
127 | + | let $list60286077 = exchangers | |
128 | + | let $size60286077 = size($list60286077) | |
129 | + | let $acc060286077 = $Tuple3(0, 0, base58'') | |
130 | + | if (($size60286077 == 0)) | |
131 | + | then $acc060286077 | |
130 | 132 | else { | |
131 | - | let $ | |
132 | - | if (($ | |
133 | - | then $ | |
133 | + | let $acc160286077 = exchangeFold($acc060286077, $list60286077[0]) | |
134 | + | if (($size60286077 == 1)) | |
135 | + | then $acc160286077 | |
134 | 136 | else { | |
135 | - | let $ | |
136 | - | if (($ | |
137 | - | then $ | |
137 | + | let $acc260286077 = exchangeFold($acc160286077, $list60286077[1]) | |
138 | + | if (($size60286077 == 2)) | |
139 | + | then $acc260286077 | |
138 | 140 | else { | |
139 | - | let $ | |
140 | - | if (($ | |
141 | - | then $ | |
141 | + | let $acc360286077 = exchangeFold($acc260286077, $list60286077[2]) | |
142 | + | if (($size60286077 == 3)) | |
143 | + | then $acc360286077 | |
142 | 144 | else { | |
143 | - | let $ | |
145 | + | let $acc460286077 = exchangeFold($acc360286077, $list60286077[3]) | |
144 | 146 | throw("List size exceed 3") | |
145 | 147 | } | |
146 | 148 | } | |
147 | 149 | } | |
148 | 150 | } | |
149 | 151 | } | |
150 | - | let exchangeCounter = $ | |
151 | - | let amountsWithFee = $ | |
152 | - | let assetsIdSend = $ | |
152 | + | let exchangeCounter = $t059766077._1 | |
153 | + | let amountsWithFee = $t059766077._2 | |
154 | + | let assetsIdSend = $t059766077._3 | |
153 | 155 | let amountToRecieve = assetBalance(this, receiveAssetId) | |
154 | 156 | if (if ((exchangeCounter == routingSize)) | |
155 | 157 | then (amountToRecieve >= minAmountToReceive) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let digits8 = 8 | |
5 | 5 | ||
6 | 6 | let scale8 = 100000000 | |
7 | 7 | ||
8 | 8 | let scale12 = 1000000000000 | |
9 | 9 | ||
10 | 10 | let alpha = 50 | |
11 | 11 | ||
12 | 12 | let alphaDigits = 2 | |
13 | 13 | ||
14 | 14 | let beta = 46000000 | |
15 | 15 | ||
16 | 16 | func skewness (x,y) = (((fraction(scale12, x, y) + fraction(scale12, y, x)) / 2) / 10000) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func invariantCalc (x,y) = { | |
20 | 20 | let sk = skewness(x, y) | |
21 | 21 | (fraction((x + y), scale8, pow(sk, digits8, alpha, alphaDigits, digits8, CEILING)) + (2 * fraction(pow(fraction(x, y, scale8), 0, 5, 1, (digits8 / 2), DOWN), pow((sk - beta), digits8, alpha, alphaDigits, digits8, DOWN), scale8))) | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func checkPossibilty (pmtAmount,minAmountToReceive,exchangers,exchangersType,routingAssetsKeys,args1,args2) = { | |
26 | 26 | let commission = 3000 | |
27 | 27 | let commissionScaleDelimiter = 1000000 | |
28 | 28 | let dApp1TokenPay = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[0]) | |
29 | 29 | let dApp1TokenGet = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[1]) | |
30 | 30 | let dApp2TokenPay = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[2]) | |
31 | 31 | let dApp2TokenGet = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[3]) | |
32 | 32 | let getFrom1TradeWithFee = if ((exchangersType[0] == "cpmm")) | |
33 | 33 | then { | |
34 | 34 | let getFrom1Trade = fraction(dApp1TokenGet, pmtAmount, (pmtAmount + dApp1TokenPay)) | |
35 | 35 | fraction(getFrom1Trade, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
36 | 36 | } | |
37 | 37 | else if ((exchangersType[0] == "flat")) | |
38 | 38 | then { | |
39 | 39 | let invariant = invariantCalc(dApp1TokenPay, dApp1TokenGet) | |
40 | 40 | let invariantNew = invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - args2[0])) | |
41 | 41 | args2[0] | |
42 | 42 | } | |
43 | 43 | else throw("Incorrect exchange type") | |
44 | 44 | let getFrom2TradeWithFee = if ((exchangersType[1] == "cpmm")) | |
45 | 45 | then { | |
46 | 46 | let getFrom2Trade = fraction(dApp2TokenGet, getFrom1TradeWithFee, (getFrom1TradeWithFee + dApp2TokenPay)) | |
47 | 47 | fraction(getFrom2Trade, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
48 | 48 | } | |
49 | 49 | else if ((exchangersType[1] == "flat")) | |
50 | 50 | then { | |
51 | 51 | let invariant = invariantCalc(dApp2TokenPay, dApp2TokenGet) | |
52 | 52 | let invariantNew = invariantCalc((dApp2TokenPay + getFrom1TradeWithFee), (dApp2TokenGet - args2[1])) | |
53 | 53 | args2[1] | |
54 | 54 | } | |
55 | 55 | else throw("Incorrect exchange type") | |
56 | - | if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
57 | - | then true | |
58 | - | else false | |
56 | + | if (true) | |
57 | + | then throw(toString(getFrom2TradeWithFee)) | |
58 | + | else if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
59 | + | then true | |
60 | + | else false | |
59 | 61 | } | |
60 | 62 | ||
61 | 63 | ||
62 | 64 | @Callable(i) | |
63 | 65 | func routingTrade (exchangers,exchangersType,args1,args2,routingAssetsKeys,receiveAssetId,minAmountToReceive) = { | |
64 | - | let $ | |
65 | - | let pmtAmount = $ | |
66 | - | let pmtAssetId = $ | |
66 | + | let $t035133587 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
67 | + | let pmtAmount = $t035133587._1 | |
68 | + | let pmtAssetId = $t035133587._2 | |
67 | 69 | if (!(checkPossibilty(pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys, args1, args2))) | |
68 | 70 | then throw("Check transaction possibilty: declined") | |
69 | 71 | else { | |
70 | 72 | let routingSize = size(exchangers) | |
71 | 73 | func exchangeFold (accumulated,exchanger) = { | |
72 | - | let $ | |
73 | - | let exchangeCounter = $ | |
74 | - | let amountsWithFee = $ | |
75 | - | let assetsIdSend = $ | |
74 | + | let $t038863949 = accumulated | |
75 | + | let exchangeCounter = $t038863949._1 | |
76 | + | let amountsWithFee = $t038863949._2 | |
77 | + | let assetsIdSend = $t038863949._3 | |
76 | 78 | if ((exchangeCounter == 0)) | |
77 | 79 | then { | |
78 | 80 | let exchangerAddress = addressFromStringValue(exchanger) | |
79 | 81 | let inv = if ((exchangersType[exchangeCounter] == "cpmm")) | |
80 | 82 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
81 | 83 | else if ((exchangersType[exchangeCounter] == "flat")) | |
82 | 84 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
83 | 85 | else throw("Incorrect exchange type") | |
84 | 86 | if ((inv == inv)) | |
85 | 87 | then match inv { | |
86 | 88 | case inv: (Int, ByteVector) => | |
87 | - | let $ | |
88 | - | let amountWithFee = $ | |
89 | - | let assetIdSend = $ | |
89 | + | let $t046454683 = inv | |
90 | + | let amountWithFee = $t046454683._1 | |
91 | + | let assetIdSend = $t046454683._2 | |
90 | 92 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
91 | 93 | case _ => | |
92 | 94 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
93 | 95 | } | |
94 | 96 | else throw("Strict value is not equal to itself.") | |
95 | 97 | } | |
96 | 98 | else if (if ((exchangeCounter > 0)) | |
97 | 99 | then (routingSize > exchangeCounter) | |
98 | 100 | else false) | |
99 | 101 | then { | |
100 | 102 | let exchangerAddress = addressFromStringValue(exchanger) | |
101 | - | let $ | |
102 | - | let pmtAssetIdRout = $ | |
103 | - | let pmtAmountRout = $ | |
103 | + | let $t050295095 = $Tuple2(assetsIdSend, amountsWithFee) | |
104 | + | let pmtAssetIdRout = $t050295095._1 | |
105 | + | let pmtAmountRout = $t050295095._2 | |
104 | 106 | let inv = if ((exchangersType[exchangeCounter] == "cpmm")) | |
105 | 107 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
106 | 108 | else if ((exchangersType[exchangeCounter] == "flat")) | |
107 | 109 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
108 | 110 | else throw("Incorrect exchange type") | |
109 | 111 | if ((inv == inv)) | |
110 | 112 | then match inv { | |
111 | 113 | case inv: (Int, ByteVector) => | |
112 | - | let $ | |
113 | - | let amountWithFee = $ | |
114 | - | let assetIdSend = $ | |
114 | + | let $t057005738 = inv | |
115 | + | let amountWithFee = $t057005738._1 | |
116 | + | let assetIdSend = $t057005738._2 | |
115 | 117 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
116 | 118 | case _ => | |
117 | 119 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
118 | 120 | } | |
119 | 121 | else throw("Strict value is not equal to itself.") | |
120 | 122 | } | |
121 | 123 | else accumulated | |
122 | 124 | } | |
123 | 125 | ||
124 | - | let $ | |
125 | - | let $ | |
126 | - | let $ | |
127 | - | let $ | |
128 | - | if (($ | |
129 | - | then $ | |
126 | + | let $t059766077 = { | |
127 | + | let $list60286077 = exchangers | |
128 | + | let $size60286077 = size($list60286077) | |
129 | + | let $acc060286077 = $Tuple3(0, 0, base58'') | |
130 | + | if (($size60286077 == 0)) | |
131 | + | then $acc060286077 | |
130 | 132 | else { | |
131 | - | let $ | |
132 | - | if (($ | |
133 | - | then $ | |
133 | + | let $acc160286077 = exchangeFold($acc060286077, $list60286077[0]) | |
134 | + | if (($size60286077 == 1)) | |
135 | + | then $acc160286077 | |
134 | 136 | else { | |
135 | - | let $ | |
136 | - | if (($ | |
137 | - | then $ | |
137 | + | let $acc260286077 = exchangeFold($acc160286077, $list60286077[1]) | |
138 | + | if (($size60286077 == 2)) | |
139 | + | then $acc260286077 | |
138 | 140 | else { | |
139 | - | let $ | |
140 | - | if (($ | |
141 | - | then $ | |
141 | + | let $acc360286077 = exchangeFold($acc260286077, $list60286077[2]) | |
142 | + | if (($size60286077 == 3)) | |
143 | + | then $acc360286077 | |
142 | 144 | else { | |
143 | - | let $ | |
145 | + | let $acc460286077 = exchangeFold($acc360286077, $list60286077[3]) | |
144 | 146 | throw("List size exceed 3") | |
145 | 147 | } | |
146 | 148 | } | |
147 | 149 | } | |
148 | 150 | } | |
149 | 151 | } | |
150 | - | let exchangeCounter = $ | |
151 | - | let amountsWithFee = $ | |
152 | - | let assetsIdSend = $ | |
152 | + | let exchangeCounter = $t059766077._1 | |
153 | + | let amountsWithFee = $t059766077._2 | |
154 | + | let assetsIdSend = $t059766077._3 | |
153 | 155 | let amountToRecieve = assetBalance(this, receiveAssetId) | |
154 | 156 | if (if ((exchangeCounter == routingSize)) | |
155 | 157 | then (amountToRecieve >= minAmountToReceive) | |
156 | 158 | else false) | |
157 | 159 | then [ScriptTransfer(i.caller, amountToRecieve, receiveAssetId)] | |
158 | 160 | else throw("routing != routingSize or amountToRecieve < minAmountToReceive") | |
159 | 161 | } | |
160 | 162 | } | |
161 | 163 | ||
162 | 164 |
github/deemru/w8io/026f985 46.04 ms ◑