tx · 6q2hmAeZiscKrQkZybYsLj78M5wmEsbJPao2Qnv4qcmT 3MqDf9VgoL9eqrCPx8F74Au6xBpvdTm9UP8: -0.01700000 Waves 2022.09.05 14:21 [2215751] smart account 3MqDf9VgoL9eqrCPx8F74Au6xBpvdTm9UP8 > SELF 0.00000000 Waves
{ "type": 13, "id": "6q2hmAeZiscKrQkZybYsLj78M5wmEsbJPao2Qnv4qcmT", "fee": 1700000, "feeAssetId": null, "timestamp": 1662376811051, "version": 2, "chainId": 84, "sender": "3MqDf9VgoL9eqrCPx8F74Au6xBpvdTm9UP8", "senderPublicKey": "4ja2PX5eqM576zv9KGzu5Qe7M92Z3jbuSmkLPdGjK4ue", "proofs": [ "wVQPxu5q2ndUEa3KcY1Cy3DgnSzrwzXczQM8ieG17KD3kiNUcSfPtkAvMYHswFpwArE9WC2mxLSL9UY53TqVeKZ", "3GnkWBx652MqX5LWrbMMjK92tbMDeTvUmMVwq9kMufMffb3GBEiJWd8UVNuC4krn4m478sbnFbey8q3iPEJLkmEY" ], "script": "base64:AAIFAAAAAAAAABAIAhIICgYYGBERGAESABIAAAAAJgAAAAAHa0FjdGl2ZQIAAAAGYWN0aXZlAAAAAAZrQ2F1c2UCAAAADnNodXRkb3duX2NhdXNlAAAAAA1rUG9vbEluT3JhY2xlAgAAAAVwb29sXwAAAAAOa1VzZXJTd29wSW5Hb3YCAAAADF9TV09QX2Ftb3VudAAAAAAKa0Rpc2NvdW50cwIAAAAJZGlzY291bnRzAAAAAA9rRGlzY291bnRWYWx1ZXMCAAAAD2Rpc2NvdW50X3ZhbHVlcwAAAAALa1JvdXRpbmdGZWUCAAAAC3JvdXRpbmdfZmVlAAAAAA1rQWRtaW5QdWJLZXkxAgAAAAthZG1pbl9wdWJfMQAAAAANa0FkbWluUHViS2V5MgIAAAALYWRtaW5fcHViXzIAAAAADWtBZG1pblB1YktleTMCAAAAC2FkbWluX3B1Yl8zAAAAABBrTW9uZXlCb3hBZGRyZXNzAgAAABFtb25leV9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m9vZnMAAAAAAAAAAAAFAAAADGFkbWluUHViS2V5MQAAAAAAAAAAAQAAAAAAAAAAAAQAAAASYWRtaW5QdWJLZXkyU2lnbmVkAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEFAAAADGFkbWluUHViS2V5MgAAAAAAAAAAAQAAAAAAAAAAAAQAAAASYWRtaW5QdWJLZXkzU2lnbmVkAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAIFAAAADGFkbWluUHViS2V5MwAAAAAAAAAAAQAAAAAAAAAAAAkAAGcAAAACCQAAZAAAAAIJAABkAAAAAgUAAAASYWRtaW5QdWJLZXkxU2lnbmVkBQAAABJhZG1pblB1YktleTJTaWduZWQFAAAAEmFkbWluUHViS2V5M1NpZ25lZAAAAAAAAAAAAgQAAAAHJG1hdGNoMAUAAAACdHgFAAAAE211bHRpU2lnbmVkQnlBZG1pbnP2Xq3d", "height": 2215751, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Biym8zuzwoGkgTG3NSyvWBURez2MKi48SYZM57ztUDi1 Next: C27KGitfbjQt7hWPUyqAJ7ymjNheTW14v74uGfgA9fdG Diff:
Old | New | Differences | |
---|---|---|---|
123 | 123 | let getFrom1TradeWithFee = if ((exchangersType[0] == "curveMultyFlat")) | |
124 | 124 | then { | |
125 | 125 | let inv = { | |
126 | - | let @ = invoke(addressFromStringValue(exchangers[0]), "getDy", [routingAssetsKeys[0], routingAssetsKeys[1], pmtAmount], nil) | |
126 | + | let @ = invoke(addressFromStringValue(exchangers[0]), "getDy", [routingAssetsKeys[0], routingAssetsKeys[1], pmtAmount, caller], nil) | |
127 | 127 | if ($isInstanceOf(@, "Int")) | |
128 | 128 | then @ | |
129 | 129 | else throw("Couldn't cast Any to Int") | |
160 | 160 | let getFrom2TradeWithFee = if ((exchangersType[0] == "curveMultyFlat")) | |
161 | 161 | then { | |
162 | 162 | let inv = { | |
163 | - | let @ = invoke(addressFromStringValue(exchangers[0]), "getDy", [routingAssetsKeys[2], routingAssetsKeys[3], getFrom1TradeWithFee], nil) | |
163 | + | let @ = invoke(addressFromStringValue(exchangers[0]), "getDy", [routingAssetsKeys[2], routingAssetsKeys[3], getFrom1TradeWithFee, caller], nil) | |
164 | 164 | if ($isInstanceOf(@, "Int")) | |
165 | 165 | then @ | |
166 | 166 | else throw("Couldn't cast Any to Int") | |
195 | 195 | ||
196 | 196 | @Callable(i) | |
197 | 197 | func routingTrade (exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive) = valueOrElse(isActive(), { | |
198 | - | let $ | |
199 | - | let pmtAmount = $ | |
200 | - | let pmtAssetId = $ | |
198 | + | let $t074137487 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
199 | + | let pmtAmount = $t074137487._1 | |
200 | + | let pmtAssetId = $t074137487._2 | |
201 | 201 | if (!(checkPossibility(i.caller, pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys, args1, args2))) | |
202 | 202 | then throw("Check transaction possibilty: declined") | |
203 | 203 | else if (if (!(isDefined(getString(oracle, (kPoolInOracle + exchangers[0]))))) | |
207 | 207 | else { | |
208 | 208 | let routingSize = size(exchangers) | |
209 | 209 | func exchangeFold (accumulated,exchanger) = { | |
210 | - | let $ | |
211 | - | let exchangeCounter = $ | |
212 | - | let amountsWithFee = $ | |
213 | - | let assetsIdSend = $ | |
214 | - | let $ | |
210 | + | let $t080018066 = accumulated | |
211 | + | let exchangeCounter = $t080018066._1 | |
212 | + | let amountsWithFee = $t080018066._2 | |
213 | + | let assetsIdSend = $t080018066._3 | |
214 | + | let $t080798277 = if ((exchangeCounter == 0)) | |
215 | 215 | then $Tuple2(pmtAssetId, pmtAmount) | |
216 | 216 | else $Tuple2(assetsIdSend, amountsWithFee) | |
217 | - | let pmtAssetIdRout = $ | |
218 | - | let pmtAmountRout = $ | |
217 | + | let pmtAssetIdRout = $t080798277._1 | |
218 | + | let pmtAmountRout = $t080798277._2 | |
219 | 219 | if (((if ((exchangeCounter >= 0)) | |
220 | 220 | then (routingSize > exchangeCounter) | |
221 | 221 | else false) == true)) | |
239 | 239 | if ((inv == inv)) | |
240 | 240 | then match inv { | |
241 | 241 | case inv: (Int, Unit)|(Int, ByteVector) => | |
242 | - | let $ | |
243 | - | let amountWithFee = $ | |
244 | - | let assetIdSend = $ | |
242 | + | let $t091429180 = inv | |
243 | + | let amountWithFee = $t091429180._1 | |
244 | + | let assetIdSend = $t091429180._2 | |
245 | 245 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
246 | 246 | case _ => | |
247 | 247 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
265 | 265 | else accumulated | |
266 | 266 | } | |
267 | 267 | ||
268 | - | let $ | |
268 | + | let $t098769982 = { | |
269 | 269 | let $l = exchangers | |
270 | 270 | let $s = size($l) | |
271 | 271 | let $acc0 = $Tuple3(0, 0, base58'') | |
279 | 279 | ||
280 | 280 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
281 | 281 | } | |
282 | - | let exchangeCounter = $ | |
283 | - | let amountWithoutFee = $ | |
284 | - | let assetIdSend = $ | |
282 | + | let exchangeCounter = $t098769982._1 | |
283 | + | let amountWithoutFee = $t098769982._2 | |
284 | + | let assetIdSend = $t098769982._3 | |
285 | 285 | let amountWithFee = fraction(amountWithoutFee, (feeScale6 - routingFee), feeScale6) | |
286 | 286 | if (if ((exchangeCounter == routingSize)) | |
287 | 287 | then (amountWithFee >= minAmountToReceive) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kActive = "active" | |
5 | 5 | ||
6 | 6 | let kCause = "shutdown_cause" | |
7 | 7 | ||
8 | 8 | let kPoolInOracle = "pool_" | |
9 | 9 | ||
10 | 10 | let kUserSwopInGov = "_SWOP_amount" | |
11 | 11 | ||
12 | 12 | let kDiscounts = "discounts" | |
13 | 13 | ||
14 | 14 | let kDiscountValues = "discount_values" | |
15 | 15 | ||
16 | 16 | let kRoutingFee = "routing_fee" | |
17 | 17 | ||
18 | 18 | let kAdminPubKey1 = "admin_pub_1" | |
19 | 19 | ||
20 | 20 | let kAdminPubKey2 = "admin_pub_2" | |
21 | 21 | ||
22 | 22 | let kAdminPubKey3 = "admin_pub_3" | |
23 | 23 | ||
24 | 24 | let kMoneyBoxAddress = "money_box_address" | |
25 | 25 | ||
26 | 26 | let kGovAddress = "governance_address" | |
27 | 27 | ||
28 | 28 | let kFee = "commission" | |
29 | 29 | ||
30 | 30 | let kMultyAssetBalance = "_balance" | |
31 | 31 | ||
32 | 32 | let digits8 = 8 | |
33 | 33 | ||
34 | 34 | let scale8 = 100000000 | |
35 | 35 | ||
36 | 36 | let scale16 = 10000000000000000 | |
37 | 37 | ||
38 | 38 | let alpha = 50 | |
39 | 39 | ||
40 | 40 | let alphaDigits = 2 | |
41 | 41 | ||
42 | 42 | let beta = 4600000000000000 | |
43 | 43 | ||
44 | 44 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
45 | 45 | ||
46 | 46 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
47 | 47 | case string: String => | |
48 | 48 | fromBase58String(string) | |
49 | 49 | case nothing => | |
50 | 50 | throw((key + "is empty")) | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
55 | 55 | ||
56 | 56 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
57 | 57 | ||
58 | 58 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
59 | 59 | ||
60 | 60 | let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress)) | |
61 | 61 | ||
62 | 62 | let govAddress = Address(getBase58FromOracle(kGovAddress)) | |
63 | 63 | ||
64 | 64 | let active = valueOrElse(getBoolean(this, kActive), true) | |
65 | 65 | ||
66 | 66 | let routingFee = valueOrErrorMessage(getInteger(oracle, kRoutingFee), "routing_fee is empty") | |
67 | 67 | ||
68 | 68 | let feeScale6 = 1000000 | |
69 | 69 | ||
70 | 70 | func isActive () = if (active) | |
71 | 71 | then unit | |
72 | 72 | else throw("DApp is inactive at this moment") | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
76 | 76 | then unit | |
77 | 77 | else throw("Only admin can call this function") | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func throwIsActive () = throw("DApp is already active") | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func skewness (x,y) = ((fraction(scale16, x, y) + fraction(scale16, y, x)) / 2) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func invariantCalc (x,y) = { | |
90 | 90 | let sk = skewness(x, y) | |
91 | 91 | (fraction((x + y), scale16, pow(sk, digits8, alpha, alphaDigits, digits8, CEILING)) + (2 * fraction(toInt(pow(fraction(toBigInt(x), toBigInt(y), toBigInt(scale8)), 0, toBigInt(5), 1, (digits8 / 2), DOWN)), pow((sk - beta), digits8, alpha, alphaDigits, digits8, DOWN), scale8))) | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func calculateFeeDiscount (userAddr) = { | |
96 | 96 | let swopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserSwopInGov)), 0) | |
97 | 97 | let discountValues = split(getStringValue(oracle, kDiscountValues), ",") | |
98 | 98 | let discounts = split(getStringValue(oracle, kDiscounts), ",") | |
99 | 99 | if (if ((swopAmount >= parseIntValue(discountValues[0]))) | |
100 | 100 | then (parseIntValue(discountValues[1]) > swopAmount) | |
101 | 101 | else false) | |
102 | 102 | then (feeScale6 - parseIntValue(discounts[0])) | |
103 | 103 | else if (if ((swopAmount >= parseIntValue(discountValues[1]))) | |
104 | 104 | then (parseIntValue(discountValues[2]) > swopAmount) | |
105 | 105 | else false) | |
106 | 106 | then (feeScale6 - parseIntValue(discounts[1])) | |
107 | 107 | else if (if ((swopAmount >= parseIntValue(discountValues[2]))) | |
108 | 108 | then (parseIntValue(discountValues[3]) > swopAmount) | |
109 | 109 | else false) | |
110 | 110 | then (feeScale6 - parseIntValue(discounts[2])) | |
111 | 111 | else if (if ((swopAmount >= parseIntValue(discountValues[3]))) | |
112 | 112 | then (parseIntValue(discountValues[4]) > swopAmount) | |
113 | 113 | else false) | |
114 | 114 | then (feeScale6 - parseIntValue(discounts[3])) | |
115 | 115 | else if ((swopAmount >= parseIntValue(discountValues[4]))) | |
116 | 116 | then (feeScale6 - parseIntValue(discounts[4])) | |
117 | 117 | else feeScale6 | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func checkPossibility (caller,pmtAmount,minAmountToReceive,exchangers,exchangersType,routingAssetsKeys,args1,args2) = { | |
122 | 122 | let feeDiscount = calculateFeeDiscount(caller) | |
123 | 123 | let getFrom1TradeWithFee = if ((exchangersType[0] == "curveMultyFlat")) | |
124 | 124 | then { | |
125 | 125 | let inv = { | |
126 | - | let @ = invoke(addressFromStringValue(exchangers[0]), "getDy", [routingAssetsKeys[0], routingAssetsKeys[1], pmtAmount], nil) | |
126 | + | let @ = invoke(addressFromStringValue(exchangers[0]), "getDy", [routingAssetsKeys[0], routingAssetsKeys[1], pmtAmount, caller], nil) | |
127 | 127 | if ($isInstanceOf(@, "Int")) | |
128 | 128 | then @ | |
129 | 129 | else throw("Couldn't cast Any to Int") | |
130 | 130 | } | |
131 | 131 | if ((inv == inv)) | |
132 | 132 | then { | |
133 | 133 | let @ = inv | |
134 | 134 | if ($isInstanceOf(@, "Int")) | |
135 | 135 | then @ | |
136 | 136 | else throw("Couldn't cast Int to Int") | |
137 | 137 | } | |
138 | 138 | else throw("Strict value is not equal to itself.") | |
139 | 139 | } | |
140 | 140 | else { | |
141 | 141 | let dApp1TokenPay = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[0]) | |
142 | 142 | let dApp1TokenGet = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[1]) | |
143 | 143 | if ((exchangersType[0] == "cpmm")) | |
144 | 144 | then { | |
145 | 145 | let fee = getIntegerValue(addressFromStringValue(exchangers[0]), kFee) | |
146 | 146 | let getFrom1TradeWithoutFee = fraction(dApp1TokenGet, pmtAmount, (pmtAmount + dApp1TokenPay)) | |
147 | 147 | fraction(getFrom1TradeWithoutFee, (feeScale6 - fraction(fee, feeDiscount, feeScale6)), feeScale6) | |
148 | 148 | } | |
149 | 149 | else if ((exchangersType[0] == "flat")) | |
150 | 150 | then { | |
151 | 151 | let invariant = invariantCalc(dApp1TokenPay, dApp1TokenGet) | |
152 | 152 | let minAmountToReceive1 = args2[0] | |
153 | 153 | let invariantNew = invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1)) | |
154 | 154 | if ((invariantNew >= invariant)) | |
155 | 155 | then minAmountToReceive1 | |
156 | 156 | else throw("Flat contract: invariantNew < invariant") | |
157 | 157 | } | |
158 | 158 | else throw("Incorrect exchange type") | |
159 | 159 | } | |
160 | 160 | let getFrom2TradeWithFee = if ((exchangersType[0] == "curveMultyFlat")) | |
161 | 161 | then { | |
162 | 162 | let inv = { | |
163 | - | let @ = invoke(addressFromStringValue(exchangers[0]), "getDy", [routingAssetsKeys[2], routingAssetsKeys[3], getFrom1TradeWithFee], nil) | |
163 | + | let @ = invoke(addressFromStringValue(exchangers[0]), "getDy", [routingAssetsKeys[2], routingAssetsKeys[3], getFrom1TradeWithFee, caller], nil) | |
164 | 164 | if ($isInstanceOf(@, "Int")) | |
165 | 165 | then @ | |
166 | 166 | else throw("Couldn't cast Any to Int") | |
167 | 167 | } | |
168 | 168 | if ((inv == inv)) | |
169 | 169 | then inv | |
170 | 170 | else throw("Strict value is not equal to itself.") | |
171 | 171 | } | |
172 | 172 | else { | |
173 | 173 | let dApp2TokenPay = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[2]) | |
174 | 174 | let dApp2TokenGet = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[3]) | |
175 | 175 | if ((exchangersType[1] == "cpmm")) | |
176 | 176 | then { | |
177 | 177 | let getFrom2TradeWithoutFee = fraction(dApp2TokenGet, getFrom1TradeWithFee, (getFrom1TradeWithFee + dApp2TokenPay)) | |
178 | 178 | let fee = getIntegerValue(addressFromStringValue(exchangers[0]), kFee) | |
179 | 179 | fraction(getFrom2TradeWithoutFee, (feeScale6 - fraction(fee, feeDiscount, feeScale6)), feeScale6) | |
180 | 180 | } | |
181 | 181 | else if ((exchangersType[1] == "flat")) | |
182 | 182 | then { | |
183 | 183 | let invariant = invariantCalc(dApp2TokenPay, dApp2TokenGet) | |
184 | 184 | let minAmountToReceive2 = args2[1] | |
185 | 185 | let invariantNew = invariantCalc((dApp2TokenPay + getFrom1TradeWithFee), (dApp2TokenGet - minAmountToReceive2)) | |
186 | 186 | if ((invariantNew >= invariant)) | |
187 | 187 | then minAmountToReceive2 | |
188 | 188 | else throw("Flat contract: invariantNew < invariant") | |
189 | 189 | } | |
190 | 190 | else throw("Incorrect exchange type") | |
191 | 191 | } | |
192 | 192 | (getFrom2TradeWithFee >= minAmountToReceive) | |
193 | 193 | } | |
194 | 194 | ||
195 | 195 | ||
196 | 196 | @Callable(i) | |
197 | 197 | func routingTrade (exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive) = valueOrElse(isActive(), { | |
198 | - | let $ | |
199 | - | let pmtAmount = $ | |
200 | - | let pmtAssetId = $ | |
198 | + | let $t074137487 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
199 | + | let pmtAmount = $t074137487._1 | |
200 | + | let pmtAssetId = $t074137487._2 | |
201 | 201 | if (!(checkPossibility(i.caller, pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys, args1, args2))) | |
202 | 202 | then throw("Check transaction possibilty: declined") | |
203 | 203 | else if (if (!(isDefined(getString(oracle, (kPoolInOracle + exchangers[0]))))) | |
204 | 204 | then true | |
205 | 205 | else !(isDefined(getString(oracle, (kPoolInOracle + exchangers[1]))))) | |
206 | 206 | then throw("Pool is not in oracle") | |
207 | 207 | else { | |
208 | 208 | let routingSize = size(exchangers) | |
209 | 209 | func exchangeFold (accumulated,exchanger) = { | |
210 | - | let $ | |
211 | - | let exchangeCounter = $ | |
212 | - | let amountsWithFee = $ | |
213 | - | let assetsIdSend = $ | |
214 | - | let $ | |
210 | + | let $t080018066 = accumulated | |
211 | + | let exchangeCounter = $t080018066._1 | |
212 | + | let amountsWithFee = $t080018066._2 | |
213 | + | let assetsIdSend = $t080018066._3 | |
214 | + | let $t080798277 = if ((exchangeCounter == 0)) | |
215 | 215 | then $Tuple2(pmtAssetId, pmtAmount) | |
216 | 216 | else $Tuple2(assetsIdSend, amountsWithFee) | |
217 | - | let pmtAssetIdRout = $ | |
218 | - | let pmtAmountRout = $ | |
217 | + | let pmtAssetIdRout = $t080798277._1 | |
218 | + | let pmtAmountRout = $t080798277._2 | |
219 | 219 | if (((if ((exchangeCounter >= 0)) | |
220 | 220 | then (routingSize > exchangeCounter) | |
221 | 221 | else false) == true)) | |
222 | 222 | then { | |
223 | 223 | let exchangerAddress = addressFromStringValue(exchanger) | |
224 | 224 | if ((exchangersType[exchangeCounter] == "cpmm")) | |
225 | 225 | then { | |
226 | 226 | let inv = { | |
227 | 227 | let @ = invoke(exchangerAddress, "callFunction", ["exchange", [toString(args1[exchangeCounter])]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
228 | 228 | if ($isInstanceOf(@, "List[Any]")) | |
229 | 229 | then @ | |
230 | 230 | else throw("Couldn't cast Any to List[Any]") | |
231 | 231 | } | |
232 | 232 | if ((inv == inv)) | |
233 | 233 | then $Tuple3((exchangeCounter + 1), inv[0], inv[1]) | |
234 | 234 | else throw("Strict value is not equal to itself.") | |
235 | 235 | } | |
236 | 236 | else if ((exchangersType[exchangeCounter] == "flat")) | |
237 | 237 | then { | |
238 | 238 | let inv = invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
239 | 239 | if ((inv == inv)) | |
240 | 240 | then match inv { | |
241 | 241 | case inv: (Int, Unit)|(Int, ByteVector) => | |
242 | - | let $ | |
243 | - | let amountWithFee = $ | |
244 | - | let assetIdSend = $ | |
242 | + | let $t091429180 = inv | |
243 | + | let amountWithFee = $t091429180._1 | |
244 | + | let assetIdSend = $t091429180._2 | |
245 | 245 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
246 | 246 | case _ => | |
247 | 247 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
248 | 248 | } | |
249 | 249 | else throw("Strict value is not equal to itself.") | |
250 | 250 | } | |
251 | 251 | else if ((exchangersType[exchangeCounter] == "curveMultyFlat")) | |
252 | 252 | then { | |
253 | 253 | let inv = { | |
254 | 254 | let @ = invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
255 | 255 | if ($isInstanceOf(@, "List[Any]")) | |
256 | 256 | then @ | |
257 | 257 | else throw("Couldn't cast Any to List[Any]") | |
258 | 258 | } | |
259 | 259 | if ((inv == inv)) | |
260 | 260 | then $Tuple3((exchangeCounter + 1), inv[0], inv[1]) | |
261 | 261 | else throw("Strict value is not equal to itself.") | |
262 | 262 | } | |
263 | 263 | else throw("Incorrect exchange type") | |
264 | 264 | } | |
265 | 265 | else accumulated | |
266 | 266 | } | |
267 | 267 | ||
268 | - | let $ | |
268 | + | let $t098769982 = { | |
269 | 269 | let $l = exchangers | |
270 | 270 | let $s = size($l) | |
271 | 271 | let $acc0 = $Tuple3(0, 0, base58'') | |
272 | 272 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
273 | 273 | then $a | |
274 | 274 | else exchangeFold($a, $l[$i]) | |
275 | 275 | ||
276 | 276 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
277 | 277 | then $a | |
278 | 278 | else throw("List size exceeds 3") | |
279 | 279 | ||
280 | 280 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
281 | 281 | } | |
282 | - | let exchangeCounter = $ | |
283 | - | let amountWithoutFee = $ | |
284 | - | let assetIdSend = $ | |
282 | + | let exchangeCounter = $t098769982._1 | |
283 | + | let amountWithoutFee = $t098769982._2 | |
284 | + | let assetIdSend = $t098769982._3 | |
285 | 285 | let amountWithFee = fraction(amountWithoutFee, (feeScale6 - routingFee), feeScale6) | |
286 | 286 | if (if ((exchangeCounter == routingSize)) | |
287 | 287 | then (amountWithFee >= minAmountToReceive) | |
288 | 288 | else false) | |
289 | 289 | then [ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(moneyBoxAddress, (amountWithoutFee - amountWithFee), assetIdSend)] | |
290 | 290 | else throw("routing != routingSize or amountToRecieve < minAmountToReceive") | |
291 | 291 | } | |
292 | 292 | }) | |
293 | 293 | ||
294 | 294 | ||
295 | 295 | ||
296 | 296 | @Callable(i) | |
297 | 297 | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
298 | 298 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
299 | 299 | else suspend("Paused by admin")) | |
300 | 300 | ||
301 | 301 | ||
302 | 302 | ||
303 | 303 | @Callable(i) | |
304 | 304 | func activate () = valueOrElse(isAdminCall(i), if (active) | |
305 | 305 | then throwIsActive() | |
306 | 306 | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
307 | 307 | ||
308 | 308 | ||
309 | 309 | @Verifier(tx) | |
310 | 310 | func verify () = { | |
311 | 311 | let multiSignedByAdmins = { | |
312 | 312 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
313 | 313 | then 1 | |
314 | 314 | else 0 | |
315 | 315 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
316 | 316 | then 1 | |
317 | 317 | else 0 | |
318 | 318 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
319 | 319 | then 1 | |
320 | 320 | else 0 | |
321 | 321 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
322 | 322 | } | |
323 | 323 | match tx { | |
324 | 324 | case _ => | |
325 | 325 | multiSignedByAdmins | |
326 | 326 | } | |
327 | 327 | } | |
328 | 328 |
github/deemru/w8io/026f985 86.62 ms ◑