tx · G7FXZm7SAJJt3w4FYMYKa97zdrFBQqRBG961NkLTHbhM 3N9kbR6BQEQV7pwBfDFzprJtNofgi6fSJ6Y: -0.03700000 Waves 2022.12.26 22:41 [2377687] smart account 3N9kbR6BQEQV7pwBfDFzprJtNofgi6fSJ6Y > SELF 0.00000000 Waves
{ "type": 13, "id": "G7FXZm7SAJJt3w4FYMYKa97zdrFBQqRBG961NkLTHbhM", "fee": 3700000, "feeAssetId": null, "timestamp": 1672083711726, "version": 2, "chainId": 84, "sender": "3N9kbR6BQEQV7pwBfDFzprJtNofgi6fSJ6Y", "senderPublicKey": "EajGg1J8duApPELWPw9gVkPwAKFC9hujhvCcne4FunUa", "proofs": [ "21kJCcLCXnTkdFUvArfDVVWk3dUoryr3i3Yw3c9DFQf9vuniYX1r5UXi1NorTVWueRMT5EXFV1kaPNt1u6WvKMhZ" ], "script": "base64:BgJLCAISBAoCCAgSAwoBCBIAEgMKAQgSCgoICAEBAQEBAQgSCwoJCAEBAQgBAQEBEg0KCwgIAQEBAQEBCAgBEgMKAQESAwoBARIDCgEBOwAUa19jb29yZGluYXRvckFkZHJlc3MCFGtfY29vcmRpbmF0b3JBZGRyZXNzABJrX2FkbWluX3B1YmxpY19rZXkCEmtfYWRtaW5fcHVibGljX2tleQANa19xdW90ZV9hc3NldAINa19xdW90ZV9hc3NldAAFa19hbW0CBWtfYW1tABFrX21hbmFnZXJfYWRkcmVzcwIRa19tYW5hZ2VyX2FkZHJlc3MAEmtfcG9zaXRpb25TZXF1ZW5jZQISa19wb3NpdGlvblNlcXVlbmNlAA5rX3Bvc2l0aW9uU2l6ZQIOa19wb3NpdGlvblNpemUABWtfZmVlAgVrX2ZlZQAQa19leGVjdXRlZE9yZGVycwIQa19leGVjdXRlZE9yZGVycwAQa19jYW5jZWxlZE9yZGVycwIQa19jYW5jZWxlZE9yZGVycwAHa19vcmRlcgIHa19vcmRlcgANa19sYXN0T3JkZXJJZAINa19sYXN0T3JkZXJJZAAQa190cmFkZXJPc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QJ0eAZwcm9vZnMAAAkBDmFkbWluUHVibGljS2V5ABy9SNs=", "height": 2377687, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Fj8LyeAxMh3HyxXSCJcfdzuxbkP34QExpoCxpuGYvYrU Next: Etj6dUa2n6myFoCEbpYbRn5tSEgTQfA1DFDKs8ejWgs Diff:
Old | New | Differences | |
---|---|---|---|
230 | 230 | @Callable(i) | |
231 | 231 | func cleanUpStaleOrders (_amm,_trader) = { | |
232 | 232 | let orders = traderAmmOrdersIds(_amm, _trader) | |
233 | + | let orderCount = getTraderOrderCount(_amm, _trader) | |
233 | 234 | func cleanUpOne (_acc,_orderId) = { | |
234 | 235 | let orderIdInt = valueOrErrorMessage(parseInt(_orderId), "Invalid order id") | |
235 | - | let $ | |
236 | - | let _x1 = $ | |
237 | - | let _x2 = $ | |
238 | - | let _x3 = $ | |
239 | - | let _x4 = $ | |
240 | - | let _type = $ | |
241 | - | let _x5 = $ | |
242 | - | let _x6 = $ | |
243 | - | let _x7 = $ | |
244 | - | let _x8 = $ | |
245 | - | let _positionId = $ | |
246 | - | let _x9 = $ | |
236 | + | let $t083838578 = getOrder(orderIdInt) | |
237 | + | let _x1 = $t083838578._1 | |
238 | + | let _x2 = $t083838578._2 | |
239 | + | let _x3 = $t083838578._3 | |
240 | + | let _x4 = $t083838578._4 | |
241 | + | let _type = $t083838578._5 | |
242 | + | let _x5 = $t083838578._6 | |
243 | + | let _x6 = $t083838578._7 | |
244 | + | let _x7 = $t083838578._8 | |
245 | + | let _x8 = $t083838578._9 | |
246 | + | let _positionId = $t083838578._10 | |
247 | + | let _x9 = $t083838578._11 | |
247 | 248 | let positionSize = getPositionSize(_amm, _trader) | |
248 | 249 | let currentPositionId = if ((positionSize != 0)) | |
249 | 250 | then getPositionId(_amm, _trader) | |
255 | 256 | else false) | |
256 | 257 | then { | |
257 | 258 | let change = (markCancelOrder(orderIdInt) ++ addRemoveOrderId(orderIdInt, _amm, _trader, false)) | |
258 | - | (_acc ++ change) | |
259 | + | $Tuple2((_acc._1 + 1), (_acc._2 ++ change)) | |
259 | 260 | } | |
260 | 261 | else _acc | |
261 | 262 | } | |
262 | 263 | ||
263 | - | let $l = orders | |
264 | - | let $s = size($l) | |
265 | - | let $acc0 = nil | |
266 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
267 | - | then $a | |
268 | - | else cleanUpOne($a, $l[$i]) | |
264 | + | let result = { | |
265 | + | let $l = orders | |
266 | + | let $s = size($l) | |
267 | + | let $acc0 = $Tuple2(0, nil) | |
268 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
269 | + | then $a | |
270 | + | else cleanUpOne($a, $l[$i]) | |
269 | 271 | ||
270 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
271 | - | then $a | |
272 | - | else throw("List size exceeds 5") | |
272 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
273 | + | then $a | |
274 | + | else throw("List size exceeds 5") | |
273 | 275 | ||
274 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
276 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
277 | + | } | |
278 | + | (result._2 ++ updateTraderOrderCount(_amm, _trader, (orderCount - result._1))) | |
275 | 279 | } | |
276 | 280 | ||
277 | 281 | ||
305 | 309 | then if ((size(i.payments) > 1)) | |
306 | 310 | then throw("Invalid createOrder parameters: invalid payment count") | |
307 | 311 | else { | |
308 | - | let $ | |
312 | + | let $t01028710539 = if ((size(i.payments) == 1)) | |
309 | 313 | then $Tuple2(toBase58String(valueOrErrorMessage(i.payments[0].assetId, "Invalid asset id")), i.payments[0].amount) | |
310 | 314 | else $Tuple2("", 0) | |
311 | - | let paymentAssetId = $ | |
312 | - | let paymentAmount = $ | |
315 | + | let paymentAssetId = $t01028710539._1 | |
316 | + | let paymentAmount = $t01028710539._2 | |
313 | 317 | let doCall = invoke(this, "internalCreateOrder", [_trader, _amm, _type, _triggerPrice, _limitPrice, _amountIn, _leverage, _side, _refLink, paymentAssetId, paymentAmount], nil) | |
314 | 318 | if ((doCall == doCall)) | |
315 | 319 | then nil | |
464 | 468 | ||
465 | 469 | @Callable(i) | |
466 | 470 | func cancelOrder (_orderId) = { | |
467 | - | let $ | |
468 | - | let _amm = $ | |
469 | - | let _trader = $ | |
470 | - | let _amountIn = $ | |
471 | - | let _leverage = $ | |
472 | - | let _type = $ | |
473 | - | let _triggerPrice = $ | |
474 | - | let _amountUsdn = $ | |
475 | - | let _side = $ | |
476 | - | let _refLink = $ | |
477 | - | let _positionId = $ | |
478 | - | let _limitPrice = $ | |
471 | + | let $t01590816127 = getOrder(_orderId) | |
472 | + | let _amm = $t01590816127._1 | |
473 | + | let _trader = $t01590816127._2 | |
474 | + | let _amountIn = $t01590816127._3 | |
475 | + | let _leverage = $t01590816127._4 | |
476 | + | let _type = $t01590816127._5 | |
477 | + | let _triggerPrice = $t01590816127._6 | |
478 | + | let _amountUsdn = $t01590816127._7 | |
479 | + | let _side = $t01590816127._8 | |
480 | + | let _refLink = $t01590816127._9 | |
481 | + | let _positionId = $t01590816127._10 | |
482 | + | let _limitPrice = $t01590816127._11 | |
479 | 483 | if (if (if (!(initialized())) | |
480 | 484 | then true | |
481 | 485 | else !(isValid(_orderId))) | |
509 | 513 | ||
510 | 514 | @Callable(i) | |
511 | 515 | func executeOrder (_orderId) = { | |
512 | - | let $ | |
513 | - | let _amm = $ | |
514 | - | let _trader = $ | |
515 | - | let _amountIn = $ | |
516 | - | let _leverage = $ | |
517 | - | let _type = $ | |
518 | - | let _triggerPrice = $ | |
519 | - | let _amountUsdn = $ | |
520 | - | let _side = $ | |
521 | - | let _refLink = $ | |
522 | - | let _positionId = $ | |
523 | - | let _limitPrice = $ | |
516 | + | let $t01709817317 = getOrder(_orderId) | |
517 | + | let _amm = $t01709817317._1 | |
518 | + | let _trader = $t01709817317._2 | |
519 | + | let _amountIn = $t01709817317._3 | |
520 | + | let _leverage = $t01709817317._4 | |
521 | + | let _type = $t01709817317._5 | |
522 | + | let _triggerPrice = $t01709817317._6 | |
523 | + | let _amountUsdn = $t01709817317._7 | |
524 | + | let _side = $t01709817317._8 | |
525 | + | let _refLink = $t01709817317._9 | |
526 | + | let _positionId = $t01709817317._10 | |
527 | + | let _limitPrice = $t01709817317._11 | |
524 | 528 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
525 | 529 | if ((cleanUp == cleanUp)) | |
526 | 530 | then if (if (!(initialized())) | |
532 | 536 | let currentPositionId = if ((positionSize != 0)) | |
533 | 537 | then getPositionId(_amm, _trader) | |
534 | 538 | else 0 | |
535 | - | let $ | |
539 | + | let $t01772121542 = if ((_type == STOP)) | |
536 | 540 | then { | |
537 | 541 | let _positionDirection = if ((positionSize > 0)) | |
538 | 542 | then LONG | |
603 | 607 | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
604 | 608 | } | |
605 | 609 | else throw(("Invalid order type: " + toString(_type))) | |
606 | - | let method = $ | |
607 | - | let args = $ | |
608 | - | let payments = $ | |
610 | + | let method = $t01772121542._1 | |
611 | + | let args = $t01772121542._2 | |
612 | + | let payments = $t01772121542._3 | |
609 | 613 | let withdraw = if ((size(payments) == 1)) | |
610 | 614 | then { | |
611 | 615 | let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), payments[0].amount], nil) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let k_coordinatorAddress = "k_coordinatorAddress" | |
5 | 5 | ||
6 | 6 | let k_admin_public_key = "k_admin_public_key" | |
7 | 7 | ||
8 | 8 | let k_quote_asset = "k_quote_asset" | |
9 | 9 | ||
10 | 10 | let k_amm = "k_amm" | |
11 | 11 | ||
12 | 12 | let k_manager_address = "k_manager_address" | |
13 | 13 | ||
14 | 14 | let k_positionSequence = "k_positionSequence" | |
15 | 15 | ||
16 | 16 | let k_positionSize = "k_positionSize" | |
17 | 17 | ||
18 | 18 | let k_fee = "k_fee" | |
19 | 19 | ||
20 | 20 | let k_executedOrders = "k_executedOrders" | |
21 | 21 | ||
22 | 22 | let k_canceledOrders = "k_canceledOrders" | |
23 | 23 | ||
24 | 24 | let k_order = "k_order" | |
25 | 25 | ||
26 | 26 | let k_lastOrderId = "k_lastOrderId" | |
27 | 27 | ||
28 | 28 | let k_traderOrderCnt = "k_traderOrderCnt" | |
29 | 29 | ||
30 | 30 | let k_traderOrderIds = "k_traderOrderIds" | |
31 | 31 | ||
32 | 32 | let k_sender = "k_sender" | |
33 | 33 | ||
34 | 34 | let k_initialized = "k_initialized" | |
35 | 35 | ||
36 | 36 | let STOP = 1 | |
37 | 37 | ||
38 | 38 | let TAKE = 2 | |
39 | 39 | ||
40 | 40 | let LIMIT = 3 | |
41 | 41 | ||
42 | 42 | let LONG = 1 | |
43 | 43 | ||
44 | 44 | let SHORT = 2 | |
45 | 45 | ||
46 | 46 | let INCREASE = 1 | |
47 | 47 | ||
48 | 48 | let DECREASE = 2 | |
49 | 49 | ||
50 | 50 | let MAX_TRADER_ORDERS_PER_AMM = 5 | |
51 | 51 | ||
52 | 52 | let TIME = lastBlock.timestamp | |
53 | 53 | ||
54 | 54 | let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
55 | 55 | ||
56 | 56 | let SPREAD_LIMIT = (DECIMAL_UNIT / 200) | |
57 | 57 | ||
58 | 58 | func abs (_x) = if ((_x > 0)) | |
59 | 59 | then _x | |
60 | 60 | else -(_x) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func minv (_x,_y) = if ((_x > _y)) | |
70 | 70 | then _y | |
71 | 71 | else _x | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func executedOrderKey (_orderId) = ((k_executedOrders + "_") + toString(_orderId)) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func canceledOrderKey (_orderId) = ((k_canceledOrders + "_") + toString(_orderId)) | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func orderKey (_orderId) = toCompositeKey(k_order, toString(_orderId)) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func traderOrderCountKey (_amm,_trader) = ((((k_traderOrderCnt + "_") + _amm) + "_") + _trader) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func traderOrderIdsKey (_amm,_trader) = ((((k_traderOrderIds + "_") + _amm) + "_") + _trader) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set") | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset)) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func managerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_manager_address)), "Manager not set") | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key)) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func isValid (_orderId) = if (valueOrElse(getBoolean(this, executedOrderKey(_orderId)), false)) | |
111 | 111 | then throw(("Order already executed: " + toString(_orderId))) | |
112 | 112 | else if (valueOrElse(getBoolean(this, canceledOrderKey(_orderId)), false)) | |
113 | 113 | then throw(("Order already cancelled: " + toString(_orderId))) | |
114 | 114 | else true | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func currentOrderId () = valueOrElse(getInteger(this, k_lastOrderId), 0) | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func getTraderOrderCount (_amm,_trader) = { | |
121 | 121 | let key = traderOrderCountKey(_amm, _trader) | |
122 | 122 | valueOrElse(getInteger(this, key), 0) | |
123 | 123 | } | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func traderAmmOrdersIds (_amm,_trader) = { | |
127 | 127 | let key = traderOrderIdsKey(_amm, _trader) | |
128 | 128 | let val = valueOrElse(getString(this, key), "") | |
129 | 129 | if ((val == "")) | |
130 | 130 | then nil | |
131 | 131 | else split(val, ",") | |
132 | 132 | } | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func getOrder (_orderId) = { | |
136 | 136 | let orderStr = valueOrErrorMessage(getString(this, orderKey(_orderId)), ("Invalid order id: " + toString(_orderId))) | |
137 | 137 | let orderPartList = split(orderStr, ",") | |
138 | 138 | let amm = orderPartList[0] | |
139 | 139 | let trader = orderPartList[1] | |
140 | 140 | let amountIn = valueOrErrorMessage(parseInt(orderPartList[2]), "Invalid amountIn") | |
141 | 141 | let leverage = valueOrErrorMessage(parseInt(orderPartList[3]), "Invalid leverage") | |
142 | 142 | let type = valueOrErrorMessage(parseInt(orderPartList[4]), "Invalid type") | |
143 | 143 | let triggerPrice = valueOrErrorMessage(parseInt(orderPartList[5]), "Invalid triggerPrice") | |
144 | 144 | let paymentUsdn = valueOrErrorMessage(parseInt(orderPartList[6]), "Invalid paymentUsdn") | |
145 | 145 | let side = valueOrErrorMessage(parseInt(orderPartList[7]), "Invalid side") | |
146 | 146 | let refLink = orderPartList[8] | |
147 | 147 | let positionId = valueOrErrorMessage(parseInt(orderPartList[9]), "Invalid positionId") | |
148 | 148 | let limitPrice = valueOrErrorMessage(parseInt(orderPartList[10]), "Invalid limitPrice") | |
149 | 149 | $Tuple11(amm, trader, amountIn, leverage, type, triggerPrice, paymentUsdn, side, refLink, positionId, limitPrice) | |
150 | 150 | } | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func getMarketPrice (_amm) = { | |
154 | 154 | let s = invoke(addressFromStringValue(_amm), "computeSpotPrice", nil, nil) | |
155 | 155 | if ((s == s)) | |
156 | 156 | then { | |
157 | 157 | let res = match s { | |
158 | 158 | case t: Int => | |
159 | 159 | t | |
160 | 160 | case _ => | |
161 | 161 | throw("Invalid computeSpotPrice result") | |
162 | 162 | } | |
163 | 163 | value(res) | |
164 | 164 | } | |
165 | 165 | else throw("Strict value is not equal to itself.") | |
166 | 166 | } | |
167 | 167 | ||
168 | 168 | ||
169 | 169 | func getFee (_amm,_trader) = { | |
170 | 170 | let s = invoke(addressFromStringValue(_amm), "computeFeeForTraderWithArtifact", [_trader, ""], nil) | |
171 | 171 | if ((s == s)) | |
172 | 172 | then { | |
173 | 173 | let res = match s { | |
174 | 174 | case t: (Int, Boolean) => | |
175 | 175 | t._1 | |
176 | 176 | case _ => | |
177 | 177 | throw("Invalid computeFeeForTraderWithArtifact result") | |
178 | 178 | } | |
179 | 179 | value(res) | |
180 | 180 | } | |
181 | 181 | else throw("Strict value is not equal to itself.") | |
182 | 182 | } | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | func getPositionSize (_amm,_trader) = { | |
186 | 186 | let amm = addressFromStringValue(_amm) | |
187 | 187 | let sizeKey = toCompositeKey(k_positionSize, _trader) | |
188 | 188 | valueOrElse(getInteger(amm, sizeKey), 0) | |
189 | 189 | } | |
190 | 190 | ||
191 | 191 | ||
192 | 192 | func getPositionId (_amm,_trader) = { | |
193 | 193 | let amm = addressFromStringValue(_amm) | |
194 | 194 | let seqKey = toCompositeKey(k_positionSequence, _trader) | |
195 | 195 | valueOrElse(getInteger(amm, seqKey), 0) | |
196 | 196 | } | |
197 | 197 | ||
198 | 198 | ||
199 | 199 | func getSpread (_price) = muld(_price, SPREAD_LIMIT) | |
200 | 200 | ||
201 | 201 | ||
202 | 202 | func saveOrder (_orderId,_amm,_trader,_amountIn,_leverage,_type,_triggerPrice,_paymentUsdn,_side,_refLink,_positionId,_limitPrice) = { | |
203 | 203 | let orderStr = makeString([_amm, _trader, toString(_amountIn), toString(_leverage), toString(_type), toString(_triggerPrice), toString(_paymentUsdn), toString(_side), _refLink, toString(_positionId), toString(_limitPrice)], ",") | |
204 | 204 | [StringEntry(orderKey(_orderId), orderStr)] | |
205 | 205 | } | |
206 | 206 | ||
207 | 207 | ||
208 | 208 | func addRemoveOrderId (_orderId,_amm,_trader,_add) = { | |
209 | 209 | let orderIds = traderAmmOrdersIds(_amm, _trader) | |
210 | 210 | let orderIdsNew = if (_add) | |
211 | 211 | then (orderIds :+ toString(_orderId)) | |
212 | 212 | else removeByIndex(orderIds, valueOrErrorMessage(indexOf(orderIds, toString(_orderId)), ("No order with id: " + toString(_orderId)))) | |
213 | 213 | let orderIdsNewStr = makeString(orderIdsNew, ",") | |
214 | 214 | [StringEntry(traderOrderIdsKey(_amm, _trader), orderIdsNewStr)] | |
215 | 215 | } | |
216 | 216 | ||
217 | 217 | ||
218 | 218 | func updateTraderOrderCount (_amm,_trader,_count) = [IntegerEntry(traderOrderCountKey(_amm, _trader), _count)] | |
219 | 219 | ||
220 | 220 | ||
221 | 221 | func updateLastOrderId (_lastOrderId) = [IntegerEntry(k_lastOrderId, _lastOrderId)] | |
222 | 222 | ||
223 | 223 | ||
224 | 224 | func markExecuteOrder (_orderId) = [BooleanEntry(toCompositeKey(k_executedOrders, toString(_orderId)), true)] | |
225 | 225 | ||
226 | 226 | ||
227 | 227 | func markCancelOrder (_orderId) = [BooleanEntry(toCompositeKey(k_canceledOrders, toString(_orderId)), true)] | |
228 | 228 | ||
229 | 229 | ||
230 | 230 | @Callable(i) | |
231 | 231 | func cleanUpStaleOrders (_amm,_trader) = { | |
232 | 232 | let orders = traderAmmOrdersIds(_amm, _trader) | |
233 | + | let orderCount = getTraderOrderCount(_amm, _trader) | |
233 | 234 | func cleanUpOne (_acc,_orderId) = { | |
234 | 235 | let orderIdInt = valueOrErrorMessage(parseInt(_orderId), "Invalid order id") | |
235 | - | let $ | |
236 | - | let _x1 = $ | |
237 | - | let _x2 = $ | |
238 | - | let _x3 = $ | |
239 | - | let _x4 = $ | |
240 | - | let _type = $ | |
241 | - | let _x5 = $ | |
242 | - | let _x6 = $ | |
243 | - | let _x7 = $ | |
244 | - | let _x8 = $ | |
245 | - | let _positionId = $ | |
246 | - | let _x9 = $ | |
236 | + | let $t083838578 = getOrder(orderIdInt) | |
237 | + | let _x1 = $t083838578._1 | |
238 | + | let _x2 = $t083838578._2 | |
239 | + | let _x3 = $t083838578._3 | |
240 | + | let _x4 = $t083838578._4 | |
241 | + | let _type = $t083838578._5 | |
242 | + | let _x5 = $t083838578._6 | |
243 | + | let _x6 = $t083838578._7 | |
244 | + | let _x7 = $t083838578._8 | |
245 | + | let _x8 = $t083838578._9 | |
246 | + | let _positionId = $t083838578._10 | |
247 | + | let _x9 = $t083838578._11 | |
247 | 248 | let positionSize = getPositionSize(_amm, _trader) | |
248 | 249 | let currentPositionId = if ((positionSize != 0)) | |
249 | 250 | then getPositionId(_amm, _trader) | |
250 | 251 | else 0 | |
251 | 252 | if (if (if ((_type == STOP)) | |
252 | 253 | then true | |
253 | 254 | else (_type == TAKE)) | |
254 | 255 | then (currentPositionId != _positionId) | |
255 | 256 | else false) | |
256 | 257 | then { | |
257 | 258 | let change = (markCancelOrder(orderIdInt) ++ addRemoveOrderId(orderIdInt, _amm, _trader, false)) | |
258 | - | (_acc ++ change) | |
259 | + | $Tuple2((_acc._1 + 1), (_acc._2 ++ change)) | |
259 | 260 | } | |
260 | 261 | else _acc | |
261 | 262 | } | |
262 | 263 | ||
263 | - | let $l = orders | |
264 | - | let $s = size($l) | |
265 | - | let $acc0 = nil | |
266 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
267 | - | then $a | |
268 | - | else cleanUpOne($a, $l[$i]) | |
264 | + | let result = { | |
265 | + | let $l = orders | |
266 | + | let $s = size($l) | |
267 | + | let $acc0 = $Tuple2(0, nil) | |
268 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
269 | + | then $a | |
270 | + | else cleanUpOne($a, $l[$i]) | |
269 | 271 | ||
270 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
271 | - | then $a | |
272 | - | else throw("List size exceeds 5") | |
272 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
273 | + | then $a | |
274 | + | else throw("List size exceeds 5") | |
273 | 275 | ||
274 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
276 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
277 | + | } | |
278 | + | (result._2 ++ updateTraderOrderCount(_amm, _trader, (orderCount - result._1))) | |
275 | 279 | } | |
276 | 280 | ||
277 | 281 | ||
278 | 282 | ||
279 | 283 | @Callable(i) | |
280 | 284 | func setContext (_sender) = if ((i.caller != this)) | |
281 | 285 | then throw("Only self-call") | |
282 | 286 | else [StringEntry(k_sender, _sender)] | |
283 | 287 | ||
284 | 288 | ||
285 | 289 | ||
286 | 290 | @Callable(i) | |
287 | 291 | func resetContext () = if ((i.caller != this)) | |
288 | 292 | then throw("Only self-call") | |
289 | 293 | else [DeleteEntry(k_sender)] | |
290 | 294 | ||
291 | 295 | ||
292 | 296 | ||
293 | 297 | @Callable(i) | |
294 | 298 | func initialize (_coordinator) = if (initialized()) | |
295 | 299 | then throw("Already initialized") | |
296 | 300 | else [StringEntry(k_coordinatorAddress, _coordinator), BooleanEntry(k_initialized, true)] | |
297 | 301 | ||
298 | 302 | ||
299 | 303 | ||
300 | 304 | @Callable(i) | |
301 | 305 | func createOrder (_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink) = { | |
302 | 306 | let _trader = toString(i.caller) | |
303 | 307 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
304 | 308 | if ((cleanUp == cleanUp)) | |
305 | 309 | then if ((size(i.payments) > 1)) | |
306 | 310 | then throw("Invalid createOrder parameters: invalid payment count") | |
307 | 311 | else { | |
308 | - | let $ | |
312 | + | let $t01028710539 = if ((size(i.payments) == 1)) | |
309 | 313 | then $Tuple2(toBase58String(valueOrErrorMessage(i.payments[0].assetId, "Invalid asset id")), i.payments[0].amount) | |
310 | 314 | else $Tuple2("", 0) | |
311 | - | let paymentAssetId = $ | |
312 | - | let paymentAmount = $ | |
315 | + | let paymentAssetId = $t01028710539._1 | |
316 | + | let paymentAmount = $t01028710539._2 | |
313 | 317 | let doCall = invoke(this, "internalCreateOrder", [_trader, _amm, _type, _triggerPrice, _limitPrice, _amountIn, _leverage, _side, _refLink, paymentAssetId, paymentAmount], nil) | |
314 | 318 | if ((doCall == doCall)) | |
315 | 319 | then nil | |
316 | 320 | else throw("Strict value is not equal to itself.") | |
317 | 321 | } | |
318 | 322 | else throw("Strict value is not equal to itself.") | |
319 | 323 | } | |
320 | 324 | ||
321 | 325 | ||
322 | 326 | ||
323 | 327 | @Callable(i) | |
324 | 328 | func increasePositionWithStopLoss (_amm,_direction,_leverage,_minBaseAssetAmount,_refLink,_stopTriggerPrice,_stopLimitPrice,_takeTriggerPrice,_takeLimitPrice) = { | |
325 | 329 | let _trader = toString(i.caller) | |
326 | 330 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
327 | 331 | if ((cleanUp == cleanUp)) | |
328 | 332 | then if (if (!(initialized())) | |
329 | 333 | then true | |
330 | 334 | else !(isWhitelist(_amm))) | |
331 | 335 | then throw("Invalid increasePositionWithStopLoss parameters") | |
332 | 336 | else { | |
333 | 337 | let positionSize = getPositionSize(_amm, _trader) | |
334 | 338 | if ((positionSize != 0)) | |
335 | 339 | then throw("Invalid increasePositionWithStopLoss parameters: only new position") | |
336 | 340 | else { | |
337 | 341 | let doSetContext = invoke(this, "setContext", [_trader], nil) | |
338 | 342 | if ((doSetContext == doSetContext)) | |
339 | 343 | then { | |
340 | 344 | let doClosePosition = invoke(addressFromStringValue(_amm), "increasePosition", [_direction, _leverage, _minBaseAssetAmount, _refLink], i.payments) | |
341 | 345 | if ((doClosePosition == doClosePosition)) | |
342 | 346 | then { | |
343 | 347 | let doResetContext = invoke(this, "resetContext", nil, nil) | |
344 | 348 | if ((doResetContext == doResetContext)) | |
345 | 349 | then { | |
346 | 350 | let openedPositionSize = getPositionSize(_amm, _trader) | |
347 | 351 | if ((openedPositionSize == openedPositionSize)) | |
348 | 352 | then { | |
349 | 353 | let amountIn = abs(openedPositionSize) | |
350 | 354 | let stopLossSide = if ((0 > openedPositionSize)) | |
351 | 355 | then LONG | |
352 | 356 | else SHORT | |
353 | 357 | let doCreateStopOrder = if ((_stopTriggerPrice > 0)) | |
354 | 358 | then { | |
355 | 359 | let doCreateStopOrder = invoke(this, "internalCreateOrder", [_trader, _amm, STOP, _stopTriggerPrice, _stopLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0], nil) | |
356 | 360 | if ((doCreateStopOrder == doCreateStopOrder)) | |
357 | 361 | then nil | |
358 | 362 | else throw("Strict value is not equal to itself.") | |
359 | 363 | } | |
360 | 364 | else nil | |
361 | 365 | if ((doCreateStopOrder == doCreateStopOrder)) | |
362 | 366 | then { | |
363 | 367 | let doCreateTakeOrder = if ((_takeTriggerPrice > 0)) | |
364 | 368 | then { | |
365 | 369 | let doCreateTakeOrder = invoke(this, "internalCreateOrder", [_trader, _amm, TAKE, _takeTriggerPrice, _takeLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0], nil) | |
366 | 370 | if ((doCreateTakeOrder == doCreateTakeOrder)) | |
367 | 371 | then nil | |
368 | 372 | else throw("Strict value is not equal to itself.") | |
369 | 373 | } | |
370 | 374 | else nil | |
371 | 375 | if ((doCreateTakeOrder == doCreateTakeOrder)) | |
372 | 376 | then nil | |
373 | 377 | else throw("Strict value is not equal to itself.") | |
374 | 378 | } | |
375 | 379 | else throw("Strict value is not equal to itself.") | |
376 | 380 | } | |
377 | 381 | else throw("Strict value is not equal to itself.") | |
378 | 382 | } | |
379 | 383 | else throw("Strict value is not equal to itself.") | |
380 | 384 | } | |
381 | 385 | else throw("Strict value is not equal to itself.") | |
382 | 386 | } | |
383 | 387 | else throw("Strict value is not equal to itself.") | |
384 | 388 | } | |
385 | 389 | } | |
386 | 390 | else throw("Strict value is not equal to itself.") | |
387 | 391 | } | |
388 | 392 | ||
389 | 393 | ||
390 | 394 | ||
391 | 395 | @Callable(i) | |
392 | 396 | func internalCreateOrder (_trader,_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink,_paymentAssetId,_paymentAmount) = if (if (if (if (if (if (if (if (if (!(initialized())) | |
393 | 397 | then true | |
394 | 398 | else !(isWhitelist(_amm))) | |
395 | 399 | then true | |
396 | 400 | else (0 >= _triggerPrice)) | |
397 | 401 | then true | |
398 | 402 | else (0 > _limitPrice)) | |
399 | 403 | then true | |
400 | 404 | else (0 >= _amountIn)) | |
401 | 405 | then true | |
402 | 406 | else (0 > _leverage)) | |
403 | 407 | then true | |
404 | 408 | else !(if ((_side == LONG)) | |
405 | 409 | then true | |
406 | 410 | else (_side == SHORT))) | |
407 | 411 | then true | |
408 | 412 | else !(if (if ((_type == STOP)) | |
409 | 413 | then true | |
410 | 414 | else (_type == TAKE)) | |
411 | 415 | then true | |
412 | 416 | else (_type == LIMIT))) | |
413 | 417 | then true | |
414 | 418 | else !((i.caller == this))) | |
415 | 419 | then throw("Invalid createOrder parameters") | |
416 | 420 | else { | |
417 | 421 | let orderId = (currentOrderId() + 1) | |
418 | 422 | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) + 1) | |
419 | 423 | let positionSize = getPositionSize(_amm, _trader) | |
420 | 424 | let _direction = if (if (if ((positionSize == 0)) | |
421 | 425 | then true | |
422 | 426 | else if ((positionSize > 0)) | |
423 | 427 | then (_side == LONG) | |
424 | 428 | else false) | |
425 | 429 | then true | |
426 | 430 | else if ((0 > positionSize)) | |
427 | 431 | then (_side == SHORT) | |
428 | 432 | else false) | |
429 | 433 | then INCREASE | |
430 | 434 | else DECREASE | |
431 | 435 | if (if ((positionSize == 0)) | |
432 | 436 | then if ((_type == STOP)) | |
433 | 437 | then true | |
434 | 438 | else (_type == TAKE) | |
435 | 439 | else false) | |
436 | 440 | then throw("Can not create STOP/TAKE order: no position") | |
437 | 441 | else { | |
438 | 442 | let usdnPayment = if ((_direction == INCREASE)) | |
439 | 443 | then if (if ((_paymentAssetId != toBase58String(quoteAsset()))) | |
440 | 444 | then true | |
441 | 445 | else (_paymentAmount != _amountIn)) | |
442 | 446 | then throw("Invalid createLimitOrder parameters: invalid payment") | |
443 | 447 | else { | |
444 | 448 | let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _paymentAmount)]) | |
445 | 449 | if ((stake == stake)) | |
446 | 450 | then _paymentAmount | |
447 | 451 | else throw("Strict value is not equal to itself.") | |
448 | 452 | } | |
449 | 453 | else 0 | |
450 | 454 | if ((usdnPayment == usdnPayment)) | |
451 | 455 | then { | |
452 | 456 | let positionId = if ((positionSize != 0)) | |
453 | 457 | then getPositionId(_amm, _trader) | |
454 | 458 | else 0 | |
455 | 459 | if ((newTraderOrderCount > MAX_TRADER_ORDERS_PER_AMM)) | |
456 | 460 | then throw("Invalid createLimitOrder parameters: order count") | |
457 | 461 | else (((saveOrder(orderId, _amm, _trader, _amountIn, _leverage, _type, _triggerPrice, usdnPayment, _side, _refLink, positionId, _limitPrice) ++ addRemoveOrderId(orderId, _amm, _trader, true)) ++ updateTraderOrderCount(_amm, _trader, newTraderOrderCount)) ++ updateLastOrderId(orderId)) | |
458 | 462 | } | |
459 | 463 | else throw("Strict value is not equal to itself.") | |
460 | 464 | } | |
461 | 465 | } | |
462 | 466 | ||
463 | 467 | ||
464 | 468 | ||
465 | 469 | @Callable(i) | |
466 | 470 | func cancelOrder (_orderId) = { | |
467 | - | let $ | |
468 | - | let _amm = $ | |
469 | - | let _trader = $ | |
470 | - | let _amountIn = $ | |
471 | - | let _leverage = $ | |
472 | - | let _type = $ | |
473 | - | let _triggerPrice = $ | |
474 | - | let _amountUsdn = $ | |
475 | - | let _side = $ | |
476 | - | let _refLink = $ | |
477 | - | let _positionId = $ | |
478 | - | let _limitPrice = $ | |
471 | + | let $t01590816127 = getOrder(_orderId) | |
472 | + | let _amm = $t01590816127._1 | |
473 | + | let _trader = $t01590816127._2 | |
474 | + | let _amountIn = $t01590816127._3 | |
475 | + | let _leverage = $t01590816127._4 | |
476 | + | let _type = $t01590816127._5 | |
477 | + | let _triggerPrice = $t01590816127._6 | |
478 | + | let _amountUsdn = $t01590816127._7 | |
479 | + | let _side = $t01590816127._8 | |
480 | + | let _refLink = $t01590816127._9 | |
481 | + | let _positionId = $t01590816127._10 | |
482 | + | let _limitPrice = $t01590816127._11 | |
479 | 483 | if (if (if (!(initialized())) | |
480 | 484 | then true | |
481 | 485 | else !(isValid(_orderId))) | |
482 | 486 | then true | |
483 | 487 | else !((toString(i.caller) == _trader))) | |
484 | 488 | then throw("Invalid cancelOrder parameters") | |
485 | 489 | else { | |
486 | 490 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
487 | 491 | if ((cleanUp == cleanUp)) | |
488 | 492 | then { | |
489 | 493 | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) - 1) | |
490 | 494 | let withdraw = if ((_amountUsdn > 0)) | |
491 | 495 | then { | |
492 | 496 | let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), _amountUsdn], nil) | |
493 | 497 | if ((unstake == unstake)) | |
494 | 498 | then nil | |
495 | 499 | else throw("Strict value is not equal to itself.") | |
496 | 500 | } | |
497 | 501 | else nil | |
498 | 502 | if ((withdraw == withdraw)) | |
499 | 503 | then (((markCancelOrder(_orderId) ++ addRemoveOrderId(_orderId, _amm, _trader, false)) ++ updateTraderOrderCount(_amm, _trader, newTraderOrderCount)) ++ (if ((_amountUsdn > 0)) | |
500 | 504 | then [ScriptTransfer(i.caller, _amountUsdn, quoteAsset())] | |
501 | 505 | else nil)) | |
502 | 506 | else throw("Strict value is not equal to itself.") | |
503 | 507 | } | |
504 | 508 | else throw("Strict value is not equal to itself.") | |
505 | 509 | } | |
506 | 510 | } | |
507 | 511 | ||
508 | 512 | ||
509 | 513 | ||
510 | 514 | @Callable(i) | |
511 | 515 | func executeOrder (_orderId) = { | |
512 | - | let $ | |
513 | - | let _amm = $ | |
514 | - | let _trader = $ | |
515 | - | let _amountIn = $ | |
516 | - | let _leverage = $ | |
517 | - | let _type = $ | |
518 | - | let _triggerPrice = $ | |
519 | - | let _amountUsdn = $ | |
520 | - | let _side = $ | |
521 | - | let _refLink = $ | |
522 | - | let _positionId = $ | |
523 | - | let _limitPrice = $ | |
516 | + | let $t01709817317 = getOrder(_orderId) | |
517 | + | let _amm = $t01709817317._1 | |
518 | + | let _trader = $t01709817317._2 | |
519 | + | let _amountIn = $t01709817317._3 | |
520 | + | let _leverage = $t01709817317._4 | |
521 | + | let _type = $t01709817317._5 | |
522 | + | let _triggerPrice = $t01709817317._6 | |
523 | + | let _amountUsdn = $t01709817317._7 | |
524 | + | let _side = $t01709817317._8 | |
525 | + | let _refLink = $t01709817317._9 | |
526 | + | let _positionId = $t01709817317._10 | |
527 | + | let _limitPrice = $t01709817317._11 | |
524 | 528 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
525 | 529 | if ((cleanUp == cleanUp)) | |
526 | 530 | then if (if (!(initialized())) | |
527 | 531 | then true | |
528 | 532 | else !(isValid(_orderId))) | |
529 | 533 | then throw("Invalid executeOrder parameters") | |
530 | 534 | else { | |
531 | 535 | let positionSize = getPositionSize(_amm, _trader) | |
532 | 536 | let currentPositionId = if ((positionSize != 0)) | |
533 | 537 | then getPositionId(_amm, _trader) | |
534 | 538 | else 0 | |
535 | - | let $ | |
539 | + | let $t01772121542 = if ((_type == STOP)) | |
536 | 540 | then { | |
537 | 541 | let _positionDirection = if ((positionSize > 0)) | |
538 | 542 | then LONG | |
539 | 543 | else if ((0 > positionSize)) | |
540 | 544 | then SHORT | |
541 | 545 | else throw("Can not execute STOP order: no open position") | |
542 | 546 | let marketPrice = getMarketPrice(_amm) | |
543 | 547 | let isExecutable = if ((_side == _positionDirection)) | |
544 | 548 | then throw("Can not execute STOP order: reduce only") | |
545 | 549 | else if ((currentPositionId != _positionId)) | |
546 | 550 | then throw("Can not execute STOP order: position closed") | |
547 | 551 | else if ((_positionDirection == LONG)) | |
548 | 552 | then (_triggerPrice >= marketPrice) | |
549 | 553 | else (marketPrice >= _triggerPrice) | |
550 | 554 | if (isExecutable) | |
551 | 555 | then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), muld(_limitPrice, abs(positionSize))], nil) | |
552 | 556 | else throw("Can not execute STOP order: triggerPrice mismatch") | |
553 | 557 | } | |
554 | 558 | else if ((_type == TAKE)) | |
555 | 559 | then { | |
556 | 560 | let _positionDirection = if ((positionSize > 0)) | |
557 | 561 | then LONG | |
558 | 562 | else if ((0 > positionSize)) | |
559 | 563 | then SHORT | |
560 | 564 | else throw("Can not execute STOP order: no open position") | |
561 | 565 | let marketPrice = getMarketPrice(_amm) | |
562 | 566 | let isExecutable = if ((_side == _positionDirection)) | |
563 | 567 | then throw("Can not execute TAKE order: reduce only") | |
564 | 568 | else if ((currentPositionId != _positionId)) | |
565 | 569 | then throw(((("Can not execute TAKE order: position closed " + toString(currentPositionId)) + "!=") + toString(_positionId))) | |
566 | 570 | else if ((_positionDirection == LONG)) | |
567 | 571 | then (marketPrice >= _triggerPrice) | |
568 | 572 | else (_triggerPrice >= marketPrice) | |
569 | 573 | if (isExecutable) | |
570 | 574 | then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), muld(_limitPrice, abs(positionSize))], nil) | |
571 | 575 | else throw("Can not execute TAKE order: triggerPrice mismatch") | |
572 | 576 | } | |
573 | 577 | else if ((_type == LIMIT)) | |
574 | 578 | then { | |
575 | 579 | let marketPrice = getMarketPrice(_amm) | |
576 | 580 | let spread = if ((_limitPrice == 0)) | |
577 | 581 | then getSpread(_triggerPrice) | |
578 | 582 | else abs((_triggerPrice - _limitPrice)) | |
579 | 583 | let isExecutable = if ((marketPrice >= (_triggerPrice - spread))) | |
580 | 584 | then ((_triggerPrice + spread) >= marketPrice) | |
581 | 585 | else false | |
582 | 586 | if (isExecutable) | |
583 | 587 | then { | |
584 | 588 | let _positionDirection = if ((positionSize > 0)) | |
585 | 589 | then LONG | |
586 | 590 | else if ((0 > positionSize)) | |
587 | 591 | then SHORT | |
588 | 592 | else -1 | |
589 | 593 | let direction = if ((positionSize == 0)) | |
590 | 594 | then INCREASE | |
591 | 595 | else if ((_positionDirection == _side)) | |
592 | 596 | then INCREASE | |
593 | 597 | else DECREASE | |
594 | 598 | if ((direction == INCREASE)) | |
595 | 599 | then { | |
596 | 600 | let amountInWithFee = (_amountUsdn - muld(_amountUsdn, getFee(_amm, _trader))) | |
597 | 601 | $Tuple3("increasePosition", [_side, _leverage, if ((_limitPrice == 0)) | |
598 | 602 | then 0 | |
599 | 603 | else divd(amountInWithFee, _limitPrice), _refLink], [AttachedPayment(quoteAsset(), _amountUsdn)]) | |
600 | 604 | } | |
601 | 605 | else $Tuple3("closePosition", [_amountIn, muld(_amountIn, _limitPrice)], nil) | |
602 | 606 | } | |
603 | 607 | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
604 | 608 | } | |
605 | 609 | else throw(("Invalid order type: " + toString(_type))) | |
606 | - | let method = $ | |
607 | - | let args = $ | |
608 | - | let payments = $ | |
610 | + | let method = $t01772121542._1 | |
611 | + | let args = $t01772121542._2 | |
612 | + | let payments = $t01772121542._3 | |
609 | 613 | let withdraw = if ((size(payments) == 1)) | |
610 | 614 | then { | |
611 | 615 | let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), payments[0].amount], nil) | |
612 | 616 | if ((unstake == unstake)) | |
613 | 617 | then nil | |
614 | 618 | else throw("Strict value is not equal to itself.") | |
615 | 619 | } | |
616 | 620 | else nil | |
617 | 621 | if ((withdraw == withdraw)) | |
618 | 622 | then { | |
619 | 623 | let doSetContext = invoke(this, "setContext", [_trader], nil) | |
620 | 624 | if ((doSetContext == doSetContext)) | |
621 | 625 | then { | |
622 | 626 | let doClosePosition = invoke(addressFromStringValue(_amm), method, args, payments) | |
623 | 627 | if ((doClosePosition == doClosePosition)) | |
624 | 628 | then { | |
625 | 629 | let doResetContext = invoke(this, "resetContext", nil, nil) | |
626 | 630 | if ((doResetContext == doResetContext)) | |
627 | 631 | then { | |
628 | 632 | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) - 1) | |
629 | 633 | ((updateTraderOrderCount(_amm, _trader, newTraderOrderCount) ++ addRemoveOrderId(_orderId, _amm, _trader, false)) ++ markExecuteOrder(_orderId)) | |
630 | 634 | } | |
631 | 635 | else throw("Strict value is not equal to itself.") | |
632 | 636 | } | |
633 | 637 | else throw("Strict value is not equal to itself.") | |
634 | 638 | } | |
635 | 639 | else throw("Strict value is not equal to itself.") | |
636 | 640 | } | |
637 | 641 | else throw("Strict value is not equal to itself.") | |
638 | 642 | } | |
639 | 643 | else throw("Strict value is not equal to itself.") | |
640 | 644 | } | |
641 | 645 | ||
642 | 646 | ||
643 | 647 | ||
644 | 648 | @Callable(i) | |
645 | 649 | func view_canExecuteOrder (_orderId) = { | |
646 | 650 | let s = invoke(this, "executeOrder", [_orderId], nil) | |
647 | 651 | if ((s == s)) | |
648 | 652 | then throw("Success") | |
649 | 653 | else throw("Strict value is not equal to itself.") | |
650 | 654 | } | |
651 | 655 | ||
652 | 656 | ||
653 | 657 | @Verifier(tx) | |
654 | 658 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey()) | |
655 | 659 |
github/deemru/w8io/026f985 84.94 ms ◑