tx · 8BvDNGLK6j3Up8oKjGFsGXPwf8869XzRh48XkMdCuD2Z 3MzGPAZokuNfqjMuP7yDXFATZjhjtEP5UCa: -0.03700000 Waves 2023.05.03 10:59 [2561305] smart account 3MzGPAZokuNfqjMuP7yDXFATZjhjtEP5UCa > SELF 0.00000000 Waves
{ "type": 13, "id": "8BvDNGLK6j3Up8oKjGFsGXPwf8869XzRh48XkMdCuD2Z", "fee": 3700000, "feeAssetId": null, "timestamp": 1683100784819, "version": 2, "chainId": 84, "sender": "3MzGPAZokuNfqjMuP7yDXFATZjhjtEP5UCa", "senderPublicKey": "4EBKd2zSCvpiSLeyovT5FUuMvGpi6oxdBAbvQybSYi6p", "proofs": [ "YNS9GDjLiXSyo6ruyXsuARrZWhK2AKsvY4qhBk7hwMtCMnSTmhTEMJBukDEHu8NTeAHLSTFqdgv18eVfV9kZCUu" ], "script": "base64:BgJiCAISBAoCCAgSAwoBCBIAEgMKAQgSDwoNCAEBAQEBAQgBAQEBARILCgkIAQEBCAEBAQESBQoDCAgBEggKBggIAQEBARIOCgwICAEBAQEBAQgIAQESAwoBARIDCgEBEgMKAQFCABRrX2Nvb3JkaW5hdG9yQWRkcmVzcwIUa19jb29yZGluYXRvckFkZHJlc3MAD2tfYWRtaW5fYWRkcmVzcwIPa19hZG1pbl9hZGRyZXNzAA1rX3F1b3RlX2Fzc2V0Ag1rX3F1b3RlX2Fzc2V0AAVrX2FtbQIFa19hbW0AEWtfbWFuYWdlcl9hZGRyZXNzAhFrX21hbmFnZXJfYWRkcmVzcwASa19wb3NpdGlvblNlcXVlbmNlAhJrX3Bvc2l0aW9uU2VxdWVuY2UADmtfcG9zaXRpb25TaXplAg5rX3Bvc2l0aW9uU2l6ZQAQa19leGVjdXRlZE9yZGVycwIQa19leGVjdXRlZE9yZGVycwAQa19jYW5jZWxlZE9yZGVycwIQa19jYW5jZWxlZE9yZGVycwAHa19vcmRlcgIHa19vcmRlcgAOa19vcmRlclJlcXVlc3QCCmtfb3JkZXJS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dG9yQWRkcmVzcwMJAQlpc0RlZmluZWQBBQ5jb29yZGluYXRvclN0cgQFYWRtaW4JAJ0IAgkBEUBleHRyTmF0aXZlKDEwNjIpAQkBBXZhbHVlAQUOY29vcmRpbmF0b3JTdHIFD2tfYWRtaW5fYWRkcmVzcwMJAQlpc0RlZmluZWQBBQVhZG1pbgkBC3ZhbHVlT3JFbHNlAgkAmwgCCQERQGV4dHJOYXRpdmUoMTA2MikBCQEFdmFsdWUBBQVhZG1pbgkArAICCQCsAgIJAKwCAgIHc3RhdHVzXwkApQgBBQR0aGlzAgFfCQDYBAEIBQJ0eAJpZAcJAAIBAi51bmFibGUgdG8gdmVyaWZ5OiBhZG1pbiBub3Qgc2V0IGluIGNvb3JkaW5hdG9yCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5mbvhOg==", "height": 2561305, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9LcQaLNXkXYqtYStNyvvREGvA84mY4gSubqhHMwgY85V Next: D3U1NZrYntYoAQiuS775RNur1fupPcWYyBm42cQB9gqC Diff:
Old | New | Differences | |
---|---|---|---|
166 | 166 | let refLink = orderPartList[8] | |
167 | 167 | let positionId = valueOrErrorMessage(parseInt(orderPartList[9]), "Invalid positionId") | |
168 | 168 | let limitPrice = valueOrErrorMessage(parseInt(orderPartList[10]), "Invalid limitPrice") | |
169 | - | $Tuple11(amm, trader, amountIn, leverage, type, triggerPrice, paymentUsdn, side, refLink, positionId, limitPrice) | |
169 | + | let expiration = if ((size(orderPartList) > 11)) | |
170 | + | then valueOrErrorMessage(parseInt(orderPartList[11]), "Invalid limitPrice") | |
171 | + | else 0 | |
172 | + | $Tuple12(amm, trader, amountIn, leverage, type, triggerPrice, paymentUsdn, side, refLink, positionId, limitPrice, expiration) | |
170 | 173 | } | |
171 | 174 | ||
172 | 175 | ||
230 | 233 | func getSpread (_price) = muld(_price, SPREAD_LIMIT) | |
231 | 234 | ||
232 | 235 | ||
233 | - | func saveOrder (_orderId,_amm,_trader,_amountIn,_leverage,_type,_triggerPrice,_paymentUsdn,_side,_refLink,_positionId,_limitPrice) = { | |
234 | - | let orderStr = makeString([_amm, _trader, toString(_amountIn), toString(_leverage), toString(_type), toString(_triggerPrice), toString(_paymentUsdn), toString(_side), _refLink, toString(_positionId), toString(_limitPrice)], ",") | |
236 | + | func saveOrder (_orderId,_amm,_trader,_amountIn,_leverage,_type,_triggerPrice,_paymentUsdn,_side,_refLink,_positionId,_limitPrice,_expiration) = { | |
237 | + | let orderStr = makeString([_amm, _trader, toString(_amountIn), toString(_leverage), toString(_type), toString(_triggerPrice), toString(_paymentUsdn), toString(_side), _refLink, toString(_positionId), toString(_limitPrice), toString(_expiration)], ",") | |
235 | 238 | [StringEntry(orderKey(_orderId), orderStr)] | |
236 | 239 | } | |
237 | 240 | ||
294 | 297 | let positionIds = getPositionIds(_amm, _trader) | |
295 | 298 | func cleanUpOne (_acc,_orderId) = { | |
296 | 299 | let orderIdInt = valueOrErrorMessage(parseInt(_orderId), "Invalid order id") | |
297 | - | let $t01115611351 = getOrder(orderIdInt) | |
298 | - | let _x1 = $t01115611351._1 | |
299 | - | let _x2 = $t01115611351._2 | |
300 | - | let _x3 = $t01115611351._3 | |
301 | - | let _x4 = $t01115611351._4 | |
302 | - | let _type = $t01115611351._5 | |
303 | - | let _x5 = $t01115611351._6 | |
304 | - | let _x6 = $t01115611351._7 | |
305 | - | let _x7 = $t01115611351._8 | |
306 | - | let _x8 = $t01115611351._9 | |
307 | - | let _positionId = $t01115611351._10 | |
308 | - | let _x9 = $t01115611351._11 | |
300 | + | let $t01135911575 = getOrder(orderIdInt) | |
301 | + | let _x1 = $t01135911575._1 | |
302 | + | let _x2 = $t01135911575._2 | |
303 | + | let _x3 = $t01135911575._3 | |
304 | + | let _x4 = $t01135911575._4 | |
305 | + | let _type = $t01135911575._5 | |
306 | + | let _x5 = $t01135911575._6 | |
307 | + | let _x6 = $t01135911575._7 | |
308 | + | let _x7 = $t01135911575._8 | |
309 | + | let _x8 = $t01135911575._9 | |
310 | + | let _positionId = $t01135911575._10 | |
311 | + | let _x9 = $t01135911575._11 | |
312 | + | let _expiration = $t01135911575._12 | |
309 | 313 | if (if (if (if ((_type == STOP)) | |
310 | 314 | then true | |
311 | 315 | else (_type == TAKE)) | |
321 | 325 | else _acc | |
322 | 326 | } | |
323 | 327 | ||
324 | - | let $ | |
328 | + | let $t01192812003 = { | |
325 | 329 | let $l = orders | |
326 | 330 | let $s = size($l) | |
327 | 331 | let $acc0 = $Tuple2(orders, nil) | |
335 | 339 | ||
336 | 340 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
337 | 341 | } | |
338 | - | let newOrders = $ | |
339 | - | let cancelActions = $ | |
342 | + | let newOrders = $t01192812003._1 | |
343 | + | let cancelActions = $t01192812003._2 | |
340 | 344 | ((cancelActions ++ updateTraderOrderCount(_amm, _trader, size(newOrders))) ++ updateOrderIdStr(makeString(newOrders, ","), _amm, _trader)) | |
341 | 345 | } | |
342 | 346 | ||
366 | 370 | ||
367 | 371 | ||
368 | 372 | @Callable(i) | |
369 | - | func createOrder (_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink,_stopTriggerPrice,_stopLimitPrice,_takeTriggerPrice,_takeLimitPrice) = { | |
373 | + | func createOrder (_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink,_stopTriggerPrice,_stopLimitPrice,_takeTriggerPrice,_takeLimitPrice,_expiration) = { | |
370 | 374 | let _trader = toString(i.caller) | |
371 | 375 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
372 | 376 | if ((cleanUp == cleanUp)) | |
373 | 377 | then if ((size(i.payments) > 1)) | |
374 | 378 | then throw("Invalid createOrder parameters: invalid payment count") | |
375 | 379 | else { | |
376 | - | let $ | |
380 | + | let $t01452114773 = if ((size(i.payments) == 1)) | |
377 | 381 | then $Tuple2(toBase58String(valueOrErrorMessage(i.payments[0].assetId, "Invalid asset id")), i.payments[0].amount) | |
378 | 382 | else $Tuple2("", 0) | |
379 | - | let paymentAssetId = $ | |
380 | - | let paymentAmount = $ | |
381 | - | let doCall = invoke(this, "internalCreateOrder", [_trader, _amm, _type, _triggerPrice, _limitPrice, _amountIn, _leverage, _side, _refLink, paymentAssetId, paymentAmount], nil) | |
383 | + | let paymentAssetId = $t01452114773._1 | |
384 | + | let paymentAmount = $t01452114773._2 | |
385 | + | let doCall = invoke(this, "internalCreateOrder", [_trader, _amm, _type, _triggerPrice, _limitPrice, _amountIn, _leverage, _side, _refLink, paymentAssetId, paymentAmount, _expiration], nil) | |
382 | 386 | if ((doCall == doCall)) | |
383 | 387 | then { | |
384 | 388 | let orderId = match doCall { | |
448 | 452 | else SHORT | |
449 | 453 | let doCreateStopOrder = if ((_stopTriggerPrice > 0)) | |
450 | 454 | then { | |
451 | - | let doCreateStopOrder = invoke(this, "internalCreateOrder", [_trader, _amm, STOP, _stopTriggerPrice, _stopLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0], nil) | |
455 | + | let doCreateStopOrder = invoke(this, "internalCreateOrder", [_trader, _amm, STOP, _stopTriggerPrice, _stopLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0, 0], nil) | |
452 | 456 | if ((doCreateStopOrder == doCreateStopOrder)) | |
453 | 457 | then nil | |
454 | 458 | else throw("Strict value is not equal to itself.") | |
458 | 462 | then { | |
459 | 463 | let doCreateTakeOrder = if ((_takeTriggerPrice > 0)) | |
460 | 464 | then { | |
461 | - | let doCreateTakeOrder = invoke(this, "internalCreateOrder", [_trader, _amm, TAKE, _takeTriggerPrice, _takeLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0], nil) | |
465 | + | let doCreateTakeOrder = invoke(this, "internalCreateOrder", [_trader, _amm, TAKE, _takeTriggerPrice, _takeLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0, 0], nil) | |
462 | 466 | if ((doCreateTakeOrder == doCreateTakeOrder)) | |
463 | 467 | then nil | |
464 | 468 | else throw("Strict value is not equal to itself.") | |
514 | 518 | ||
515 | 519 | ||
516 | 520 | @Callable(i) | |
517 | - | func internalCreateOrder (_trader,_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink,_paymentAssetId,_paymentAmount) = { | |
518 | - | let x1 = toString(!(initialized())) | |
519 | - | let x2 = toString(!(isWhitelist(_amm))) | |
520 | - | let x3 = toString((0 >= _triggerPrice)) | |
521 | - | let x4 = toString((0 > _limitPrice)) | |
522 | - | let x5 = toString((0 >= _amountIn)) | |
523 | - | let x6 = toString((0 > _leverage)) | |
524 | - | let x7 = toString(!(if ((_side == LONG)) | |
521 | + | func internalCreateOrder (_trader,_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink,_paymentAssetId,_paymentAmount,_expiration) = if (if (if (if (if (if (if (if (if (if (!(initialized())) | |
522 | + | then true | |
523 | + | else !(isWhitelist(_amm))) | |
524 | + | then true | |
525 | + | else (0 >= _triggerPrice)) | |
526 | + | then true | |
527 | + | else (0 > _limitPrice)) | |
528 | + | then true | |
529 | + | else (0 >= _amountIn)) | |
530 | + | then true | |
531 | + | else (0 > _leverage)) | |
532 | + | then true | |
533 | + | else !(if ((_side == LONG)) | |
525 | 534 | then true | |
526 | 535 | else (_side == SHORT))) | |
527 | - | let x8 = toString(!(if (if ((_type == STOP)) | |
536 | + | then true | |
537 | + | else !(if (if ((_type == STOP)) | |
528 | 538 | then true | |
529 | 539 | else (_type == TAKE)) | |
530 | 540 | then true | |
531 | 541 | else (_type == LIMIT))) | |
532 | - | let x9 = toString(!((i.caller == this))) | |
533 | - | let all = makeString([x1, x2, x3, x4, x5, x6, x7, x8, x9], ",") | |
534 | - | if (if (if (if (if (if (if (if (if (!(initialized())) | |
535 | - | then true | |
536 | - | else !(isWhitelist(_amm))) | |
537 | - | then true | |
538 | - | else (0 >= _triggerPrice)) | |
539 | - | then true | |
540 | - | else (0 > _limitPrice)) | |
541 | - | then true | |
542 | - | else (0 >= _amountIn)) | |
543 | - | then true | |
544 | - | else (0 > _leverage)) | |
545 | - | then true | |
546 | - | else !(if ((_side == LONG)) | |
542 | + | then true | |
543 | + | else !((i.caller == this))) | |
544 | + | then true | |
545 | + | else (0 > _expiration)) | |
546 | + | then throw("Invalid internalCreateOrder parameters") | |
547 | + | else { | |
548 | + | let orderId = (currentOrderId() + 1) | |
549 | + | let positionDirection = getPositionDirection(_side, _type) | |
550 | + | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) + 1) | |
551 | + | let positionSize = getPositionSize(_amm, _trader, positionDirection) | |
552 | + | let _direction = if (if (if ((positionSize == 0)) | |
547 | 553 | then true | |
548 | - | else ( | |
549 | - | then | |
550 | - | else | |
554 | + | else if ((positionSize > 0)) | |
555 | + | then (_side == LONG) | |
556 | + | else false) | |
551 | 557 | then true | |
552 | - | else (_type == TAKE)) | |
553 | - | then true | |
554 | - | else (_type == LIMIT))) | |
555 | - | then true | |
556 | - | else !((i.caller == this))) | |
557 | - | then throw(("Invalid internalCreateOrder parameters " + all)) | |
558 | - | else { | |
559 | - | let orderId = (currentOrderId() + 1) | |
560 | - | let positionDirection = getPositionDirection(_side, _type) | |
561 | - | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) + 1) | |
562 | - | let positionSize = getPositionSize(_amm, _trader, positionDirection) | |
563 | - | let _direction = if (if (if ((positionSize == 0)) | |
558 | + | else if ((0 > positionSize)) | |
559 | + | then (_side == SHORT) | |
560 | + | else false) | |
561 | + | then INCREASE | |
562 | + | else DECREASE | |
563 | + | if (if ((positionSize == 0)) | |
564 | + | then if ((_type == STOP)) | |
564 | 565 | then true | |
565 | - | else if ((positionSize > 0)) | |
566 | - | then (_side == LONG) | |
567 | - | else false) | |
568 | - | then true | |
569 | - | else if ((0 > positionSize)) | |
570 | - | then (_side == SHORT) | |
571 | - | else false) | |
572 | - | then INCREASE | |
573 | - | else DECREASE | |
574 | - | if (if ((positionSize == 0)) | |
575 | - | then if ((_type == STOP)) | |
576 | - | then true | |
577 | - | else (_type == TAKE) | |
578 | - | else false) | |
579 | - | then throw("Can not create STOP/TAKE order: no position") | |
580 | - | else { | |
581 | - | let usdnPayment = if ((_direction == INCREASE)) | |
582 | - | then if (if ((_paymentAssetId != toBase58String(quoteAsset()))) | |
566 | + | else (_type == TAKE) | |
567 | + | else false) | |
568 | + | then throw("Can not create STOP/TAKE order: no position") | |
569 | + | else { | |
570 | + | let usdnPayment = if ((_direction == INCREASE)) | |
571 | + | then if (if ((_paymentAssetId != toBase58String(quoteAsset()))) | |
572 | + | then true | |
573 | + | else (_paymentAmount != _amountIn)) | |
574 | + | then throw("Invalid createLimitOrder parameters: invalid payment") | |
575 | + | else { | |
576 | + | let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _paymentAmount)]) | |
577 | + | if ((stake == stake)) | |
578 | + | then _paymentAmount | |
579 | + | else throw("Strict value is not equal to itself.") | |
580 | + | } | |
581 | + | else 0 | |
582 | + | if ((usdnPayment == usdnPayment)) | |
583 | + | then { | |
584 | + | let positionId = if ((positionSize != 0)) | |
585 | + | then getPositionId(_amm, _trader, positionDirection) | |
586 | + | else 0 | |
587 | + | if (if (if ((_type == STOP)) | |
583 | 588 | then true | |
584 | - | else (_paymentAmount != _amountIn)) | |
585 | - | then throw("Invalid createLimitOrder parameters: invalid payment") | |
586 | - | else { | |
587 | - | let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _paymentAmount)]) | |
588 | - | if ((stake == stake)) | |
589 | - | then _paymentAmount | |
590 | - | else throw("Strict value is not equal to itself.") | |
591 | - | } | |
592 | - | else 0 | |
593 | - | if ((usdnPayment == usdnPayment)) | |
594 | - | then { | |
595 | - | let positionId = if ((positionSize != 0)) | |
596 | - | then getPositionId(_amm, _trader, positionDirection) | |
597 | - | else 0 | |
598 | - | if (if (if ((_type == STOP)) | |
599 | - | then true | |
600 | - | else (_type == TAKE)) | |
601 | - | then (positionId == 0) | |
602 | - | else false) | |
603 | - | then throw("STOP and TAKE order should be assigned to position with id != 0") | |
604 | - | else if ((newTraderOrderCount > MAX_TRADER_ORDERS_PER_AMM)) | |
605 | - | then throw("Invalid createLimitOrder parameters: order count") | |
606 | - | else { | |
607 | - | let changeSet = (((saveOrder(orderId, _amm, _trader, _amountIn, _leverage, _type, _triggerPrice, usdnPayment, _side, _refLink, positionId, _limitPrice) ++ addRemoveOrderId(orderId, _amm, _trader, true)) ++ updateTraderOrderCount(_amm, _trader, newTraderOrderCount)) ++ updateLastOrderId(orderId)) | |
608 | - | $Tuple2(changeSet, orderId) | |
609 | - | } | |
610 | - | } | |
611 | - | else throw("Strict value is not equal to itself.") | |
612 | - | } | |
613 | - | } | |
614 | - | } | |
589 | + | else (_type == TAKE)) | |
590 | + | then (positionId == 0) | |
591 | + | else false) | |
592 | + | then throw("STOP and TAKE order should be assigned to position with id != 0") | |
593 | + | else if ((newTraderOrderCount > MAX_TRADER_ORDERS_PER_AMM)) | |
594 | + | then throw("Invalid createLimitOrder parameters: order count") | |
595 | + | else { | |
596 | + | let changeSet = (((saveOrder(orderId, _amm, _trader, _amountIn, _leverage, _type, _triggerPrice, usdnPayment, _side, _refLink, positionId, _limitPrice, _expiration) ++ addRemoveOrderId(orderId, _amm, _trader, true)) ++ updateTraderOrderCount(_amm, _trader, newTraderOrderCount)) ++ updateLastOrderId(orderId)) | |
597 | + | $Tuple2(changeSet, orderId) | |
598 | + | } | |
599 | + | } | |
600 | + | else throw("Strict value is not equal to itself.") | |
601 | + | } | |
602 | + | } | |
615 | 603 | ||
616 | 604 | ||
617 | 605 | ||
618 | 606 | @Callable(i) | |
619 | 607 | func cancelOrder (_orderId) = { | |
620 | - | let $ | |
621 | - | let _amm = $ | |
622 | - | let _trader = $ | |
623 | - | let _amountIn = $ | |
624 | - | let _leverage = $ | |
625 | - | let _type = $ | |
626 | - | let _triggerPrice = $ | |
627 | - | let _amountUsdn = $ | |
628 | - | let _side = $ | |
629 | - | let _refLink = $ | |
630 | - | let _positionId = $ | |
631 | - | let _limitPrice = $ | |
608 | + | let $t02383724056 = getOrder(_orderId) | |
609 | + | let _amm = $t02383724056._1 | |
610 | + | let _trader = $t02383724056._2 | |
611 | + | let _amountIn = $t02383724056._3 | |
612 | + | let _leverage = $t02383724056._4 | |
613 | + | let _type = $t02383724056._5 | |
614 | + | let _triggerPrice = $t02383724056._6 | |
615 | + | let _amountUsdn = $t02383724056._7 | |
616 | + | let _side = $t02383724056._8 | |
617 | + | let _refLink = $t02383724056._9 | |
618 | + | let _positionId = $t02383724056._10 | |
619 | + | let _limitPrice = $t02383724056._11 | |
632 | 620 | if (if (if (!(initialized())) | |
633 | 621 | then true | |
634 | 622 | else !(isValid(_orderId))) | |
662 | 650 | ||
663 | 651 | @Callable(i) | |
664 | 652 | func executeOrder (_orderId) = { | |
665 | - | let $ | |
666 | - | let _amm = $ | |
667 | - | let _trader = $ | |
668 | - | let _amountIn = $ | |
669 | - | let _leverage = $ | |
670 | - | let _type = $ | |
671 | - | let _triggerPrice = $ | |
672 | - | let _amountUsdn = $ | |
673 | - | let _side = $ | |
674 | - | let _refLink = $ | |
675 | - | let _positionId = $ | |
676 | - | let _limitPrice = $ | |
653 | + | let $t02525425473 = getOrder(_orderId) | |
654 | + | let _amm = $t02525425473._1 | |
655 | + | let _trader = $t02525425473._2 | |
656 | + | let _amountIn = $t02525425473._3 | |
657 | + | let _leverage = $t02525425473._4 | |
658 | + | let _type = $t02525425473._5 | |
659 | + | let _triggerPrice = $t02525425473._6 | |
660 | + | let _amountUsdn = $t02525425473._7 | |
661 | + | let _side = $t02525425473._8 | |
662 | + | let _refLink = $t02525425473._9 | |
663 | + | let _positionId = $t02525425473._10 | |
664 | + | let _limitPrice = $t02525425473._11 | |
677 | 665 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
678 | 666 | if ((cleanUp == cleanUp)) | |
679 | 667 | then { | |
689 | 677 | let currentPositionId = if ((positionSize != 0)) | |
690 | 678 | then getPositionId(_amm, _trader, positionDirection) | |
691 | 679 | else 0 | |
692 | - | let $ | |
680 | + | let $t02598029358 = if ((_type == STOP)) | |
693 | 681 | then { | |
694 | 682 | let _positionDirection = if ((positionSize > 0)) | |
695 | 683 | then LONG | |
746 | 734 | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
747 | 735 | } | |
748 | 736 | else throw(("Invalid order type: " + toString(_type))) | |
749 | - | let method = $ | |
750 | - | let args = $ | |
751 | - | let payments = $ | |
737 | + | let method = $t02598029358._1 | |
738 | + | let args = $t02598029358._2 | |
739 | + | let payments = $t02598029358._3 | |
752 | 740 | let withdraw = if ((size(payments) == 1)) | |
753 | 741 | then { | |
754 | 742 | let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), payments[0].amount], nil) | |
782 | 770 | else LONG | |
783 | 771 | let makeTakeOrder = if (haveOrderRequest(_orderId, TAKE)) | |
784 | 772 | then { | |
785 | - | let $ | |
786 | - | let newOrderId = $ | |
787 | - | let newAmm = $ | |
788 | - | let newTrader = $ | |
789 | - | let newType = $ | |
790 | - | let newTriggerPrice = $ | |
791 | - | let newLimitPrice = $ | |
792 | - | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0], nil) | |
773 | + | let $t03032030519 = getOrderRequest(_orderId, TAKE) | |
774 | + | let newOrderId = $t03032030519._1 | |
775 | + | let newAmm = $t03032030519._2 | |
776 | + | let newTrader = $t03032030519._3 | |
777 | + | let newType = $t03032030519._4 | |
778 | + | let newTriggerPrice = $t03032030519._5 | |
779 | + | let newLimitPrice = $t03032030519._6 | |
780 | + | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
793 | 781 | if ((doCall == doCall)) | |
794 | 782 | then nil | |
795 | 783 | else throw("Strict value is not equal to itself.") | |
799 | 787 | then { | |
800 | 788 | let makeStopOrder = if (haveOrderRequest(_orderId, STOP)) | |
801 | 789 | then { | |
802 | - | let $ | |
803 | - | let newOrderId = $ | |
804 | - | let newAmm = $ | |
805 | - | let newTrader = $ | |
806 | - | let newType = $ | |
807 | - | let newTriggerPrice = $ | |
808 | - | let newLimitPrice = $ | |
809 | - | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0], nil) | |
790 | + | let $t03109231291 = getOrderRequest(_orderId, STOP) | |
791 | + | let newOrderId = $t03109231291._1 | |
792 | + | let newAmm = $t03109231291._2 | |
793 | + | let newTrader = $t03109231291._3 | |
794 | + | let newType = $t03109231291._4 | |
795 | + | let newTriggerPrice = $t03109231291._5 | |
796 | + | let newLimitPrice = $t03109231291._6 | |
797 | + | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
810 | 798 | if ((doCall == doCall)) | |
811 | 799 | then nil | |
812 | 800 | else throw("Strict value is not equal to itself.") |
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_address = "k_admin_address" | |
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_executedOrders = "k_executedOrders" | |
19 | 19 | ||
20 | 20 | let k_canceledOrders = "k_canceledOrders" | |
21 | 21 | ||
22 | 22 | let k_order = "k_order" | |
23 | 23 | ||
24 | 24 | let k_orderRequest = "k_orderReq" | |
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 = 10 | |
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 orderRequestKey (_orderId,_type) = ((((k_orderRequest + "_") + toString(_orderId)) + "_") + toString(_type)) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func traderOrderCountKey (_amm,_trader) = ((((k_traderOrderCnt + "_") + _amm) + "_") + _trader) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func traderOrderIdsKey (_amm,_trader) = ((((k_traderOrderIds + "_") + _amm) + "_") + _trader) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set") | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset)) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func managerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_manager_address)), "Manager not set") | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false) | |
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 haveOrderRequest (_orderId,_type) = { | |
136 | 136 | let key = orderRequestKey(_orderId, _type) | |
137 | 137 | isDefined(getString(this, key)) | |
138 | 138 | } | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func getOrderRequest (_orderId,_type) = { | |
142 | 142 | let key = orderRequestKey(_orderId, _type) | |
143 | 143 | let orderRequestStr = valueOrErrorMessage(getString(this, key), ("Not order request for key: " + key)) | |
144 | 144 | let orderRequestPartList = split(orderRequestStr, ",") | |
145 | 145 | let orderId = valueOrErrorMessage(parseInt(orderRequestPartList[0]), "Invalid orderId") | |
146 | 146 | let amm = orderRequestPartList[1] | |
147 | 147 | let trader = orderRequestPartList[2] | |
148 | 148 | let type = valueOrErrorMessage(parseInt(orderRequestPartList[3]), "Invalid type") | |
149 | 149 | let triggerPrice = valueOrErrorMessage(parseInt(orderRequestPartList[4]), "Invalid triggerPrice") | |
150 | 150 | let limitPrice = valueOrErrorMessage(parseInt(orderRequestPartList[5]), "Invalid limitPrice") | |
151 | 151 | $Tuple6(orderId, amm, trader, type, triggerPrice, limitPrice) | |
152 | 152 | } | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | func getOrder (_orderId) = { | |
156 | 156 | let orderStr = valueOrErrorMessage(getString(this, orderKey(_orderId)), ("Invalid order id: " + toString(_orderId))) | |
157 | 157 | let orderPartList = split(orderStr, ",") | |
158 | 158 | let amm = orderPartList[0] | |
159 | 159 | let trader = orderPartList[1] | |
160 | 160 | let amountIn = valueOrErrorMessage(parseInt(orderPartList[2]), "Invalid amountIn") | |
161 | 161 | let leverage = valueOrErrorMessage(parseInt(orderPartList[3]), "Invalid leverage") | |
162 | 162 | let type = valueOrErrorMessage(parseInt(orderPartList[4]), "Invalid type") | |
163 | 163 | let triggerPrice = valueOrErrorMessage(parseInt(orderPartList[5]), "Invalid triggerPrice") | |
164 | 164 | let paymentUsdn = valueOrErrorMessage(parseInt(orderPartList[6]), "Invalid paymentUsdn") | |
165 | 165 | let side = valueOrErrorMessage(parseInt(orderPartList[7]), "Invalid side") | |
166 | 166 | let refLink = orderPartList[8] | |
167 | 167 | let positionId = valueOrErrorMessage(parseInt(orderPartList[9]), "Invalid positionId") | |
168 | 168 | let limitPrice = valueOrErrorMessage(parseInt(orderPartList[10]), "Invalid limitPrice") | |
169 | - | $Tuple11(amm, trader, amountIn, leverage, type, triggerPrice, paymentUsdn, side, refLink, positionId, limitPrice) | |
169 | + | let expiration = if ((size(orderPartList) > 11)) | |
170 | + | then valueOrErrorMessage(parseInt(orderPartList[11]), "Invalid limitPrice") | |
171 | + | else 0 | |
172 | + | $Tuple12(amm, trader, amountIn, leverage, type, triggerPrice, paymentUsdn, side, refLink, positionId, limitPrice, expiration) | |
170 | 173 | } | |
171 | 174 | ||
172 | 175 | ||
173 | 176 | func getMarketPrice (_amm) = { | |
174 | 177 | let s = invoke(addressFromStringValue(_amm), "computeSpotPrice", nil, nil) | |
175 | 178 | if ((s == s)) | |
176 | 179 | then { | |
177 | 180 | let res = match s { | |
178 | 181 | case t: Int => | |
179 | 182 | t | |
180 | 183 | case _ => | |
181 | 184 | throw("Invalid computeSpotPrice result") | |
182 | 185 | } | |
183 | 186 | value(res) | |
184 | 187 | } | |
185 | 188 | else throw("Strict value is not equal to itself.") | |
186 | 189 | } | |
187 | 190 | ||
188 | 191 | ||
189 | 192 | func getFee (_amm,_trader) = { | |
190 | 193 | let s = invoke(addressFromStringValue(_amm), "computeFeeForTraderWithArtifact", [_trader, ""], nil) | |
191 | 194 | if ((s == s)) | |
192 | 195 | then { | |
193 | 196 | let res = match s { | |
194 | 197 | case t: (Int, Boolean) => | |
195 | 198 | t._1 | |
196 | 199 | case _ => | |
197 | 200 | throw("Invalid computeFeeForTraderWithArtifact result") | |
198 | 201 | } | |
199 | 202 | value(res) | |
200 | 203 | } | |
201 | 204 | else throw("Strict value is not equal to itself.") | |
202 | 205 | } | |
203 | 206 | ||
204 | 207 | ||
205 | 208 | func getPositionDirection (_orderSide,_orderType) = if (if ((_orderType == TAKE)) | |
206 | 209 | then true | |
207 | 210 | else (_orderType == STOP)) | |
208 | 211 | then if ((_orderSide == LONG)) | |
209 | 212 | then SHORT | |
210 | 213 | else LONG | |
211 | 214 | else _orderSide | |
212 | 215 | ||
213 | 216 | ||
214 | 217 | func getPositionSize (_amm,_trader,_direction) = { | |
215 | 218 | let amm = addressFromStringValue(_amm) | |
216 | 219 | let positionKey = ((_trader + "_") + toString(_direction)) | |
217 | 220 | let sizeKey = toCompositeKey(k_positionSize, positionKey) | |
218 | 221 | valueOrElse(getInteger(amm, sizeKey), 0) | |
219 | 222 | } | |
220 | 223 | ||
221 | 224 | ||
222 | 225 | func getPositionId (_amm,_trader,_direction) = { | |
223 | 226 | let amm = addressFromStringValue(_amm) | |
224 | 227 | let positionKey = ((_trader + "_") + toString(_direction)) | |
225 | 228 | let seqKey = toCompositeKey(k_positionSequence, positionKey) | |
226 | 229 | valueOrElse(getInteger(amm, seqKey), 0) | |
227 | 230 | } | |
228 | 231 | ||
229 | 232 | ||
230 | 233 | func getSpread (_price) = muld(_price, SPREAD_LIMIT) | |
231 | 234 | ||
232 | 235 | ||
233 | - | func saveOrder (_orderId,_amm,_trader,_amountIn,_leverage,_type,_triggerPrice,_paymentUsdn,_side,_refLink,_positionId,_limitPrice) = { | |
234 | - | let orderStr = makeString([_amm, _trader, toString(_amountIn), toString(_leverage), toString(_type), toString(_triggerPrice), toString(_paymentUsdn), toString(_side), _refLink, toString(_positionId), toString(_limitPrice)], ",") | |
236 | + | func saveOrder (_orderId,_amm,_trader,_amountIn,_leverage,_type,_triggerPrice,_paymentUsdn,_side,_refLink,_positionId,_limitPrice,_expiration) = { | |
237 | + | let orderStr = makeString([_amm, _trader, toString(_amountIn), toString(_leverage), toString(_type), toString(_triggerPrice), toString(_paymentUsdn), toString(_side), _refLink, toString(_positionId), toString(_limitPrice), toString(_expiration)], ",") | |
235 | 238 | [StringEntry(orderKey(_orderId), orderStr)] | |
236 | 239 | } | |
237 | 240 | ||
238 | 241 | ||
239 | 242 | func saveOrderRequest (_orderId,_amm,_trader,_type,_triggerPrice,_limitPrice) = { | |
240 | 243 | let orderReqStr = makeString([toString(_orderId), _amm, _trader, toString(_type), toString(_triggerPrice), toString(_limitPrice)], ",") | |
241 | 244 | [StringEntry(orderRequestKey(_orderId, _type), orderReqStr)] | |
242 | 245 | } | |
243 | 246 | ||
244 | 247 | ||
245 | 248 | func updateOrderIdStr (_orderIdsNewStr,_amm,_trader) = [StringEntry(traderOrderIdsKey(_amm, _trader), _orderIdsNewStr)] | |
246 | 249 | ||
247 | 250 | ||
248 | 251 | func addRemoveOrderIdList (_orderIds,_orderId,_amm,_trader,_add) = { | |
249 | 252 | let orderIdsNew = if (_add) | |
250 | 253 | then (_orderIds :+ toString(_orderId)) | |
251 | 254 | else removeByIndex(_orderIds, valueOrErrorMessage(indexOf(_orderIds, toString(_orderId)), ("No order with id: " + toString(_orderId)))) | |
252 | 255 | orderIdsNew | |
253 | 256 | } | |
254 | 257 | ||
255 | 258 | ||
256 | 259 | func addRemoveOrderId (_orderId,_amm,_trader,_add) = { | |
257 | 260 | let orderIds = traderAmmOrdersIds(_amm, _trader) | |
258 | 261 | let orderIdsNew = addRemoveOrderIdList(orderIds, _orderId, _amm, _trader, _add) | |
259 | 262 | let orderIdsNewStr = makeString(orderIdsNew, ",") | |
260 | 263 | updateOrderIdStr(orderIdsNewStr, _amm, _trader) | |
261 | 264 | } | |
262 | 265 | ||
263 | 266 | ||
264 | 267 | func updateTraderOrderCount (_amm,_trader,_count) = if ((0 > _count)) | |
265 | 268 | then throw(("Invalid order count: " + toString(_count))) | |
266 | 269 | else [IntegerEntry(traderOrderCountKey(_amm, _trader), _count)] | |
267 | 270 | ||
268 | 271 | ||
269 | 272 | func updateLastOrderId (_lastOrderId) = [IntegerEntry(k_lastOrderId, _lastOrderId)] | |
270 | 273 | ||
271 | 274 | ||
272 | 275 | func markExecuteOrder (_orderId) = [BooleanEntry(toCompositeKey(k_executedOrders, toString(_orderId)), true)] | |
273 | 276 | ||
274 | 277 | ||
275 | 278 | func markCancelOrder (_orderId) = [BooleanEntry(toCompositeKey(k_canceledOrders, toString(_orderId)), true)] | |
276 | 279 | ||
277 | 280 | ||
278 | 281 | func getPositionIds (_amm,_trader) = { | |
279 | 282 | let longPositionSize = getPositionSize(_amm, _trader, LONG) | |
280 | 283 | let currentLongPositionId = if ((longPositionSize != 0)) | |
281 | 284 | then getPositionId(_amm, _trader, LONG) | |
282 | 285 | else 0 | |
283 | 286 | let shortPositionSize = getPositionSize(_amm, _trader, SHORT) | |
284 | 287 | let currentShortPositionId = if ((shortPositionSize != 0)) | |
285 | 288 | then getPositionId(_amm, _trader, SHORT) | |
286 | 289 | else 0 | |
287 | 290 | [currentLongPositionId, currentShortPositionId] | |
288 | 291 | } | |
289 | 292 | ||
290 | 293 | ||
291 | 294 | @Callable(i) | |
292 | 295 | func cleanUpStaleOrders (_amm,_trader) = { | |
293 | 296 | let orders = traderAmmOrdersIds(_amm, _trader) | |
294 | 297 | let positionIds = getPositionIds(_amm, _trader) | |
295 | 298 | func cleanUpOne (_acc,_orderId) = { | |
296 | 299 | let orderIdInt = valueOrErrorMessage(parseInt(_orderId), "Invalid order id") | |
297 | - | let $t01115611351 = getOrder(orderIdInt) | |
298 | - | let _x1 = $t01115611351._1 | |
299 | - | let _x2 = $t01115611351._2 | |
300 | - | let _x3 = $t01115611351._3 | |
301 | - | let _x4 = $t01115611351._4 | |
302 | - | let _type = $t01115611351._5 | |
303 | - | let _x5 = $t01115611351._6 | |
304 | - | let _x6 = $t01115611351._7 | |
305 | - | let _x7 = $t01115611351._8 | |
306 | - | let _x8 = $t01115611351._9 | |
307 | - | let _positionId = $t01115611351._10 | |
308 | - | let _x9 = $t01115611351._11 | |
300 | + | let $t01135911575 = getOrder(orderIdInt) | |
301 | + | let _x1 = $t01135911575._1 | |
302 | + | let _x2 = $t01135911575._2 | |
303 | + | let _x3 = $t01135911575._3 | |
304 | + | let _x4 = $t01135911575._4 | |
305 | + | let _type = $t01135911575._5 | |
306 | + | let _x5 = $t01135911575._6 | |
307 | + | let _x6 = $t01135911575._7 | |
308 | + | let _x7 = $t01135911575._8 | |
309 | + | let _x8 = $t01135911575._9 | |
310 | + | let _positionId = $t01135911575._10 | |
311 | + | let _x9 = $t01135911575._11 | |
312 | + | let _expiration = $t01135911575._12 | |
309 | 313 | if (if (if (if ((_type == STOP)) | |
310 | 314 | then true | |
311 | 315 | else (_type == TAKE)) | |
312 | 316 | then (positionIds[0] != _positionId) | |
313 | 317 | else false) | |
314 | 318 | then (positionIds[1] != _positionId) | |
315 | 319 | else false) | |
316 | 320 | then { | |
317 | 321 | let change = markCancelOrder(orderIdInt) | |
318 | 322 | let newOrderList = addRemoveOrderIdList(_acc._1, orderIdInt, _amm, _trader, false) | |
319 | 323 | $Tuple2(newOrderList, (_acc._2 ++ change)) | |
320 | 324 | } | |
321 | 325 | else _acc | |
322 | 326 | } | |
323 | 327 | ||
324 | - | let $ | |
328 | + | let $t01192812003 = { | |
325 | 329 | let $l = orders | |
326 | 330 | let $s = size($l) | |
327 | 331 | let $acc0 = $Tuple2(orders, nil) | |
328 | 332 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
329 | 333 | then $a | |
330 | 334 | else cleanUpOne($a, $l[$i]) | |
331 | 335 | ||
332 | 336 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
333 | 337 | then $a | |
334 | 338 | else throw("List size exceeds 10") | |
335 | 339 | ||
336 | 340 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
337 | 341 | } | |
338 | - | let newOrders = $ | |
339 | - | let cancelActions = $ | |
342 | + | let newOrders = $t01192812003._1 | |
343 | + | let cancelActions = $t01192812003._2 | |
340 | 344 | ((cancelActions ++ updateTraderOrderCount(_amm, _trader, size(newOrders))) ++ updateOrderIdStr(makeString(newOrders, ","), _amm, _trader)) | |
341 | 345 | } | |
342 | 346 | ||
343 | 347 | ||
344 | 348 | ||
345 | 349 | @Callable(i) | |
346 | 350 | func setContext (_sender) = if ((i.caller != this)) | |
347 | 351 | then throw("Only self-call") | |
348 | 352 | else [StringEntry(k_sender, _sender)] | |
349 | 353 | ||
350 | 354 | ||
351 | 355 | ||
352 | 356 | @Callable(i) | |
353 | 357 | func resetContext () = if ((i.caller != this)) | |
354 | 358 | then throw("Only self-call") | |
355 | 359 | else [DeleteEntry(k_sender)] | |
356 | 360 | ||
357 | 361 | ||
358 | 362 | ||
359 | 363 | @Callable(i) | |
360 | 364 | func initialize (_coordinator) = if (if (initialized()) | |
361 | 365 | then true | |
362 | 366 | else (i.caller != this)) | |
363 | 367 | then throw("Unable to initialize") | |
364 | 368 | else [StringEntry(k_coordinatorAddress, toString(addressFromStringValue(_coordinator))), BooleanEntry(k_initialized, true)] | |
365 | 369 | ||
366 | 370 | ||
367 | 371 | ||
368 | 372 | @Callable(i) | |
369 | - | func createOrder (_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink,_stopTriggerPrice,_stopLimitPrice,_takeTriggerPrice,_takeLimitPrice) = { | |
373 | + | func createOrder (_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink,_stopTriggerPrice,_stopLimitPrice,_takeTriggerPrice,_takeLimitPrice,_expiration) = { | |
370 | 374 | let _trader = toString(i.caller) | |
371 | 375 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
372 | 376 | if ((cleanUp == cleanUp)) | |
373 | 377 | then if ((size(i.payments) > 1)) | |
374 | 378 | then throw("Invalid createOrder parameters: invalid payment count") | |
375 | 379 | else { | |
376 | - | let $ | |
380 | + | let $t01452114773 = if ((size(i.payments) == 1)) | |
377 | 381 | then $Tuple2(toBase58String(valueOrErrorMessage(i.payments[0].assetId, "Invalid asset id")), i.payments[0].amount) | |
378 | 382 | else $Tuple2("", 0) | |
379 | - | let paymentAssetId = $ | |
380 | - | let paymentAmount = $ | |
381 | - | let doCall = invoke(this, "internalCreateOrder", [_trader, _amm, _type, _triggerPrice, _limitPrice, _amountIn, _leverage, _side, _refLink, paymentAssetId, paymentAmount], nil) | |
383 | + | let paymentAssetId = $t01452114773._1 | |
384 | + | let paymentAmount = $t01452114773._2 | |
385 | + | let doCall = invoke(this, "internalCreateOrder", [_trader, _amm, _type, _triggerPrice, _limitPrice, _amountIn, _leverage, _side, _refLink, paymentAssetId, paymentAmount, _expiration], nil) | |
382 | 386 | if ((doCall == doCall)) | |
383 | 387 | then { | |
384 | 388 | let orderId = match doCall { | |
385 | 389 | case t: Int => | |
386 | 390 | t | |
387 | 391 | case _ => | |
388 | 392 | throw("Invalid ID of created order") | |
389 | 393 | } | |
390 | 394 | if ((_type == LIMIT)) | |
391 | 395 | then { | |
392 | 396 | let makeStop = if ((_stopTriggerPrice > 0)) | |
393 | 397 | then { | |
394 | 398 | let doMakeStop = invoke(this, "internalCreateOrderRequest", [_trader, _amm, orderId, STOP, _stopTriggerPrice, _stopLimitPrice], nil) | |
395 | 399 | if ((doMakeStop == doMakeStop)) | |
396 | 400 | then nil | |
397 | 401 | else throw("Strict value is not equal to itself.") | |
398 | 402 | } | |
399 | 403 | else nil | |
400 | 404 | let makeTake = if ((_takeTriggerPrice > 0)) | |
401 | 405 | then { | |
402 | 406 | let doMakeTake = invoke(this, "internalCreateOrderRequest", [_trader, _amm, orderId, TAKE, _takeTriggerPrice, _takeLimitPrice], nil) | |
403 | 407 | if ((doMakeTake == doMakeTake)) | |
404 | 408 | then nil | |
405 | 409 | else throw("Strict value is not equal to itself.") | |
406 | 410 | } | |
407 | 411 | else nil | |
408 | 412 | (makeStop ++ makeTake) | |
409 | 413 | } | |
410 | 414 | else nil | |
411 | 415 | } | |
412 | 416 | else throw("Strict value is not equal to itself.") | |
413 | 417 | } | |
414 | 418 | else throw("Strict value is not equal to itself.") | |
415 | 419 | } | |
416 | 420 | ||
417 | 421 | ||
418 | 422 | ||
419 | 423 | @Callable(i) | |
420 | 424 | func increasePositionWithStopLoss (_amm,_direction,_leverage,_minBaseAssetAmount,_refLink,_stopTriggerPrice,_stopLimitPrice,_takeTriggerPrice,_takeLimitPrice) = { | |
421 | 425 | let _trader = toString(i.caller) | |
422 | 426 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
423 | 427 | if ((cleanUp == cleanUp)) | |
424 | 428 | then if (if (!(initialized())) | |
425 | 429 | then true | |
426 | 430 | else !(isWhitelist(_amm))) | |
427 | 431 | then throw("Invalid increasePositionWithStopLoss parameters") | |
428 | 432 | else { | |
429 | 433 | let positionSize = getPositionSize(_amm, _trader, _direction) | |
430 | 434 | if ((positionSize != 0)) | |
431 | 435 | then throw("Invalid increasePositionWithStopLoss parameters: only new position") | |
432 | 436 | else { | |
433 | 437 | let doSetContext = invoke(this, "setContext", [_trader], nil) | |
434 | 438 | if ((doSetContext == doSetContext)) | |
435 | 439 | then { | |
436 | 440 | let doClosePosition = invoke(addressFromStringValue(_amm), "increasePosition", [_direction, _leverage, _minBaseAssetAmount, _refLink], i.payments) | |
437 | 441 | if ((doClosePosition == doClosePosition)) | |
438 | 442 | then { | |
439 | 443 | let doResetContext = invoke(this, "resetContext", nil, nil) | |
440 | 444 | if ((doResetContext == doResetContext)) | |
441 | 445 | then { | |
442 | 446 | let openedPositionSize = getPositionSize(_amm, _trader, _direction) | |
443 | 447 | if ((openedPositionSize == openedPositionSize)) | |
444 | 448 | then { | |
445 | 449 | let amountIn = abs(openedPositionSize) | |
446 | 450 | let stopLossSide = if ((0 > openedPositionSize)) | |
447 | 451 | then LONG | |
448 | 452 | else SHORT | |
449 | 453 | let doCreateStopOrder = if ((_stopTriggerPrice > 0)) | |
450 | 454 | then { | |
451 | - | let doCreateStopOrder = invoke(this, "internalCreateOrder", [_trader, _amm, STOP, _stopTriggerPrice, _stopLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0], nil) | |
455 | + | let doCreateStopOrder = invoke(this, "internalCreateOrder", [_trader, _amm, STOP, _stopTriggerPrice, _stopLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0, 0], nil) | |
452 | 456 | if ((doCreateStopOrder == doCreateStopOrder)) | |
453 | 457 | then nil | |
454 | 458 | else throw("Strict value is not equal to itself.") | |
455 | 459 | } | |
456 | 460 | else nil | |
457 | 461 | if ((doCreateStopOrder == doCreateStopOrder)) | |
458 | 462 | then { | |
459 | 463 | let doCreateTakeOrder = if ((_takeTriggerPrice > 0)) | |
460 | 464 | then { | |
461 | - | let doCreateTakeOrder = invoke(this, "internalCreateOrder", [_trader, _amm, TAKE, _takeTriggerPrice, _takeLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0], nil) | |
465 | + | let doCreateTakeOrder = invoke(this, "internalCreateOrder", [_trader, _amm, TAKE, _takeTriggerPrice, _takeLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0, 0], nil) | |
462 | 466 | if ((doCreateTakeOrder == doCreateTakeOrder)) | |
463 | 467 | then nil | |
464 | 468 | else throw("Strict value is not equal to itself.") | |
465 | 469 | } | |
466 | 470 | else nil | |
467 | 471 | if ((doCreateTakeOrder == doCreateTakeOrder)) | |
468 | 472 | then nil | |
469 | 473 | else throw("Strict value is not equal to itself.") | |
470 | 474 | } | |
471 | 475 | else throw("Strict value is not equal to itself.") | |
472 | 476 | } | |
473 | 477 | else throw("Strict value is not equal to itself.") | |
474 | 478 | } | |
475 | 479 | else throw("Strict value is not equal to itself.") | |
476 | 480 | } | |
477 | 481 | else throw("Strict value is not equal to itself.") | |
478 | 482 | } | |
479 | 483 | else throw("Strict value is not equal to itself.") | |
480 | 484 | } | |
481 | 485 | } | |
482 | 486 | else throw("Strict value is not equal to itself.") | |
483 | 487 | } | |
484 | 488 | ||
485 | 489 | ||
486 | 490 | ||
487 | 491 | @Callable(i) | |
488 | 492 | func internalMarkOrderExecuted (_amm,_trader,_orderId) = if (if (if (!(initialized())) | |
489 | 493 | then true | |
490 | 494 | else !(isWhitelist(_amm))) | |
491 | 495 | then true | |
492 | 496 | else !((i.caller == this))) | |
493 | 497 | then throw("Invalid internalMarkOrderExecuted parameters") | |
494 | 498 | else { | |
495 | 499 | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) - 1) | |
496 | 500 | ((updateTraderOrderCount(_amm, _trader, newTraderOrderCount) ++ addRemoveOrderId(_orderId, _amm, _trader, false)) ++ markExecuteOrder(_orderId)) | |
497 | 501 | } | |
498 | 502 | ||
499 | 503 | ||
500 | 504 | ||
501 | 505 | @Callable(i) | |
502 | 506 | func internalCreateOrderRequest (_trader,_amm,_orderId,_type,_triggerPrice,_limitPrice) = if (if (if (if (if (!(initialized())) | |
503 | 507 | then true | |
504 | 508 | else !(isWhitelist(_amm))) | |
505 | 509 | then true | |
506 | 510 | else (0 >= _triggerPrice)) | |
507 | 511 | then true | |
508 | 512 | else (0 > _limitPrice)) | |
509 | 513 | then true | |
510 | 514 | else !((i.caller == this))) | |
511 | 515 | then throw("Invalid internalCreateOrderRequest parameters") | |
512 | 516 | else saveOrderRequest(_orderId, _amm, _trader, _type, _triggerPrice, _limitPrice) | |
513 | 517 | ||
514 | 518 | ||
515 | 519 | ||
516 | 520 | @Callable(i) | |
517 | - | func internalCreateOrder (_trader,_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink,_paymentAssetId,_paymentAmount) = { | |
518 | - | let x1 = toString(!(initialized())) | |
519 | - | let x2 = toString(!(isWhitelist(_amm))) | |
520 | - | let x3 = toString((0 >= _triggerPrice)) | |
521 | - | let x4 = toString((0 > _limitPrice)) | |
522 | - | let x5 = toString((0 >= _amountIn)) | |
523 | - | let x6 = toString((0 > _leverage)) | |
524 | - | let x7 = toString(!(if ((_side == LONG)) | |
521 | + | func internalCreateOrder (_trader,_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink,_paymentAssetId,_paymentAmount,_expiration) = if (if (if (if (if (if (if (if (if (if (!(initialized())) | |
522 | + | then true | |
523 | + | else !(isWhitelist(_amm))) | |
524 | + | then true | |
525 | + | else (0 >= _triggerPrice)) | |
526 | + | then true | |
527 | + | else (0 > _limitPrice)) | |
528 | + | then true | |
529 | + | else (0 >= _amountIn)) | |
530 | + | then true | |
531 | + | else (0 > _leverage)) | |
532 | + | then true | |
533 | + | else !(if ((_side == LONG)) | |
525 | 534 | then true | |
526 | 535 | else (_side == SHORT))) | |
527 | - | let x8 = toString(!(if (if ((_type == STOP)) | |
536 | + | then true | |
537 | + | else !(if (if ((_type == STOP)) | |
528 | 538 | then true | |
529 | 539 | else (_type == TAKE)) | |
530 | 540 | then true | |
531 | 541 | else (_type == LIMIT))) | |
532 | - | let x9 = toString(!((i.caller == this))) | |
533 | - | let all = makeString([x1, x2, x3, x4, x5, x6, x7, x8, x9], ",") | |
534 | - | if (if (if (if (if (if (if (if (if (!(initialized())) | |
535 | - | then true | |
536 | - | else !(isWhitelist(_amm))) | |
537 | - | then true | |
538 | - | else (0 >= _triggerPrice)) | |
539 | - | then true | |
540 | - | else (0 > _limitPrice)) | |
541 | - | then true | |
542 | - | else (0 >= _amountIn)) | |
543 | - | then true | |
544 | - | else (0 > _leverage)) | |
545 | - | then true | |
546 | - | else !(if ((_side == LONG)) | |
542 | + | then true | |
543 | + | else !((i.caller == this))) | |
544 | + | then true | |
545 | + | else (0 > _expiration)) | |
546 | + | then throw("Invalid internalCreateOrder parameters") | |
547 | + | else { | |
548 | + | let orderId = (currentOrderId() + 1) | |
549 | + | let positionDirection = getPositionDirection(_side, _type) | |
550 | + | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) + 1) | |
551 | + | let positionSize = getPositionSize(_amm, _trader, positionDirection) | |
552 | + | let _direction = if (if (if ((positionSize == 0)) | |
547 | 553 | then true | |
548 | - | else ( | |
549 | - | then | |
550 | - | else | |
554 | + | else if ((positionSize > 0)) | |
555 | + | then (_side == LONG) | |
556 | + | else false) | |
551 | 557 | then true | |
552 | - | else (_type == TAKE)) | |
553 | - | then true | |
554 | - | else (_type == LIMIT))) | |
555 | - | then true | |
556 | - | else !((i.caller == this))) | |
557 | - | then throw(("Invalid internalCreateOrder parameters " + all)) | |
558 | - | else { | |
559 | - | let orderId = (currentOrderId() + 1) | |
560 | - | let positionDirection = getPositionDirection(_side, _type) | |
561 | - | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) + 1) | |
562 | - | let positionSize = getPositionSize(_amm, _trader, positionDirection) | |
563 | - | let _direction = if (if (if ((positionSize == 0)) | |
558 | + | else if ((0 > positionSize)) | |
559 | + | then (_side == SHORT) | |
560 | + | else false) | |
561 | + | then INCREASE | |
562 | + | else DECREASE | |
563 | + | if (if ((positionSize == 0)) | |
564 | + | then if ((_type == STOP)) | |
564 | 565 | then true | |
565 | - | else if ((positionSize > 0)) | |
566 | - | then (_side == LONG) | |
567 | - | else false) | |
568 | - | then true | |
569 | - | else if ((0 > positionSize)) | |
570 | - | then (_side == SHORT) | |
571 | - | else false) | |
572 | - | then INCREASE | |
573 | - | else DECREASE | |
574 | - | if (if ((positionSize == 0)) | |
575 | - | then if ((_type == STOP)) | |
576 | - | then true | |
577 | - | else (_type == TAKE) | |
578 | - | else false) | |
579 | - | then throw("Can not create STOP/TAKE order: no position") | |
580 | - | else { | |
581 | - | let usdnPayment = if ((_direction == INCREASE)) | |
582 | - | then if (if ((_paymentAssetId != toBase58String(quoteAsset()))) | |
566 | + | else (_type == TAKE) | |
567 | + | else false) | |
568 | + | then throw("Can not create STOP/TAKE order: no position") | |
569 | + | else { | |
570 | + | let usdnPayment = if ((_direction == INCREASE)) | |
571 | + | then if (if ((_paymentAssetId != toBase58String(quoteAsset()))) | |
572 | + | then true | |
573 | + | else (_paymentAmount != _amountIn)) | |
574 | + | then throw("Invalid createLimitOrder parameters: invalid payment") | |
575 | + | else { | |
576 | + | let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _paymentAmount)]) | |
577 | + | if ((stake == stake)) | |
578 | + | then _paymentAmount | |
579 | + | else throw("Strict value is not equal to itself.") | |
580 | + | } | |
581 | + | else 0 | |
582 | + | if ((usdnPayment == usdnPayment)) | |
583 | + | then { | |
584 | + | let positionId = if ((positionSize != 0)) | |
585 | + | then getPositionId(_amm, _trader, positionDirection) | |
586 | + | else 0 | |
587 | + | if (if (if ((_type == STOP)) | |
583 | 588 | then true | |
584 | - | else (_paymentAmount != _amountIn)) | |
585 | - | then throw("Invalid createLimitOrder parameters: invalid payment") | |
586 | - | else { | |
587 | - | let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _paymentAmount)]) | |
588 | - | if ((stake == stake)) | |
589 | - | then _paymentAmount | |
590 | - | else throw("Strict value is not equal to itself.") | |
591 | - | } | |
592 | - | else 0 | |
593 | - | if ((usdnPayment == usdnPayment)) | |
594 | - | then { | |
595 | - | let positionId = if ((positionSize != 0)) | |
596 | - | then getPositionId(_amm, _trader, positionDirection) | |
597 | - | else 0 | |
598 | - | if (if (if ((_type == STOP)) | |
599 | - | then true | |
600 | - | else (_type == TAKE)) | |
601 | - | then (positionId == 0) | |
602 | - | else false) | |
603 | - | then throw("STOP and TAKE order should be assigned to position with id != 0") | |
604 | - | else if ((newTraderOrderCount > MAX_TRADER_ORDERS_PER_AMM)) | |
605 | - | then throw("Invalid createLimitOrder parameters: order count") | |
606 | - | else { | |
607 | - | let changeSet = (((saveOrder(orderId, _amm, _trader, _amountIn, _leverage, _type, _triggerPrice, usdnPayment, _side, _refLink, positionId, _limitPrice) ++ addRemoveOrderId(orderId, _amm, _trader, true)) ++ updateTraderOrderCount(_amm, _trader, newTraderOrderCount)) ++ updateLastOrderId(orderId)) | |
608 | - | $Tuple2(changeSet, orderId) | |
609 | - | } | |
610 | - | } | |
611 | - | else throw("Strict value is not equal to itself.") | |
612 | - | } | |
613 | - | } | |
614 | - | } | |
589 | + | else (_type == TAKE)) | |
590 | + | then (positionId == 0) | |
591 | + | else false) | |
592 | + | then throw("STOP and TAKE order should be assigned to position with id != 0") | |
593 | + | else if ((newTraderOrderCount > MAX_TRADER_ORDERS_PER_AMM)) | |
594 | + | then throw("Invalid createLimitOrder parameters: order count") | |
595 | + | else { | |
596 | + | let changeSet = (((saveOrder(orderId, _amm, _trader, _amountIn, _leverage, _type, _triggerPrice, usdnPayment, _side, _refLink, positionId, _limitPrice, _expiration) ++ addRemoveOrderId(orderId, _amm, _trader, true)) ++ updateTraderOrderCount(_amm, _trader, newTraderOrderCount)) ++ updateLastOrderId(orderId)) | |
597 | + | $Tuple2(changeSet, orderId) | |
598 | + | } | |
599 | + | } | |
600 | + | else throw("Strict value is not equal to itself.") | |
601 | + | } | |
602 | + | } | |
615 | 603 | ||
616 | 604 | ||
617 | 605 | ||
618 | 606 | @Callable(i) | |
619 | 607 | func cancelOrder (_orderId) = { | |
620 | - | let $ | |
621 | - | let _amm = $ | |
622 | - | let _trader = $ | |
623 | - | let _amountIn = $ | |
624 | - | let _leverage = $ | |
625 | - | let _type = $ | |
626 | - | let _triggerPrice = $ | |
627 | - | let _amountUsdn = $ | |
628 | - | let _side = $ | |
629 | - | let _refLink = $ | |
630 | - | let _positionId = $ | |
631 | - | let _limitPrice = $ | |
608 | + | let $t02383724056 = getOrder(_orderId) | |
609 | + | let _amm = $t02383724056._1 | |
610 | + | let _trader = $t02383724056._2 | |
611 | + | let _amountIn = $t02383724056._3 | |
612 | + | let _leverage = $t02383724056._4 | |
613 | + | let _type = $t02383724056._5 | |
614 | + | let _triggerPrice = $t02383724056._6 | |
615 | + | let _amountUsdn = $t02383724056._7 | |
616 | + | let _side = $t02383724056._8 | |
617 | + | let _refLink = $t02383724056._9 | |
618 | + | let _positionId = $t02383724056._10 | |
619 | + | let _limitPrice = $t02383724056._11 | |
632 | 620 | if (if (if (!(initialized())) | |
633 | 621 | then true | |
634 | 622 | else !(isValid(_orderId))) | |
635 | 623 | then true | |
636 | 624 | else !((toString(i.caller) == _trader))) | |
637 | 625 | then throw("Invalid cancelOrder parameters") | |
638 | 626 | else { | |
639 | 627 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
640 | 628 | if ((cleanUp == cleanUp)) | |
641 | 629 | then { | |
642 | 630 | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) - 1) | |
643 | 631 | let withdraw = if ((_amountUsdn > 0)) | |
644 | 632 | then { | |
645 | 633 | let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), _amountUsdn], nil) | |
646 | 634 | if ((unstake == unstake)) | |
647 | 635 | then nil | |
648 | 636 | else throw("Strict value is not equal to itself.") | |
649 | 637 | } | |
650 | 638 | else nil | |
651 | 639 | if ((withdraw == withdraw)) | |
652 | 640 | then (((markCancelOrder(_orderId) ++ addRemoveOrderId(_orderId, _amm, _trader, false)) ++ updateTraderOrderCount(_amm, _trader, newTraderOrderCount)) ++ (if ((_amountUsdn > 0)) | |
653 | 641 | then [ScriptTransfer(i.caller, _amountUsdn, quoteAsset())] | |
654 | 642 | else nil)) | |
655 | 643 | else throw("Strict value is not equal to itself.") | |
656 | 644 | } | |
657 | 645 | else throw("Strict value is not equal to itself.") | |
658 | 646 | } | |
659 | 647 | } | |
660 | 648 | ||
661 | 649 | ||
662 | 650 | ||
663 | 651 | @Callable(i) | |
664 | 652 | func executeOrder (_orderId) = { | |
665 | - | let $ | |
666 | - | let _amm = $ | |
667 | - | let _trader = $ | |
668 | - | let _amountIn = $ | |
669 | - | let _leverage = $ | |
670 | - | let _type = $ | |
671 | - | let _triggerPrice = $ | |
672 | - | let _amountUsdn = $ | |
673 | - | let _side = $ | |
674 | - | let _refLink = $ | |
675 | - | let _positionId = $ | |
676 | - | let _limitPrice = $ | |
653 | + | let $t02525425473 = getOrder(_orderId) | |
654 | + | let _amm = $t02525425473._1 | |
655 | + | let _trader = $t02525425473._2 | |
656 | + | let _amountIn = $t02525425473._3 | |
657 | + | let _leverage = $t02525425473._4 | |
658 | + | let _type = $t02525425473._5 | |
659 | + | let _triggerPrice = $t02525425473._6 | |
660 | + | let _amountUsdn = $t02525425473._7 | |
661 | + | let _side = $t02525425473._8 | |
662 | + | let _refLink = $t02525425473._9 | |
663 | + | let _positionId = $t02525425473._10 | |
664 | + | let _limitPrice = $t02525425473._11 | |
677 | 665 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
678 | 666 | if ((cleanUp == cleanUp)) | |
679 | 667 | then { | |
680 | 668 | let positionDirection = getPositionDirection(_side, _type) | |
681 | 669 | if (if (!(initialized())) | |
682 | 670 | then true | |
683 | 671 | else !(isValid(_orderId))) | |
684 | 672 | then throw("Invalid executeOrder parameters") | |
685 | 673 | else { | |
686 | 674 | let positionSize = getPositionSize(_amm, _trader, positionDirection) | |
687 | 675 | if ((positionSize == positionSize)) | |
688 | 676 | then { | |
689 | 677 | let currentPositionId = if ((positionSize != 0)) | |
690 | 678 | then getPositionId(_amm, _trader, positionDirection) | |
691 | 679 | else 0 | |
692 | - | let $ | |
680 | + | let $t02598029358 = if ((_type == STOP)) | |
693 | 681 | then { | |
694 | 682 | let _positionDirection = if ((positionSize > 0)) | |
695 | 683 | then LONG | |
696 | 684 | else if ((0 > positionSize)) | |
697 | 685 | then SHORT | |
698 | 686 | else throw("Can not execute STOP order: no open position") | |
699 | 687 | let marketPrice = getMarketPrice(_amm) | |
700 | 688 | let isExecutable = if ((_side == _positionDirection)) | |
701 | 689 | then throw("Can not execute STOP order: reduce only") | |
702 | 690 | else if ((currentPositionId != _positionId)) | |
703 | 691 | then throw("Can not execute STOP order: position closed") | |
704 | 692 | else if ((_positionDirection == LONG)) | |
705 | 693 | then (_triggerPrice >= marketPrice) | |
706 | 694 | else (marketPrice >= _triggerPrice) | |
707 | 695 | if (isExecutable) | |
708 | 696 | then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false], nil) | |
709 | 697 | else throw("Can not execute STOP order: triggerPrice mismatch") | |
710 | 698 | } | |
711 | 699 | else if ((_type == TAKE)) | |
712 | 700 | then { | |
713 | 701 | let _positionDirection = if ((positionSize > 0)) | |
714 | 702 | then LONG | |
715 | 703 | else if ((0 > positionSize)) | |
716 | 704 | then SHORT | |
717 | 705 | else throw("Can not execute STOP order: no open position") | |
718 | 706 | let marketPrice = getMarketPrice(_amm) | |
719 | 707 | let isExecutable = if ((_side == _positionDirection)) | |
720 | 708 | then throw("Can not execute TAKE order: reduce only") | |
721 | 709 | else if ((currentPositionId != _positionId)) | |
722 | 710 | then throw(((("Can not execute TAKE order: position closed " + toString(currentPositionId)) + "!=") + toString(_positionId))) | |
723 | 711 | else if ((_positionDirection == LONG)) | |
724 | 712 | then (marketPrice >= _triggerPrice) | |
725 | 713 | else (_triggerPrice >= marketPrice) | |
726 | 714 | if (isExecutable) | |
727 | 715 | then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false], nil) | |
728 | 716 | else throw("Can not execute TAKE order: triggerPrice mismatch") | |
729 | 717 | } | |
730 | 718 | else if ((_type == LIMIT)) | |
731 | 719 | then { | |
732 | 720 | let marketPrice = getMarketPrice(_amm) | |
733 | 721 | let spread = if ((_limitPrice == 0)) | |
734 | 722 | then getSpread(_triggerPrice) | |
735 | 723 | else abs((_triggerPrice - _limitPrice)) | |
736 | 724 | let isExecutable = if ((marketPrice >= (_triggerPrice - spread))) | |
737 | 725 | then ((_triggerPrice + spread) >= marketPrice) | |
738 | 726 | else false | |
739 | 727 | if (isExecutable) | |
740 | 728 | then { | |
741 | 729 | let amountInWithFee = (_amountUsdn - muld(_amountUsdn, getFee(_amm, _trader))) | |
742 | 730 | $Tuple3("increasePosition", [_side, _leverage, if ((_limitPrice == 0)) | |
743 | 731 | then 0 | |
744 | 732 | else divd(amountInWithFee, _limitPrice), _refLink], [AttachedPayment(quoteAsset(), _amountUsdn)]) | |
745 | 733 | } | |
746 | 734 | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
747 | 735 | } | |
748 | 736 | else throw(("Invalid order type: " + toString(_type))) | |
749 | - | let method = $ | |
750 | - | let args = $ | |
751 | - | let payments = $ | |
737 | + | let method = $t02598029358._1 | |
738 | + | let args = $t02598029358._2 | |
739 | + | let payments = $t02598029358._3 | |
752 | 740 | let withdraw = if ((size(payments) == 1)) | |
753 | 741 | then { | |
754 | 742 | let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), payments[0].amount], nil) | |
755 | 743 | if ((unstake == unstake)) | |
756 | 744 | then nil | |
757 | 745 | else throw("Strict value is not equal to itself.") | |
758 | 746 | } | |
759 | 747 | else nil | |
760 | 748 | if ((withdraw == withdraw)) | |
761 | 749 | then { | |
762 | 750 | let doSetContext = invoke(this, "setContext", [_trader], nil) | |
763 | 751 | if ((doSetContext == doSetContext)) | |
764 | 752 | then { | |
765 | 753 | let doClosePosition = invoke(addressFromStringValue(_amm), method, args, payments) | |
766 | 754 | if ((doClosePosition == doClosePosition)) | |
767 | 755 | then { | |
768 | 756 | let doResetContext = invoke(this, "resetContext", nil, nil) | |
769 | 757 | if ((doResetContext == doResetContext)) | |
770 | 758 | then { | |
771 | 759 | let executeOrderRequest = if ((_type == LIMIT)) | |
772 | 760 | then { | |
773 | 761 | let newPositionSize = getPositionSize(_amm, _trader, positionDirection) | |
774 | 762 | if ((newPositionSize == newPositionSize)) | |
775 | 763 | then { | |
776 | 764 | let newPositionId = getPositionId(_amm, _trader, positionDirection) | |
777 | 765 | if ((newPositionId == newPositionId)) | |
778 | 766 | then { | |
779 | 767 | let positionSizeDelta = (newPositionSize - positionSize) | |
780 | 768 | let closeOrderSide = if ((newPositionSize > 0)) | |
781 | 769 | then SHORT | |
782 | 770 | else LONG | |
783 | 771 | let makeTakeOrder = if (haveOrderRequest(_orderId, TAKE)) | |
784 | 772 | then { | |
785 | - | let $ | |
786 | - | let newOrderId = $ | |
787 | - | let newAmm = $ | |
788 | - | let newTrader = $ | |
789 | - | let newType = $ | |
790 | - | let newTriggerPrice = $ | |
791 | - | let newLimitPrice = $ | |
792 | - | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0], nil) | |
773 | + | let $t03032030519 = getOrderRequest(_orderId, TAKE) | |
774 | + | let newOrderId = $t03032030519._1 | |
775 | + | let newAmm = $t03032030519._2 | |
776 | + | let newTrader = $t03032030519._3 | |
777 | + | let newType = $t03032030519._4 | |
778 | + | let newTriggerPrice = $t03032030519._5 | |
779 | + | let newLimitPrice = $t03032030519._6 | |
780 | + | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
793 | 781 | if ((doCall == doCall)) | |
794 | 782 | then nil | |
795 | 783 | else throw("Strict value is not equal to itself.") | |
796 | 784 | } | |
797 | 785 | else nil | |
798 | 786 | if ((makeTakeOrder == makeTakeOrder)) | |
799 | 787 | then { | |
800 | 788 | let makeStopOrder = if (haveOrderRequest(_orderId, STOP)) | |
801 | 789 | then { | |
802 | - | let $ | |
803 | - | let newOrderId = $ | |
804 | - | let newAmm = $ | |
805 | - | let newTrader = $ | |
806 | - | let newType = $ | |
807 | - | let newTriggerPrice = $ | |
808 | - | let newLimitPrice = $ | |
809 | - | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0], nil) | |
790 | + | let $t03109231291 = getOrderRequest(_orderId, STOP) | |
791 | + | let newOrderId = $t03109231291._1 | |
792 | + | let newAmm = $t03109231291._2 | |
793 | + | let newTrader = $t03109231291._3 | |
794 | + | let newType = $t03109231291._4 | |
795 | + | let newTriggerPrice = $t03109231291._5 | |
796 | + | let newLimitPrice = $t03109231291._6 | |
797 | + | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
810 | 798 | if ((doCall == doCall)) | |
811 | 799 | then nil | |
812 | 800 | else throw("Strict value is not equal to itself.") | |
813 | 801 | } | |
814 | 802 | else nil | |
815 | 803 | if ((makeStopOrder == makeStopOrder)) | |
816 | 804 | then (makeTakeOrder ++ makeStopOrder) | |
817 | 805 | else throw("Strict value is not equal to itself.") | |
818 | 806 | } | |
819 | 807 | else throw("Strict value is not equal to itself.") | |
820 | 808 | } | |
821 | 809 | else throw("Strict value is not equal to itself.") | |
822 | 810 | } | |
823 | 811 | else throw("Strict value is not equal to itself.") | |
824 | 812 | } | |
825 | 813 | else nil | |
826 | 814 | if ((executeOrderRequest == executeOrderRequest)) | |
827 | 815 | then { | |
828 | 816 | let doMarkOrderExecuted = invoke(this, "internalMarkOrderExecuted", [_amm, _trader, _orderId], nil) | |
829 | 817 | if ((doMarkOrderExecuted == doMarkOrderExecuted)) | |
830 | 818 | then nil | |
831 | 819 | else throw("Strict value is not equal to itself.") | |
832 | 820 | } | |
833 | 821 | else throw("Strict value is not equal to itself.") | |
834 | 822 | } | |
835 | 823 | else throw("Strict value is not equal to itself.") | |
836 | 824 | } | |
837 | 825 | else throw("Strict value is not equal to itself.") | |
838 | 826 | } | |
839 | 827 | else throw("Strict value is not equal to itself.") | |
840 | 828 | } | |
841 | 829 | else throw("Strict value is not equal to itself.") | |
842 | 830 | } | |
843 | 831 | else throw("Strict value is not equal to itself.") | |
844 | 832 | } | |
845 | 833 | } | |
846 | 834 | else throw("Strict value is not equal to itself.") | |
847 | 835 | } | |
848 | 836 | ||
849 | 837 | ||
850 | 838 | ||
851 | 839 | @Callable(i) | |
852 | 840 | func view_canExecuteOrder (_orderId) = { | |
853 | 841 | let s = invoke(this, "executeOrder", [_orderId], nil) | |
854 | 842 | if ((s == s)) | |
855 | 843 | then throw("Success") | |
856 | 844 | else throw("Strict value is not equal to itself.") | |
857 | 845 | } | |
858 | 846 | ||
859 | 847 | ||
860 | 848 | @Verifier(tx) | |
861 | 849 | func verify () = { | |
862 | 850 | let coordinatorStr = getString(this, k_coordinatorAddress) | |
863 | 851 | if (isDefined(coordinatorStr)) | |
864 | 852 | then { | |
865 | 853 | let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address) | |
866 | 854 | if (isDefined(admin)) | |
867 | 855 | then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false) | |
868 | 856 | else throw("unable to verify: admin not set in coordinator") | |
869 | 857 | } | |
870 | 858 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
871 | 859 | } | |
872 | 860 |
github/deemru/w8io/169f3d6 152.53 ms ◑