tx · 3RmRwRySRNKjzx8kLkRPiDrmVe3woY2LPiJPRsnkcGFH 3MqDf9VgoL9eqrCPx8F74Au6xBpvdTm9UP8: -0.10200000 Waves 2022.06.30 10:45 [2118884] smart account 3MqDf9VgoL9eqrCPx8F74Au6xBpvdTm9UP8 > SELF 0.00000000 Waves
{ "type": 13, "id": "3RmRwRySRNKjzx8kLkRPiDrmVe3woY2LPiJPRsnkcGFH", "fee": 10200000, "feeAssetId": null, "timestamp": 1656575149798, "version": 2, "chainId": 84, "sender": "3MqDf9VgoL9eqrCPx8F74Au6xBpvdTm9UP8", "senderPublicKey": "4ja2PX5eqM576zv9KGzu5Qe7M92Z3jbuSmkLPdGjK4ue", "proofs": [ "3JUu2TWuyFLHjW3BetVJi16yksoqTYyyRCgLfucpMBgpNQ2b9rMeaMHA1nCsy1jeqWeeTp2TNNgDf91Fnwfdnmhz", "49WtqSHgNbFzkHeyETwnSPuYtLLUtriDoZtMwWvXyPkTBorDTDZ48F2TYrVi3JSr4LhSCpnpjrjxxW5xMAKqF7a1" ], "script": "base64:AAIFAAAAAAAAABAIAhIICgYYGBERGAESABIAAAAAJQAAAAAHa0FjdGl2ZQIAAAAGYWN0aXZlAAAAAAZrQ2F1c2UCAAAADnNodXRkb3duX2NhdXNlAAAAAA1rUG9vbEluT3JhY2xlAgAAAAVwb29sXwAAAAAOa1VzZXJTd29wSW5Hb3YCAAAADF9TV09QX2Ftb3VudAAAAAAKa0Rpc2NvdW50cwIAAAAJZGlzY291bnRzAAAAAA9rRGlzY291bnRWYWx1ZXMCAAAAD2Rpc2NvdW50X3ZhbHVlcwAAAAALa1JvdXRpbmdGZWUCAAAAC3JvdXRpbmdfZmVlAAAAAA1rQWRtaW5QdWJLZXkxAgAAAAthZG1pbl9wdWJfMQAAAAANa0FkbWluUHViS2V5MgIAAAALYWRtaW5fcHViXzIAAAAADWtBZG1pblB1YktleTMCAAAAC2FkbWluX3B1Yl8zAAAAABBrTW9uZXlCb3hBZGRyZXNzAgAAAB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AACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADGFkbWluUHViS2V5MQAAAAAAAAAAAQAAAAAAAAAAAAQAAAASYWRtaW5QdWJLZXkyU2lnbmVkAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEFAAAADGFkbWluUHViS2V5MgAAAAAAAAAAAQAAAAAAAAAAAAQAAAASYWRtaW5QdWJLZXkzU2lnbmVkAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAIFAAAADGFkbWluUHViS2V5MwAAAAAAAAAAAQAAAAAAAAAAAAkAAGcAAAACCQAAZAAAAAIJAABkAAAAAgUAAAASYWRtaW5QdWJLZXkxU2lnbmVkBQAAABJhZG1pblB1YktleTJTaWduZWQFAAAAEmFkbWluUHViS2V5M1NpZ25lZAAAAAAAAAAAAgQAAAAHJG1hdGNoMAUAAAACdHgFAAAAE211bHRpU2lnbmVkQnlBZG1pbnP7Lg/H", "height": 2118884, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AGf5gH31wVmghTYnEYRiYE8sxUGvwXCudkWSEQALvWqj Next: Biym8zuzwoGkgTG3NSyvWBURez2MKi48SYZM57ztUDi1 Diff:
Old | New | Differences | |
---|---|---|---|
186 | 186 | else false) == true)) | |
187 | 187 | then { | |
188 | 188 | let exchangerAddress = addressFromStringValue(exchanger) | |
189 | - | let inv = if ((exchangersType[exchangeCounter] == "cpmm")) | |
190 | - | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
189 | + | if ((exchangersType[exchangeCounter] == "cpmm")) | |
190 | + | then { | |
191 | + | let inv = { | |
192 | + | let @ = invoke(exchangerAddress, "callFunction", ["exchange", [toString(args1[exchangeCounter])]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
193 | + | if ($isInstanceOf(@, "List[Any]")) | |
194 | + | then @ | |
195 | + | else throw("Couldn't cast Any to List[Any]") | |
196 | + | } | |
197 | + | if ((inv == inv)) | |
198 | + | then $Tuple3((exchangeCounter + 1), inv[0], inv[1]) | |
199 | + | else throw("Strict value is not equal to itself.") | |
200 | + | } | |
191 | 201 | else if ((exchangersType[exchangeCounter] == "flat")) | |
192 | - | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
202 | + | then { | |
203 | + | let inv = invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
204 | + | if ((inv == inv)) | |
205 | + | then match inv { | |
206 | + | case inv: (Int, Unit)|(Int, ByteVector) => | |
207 | + | let $t084328470 = inv | |
208 | + | let amountWithFee = $t084328470._1 | |
209 | + | let assetIdSend = $t084328470._2 | |
210 | + | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
211 | + | case _ => | |
212 | + | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
213 | + | } | |
214 | + | else throw("Strict value is not equal to itself.") | |
215 | + | } | |
193 | 216 | else throw("Incorrect exchange type") | |
194 | - | if ((inv == inv)) | |
195 | - | then match inv { | |
196 | - | case inv: (Int, Unit)|(Int, ByteVector) => | |
197 | - | let $t084158453 = inv | |
198 | - | let amountWithFee = $t084158453._1 | |
199 | - | let assetIdSend = $t084158453._2 | |
200 | - | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
201 | - | case _ => | |
202 | - | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
203 | - | } | |
204 | - | else throw("Strict value is not equal to itself.") | |
205 | 217 | } | |
206 | 218 | else accumulated | |
207 | 219 | } | |
208 | 220 | ||
209 | - | let $ | |
221 | + | let $t088418947 = { | |
210 | 222 | let $l = exchangers | |
211 | 223 | let $s = size($l) | |
212 | 224 | let $acc0 = $Tuple3(0, 0, base58'') | |
220 | 232 | ||
221 | 233 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
222 | 234 | } | |
223 | - | let exchangeCounter = $ | |
224 | - | let amountWithoutFee = $ | |
225 | - | let assetIdSend = $ | |
235 | + | let exchangeCounter = $t088418947._1 | |
236 | + | let amountWithoutFee = $t088418947._2 | |
237 | + | let assetIdSend = $t088418947._3 | |
226 | 238 | let amountWithFee = fraction(amountWithoutFee, (feeScale6 - routingFee), feeScale6) | |
227 | 239 | if (if ((exchangeCounter == routingSize)) | |
228 | 240 | 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 digits8 = 8 | |
31 | 31 | ||
32 | 32 | let scale8 = 100000000 | |
33 | 33 | ||
34 | 34 | let scale16 = 10000000000000000 | |
35 | 35 | ||
36 | 36 | let alpha = 50 | |
37 | 37 | ||
38 | 38 | let alphaDigits = 2 | |
39 | 39 | ||
40 | 40 | let beta = 4600000000000000 | |
41 | 41 | ||
42 | 42 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
43 | 43 | ||
44 | 44 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
45 | 45 | case string: String => | |
46 | 46 | fromBase58String(string) | |
47 | 47 | case nothing => | |
48 | 48 | throw((key + "is empty")) | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
53 | 53 | ||
54 | 54 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
55 | 55 | ||
56 | 56 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
57 | 57 | ||
58 | 58 | let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress)) | |
59 | 59 | ||
60 | 60 | let govAddress = Address(getBase58FromOracle(kGovAddress)) | |
61 | 61 | ||
62 | 62 | let active = valueOrElse(getBoolean(this, kActive), true) | |
63 | 63 | ||
64 | 64 | let routingFee = valueOrErrorMessage(getInteger(oracle, kRoutingFee), "routing_fee is empty") | |
65 | 65 | ||
66 | 66 | let feeScale6 = 1000000 | |
67 | 67 | ||
68 | 68 | func isActive () = if (active) | |
69 | 69 | then unit | |
70 | 70 | else throw("DApp is inactive at this moment") | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
74 | 74 | then unit | |
75 | 75 | else throw("Only admin can call this function") | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func throwIsActive () = throw("DApp is already active") | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func skewness (x,y) = ((fraction(scale16, x, y) + fraction(scale16, y, x)) / 2) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func invariantCalc (x,y) = { | |
88 | 88 | let sk = skewness(x, y) | |
89 | 89 | (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))) | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func calculateFeeDiscount (userAddr) = { | |
94 | 94 | let swopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserSwopInGov)), 0) | |
95 | 95 | let discountValues = split(getStringValue(oracle, kDiscountValues), ",") | |
96 | 96 | let discounts = split(getStringValue(oracle, kDiscounts), ",") | |
97 | 97 | if (if ((swopAmount >= parseIntValue(discountValues[0]))) | |
98 | 98 | then (parseIntValue(discountValues[1]) > swopAmount) | |
99 | 99 | else false) | |
100 | 100 | then (feeScale6 - parseIntValue(discounts[0])) | |
101 | 101 | else if (if ((swopAmount >= parseIntValue(discountValues[1]))) | |
102 | 102 | then (parseIntValue(discountValues[2]) > swopAmount) | |
103 | 103 | else false) | |
104 | 104 | then (feeScale6 - parseIntValue(discounts[1])) | |
105 | 105 | else if (if ((swopAmount >= parseIntValue(discountValues[2]))) | |
106 | 106 | then (parseIntValue(discountValues[3]) > swopAmount) | |
107 | 107 | else false) | |
108 | 108 | then (feeScale6 - parseIntValue(discounts[2])) | |
109 | 109 | else if (if ((swopAmount >= parseIntValue(discountValues[3]))) | |
110 | 110 | then (parseIntValue(discountValues[4]) > swopAmount) | |
111 | 111 | else false) | |
112 | 112 | then (feeScale6 - parseIntValue(discounts[3])) | |
113 | 113 | else if ((swopAmount >= parseIntValue(discountValues[4]))) | |
114 | 114 | then (feeScale6 - parseIntValue(discounts[4])) | |
115 | 115 | else feeScale6 | |
116 | 116 | } | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func checkPossibility (caller,pmtAmount,minAmountToReceive,exchangers,exchangersType,routingAssetsKeys,args1,args2) = { | |
120 | 120 | let dApp1TokenPay = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[0]) | |
121 | 121 | let dApp1TokenGet = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[1]) | |
122 | 122 | let dApp2TokenPay = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[2]) | |
123 | 123 | let dApp2TokenGet = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[3]) | |
124 | 124 | let feeDiscount = calculateFeeDiscount(caller) | |
125 | 125 | let getFrom1TradeWithFee = if ((exchangersType[0] == "cpmm")) | |
126 | 126 | then { | |
127 | 127 | let fee = getIntegerValue(addressFromStringValue(exchangers[0]), kFee) | |
128 | 128 | let getFrom1TradeWithoutFee = fraction(dApp1TokenGet, pmtAmount, (pmtAmount + dApp1TokenPay)) | |
129 | 129 | fraction(getFrom1TradeWithoutFee, (feeScale6 - fraction(fee, feeDiscount, feeScale6)), feeScale6) | |
130 | 130 | } | |
131 | 131 | else if ((exchangersType[0] == "flat")) | |
132 | 132 | then { | |
133 | 133 | let invariant = invariantCalc(dApp1TokenPay, dApp1TokenGet) | |
134 | 134 | let minAmountToReceive1 = args2[0] | |
135 | 135 | let invariantNew = invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1)) | |
136 | 136 | if ((invariantNew >= invariant)) | |
137 | 137 | then minAmountToReceive1 | |
138 | 138 | else throw("Flat contract: invariantNew < invariant") | |
139 | 139 | } | |
140 | 140 | else throw("Incorrect exchange type") | |
141 | 141 | let getFrom2TradeWithFee = if ((exchangersType[1] == "cpmm")) | |
142 | 142 | then { | |
143 | 143 | let getFrom2TradeWithoutFee = fraction(dApp2TokenGet, getFrom1TradeWithFee, (getFrom1TradeWithFee + dApp2TokenPay)) | |
144 | 144 | let fee = getIntegerValue(addressFromStringValue(exchangers[0]), kFee) | |
145 | 145 | fraction(getFrom2TradeWithoutFee, (feeScale6 - fraction(fee, feeDiscount, feeScale6)), feeScale6) | |
146 | 146 | } | |
147 | 147 | else if ((exchangersType[1] == "flat")) | |
148 | 148 | then { | |
149 | 149 | let invariant = invariantCalc(dApp2TokenPay, dApp2TokenGet) | |
150 | 150 | let minAmountToReceive2 = args2[1] | |
151 | 151 | let invariantNew = invariantCalc((dApp2TokenPay + getFrom1TradeWithFee), (dApp2TokenGet - minAmountToReceive2)) | |
152 | 152 | if ((invariantNew >= invariant)) | |
153 | 153 | then minAmountToReceive2 | |
154 | 154 | else throw("Flat contract: invariantNew < invariant") | |
155 | 155 | } | |
156 | 156 | else throw("Incorrect exchange type") | |
157 | 157 | (getFrom2TradeWithFee >= minAmountToReceive) | |
158 | 158 | } | |
159 | 159 | ||
160 | 160 | ||
161 | 161 | @Callable(i) | |
162 | 162 | func routingTrade (exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive) = valueOrElse(isActive(), { | |
163 | 163 | let $t067036777 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
164 | 164 | let pmtAmount = $t067036777._1 | |
165 | 165 | let pmtAssetId = $t067036777._2 | |
166 | 166 | if (!(checkPossibility(i.caller, pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys, args1, args2))) | |
167 | 167 | then throw("Check transaction possibilty: declined") | |
168 | 168 | else if (if (!(isDefined(getString(oracle, (kPoolInOracle + exchangers[0]))))) | |
169 | 169 | then true | |
170 | 170 | else !(isDefined(getString(oracle, (kPoolInOracle + exchangers[1]))))) | |
171 | 171 | then throw("Pool is not in oracle") | |
172 | 172 | else { | |
173 | 173 | let routingSize = size(exchangers) | |
174 | 174 | func exchangeFold (accumulated,exchanger) = { | |
175 | 175 | let $t072917356 = accumulated | |
176 | 176 | let exchangeCounter = $t072917356._1 | |
177 | 177 | let amountsWithFee = $t072917356._2 | |
178 | 178 | let assetsIdSend = $t072917356._3 | |
179 | 179 | let $t073697567 = if ((exchangeCounter == 0)) | |
180 | 180 | then $Tuple2(pmtAssetId, pmtAmount) | |
181 | 181 | else $Tuple2(assetsIdSend, amountsWithFee) | |
182 | 182 | let pmtAssetIdRout = $t073697567._1 | |
183 | 183 | let pmtAmountRout = $t073697567._2 | |
184 | 184 | if (((if ((exchangeCounter >= 0)) | |
185 | 185 | then (routingSize > exchangeCounter) | |
186 | 186 | else false) == true)) | |
187 | 187 | then { | |
188 | 188 | let exchangerAddress = addressFromStringValue(exchanger) | |
189 | - | let inv = if ((exchangersType[exchangeCounter] == "cpmm")) | |
190 | - | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
189 | + | if ((exchangersType[exchangeCounter] == "cpmm")) | |
190 | + | then { | |
191 | + | let inv = { | |
192 | + | let @ = invoke(exchangerAddress, "callFunction", ["exchange", [toString(args1[exchangeCounter])]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
193 | + | if ($isInstanceOf(@, "List[Any]")) | |
194 | + | then @ | |
195 | + | else throw("Couldn't cast Any to List[Any]") | |
196 | + | } | |
197 | + | if ((inv == inv)) | |
198 | + | then $Tuple3((exchangeCounter + 1), inv[0], inv[1]) | |
199 | + | else throw("Strict value is not equal to itself.") | |
200 | + | } | |
191 | 201 | else if ((exchangersType[exchangeCounter] == "flat")) | |
192 | - | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
202 | + | then { | |
203 | + | let inv = invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
204 | + | if ((inv == inv)) | |
205 | + | then match inv { | |
206 | + | case inv: (Int, Unit)|(Int, ByteVector) => | |
207 | + | let $t084328470 = inv | |
208 | + | let amountWithFee = $t084328470._1 | |
209 | + | let assetIdSend = $t084328470._2 | |
210 | + | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
211 | + | case _ => | |
212 | + | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
213 | + | } | |
214 | + | else throw("Strict value is not equal to itself.") | |
215 | + | } | |
193 | 216 | else throw("Incorrect exchange type") | |
194 | - | if ((inv == inv)) | |
195 | - | then match inv { | |
196 | - | case inv: (Int, Unit)|(Int, ByteVector) => | |
197 | - | let $t084158453 = inv | |
198 | - | let amountWithFee = $t084158453._1 | |
199 | - | let assetIdSend = $t084158453._2 | |
200 | - | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
201 | - | case _ => | |
202 | - | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
203 | - | } | |
204 | - | else throw("Strict value is not equal to itself.") | |
205 | 217 | } | |
206 | 218 | else accumulated | |
207 | 219 | } | |
208 | 220 | ||
209 | - | let $ | |
221 | + | let $t088418947 = { | |
210 | 222 | let $l = exchangers | |
211 | 223 | let $s = size($l) | |
212 | 224 | let $acc0 = $Tuple3(0, 0, base58'') | |
213 | 225 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
214 | 226 | then $a | |
215 | 227 | else exchangeFold($a, $l[$i]) | |
216 | 228 | ||
217 | 229 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
218 | 230 | then $a | |
219 | 231 | else throw("List size exceeds 3") | |
220 | 232 | ||
221 | 233 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
222 | 234 | } | |
223 | - | let exchangeCounter = $ | |
224 | - | let amountWithoutFee = $ | |
225 | - | let assetIdSend = $ | |
235 | + | let exchangeCounter = $t088418947._1 | |
236 | + | let amountWithoutFee = $t088418947._2 | |
237 | + | let assetIdSend = $t088418947._3 | |
226 | 238 | let amountWithFee = fraction(amountWithoutFee, (feeScale6 - routingFee), feeScale6) | |
227 | 239 | if (if ((exchangeCounter == routingSize)) | |
228 | 240 | then (amountWithFee >= minAmountToReceive) | |
229 | 241 | else false) | |
230 | 242 | then [ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(moneyBoxAddress, (amountWithoutFee - amountWithFee), assetIdSend)] | |
231 | 243 | else throw("routing != routingSize or amountToRecieve < minAmountToReceive") | |
232 | 244 | } | |
233 | 245 | }) | |
234 | 246 | ||
235 | 247 | ||
236 | 248 | ||
237 | 249 | @Callable(i) | |
238 | 250 | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
239 | 251 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
240 | 252 | else suspend("Paused by admin")) | |
241 | 253 | ||
242 | 254 | ||
243 | 255 | ||
244 | 256 | @Callable(i) | |
245 | 257 | func activate () = valueOrElse(isAdminCall(i), if (active) | |
246 | 258 | then throwIsActive() | |
247 | 259 | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
248 | 260 | ||
249 | 261 | ||
250 | 262 | @Verifier(tx) | |
251 | 263 | func verify () = { | |
252 | 264 | let multiSignedByAdmins = { | |
253 | 265 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
254 | 266 | then 1 | |
255 | 267 | else 0 | |
256 | 268 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
257 | 269 | then 1 | |
258 | 270 | else 0 | |
259 | 271 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
260 | 272 | then 1 | |
261 | 273 | else 0 | |
262 | 274 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
263 | 275 | } | |
264 | 276 | match tx { | |
265 | 277 | case _ => | |
266 | 278 | multiSignedByAdmins | |
267 | 279 | } | |
268 | 280 | } | |
269 | 281 |
github/deemru/w8io/169f3d6 54.38 ms ◑