tx · BLpFyCWpUHFNyuwHprZGidX7x6yHV8xhUR8mVANTeTAF 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL: -0.01000000 Waves 2021.09.12 19:49 [1700098] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves
{ "type": 13, "id": "BLpFyCWpUHFNyuwHprZGidX7x6yHV8xhUR8mVANTeTAF", "fee": 1000000, "feeAssetId": null, "timestamp": 1631465402293, "version": 2, "chainId": 84, "sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL", "senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx", "proofs": [ "3gVNEvyHTiVX9iuL4bgPck8k5jNSw7ZHSq5UbysKNSzD9EmBkoFQnfRYEw4H11C6ft1MSK3o39qaCvZ1833cwDkv" ], "script": "base64:AAIFAAAAAAAAAA0IAhIJCgcYGBERGAIBAAAACQAAAAAHZGlnaXRzOAAAAAAAAAAACAAAAAAGc2NhbGU4AAAAAAAF9eEAAAAAAAdzY2FsZTEyAAAAAOjUpRAAAAAAAAVhbHBoYQAAAAAAAAAAMgAAAAALYWxwaGFEaWdpdHMAAAAAAAAAAAIAAAAABGJldGEAAAAAAAK954ABAAAACHNrZXduZXNzAAAAAgAAAAF4AAAAAXkJAABpAAAAAgkAAGkAAAACCQAAZAAAAAIJAABrAAAAAwUAAAAHc2NhbGUxMgUAAAABeAUAAAABeQkAAGsAAAADBQAAAAdzY2FsZTEyBQAAAAF5BQAAAAF4AAAAAAAAAAACAAAAAAAAACcQAQAAAA1pbnZhcmlhbnRDYWxjAAAAAgAAAAF4AAAAAXkEAAAAAnNrCQEAAAAIc2tld25lc3MAAAACBQAAAAF4BQAAAAF5CQAAZAAAAAIJAABrAAAAAwkAAGQAAAACBQAAAAF4BQAAAAF5BQAAAAZzY2FsZTgJAABsAAAABgUAAAACc2sFAAAAB2RpZ2l0czgFAAAABWFscGhhBQAAAAthbHBo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MgkAAZEAAAACBQAAAA0kbGlzdDYyNjM2MzEyAAAAAAAAAAADCQAAAgAAAAECAAAAEkxpc3Qgc2l6ZSBleGNlZWQgMwQAAAAPZXhjaGFuZ2VDb3VudGVyCAUAAAALJHQwNjIxMTYzMTIAAAACXzEEAAAADmFtb3VudHNXaXRoRmVlCAUAAAALJHQwNjIxMTYzMTIAAAACXzIEAAAADGFzc2V0c0lkU2VuZAgFAAAACyR0MDYyMTE2MzEyAAAAAl8zBAAAAA9hbW91bnRUb1JlY2lldmUJAAPwAAAAAgUAAAAEdGhpcwUAAAAOcmVjZWl2ZUFzc2V0SWQDAwkAAAAAAAACBQAAAA9leGNoYW5nZUNvdW50ZXIFAAAAC3JvdXRpbmdTaXplCQAAZwAAAAIFAAAAD2Ftb3VudFRvUmVjaWV2ZQUAAAASbWluQW1vdW50VG9SZWNlaXZlBwkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAD2Ftb3VudFRvUmVjaWV2ZQUAAAAOcmVjZWl2ZUFzc2V0SWQFAAAAA25pbAkAAAIAAAABAgAAAD5yb3V0aW5nICE9IHJvdXRpbmdTaXplIG9yIGFtb3VudFRvUmVjaWV2ZSA8IG1pbkFtb3VudFRvUmVjZWl2ZQAAAABs8yVG", "height": 1700098, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3vaq6DDtiEi3KmR3cUeBf33CxsEFBV6ZjcdqoiHMd8EM Next: 7X3LFxdPQt1bxd5JsemCmswSPgD2rUyJy6aBmT426SSi Diff:
Old | New | Differences | |
---|---|---|---|
59 | 59 | else throw("Flat contract: invariantNew < invariant") | |
60 | 60 | } | |
61 | 61 | else throw("Incorrect exchange type") | |
62 | - | if (true) | |
63 | - | then throw(((toString(getFrom2TradeWithFee) + " ") + toString(minAmountToReceive))) | |
64 | - | else if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
65 | - | then true | |
66 | - | else false | |
62 | + | if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
63 | + | then true | |
64 | + | else false | |
67 | 65 | } | |
68 | 66 | ||
69 | 67 | ||
70 | 68 | @Callable(i) | |
71 | 69 | func routingTrade (exchangers,exchangersType,args1,args2,routingAssetsKeys,receiveAssetId,minAmountToReceive) = { | |
72 | - | let $ | |
73 | - | let pmtAmount = $ | |
74 | - | let pmtAssetId = $ | |
70 | + | let $t037483822 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
71 | + | let pmtAmount = $t037483822._1 | |
72 | + | let pmtAssetId = $t037483822._2 | |
75 | 73 | if (!(checkPossibilty(pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys, args1, args2))) | |
76 | 74 | then throw("Check transaction possibilty: declined") | |
77 | 75 | else { | |
78 | 76 | let routingSize = size(exchangers) | |
79 | 77 | func exchangeFold (accumulated,exchanger) = { | |
80 | - | let $ | |
81 | - | let exchangeCounter = $ | |
82 | - | let amountsWithFee = $ | |
83 | - | let assetsIdSend = $ | |
78 | + | let $t041214184 = accumulated | |
79 | + | let exchangeCounter = $t041214184._1 | |
80 | + | let amountsWithFee = $t041214184._2 | |
81 | + | let assetsIdSend = $t041214184._3 | |
84 | 82 | if ((exchangeCounter == 0)) | |
85 | 83 | then { | |
86 | 84 | let exchangerAddress = addressFromStringValue(exchanger) | |
92 | 90 | if ((inv == inv)) | |
93 | 91 | then match inv { | |
94 | 92 | case inv: (Int, ByteVector) => | |
95 | - | let $ | |
96 | - | let amountWithFee = $ | |
97 | - | let assetIdSend = $ | |
93 | + | let $t048804918 = inv | |
94 | + | let amountWithFee = $t048804918._1 | |
95 | + | let assetIdSend = $t048804918._2 | |
98 | 96 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
99 | 97 | case _ => | |
100 | 98 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
106 | 104 | else false) | |
107 | 105 | then { | |
108 | 106 | let exchangerAddress = addressFromStringValue(exchanger) | |
109 | - | let $ | |
110 | - | let pmtAssetIdRout = $ | |
111 | - | let pmtAmountRout = $ | |
107 | + | let $t052645330 = $Tuple2(assetsIdSend, amountsWithFee) | |
108 | + | let pmtAssetIdRout = $t052645330._1 | |
109 | + | let pmtAmountRout = $t052645330._2 | |
112 | 110 | let inv = if ((exchangersType[exchangeCounter] == "cpmm")) | |
113 | 111 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
114 | 112 | else if ((exchangersType[exchangeCounter] == "flat")) | |
117 | 115 | if ((inv == inv)) | |
118 | 116 | then match inv { | |
119 | 117 | case inv: (Int, ByteVector) => | |
120 | - | let $ | |
121 | - | let amountWithFee = $ | |
122 | - | let assetIdSend = $ | |
118 | + | let $t059355973 = inv | |
119 | + | let amountWithFee = $t059355973._1 | |
120 | + | let assetIdSend = $t059355973._2 | |
123 | 121 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
124 | 122 | case _ => | |
125 | 123 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
129 | 127 | else accumulated | |
130 | 128 | } | |
131 | 129 | ||
132 | - | let $ | |
133 | - | let $ | |
134 | - | let $ | |
135 | - | let $ | |
136 | - | if (($ | |
137 | - | then $ | |
130 | + | let $t062116312 = { | |
131 | + | let $list62636312 = exchangers | |
132 | + | let $size62636312 = size($list62636312) | |
133 | + | let $acc062636312 = $Tuple3(0, 0, base58'') | |
134 | + | if (($size62636312 == 0)) | |
135 | + | then $acc062636312 | |
138 | 136 | else { | |
139 | - | let $ | |
140 | - | if (($ | |
141 | - | then $ | |
137 | + | let $acc162636312 = exchangeFold($acc062636312, $list62636312[0]) | |
138 | + | if (($size62636312 == 1)) | |
139 | + | then $acc162636312 | |
142 | 140 | else { | |
143 | - | let $ | |
144 | - | if (($ | |
145 | - | then $ | |
141 | + | let $acc262636312 = exchangeFold($acc162636312, $list62636312[1]) | |
142 | + | if (($size62636312 == 2)) | |
143 | + | then $acc262636312 | |
146 | 144 | else { | |
147 | - | let $ | |
148 | - | if (($ | |
149 | - | then $ | |
145 | + | let $acc362636312 = exchangeFold($acc262636312, $list62636312[2]) | |
146 | + | if (($size62636312 == 3)) | |
147 | + | then $acc362636312 | |
150 | 148 | else { | |
151 | - | let $ | |
149 | + | let $acc462636312 = exchangeFold($acc362636312, $list62636312[3]) | |
152 | 150 | throw("List size exceed 3") | |
153 | 151 | } | |
154 | 152 | } | |
155 | 153 | } | |
156 | 154 | } | |
157 | 155 | } | |
158 | - | let exchangeCounter = $ | |
159 | - | let amountsWithFee = $ | |
160 | - | let assetsIdSend = $ | |
156 | + | let exchangeCounter = $t062116312._1 | |
157 | + | let amountsWithFee = $t062116312._2 | |
158 | + | let assetsIdSend = $t062116312._3 | |
161 | 159 | let amountToRecieve = assetBalance(this, receiveAssetId) | |
162 | 160 | if (if ((exchangeCounter == routingSize)) | |
163 | 161 | 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 minAmountToReceive1 = args2[0] | |
41 | 41 | let invariantNew = invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - args2[0])) | |
42 | 42 | if ((invariantNew >= invariant)) | |
43 | 43 | then minAmountToReceive1 | |
44 | 44 | else throw("Flat contract: invariantNew < invariant") | |
45 | 45 | } | |
46 | 46 | else throw("Incorrect exchange type") | |
47 | 47 | let getFrom2TradeWithFee = if ((exchangersType[1] == "cpmm")) | |
48 | 48 | then { | |
49 | 49 | let getFrom2Trade = fraction(dApp2TokenGet, getFrom1TradeWithFee, (getFrom1TradeWithFee + dApp2TokenPay)) | |
50 | 50 | fraction(getFrom2Trade, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
51 | 51 | } | |
52 | 52 | else if ((exchangersType[1] == "flat")) | |
53 | 53 | then { | |
54 | 54 | let invariant = invariantCalc(dApp2TokenPay, dApp2TokenGet) | |
55 | 55 | let minAmountToReceive2 = args2[1] | |
56 | 56 | let invariantNew = invariantCalc((dApp2TokenPay + getFrom1TradeWithFee), (dApp2TokenGet - minAmountToReceive2)) | |
57 | 57 | if ((invariantNew >= invariant)) | |
58 | 58 | then minAmountToReceive2 | |
59 | 59 | else throw("Flat contract: invariantNew < invariant") | |
60 | 60 | } | |
61 | 61 | else throw("Incorrect exchange type") | |
62 | - | if (true) | |
63 | - | then throw(((toString(getFrom2TradeWithFee) + " ") + toString(minAmountToReceive))) | |
64 | - | else if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
65 | - | then true | |
66 | - | else false | |
62 | + | if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
63 | + | then true | |
64 | + | else false | |
67 | 65 | } | |
68 | 66 | ||
69 | 67 | ||
70 | 68 | @Callable(i) | |
71 | 69 | func routingTrade (exchangers,exchangersType,args1,args2,routingAssetsKeys,receiveAssetId,minAmountToReceive) = { | |
72 | - | let $ | |
73 | - | let pmtAmount = $ | |
74 | - | let pmtAssetId = $ | |
70 | + | let $t037483822 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
71 | + | let pmtAmount = $t037483822._1 | |
72 | + | let pmtAssetId = $t037483822._2 | |
75 | 73 | if (!(checkPossibilty(pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys, args1, args2))) | |
76 | 74 | then throw("Check transaction possibilty: declined") | |
77 | 75 | else { | |
78 | 76 | let routingSize = size(exchangers) | |
79 | 77 | func exchangeFold (accumulated,exchanger) = { | |
80 | - | let $ | |
81 | - | let exchangeCounter = $ | |
82 | - | let amountsWithFee = $ | |
83 | - | let assetsIdSend = $ | |
78 | + | let $t041214184 = accumulated | |
79 | + | let exchangeCounter = $t041214184._1 | |
80 | + | let amountsWithFee = $t041214184._2 | |
81 | + | let assetsIdSend = $t041214184._3 | |
84 | 82 | if ((exchangeCounter == 0)) | |
85 | 83 | then { | |
86 | 84 | let exchangerAddress = addressFromStringValue(exchanger) | |
87 | 85 | let inv = if ((exchangersType[exchangeCounter] == "cpmm")) | |
88 | 86 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
89 | 87 | else if ((exchangersType[exchangeCounter] == "flat")) | |
90 | 88 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
91 | 89 | else throw("Incorrect exchange type") | |
92 | 90 | if ((inv == inv)) | |
93 | 91 | then match inv { | |
94 | 92 | case inv: (Int, ByteVector) => | |
95 | - | let $ | |
96 | - | let amountWithFee = $ | |
97 | - | let assetIdSend = $ | |
93 | + | let $t048804918 = inv | |
94 | + | let amountWithFee = $t048804918._1 | |
95 | + | let assetIdSend = $t048804918._2 | |
98 | 96 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
99 | 97 | case _ => | |
100 | 98 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
101 | 99 | } | |
102 | 100 | else throw("Strict value is not equal to itself.") | |
103 | 101 | } | |
104 | 102 | else if (if ((exchangeCounter > 0)) | |
105 | 103 | then (routingSize > exchangeCounter) | |
106 | 104 | else false) | |
107 | 105 | then { | |
108 | 106 | let exchangerAddress = addressFromStringValue(exchanger) | |
109 | - | let $ | |
110 | - | let pmtAssetIdRout = $ | |
111 | - | let pmtAmountRout = $ | |
107 | + | let $t052645330 = $Tuple2(assetsIdSend, amountsWithFee) | |
108 | + | let pmtAssetIdRout = $t052645330._1 | |
109 | + | let pmtAmountRout = $t052645330._2 | |
112 | 110 | let inv = if ((exchangersType[exchangeCounter] == "cpmm")) | |
113 | 111 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
114 | 112 | else if ((exchangersType[exchangeCounter] == "flat")) | |
115 | 113 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
116 | 114 | else throw("Incorrect exchange type") | |
117 | 115 | if ((inv == inv)) | |
118 | 116 | then match inv { | |
119 | 117 | case inv: (Int, ByteVector) => | |
120 | - | let $ | |
121 | - | let amountWithFee = $ | |
122 | - | let assetIdSend = $ | |
118 | + | let $t059355973 = inv | |
119 | + | let amountWithFee = $t059355973._1 | |
120 | + | let assetIdSend = $t059355973._2 | |
123 | 121 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
124 | 122 | case _ => | |
125 | 123 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
126 | 124 | } | |
127 | 125 | else throw("Strict value is not equal to itself.") | |
128 | 126 | } | |
129 | 127 | else accumulated | |
130 | 128 | } | |
131 | 129 | ||
132 | - | let $ | |
133 | - | let $ | |
134 | - | let $ | |
135 | - | let $ | |
136 | - | if (($ | |
137 | - | then $ | |
130 | + | let $t062116312 = { | |
131 | + | let $list62636312 = exchangers | |
132 | + | let $size62636312 = size($list62636312) | |
133 | + | let $acc062636312 = $Tuple3(0, 0, base58'') | |
134 | + | if (($size62636312 == 0)) | |
135 | + | then $acc062636312 | |
138 | 136 | else { | |
139 | - | let $ | |
140 | - | if (($ | |
141 | - | then $ | |
137 | + | let $acc162636312 = exchangeFold($acc062636312, $list62636312[0]) | |
138 | + | if (($size62636312 == 1)) | |
139 | + | then $acc162636312 | |
142 | 140 | else { | |
143 | - | let $ | |
144 | - | if (($ | |
145 | - | then $ | |
141 | + | let $acc262636312 = exchangeFold($acc162636312, $list62636312[1]) | |
142 | + | if (($size62636312 == 2)) | |
143 | + | then $acc262636312 | |
146 | 144 | else { | |
147 | - | let $ | |
148 | - | if (($ | |
149 | - | then $ | |
145 | + | let $acc362636312 = exchangeFold($acc262636312, $list62636312[2]) | |
146 | + | if (($size62636312 == 3)) | |
147 | + | then $acc362636312 | |
150 | 148 | else { | |
151 | - | let $ | |
149 | + | let $acc462636312 = exchangeFold($acc362636312, $list62636312[3]) | |
152 | 150 | throw("List size exceed 3") | |
153 | 151 | } | |
154 | 152 | } | |
155 | 153 | } | |
156 | 154 | } | |
157 | 155 | } | |
158 | - | let exchangeCounter = $ | |
159 | - | let amountsWithFee = $ | |
160 | - | let assetsIdSend = $ | |
156 | + | let exchangeCounter = $t062116312._1 | |
157 | + | let amountsWithFee = $t062116312._2 | |
158 | + | let assetsIdSend = $t062116312._3 | |
161 | 159 | let amountToRecieve = assetBalance(this, receiveAssetId) | |
162 | 160 | if (if ((exchangeCounter == routingSize)) | |
163 | 161 | then (amountToRecieve >= minAmountToReceive) | |
164 | 162 | else false) | |
165 | 163 | then [ScriptTransfer(i.caller, amountToRecieve, receiveAssetId)] | |
166 | 164 | else throw("routing != routingSize or amountToRecieve < minAmountToReceive") | |
167 | 165 | } | |
168 | 166 | } | |
169 | 167 | ||
170 | 168 |
github/deemru/w8io/026f985 53.59 ms ◑