tx · FkuR2AKnycwJR59r9Mgy8GG3GLAE3iofBYjFjCYi6msH 3N6VKmg8fcTLVZtzTGJTd2gfjmK3VYobQf1: -0.03700000 Waves 2023.07.27 15:54 [2684285] smart account 3N6VKmg8fcTLVZtzTGJTd2gfjmK3VYobQf1 > SELF 0.00000000 Waves
{ "type": 13, "id": "FkuR2AKnycwJR59r9Mgy8GG3GLAE3iofBYjFjCYi6msH", "fee": 3700000, "feeAssetId": null, "timestamp": 1690462436135, "version": 2, "chainId": 84, "sender": "3N6VKmg8fcTLVZtzTGJTd2gfjmK3VYobQf1", "senderPublicKey": "A2kf7bN5S7rrpJUdubvPFNzkrSEL8uTN8Hc2Sya5cZth", "proofs": [ "3gGeWraoxrQvuFn36wiQxX5YFFEM21VHRTkx42L2mnmjeVEViN8LZHnAsZV8FJc2FBaE8sRj4VJEtWMzrUPL366k" ], "script": "base64:BgKPAQgCEhAKDgEICAEBAQEBAQgBAQEBEgQKAggIEgMKAQgSABIECgIIARIECgIBBBIDCgEIEgMKAQgSEAoOCAEBAQEBAQgBAQEBAQgSDAoKCAEBAQgBAQEBCBIFCgMICAESCAoGCAgBAQEBEg4KDAgIAQEBAQEBCAgBARIDCgEBEgQKAgEIEgQKAgEIEgQKAgEISgAUa19jb29yZGluYXRvckFkZHJlc3MCFGtfY29vcmRpbmF0b3JBZGRyZXNzAA9rX2FkbWluX2FkZHJlc3MCD2tfYWRtaW5fYWRkcmVzcwANa19xdW90ZV9hc3NldAINa19xdW90ZV9hc3NldAAFa19hbW0CBWtfYW1tABFrX21hbmFnZXJfYWRkcmVzcwIRa19tYW5hZ2VyX2FkZHJlc3MAEmtfcG9zaXRpb25TZXF1ZW5jZQISa19wb3NpdGlvblNlcXVlbmNlAA5rX3Bvc2l0aW9uU2l6ZQIOa19wb3NpdGlvblNpemUAEGtfZXhlY3V0ZWRPcmRlcnMCEGtfZXhlY3V0ZWRPcmRlcnMAEGtfY2FuY2VsZWRPcmRlcnMCEGtfY2FuY2VsZWRPc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3Qgc2V0IGluIGNvb3JkaW5hdG9yCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5zP3F3Q==", "height": 2684285, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: NPfrjd7jFwnFDy2cdaaj35Bnuggps7Hk2oi7NeSSW4x Next: none Diff:
Old | New | Differences | |
---|---|---|---|
318 | 318 | ||
319 | 319 | ||
320 | 320 | @Callable(i) | |
321 | + | func internalSaveOrder (_orderId,_amm,_trader,_amountIn,_leverage,_type,_triggerPrice,_paymentUsdn,_side,_refLink,_positionId,_limitPrice,_expiration,_orderMarketPrice) = if ((i.caller != this)) | |
322 | + | then throw("Invalid saveOrderInternal params") | |
323 | + | else saveOrder(_orderId, _amm, _trader, _amountIn, _leverage, _type, _triggerPrice, _paymentUsdn, _side, _refLink, _positionId, _limitPrice, _expiration, _orderMarketPrice) | |
324 | + | ||
325 | + | ||
326 | + | ||
327 | + | @Callable(i) | |
321 | 328 | func cleanUpStaleOrders (_amm,_trader) = { | |
322 | 329 | let orders = traderAmmOrdersIds(_amm, _trader) | |
323 | 330 | let positionIds = getPositionIds(_amm, _trader) | |
324 | 331 | func cleanUpOne (_acc,_orderId) = { | |
325 | 332 | let orderIdInt = valueOrErrorMessage(parseInt(_orderId), "Invalid order id") | |
326 | - | let $ | |
327 | - | let _x1 = $ | |
328 | - | let _x2 = $ | |
329 | - | let _x3 = $ | |
330 | - | let _x4 = $ | |
331 | - | let _type = $ | |
332 | - | let _x5 = $ | |
333 | - | let _paymentUsdn = $ | |
334 | - | let _x6 = $ | |
335 | - | let _x7 = $ | |
336 | - | let _positionId = $ | |
337 | - | let _x8 = $ | |
338 | - | let _expiration = $ | |
333 | + | let $t01311313338 = getOrder(orderIdInt) | |
334 | + | let _x1 = $t01311313338._1 | |
335 | + | let _x2 = $t01311313338._2 | |
336 | + | let _x3 = $t01311313338._3 | |
337 | + | let _x4 = $t01311313338._4 | |
338 | + | let _type = $t01311313338._5 | |
339 | + | let _x5 = $t01311313338._6 | |
340 | + | let _paymentUsdn = $t01311313338._7 | |
341 | + | let _x6 = $t01311313338._8 | |
342 | + | let _x7 = $t01311313338._9 | |
343 | + | let _positionId = $t01311313338._10 | |
344 | + | let _x8 = $t01311313338._11 | |
345 | + | let _expiration = $t01311313338._12 | |
339 | 346 | let cancelTakeStopOfNoPosition = if (if (if ((_type == STOP)) | |
340 | 347 | then true | |
341 | 348 | else (_type == TAKE)) | |
364 | 371 | else _acc | |
365 | 372 | } | |
366 | 373 | ||
367 | - | let $ | |
374 | + | let $t01404014135 = { | |
368 | 375 | let $l = orders | |
369 | 376 | let $s = size($l) | |
370 | 377 | let $acc0 = $Tuple3(orders, nil, 0) | |
378 | 385 | ||
379 | 386 | $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) | |
380 | 387 | } | |
381 | - | let newOrders = $ | |
382 | - | let cancelActions = $ | |
383 | - | let paymentToReturn = $ | |
388 | + | let newOrders = $t01404014135._1 | |
389 | + | let cancelActions = $t01404014135._2 | |
390 | + | let paymentToReturn = $t01404014135._3 | |
384 | 391 | let withdraw = if ((paymentToReturn > 0)) | |
385 | 392 | then { | |
386 | 393 | let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), paymentToReturn], nil) | |
499 | 506 | then if ((size(i.payments) > 1)) | |
500 | 507 | then throw("Invalid createOrder parameters: invalid payment count") | |
501 | 508 | else { | |
502 | - | let $ | |
509 | + | let $t01864418896 = if ((size(i.payments) == 1)) | |
503 | 510 | then $Tuple2(toBase58String(valueOrErrorMessage(i.payments[0].assetId, "Invalid asset id")), i.payments[0].amount) | |
504 | 511 | else $Tuple2("", 0) | |
505 | - | let paymentAssetId = $ | |
506 | - | let paymentAmount = $ | |
512 | + | let paymentAssetId = $t01864418896._1 | |
513 | + | let paymentAmount = $t01864418896._2 | |
507 | 514 | let doCall = invoke(this, "internalCreateOrder", [_trader, _amm, _type, _triggerPrice, _limitPrice, _amountIn, _leverage, _side, _refLink, paymentAssetId, paymentAmount, _expiration], nil) | |
508 | 515 | if ((doCall == doCall)) | |
509 | 516 | then { | |
748 | 755 | ||
749 | 756 | @Callable(i) | |
750 | 757 | func cancelOrder (_orderId) = { | |
751 | - | let $ | |
752 | - | let _amm = $ | |
753 | - | let _trader = $ | |
754 | - | let _amountIn = $ | |
755 | - | let _leverage = $ | |
756 | - | let _type = $ | |
757 | - | let _triggerPrice = $ | |
758 | - | let _amountUsdn = $ | |
758 | + | let $t02856928719 = getOrder(_orderId) | |
759 | + | let _amm = $t02856928719._1 | |
760 | + | let _trader = $t02856928719._2 | |
761 | + | let _amountIn = $t02856928719._3 | |
762 | + | let _leverage = $t02856928719._4 | |
763 | + | let _type = $t02856928719._5 | |
764 | + | let _triggerPrice = $t02856928719._6 | |
765 | + | let _amountUsdn = $t02856928719._7 | |
759 | 766 | if (if (if (!(initialized())) | |
760 | 767 | then true | |
761 | 768 | else !(isValid(_orderId))) | |
789 | 796 | ||
790 | 797 | @Callable(i) | |
791 | 798 | func executeOrder (_orderId,_priceData) = { | |
792 | - | let $ | |
793 | - | let _amm = $ | |
794 | - | let _trader = $ | |
795 | - | let _amountIn = $ | |
796 | - | let _leverage = $ | |
797 | - | let _type = $ | |
798 | - | let _triggerPrice = $ | |
799 | - | let _amountUsdn = $ | |
800 | - | let _side = $ | |
801 | - | let _refLink = $ | |
802 | - | let _positionId = $ | |
803 | - | let _limitPrice = $ | |
804 | - | let _expiration = $ | |
805 | - | let _orderMarketPrice = $ | |
799 | + | let $t02993730200 = getOrder(_orderId) | |
800 | + | let _amm = $t02993730200._1 | |
801 | + | let _trader = $t02993730200._2 | |
802 | + | let _amountIn = $t02993730200._3 | |
803 | + | let _leverage = $t02993730200._4 | |
804 | + | let _type = $t02993730200._5 | |
805 | + | let _triggerPrice = $t02993730200._6 | |
806 | + | let _amountUsdn = $t02993730200._7 | |
807 | + | let _side = $t02993730200._8 | |
808 | + | let _refLink = $t02993730200._9 | |
809 | + | let _positionId = $t02993730200._10 | |
810 | + | let _limitPrice = $t02993730200._11 | |
811 | + | let _expiration = $t02993730200._12 | |
812 | + | let _orderMarketPrice = $t02993730200._13 | |
806 | 813 | let updatePrice = invoke(addressFromStringValue(_amm), "updateOracle", [_priceData], nil) | |
807 | 814 | if ((updatePrice == updatePrice)) | |
808 | 815 | then { | |
828 | 835 | let currentPositionId = if ((positionSize != 0)) | |
829 | 836 | then getPositionId(_amm, _trader, positionDirection) | |
830 | 837 | else 0 | |
831 | - | let $ | |
838 | + | let $t03094636197 = if ((_type == STOP)) | |
832 | 839 | then { | |
833 | 840 | let _positionDirection = if ((positionSize > 0)) | |
834 | 841 | then LONG | |
871 | 878 | let marketPrice = getMarketPrice(_amm) | |
872 | 879 | let isExecutableByStop = if ((_limitPrice == 0)) | |
873 | 880 | then true | |
874 | - | else if ((_ | |
881 | + | else if ((_side == LONG)) | |
875 | 882 | then (marketPrice >= _limitPrice) | |
876 | 883 | else (_limitPrice >= marketPrice) | |
877 | 884 | let isExecutableForTriggerPrice = if ((_side == LONG)) | |
895 | 902 | let minBaseAssetAmount = (idealMinBaseAssetAmount - muld(idealMinBaseAssetAmount, getSpreadLimit())) | |
896 | 903 | $Tuple3("increasePosition", [_side, _leverage, minBaseAssetAmount, _refLink, _priceData], [AttachedPayment(quoteAsset(), _amountUsdn)]) | |
897 | 904 | } | |
898 | - | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
905 | + | else if (if (if (isExecutableByStop) | |
906 | + | then isExecutableByTimestamp | |
907 | + | else false) | |
908 | + | then (_limitPrice != 0) | |
909 | + | else false) | |
910 | + | then { | |
911 | + | let doUpdateOrder = invoke(this, "internalSaveOrder", [_orderId, _amm, _trader, _amountIn, _leverage, _type, _triggerPrice, _amountUsdn, _side, _refLink, _positionId, 0, _expiration, _orderMarketPrice], nil) | |
912 | + | if ((doUpdateOrder == doUpdateOrder)) | |
913 | + | then $Tuple3("", nil, nil) | |
914 | + | else throw("Strict value is not equal to itself.") | |
915 | + | } | |
916 | + | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
899 | 917 | } | |
900 | 918 | else if ((_type == MARKET)) | |
901 | 919 | then { | |
911 | 929 | else throw("Can not execute MARKET order: expiration mismatch") | |
912 | 930 | } | |
913 | 931 | else throw(("Invalid order type: " + toString(_type))) | |
914 | - | let method = $ | |
915 | - | let args = $ | |
916 | - | let payments = $ | |
932 | + | let method = $t03094636197._1 | |
933 | + | let args = $t03094636197._2 | |
934 | + | let payments = $t03094636197._3 | |
917 | 935 | let withdraw = if ((size(payments) == 1)) | |
918 | 936 | then { | |
919 | 937 | let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), payments[0].amount], nil) | |
923 | 941 | } | |
924 | 942 | else nil | |
925 | 943 | if ((withdraw == withdraw)) | |
926 | - | then { | |
927 | - | let doSetContext = invoke(this, "setContext", [_trader], nil) | |
928 | - | if ((doSetContext == doSetContext)) | |
929 | - | then { | |
930 | - | let doClosePosition = invoke(addressFromStringValue(_amm), method, args, payments) | |
931 | - | if ((doClosePosition == doClosePosition)) | |
932 | - | then { | |
933 | - | let doResetContext = invoke(this, "resetContext", nil, nil) | |
934 | - | if ((doResetContext == doResetContext)) | |
935 | - | then { | |
936 | - | let executeOrderRequest = if (if ((_type == LIMIT)) | |
937 | - | then true | |
938 | - | else (_type == MARKET)) | |
939 | - | then { | |
940 | - | let newPositionSize = getPositionSize(_amm, _trader, positionDirection) | |
941 | - | if ((newPositionSize == newPositionSize)) | |
942 | - | then { | |
943 | - | let newPositionId = getPositionId(_amm, _trader, positionDirection) | |
944 | - | if ((newPositionId == newPositionId)) | |
945 | - | then { | |
946 | - | let positionSizeDelta = (newPositionSize - positionSize) | |
947 | - | let closeOrderSide = if ((newPositionSize > 0)) | |
948 | - | then SHORT | |
949 | - | else LONG | |
950 | - | let makeTakeOrder = if (haveOrderRequest(_orderId, TAKE)) | |
951 | - | then { | |
952 | - | let $t03593236131 = getOrderRequest(_orderId, TAKE) | |
953 | - | let newOrderId = $t03593236131._1 | |
954 | - | let newAmm = $t03593236131._2 | |
955 | - | let newTrader = $t03593236131._3 | |
956 | - | let newType = $t03593236131._4 | |
957 | - | let newTriggerPrice = $t03593236131._5 | |
958 | - | let newLimitPrice = $t03593236131._6 | |
959 | - | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
960 | - | if ((doCall == doCall)) | |
961 | - | then nil | |
962 | - | else throw("Strict value is not equal to itself.") | |
963 | - | } | |
964 | - | else nil | |
965 | - | if ((makeTakeOrder == makeTakeOrder)) | |
966 | - | then { | |
967 | - | let makeStopOrder = if (haveOrderRequest(_orderId, STOP)) | |
968 | - | then { | |
969 | - | let $t03670436903 = getOrderRequest(_orderId, STOP) | |
970 | - | let newOrderId = $t03670436903._1 | |
971 | - | let newAmm = $t03670436903._2 | |
972 | - | let newTrader = $t03670436903._3 | |
973 | - | let newType = $t03670436903._4 | |
974 | - | let newTriggerPrice = $t03670436903._5 | |
975 | - | let newLimitPrice = $t03670436903._6 | |
976 | - | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
977 | - | if ((doCall == doCall)) | |
978 | - | then nil | |
979 | - | else throw("Strict value is not equal to itself.") | |
980 | - | } | |
981 | - | else nil | |
982 | - | if ((makeStopOrder == makeStopOrder)) | |
983 | - | then (makeTakeOrder ++ makeStopOrder) | |
984 | - | else throw("Strict value is not equal to itself.") | |
985 | - | } | |
986 | - | else throw("Strict value is not equal to itself.") | |
987 | - | } | |
988 | - | else throw("Strict value is not equal to itself.") | |
989 | - | } | |
990 | - | else throw("Strict value is not equal to itself.") | |
991 | - | } | |
992 | - | else nil | |
993 | - | if ((executeOrderRequest == executeOrderRequest)) | |
994 | - | then { | |
995 | - | let doMarkOrderExecuted = invoke(this, "internalMarkOrderExecuted", [_amm, _trader, _orderId], nil) | |
996 | - | if ((doMarkOrderExecuted == doMarkOrderExecuted)) | |
997 | - | then nil | |
998 | - | else throw("Strict value is not equal to itself.") | |
999 | - | } | |
1000 | - | else throw("Strict value is not equal to itself.") | |
1001 | - | } | |
1002 | - | else throw("Strict value is not equal to itself.") | |
1003 | - | } | |
1004 | - | else throw("Strict value is not equal to itself.") | |
1005 | - | } | |
1006 | - | else throw("Strict value is not equal to itself.") | |
1007 | - | } | |
944 | + | then if ((method != "")) | |
945 | + | then { | |
946 | + | let doSetContext = invoke(this, "setContext", [_trader], nil) | |
947 | + | if ((doSetContext == doSetContext)) | |
948 | + | then { | |
949 | + | let doClosePosition = invoke(addressFromStringValue(_amm), method, args, payments) | |
950 | + | if ((doClosePosition == doClosePosition)) | |
951 | + | then { | |
952 | + | let doResetContext = invoke(this, "resetContext", nil, nil) | |
953 | + | if ((doResetContext == doResetContext)) | |
954 | + | then { | |
955 | + | let executeOrderRequest = if (if ((_type == LIMIT)) | |
956 | + | then true | |
957 | + | else (_type == MARKET)) | |
958 | + | then { | |
959 | + | let newPositionSize = getPositionSize(_amm, _trader, positionDirection) | |
960 | + | if ((newPositionSize == newPositionSize)) | |
961 | + | then { | |
962 | + | let newPositionId = getPositionId(_amm, _trader, positionDirection) | |
963 | + | if ((newPositionId == newPositionId)) | |
964 | + | then { | |
965 | + | let positionSizeDelta = (newPositionSize - positionSize) | |
966 | + | let closeOrderSide = if ((newPositionSize > 0)) | |
967 | + | then SHORT | |
968 | + | else LONG | |
969 | + | let makeTakeOrder = if (haveOrderRequest(_orderId, TAKE)) | |
970 | + | then { | |
971 | + | let $t03723137444 = getOrderRequest(_orderId, TAKE) | |
972 | + | let newOrderId = $t03723137444._1 | |
973 | + | let newAmm = $t03723137444._2 | |
974 | + | let newTrader = $t03723137444._3 | |
975 | + | let newType = $t03723137444._4 | |
976 | + | let newTriggerPrice = $t03723137444._5 | |
977 | + | let newLimitPrice = $t03723137444._6 | |
978 | + | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
979 | + | if ((doCall == doCall)) | |
980 | + | then nil | |
981 | + | else throw("Strict value is not equal to itself.") | |
982 | + | } | |
983 | + | else nil | |
984 | + | if ((makeTakeOrder == makeTakeOrder)) | |
985 | + | then { | |
986 | + | let makeStopOrder = if (haveOrderRequest(_orderId, STOP)) | |
987 | + | then { | |
988 | + | let $t03806738280 = getOrderRequest(_orderId, STOP) | |
989 | + | let newOrderId = $t03806738280._1 | |
990 | + | let newAmm = $t03806738280._2 | |
991 | + | let newTrader = $t03806738280._3 | |
992 | + | let newType = $t03806738280._4 | |
993 | + | let newTriggerPrice = $t03806738280._5 | |
994 | + | let newLimitPrice = $t03806738280._6 | |
995 | + | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
996 | + | if ((doCall == doCall)) | |
997 | + | then nil | |
998 | + | else throw("Strict value is not equal to itself.") | |
999 | + | } | |
1000 | + | else nil | |
1001 | + | if ((makeStopOrder == makeStopOrder)) | |
1002 | + | then (makeTakeOrder ++ makeStopOrder) | |
1003 | + | else throw("Strict value is not equal to itself.") | |
1004 | + | } | |
1005 | + | else throw("Strict value is not equal to itself.") | |
1006 | + | } | |
1007 | + | else throw("Strict value is not equal to itself.") | |
1008 | + | } | |
1009 | + | else throw("Strict value is not equal to itself.") | |
1010 | + | } | |
1011 | + | else nil | |
1012 | + | if ((executeOrderRequest == executeOrderRequest)) | |
1013 | + | then { | |
1014 | + | let doMarkOrderExecuted = invoke(this, "internalMarkOrderExecuted", [_amm, _trader, _orderId], nil) | |
1015 | + | if ((doMarkOrderExecuted == doMarkOrderExecuted)) | |
1016 | + | then nil | |
1017 | + | else throw("Strict value is not equal to itself.") | |
1018 | + | } | |
1019 | + | else throw("Strict value is not equal to itself.") | |
1020 | + | } | |
1021 | + | else throw("Strict value is not equal to itself.") | |
1022 | + | } | |
1023 | + | else throw("Strict value is not equal to itself.") | |
1024 | + | } | |
1025 | + | else throw("Strict value is not equal to itself.") | |
1026 | + | } | |
1027 | + | else nil | |
1008 | 1028 | else throw("Strict value is not equal to itself.") | |
1009 | 1029 | } | |
1010 | 1030 | else throw("Strict value is not equal to itself.") | |
1028 | 1048 | } | |
1029 | 1049 | ||
1030 | 1050 | ||
1051 | + | ||
1052 | + | @Callable(i) | |
1053 | + | func view_canActivateStopOrder (_orderId,_priceData) = { | |
1054 | + | let s = invoke(this, "activateStopOrder", [_orderId, _priceData], nil) | |
1055 | + | if ((s == s)) | |
1056 | + | then throw("Success") | |
1057 | + | else throw("Strict value is not equal to itself.") | |
1058 | + | } | |
1059 | + | ||
1060 | + | ||
1031 | 1061 | @Verifier(tx) | |
1032 | 1062 | func verify () = { | |
1033 | 1063 | let coordinatorStr = getString(this, k_coordinatorAddress) |
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_spreadLimit = "k_spreadLimit" | |
33 | 33 | ||
34 | 34 | let k_onlyWhitelist = "k_onlyWhitelist" | |
35 | 35 | ||
36 | 36 | let k_whitelistExecutor = "k_whitelistExecutor" | |
37 | 37 | ||
38 | 38 | let k_sender = "k_sender" | |
39 | 39 | ||
40 | 40 | let k_initialized = "k_initialized" | |
41 | 41 | ||
42 | 42 | let STOP = 1 | |
43 | 43 | ||
44 | 44 | let TAKE = 2 | |
45 | 45 | ||
46 | 46 | let LIMIT = 3 | |
47 | 47 | ||
48 | 48 | let MARKET = 4 | |
49 | 49 | ||
50 | 50 | let LONG = 1 | |
51 | 51 | ||
52 | 52 | let SHORT = 2 | |
53 | 53 | ||
54 | 54 | let INCREASE = 1 | |
55 | 55 | ||
56 | 56 | let DECREASE = 2 | |
57 | 57 | ||
58 | 58 | let MAX_TRADER_ORDERS_PER_AMM = 10 | |
59 | 59 | ||
60 | 60 | let TIME = lastBlock.timestamp | |
61 | 61 | ||
62 | 62 | let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
63 | 63 | ||
64 | 64 | func abs (_x) = if ((_x > 0)) | |
65 | 65 | then _x | |
66 | 66 | else -(_x) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func minv (_x,_y) = if ((_x > _y)) | |
76 | 76 | then _y | |
77 | 77 | else _x | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func executedOrderKey (_orderId) = ((k_executedOrders + "_") + toString(_orderId)) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func canceledOrderKey (_orderId) = ((k_canceledOrders + "_") + toString(_orderId)) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func orderKey (_orderId) = toCompositeKey(k_order, toString(_orderId)) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func orderRequestKey (_orderId,_type) = ((((k_orderRequest + "_") + toString(_orderId)) + "_") + toString(_type)) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func traderOrderCountKey (_amm,_trader) = ((((k_traderOrderCnt + "_") + _amm) + "_") + _trader) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func traderOrderIdsKey (_amm,_trader) = ((((k_traderOrderIds + "_") + _amm) + "_") + _trader) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set") | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address)) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset)) | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func managerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_manager_address)), "Manager not set") | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false) | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func isValid (_orderId) = if (valueOrElse(getBoolean(this, executedOrderKey(_orderId)), false)) | |
120 | 120 | then throw(("Order already executed: " + toString(_orderId))) | |
121 | 121 | else if (valueOrElse(getBoolean(this, canceledOrderKey(_orderId)), false)) | |
122 | 122 | then throw(("Order already cancelled: " + toString(_orderId))) | |
123 | 123 | else true | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func getSpreadLimit () = valueOrErrorMessage(getInteger(this, k_spreadLimit), "Spread limit not set") | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | func currentOrderId () = valueOrElse(getInteger(this, k_lastOrderId), 0) | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func getTraderOrderCount (_amm,_trader) = { | |
133 | 133 | let key = traderOrderCountKey(_amm, _trader) | |
134 | 134 | valueOrElse(getInteger(this, key), 0) | |
135 | 135 | } | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func traderAmmOrdersIds (_amm,_trader) = { | |
139 | 139 | let key = traderOrderIdsKey(_amm, _trader) | |
140 | 140 | let val = valueOrElse(getString(this, key), "") | |
141 | 141 | if ((val == "")) | |
142 | 142 | then nil | |
143 | 143 | else split(val, ",") | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func haveOrderRequest (_orderId,_type) = { | |
148 | 148 | let key = orderRequestKey(_orderId, _type) | |
149 | 149 | isDefined(getString(this, key)) | |
150 | 150 | } | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func getOrderRequest (_orderId,_type) = { | |
154 | 154 | let key = orderRequestKey(_orderId, _type) | |
155 | 155 | let orderRequestStr = valueOrErrorMessage(getString(this, key), ("Not order request for key: " + key)) | |
156 | 156 | let orderRequestPartList = split(orderRequestStr, ",") | |
157 | 157 | let orderId = valueOrErrorMessage(parseInt(orderRequestPartList[0]), "Invalid orderId") | |
158 | 158 | let amm = orderRequestPartList[1] | |
159 | 159 | let trader = orderRequestPartList[2] | |
160 | 160 | let type = valueOrErrorMessage(parseInt(orderRequestPartList[3]), "Invalid type") | |
161 | 161 | let triggerPrice = valueOrErrorMessage(parseInt(orderRequestPartList[4]), "Invalid triggerPrice") | |
162 | 162 | let limitPrice = valueOrErrorMessage(parseInt(orderRequestPartList[5]), "Invalid limitPrice") | |
163 | 163 | $Tuple6(orderId, amm, trader, type, triggerPrice, limitPrice) | |
164 | 164 | } | |
165 | 165 | ||
166 | 166 | ||
167 | 167 | func getOrder (_orderId) = { | |
168 | 168 | let orderStr = valueOrErrorMessage(getString(this, orderKey(_orderId)), ("Invalid order id: " + toString(_orderId))) | |
169 | 169 | let orderPartList = split(orderStr, ",") | |
170 | 170 | let amm = orderPartList[0] | |
171 | 171 | let trader = orderPartList[1] | |
172 | 172 | let amountIn = valueOrErrorMessage(parseInt(orderPartList[2]), "Invalid amountIn") | |
173 | 173 | let leverage = valueOrErrorMessage(parseInt(orderPartList[3]), "Invalid leverage") | |
174 | 174 | let type = valueOrErrorMessage(parseInt(orderPartList[4]), "Invalid type") | |
175 | 175 | let triggerPrice = valueOrErrorMessage(parseInt(orderPartList[5]), "Invalid triggerPrice") | |
176 | 176 | let paymentUsdn = valueOrErrorMessage(parseInt(orderPartList[6]), "Invalid paymentUsdn") | |
177 | 177 | let side = valueOrErrorMessage(parseInt(orderPartList[7]), "Invalid side") | |
178 | 178 | let refLink = orderPartList[8] | |
179 | 179 | let positionId = valueOrErrorMessage(parseInt(orderPartList[9]), "Invalid positionId") | |
180 | 180 | let limitPrice = valueOrErrorMessage(parseInt(orderPartList[10]), "Invalid limitPrice") | |
181 | 181 | let expiration = if ((size(orderPartList) > 11)) | |
182 | 182 | then valueOrErrorMessage(parseInt(orderPartList[11]), "Invalid expiration") | |
183 | 183 | else 0 | |
184 | 184 | let marketPrice = if ((size(orderPartList) > 12)) | |
185 | 185 | then valueOrErrorMessage(parseInt(orderPartList[12]), "Invalid orderMarketPrice") | |
186 | 186 | else 0 | |
187 | 187 | $Tuple13(amm, trader, amountIn, leverage, type, triggerPrice, paymentUsdn, side, refLink, positionId, limitPrice, expiration, marketPrice) | |
188 | 188 | } | |
189 | 189 | ||
190 | 190 | ||
191 | 191 | func getMarketPrice (_amm) = { | |
192 | 192 | let s = invoke(addressFromStringValue(_amm), "computeSpotPrice", nil, nil) | |
193 | 193 | if ((s == s)) | |
194 | 194 | then { | |
195 | 195 | let res = match s { | |
196 | 196 | case t: Int => | |
197 | 197 | t | |
198 | 198 | case _ => | |
199 | 199 | throw("Invalid computeSpotPrice result") | |
200 | 200 | } | |
201 | 201 | value(res) | |
202 | 202 | } | |
203 | 203 | else throw("Strict value is not equal to itself.") | |
204 | 204 | } | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | func getFee (_amm,_trader) = { | |
208 | 208 | let s = invoke(addressFromStringValue(_amm), "computeFeeForTraderWithArtifact", [_trader, ""], nil) | |
209 | 209 | if ((s == s)) | |
210 | 210 | then { | |
211 | 211 | let res = match s { | |
212 | 212 | case t: (Int, Boolean) => | |
213 | 213 | t._1 | |
214 | 214 | case _ => | |
215 | 215 | throw("Invalid computeFeeForTraderWithArtifact result") | |
216 | 216 | } | |
217 | 217 | value(res) | |
218 | 218 | } | |
219 | 219 | else throw("Strict value is not equal to itself.") | |
220 | 220 | } | |
221 | 221 | ||
222 | 222 | ||
223 | 223 | func getPositionDirection (_orderSide,_orderType) = if (if ((_orderType == TAKE)) | |
224 | 224 | then true | |
225 | 225 | else (_orderType == STOP)) | |
226 | 226 | then if ((_orderSide == LONG)) | |
227 | 227 | then SHORT | |
228 | 228 | else LONG | |
229 | 229 | else _orderSide | |
230 | 230 | ||
231 | 231 | ||
232 | 232 | func getPositionSize (_amm,_trader,_direction) = { | |
233 | 233 | let amm = addressFromStringValue(_amm) | |
234 | 234 | let positionKey = ((_trader + "_") + toString(_direction)) | |
235 | 235 | let sizeKey = toCompositeKey(k_positionSize, positionKey) | |
236 | 236 | valueOrElse(getInteger(amm, sizeKey), 0) | |
237 | 237 | } | |
238 | 238 | ||
239 | 239 | ||
240 | 240 | func getPositionId (_amm,_trader,_direction) = { | |
241 | 241 | let amm = addressFromStringValue(_amm) | |
242 | 242 | let positionKey = ((_trader + "_") + toString(_direction)) | |
243 | 243 | let seqKey = toCompositeKey(k_positionSequence, positionKey) | |
244 | 244 | valueOrElse(getInteger(amm, seqKey), 0) | |
245 | 245 | } | |
246 | 246 | ||
247 | 247 | ||
248 | 248 | func getSpread (_price) = muld(_price, getSpreadLimit()) | |
249 | 249 | ||
250 | 250 | ||
251 | 251 | func isOnlyWhitelistExecutors () = valueOrElse(getBoolean(this, k_onlyWhitelist), false) | |
252 | 252 | ||
253 | 253 | ||
254 | 254 | func isWhitelistExecutor (_executor) = valueOrElse(getBoolean(this, toCompositeKey(k_whitelistExecutor, _executor)), false) | |
255 | 255 | ||
256 | 256 | ||
257 | 257 | func saveOrder (_orderId,_amm,_trader,_amountIn,_leverage,_type,_triggerPrice,_paymentUsdn,_side,_refLink,_positionId,_limitPrice,_expiration,_orderMarketPrice) = { | |
258 | 258 | let orderStr = makeString([_amm, _trader, toString(_amountIn), toString(_leverage), toString(_type), toString(_triggerPrice), toString(_paymentUsdn), toString(_side), _refLink, toString(_positionId), toString(_limitPrice), toString(_expiration), toString(_orderMarketPrice)], ",") | |
259 | 259 | [StringEntry(orderKey(_orderId), orderStr)] | |
260 | 260 | } | |
261 | 261 | ||
262 | 262 | ||
263 | 263 | func saveOrderRequest (_orderId,_amm,_trader,_type,_triggerPrice,_limitPrice) = { | |
264 | 264 | let orderReqStr = makeString([toString(_orderId), _amm, _trader, toString(_type), toString(_triggerPrice), toString(_limitPrice)], ",") | |
265 | 265 | [StringEntry(orderRequestKey(_orderId, _type), orderReqStr)] | |
266 | 266 | } | |
267 | 267 | ||
268 | 268 | ||
269 | 269 | func updateOrderIdStr (_orderIdsNewStr,_amm,_trader) = [StringEntry(traderOrderIdsKey(_amm, _trader), _orderIdsNewStr)] | |
270 | 270 | ||
271 | 271 | ||
272 | 272 | func addRemoveOrderIdList (_orderIds,_orderId,_amm,_trader,_add) = { | |
273 | 273 | let orderIdsNew = if (_add) | |
274 | 274 | then (_orderIds :+ toString(_orderId)) | |
275 | 275 | else removeByIndex(_orderIds, valueOrErrorMessage(indexOf(_orderIds, toString(_orderId)), ("No order with id: " + toString(_orderId)))) | |
276 | 276 | orderIdsNew | |
277 | 277 | } | |
278 | 278 | ||
279 | 279 | ||
280 | 280 | func addRemoveOrderId (_orderId,_amm,_trader,_add) = { | |
281 | 281 | let orderIds = traderAmmOrdersIds(_amm, _trader) | |
282 | 282 | let orderIdsNew = addRemoveOrderIdList(orderIds, _orderId, _amm, _trader, _add) | |
283 | 283 | let orderIdsNewStr = makeString(orderIdsNew, ",") | |
284 | 284 | updateOrderIdStr(orderIdsNewStr, _amm, _trader) | |
285 | 285 | } | |
286 | 286 | ||
287 | 287 | ||
288 | 288 | func updateTraderOrderCount (_amm,_trader,_count) = if ((0 > _count)) | |
289 | 289 | then throw(("Invalid order count: " + toString(_count))) | |
290 | 290 | else [IntegerEntry(traderOrderCountKey(_amm, _trader), _count)] | |
291 | 291 | ||
292 | 292 | ||
293 | 293 | func updateLastOrderId (_lastOrderId) = [IntegerEntry(k_lastOrderId, _lastOrderId)] | |
294 | 294 | ||
295 | 295 | ||
296 | 296 | func markExecuteOrder (_orderId) = [BooleanEntry(toCompositeKey(k_executedOrders, toString(_orderId)), true)] | |
297 | 297 | ||
298 | 298 | ||
299 | 299 | func markCancelOrder (_orderId) = [BooleanEntry(toCompositeKey(k_canceledOrders, toString(_orderId)), true)] | |
300 | 300 | ||
301 | 301 | ||
302 | 302 | func getPositionIds (_amm,_trader) = { | |
303 | 303 | let longPositionSize = getPositionSize(_amm, _trader, LONG) | |
304 | 304 | let currentLongPositionId = if ((longPositionSize != 0)) | |
305 | 305 | then getPositionId(_amm, _trader, LONG) | |
306 | 306 | else 0 | |
307 | 307 | let shortPositionSize = getPositionSize(_amm, _trader, SHORT) | |
308 | 308 | let currentShortPositionId = if ((shortPositionSize != 0)) | |
309 | 309 | then getPositionId(_amm, _trader, SHORT) | |
310 | 310 | else 0 | |
311 | 311 | [currentLongPositionId, currentShortPositionId] | |
312 | 312 | } | |
313 | 313 | ||
314 | 314 | ||
315 | 315 | func checkValidExecutor (_caller) = if (isOnlyWhitelistExecutors()) | |
316 | 316 | then isWhitelistExecutor(toString(_caller)) | |
317 | 317 | else true | |
318 | 318 | ||
319 | 319 | ||
320 | 320 | @Callable(i) | |
321 | + | func internalSaveOrder (_orderId,_amm,_trader,_amountIn,_leverage,_type,_triggerPrice,_paymentUsdn,_side,_refLink,_positionId,_limitPrice,_expiration,_orderMarketPrice) = if ((i.caller != this)) | |
322 | + | then throw("Invalid saveOrderInternal params") | |
323 | + | else saveOrder(_orderId, _amm, _trader, _amountIn, _leverage, _type, _triggerPrice, _paymentUsdn, _side, _refLink, _positionId, _limitPrice, _expiration, _orderMarketPrice) | |
324 | + | ||
325 | + | ||
326 | + | ||
327 | + | @Callable(i) | |
321 | 328 | func cleanUpStaleOrders (_amm,_trader) = { | |
322 | 329 | let orders = traderAmmOrdersIds(_amm, _trader) | |
323 | 330 | let positionIds = getPositionIds(_amm, _trader) | |
324 | 331 | func cleanUpOne (_acc,_orderId) = { | |
325 | 332 | let orderIdInt = valueOrErrorMessage(parseInt(_orderId), "Invalid order id") | |
326 | - | let $ | |
327 | - | let _x1 = $ | |
328 | - | let _x2 = $ | |
329 | - | let _x3 = $ | |
330 | - | let _x4 = $ | |
331 | - | let _type = $ | |
332 | - | let _x5 = $ | |
333 | - | let _paymentUsdn = $ | |
334 | - | let _x6 = $ | |
335 | - | let _x7 = $ | |
336 | - | let _positionId = $ | |
337 | - | let _x8 = $ | |
338 | - | let _expiration = $ | |
333 | + | let $t01311313338 = getOrder(orderIdInt) | |
334 | + | let _x1 = $t01311313338._1 | |
335 | + | let _x2 = $t01311313338._2 | |
336 | + | let _x3 = $t01311313338._3 | |
337 | + | let _x4 = $t01311313338._4 | |
338 | + | let _type = $t01311313338._5 | |
339 | + | let _x5 = $t01311313338._6 | |
340 | + | let _paymentUsdn = $t01311313338._7 | |
341 | + | let _x6 = $t01311313338._8 | |
342 | + | let _x7 = $t01311313338._9 | |
343 | + | let _positionId = $t01311313338._10 | |
344 | + | let _x8 = $t01311313338._11 | |
345 | + | let _expiration = $t01311313338._12 | |
339 | 346 | let cancelTakeStopOfNoPosition = if (if (if ((_type == STOP)) | |
340 | 347 | then true | |
341 | 348 | else (_type == TAKE)) | |
342 | 349 | then (positionIds[0] != _positionId) | |
343 | 350 | else false) | |
344 | 351 | then (positionIds[1] != _positionId) | |
345 | 352 | else false | |
346 | 353 | let cancelLimitIfExpired = if (if ((_type == LIMIT)) | |
347 | 354 | then true | |
348 | 355 | else (_type == MARKET)) | |
349 | 356 | then (TIME >= _expiration) | |
350 | 357 | else false | |
351 | 358 | if (if (cancelTakeStopOfNoPosition) | |
352 | 359 | then true | |
353 | 360 | else cancelLimitIfExpired) | |
354 | 361 | then { | |
355 | 362 | let change = markCancelOrder(orderIdInt) | |
356 | 363 | let newOrderList = addRemoveOrderIdList(_acc._1, orderIdInt, _amm, _trader, false) | |
357 | 364 | let paymentToReturn = if (if ((_type == LIMIT)) | |
358 | 365 | then true | |
359 | 366 | else (_type == MARKET)) | |
360 | 367 | then _paymentUsdn | |
361 | 368 | else 0 | |
362 | 369 | $Tuple3(newOrderList, (_acc._2 ++ change), (_acc._3 + paymentToReturn)) | |
363 | 370 | } | |
364 | 371 | else _acc | |
365 | 372 | } | |
366 | 373 | ||
367 | - | let $ | |
374 | + | let $t01404014135 = { | |
368 | 375 | let $l = orders | |
369 | 376 | let $s = size($l) | |
370 | 377 | let $acc0 = $Tuple3(orders, nil, 0) | |
371 | 378 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
372 | 379 | then $a | |
373 | 380 | else cleanUpOne($a, $l[$i]) | |
374 | 381 | ||
375 | 382 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
376 | 383 | then $a | |
377 | 384 | else throw("List size exceeds 10") | |
378 | 385 | ||
379 | 386 | $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) | |
380 | 387 | } | |
381 | - | let newOrders = $ | |
382 | - | let cancelActions = $ | |
383 | - | let paymentToReturn = $ | |
388 | + | let newOrders = $t01404014135._1 | |
389 | + | let cancelActions = $t01404014135._2 | |
390 | + | let paymentToReturn = $t01404014135._3 | |
384 | 391 | let withdraw = if ((paymentToReturn > 0)) | |
385 | 392 | then { | |
386 | 393 | let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), paymentToReturn], nil) | |
387 | 394 | if ((unstake == unstake)) | |
388 | 395 | then nil | |
389 | 396 | else throw("Strict value is not equal to itself.") | |
390 | 397 | } | |
391 | 398 | else nil | |
392 | 399 | if ((withdraw == withdraw)) | |
393 | 400 | then (((cancelActions ++ updateTraderOrderCount(_amm, _trader, size(newOrders))) ++ updateOrderIdStr(makeString(newOrders, ","), _amm, _trader)) ++ [ScriptTransfer(addressFromStringValue(_trader), paymentToReturn, quoteAsset())]) | |
394 | 401 | else throw("Strict value is not equal to itself.") | |
395 | 402 | } | |
396 | 403 | ||
397 | 404 | ||
398 | 405 | ||
399 | 406 | @Callable(i) | |
400 | 407 | func setContext (_sender) = if ((i.caller != this)) | |
401 | 408 | then throw("Only self-call") | |
402 | 409 | else [StringEntry(k_sender, _sender)] | |
403 | 410 | ||
404 | 411 | ||
405 | 412 | ||
406 | 413 | @Callable(i) | |
407 | 414 | func resetContext () = if ((i.caller != this)) | |
408 | 415 | then throw("Only self-call") | |
409 | 416 | else [DeleteEntry(k_sender)] | |
410 | 417 | ||
411 | 418 | ||
412 | 419 | ||
413 | 420 | @Callable(i) | |
414 | 421 | func initialize (_coordinator,_spreadLimit) = if (if (if (initialized()) | |
415 | 422 | then true | |
416 | 423 | else if ((0 > _spreadLimit)) | |
417 | 424 | then true | |
418 | 425 | else (_spreadLimit > (DECIMAL_UNIT / 10))) | |
419 | 426 | then true | |
420 | 427 | else (i.caller != this)) | |
421 | 428 | then throw("Unable to initialize") | |
422 | 429 | else [StringEntry(k_coordinatorAddress, toString(addressFromStringValue(_coordinator))), IntegerEntry(k_spreadLimit, _spreadLimit), BooleanEntry(k_initialized, true)] | |
423 | 430 | ||
424 | 431 | ||
425 | 432 | ||
426 | 433 | @Callable(i) | |
427 | 434 | func changeSettings (_spreadLimit,_onlyWhitelist) = if (if ((i.caller != adminAddress())) | |
428 | 435 | then true | |
429 | 436 | else if ((0 > _spreadLimit)) | |
430 | 437 | then true | |
431 | 438 | else (_spreadLimit > (DECIMAL_UNIT / 10))) | |
432 | 439 | then throw("Invalid changeSettings params") | |
433 | 440 | else [IntegerEntry(k_spreadLimit, _spreadLimit), BooleanEntry(k_onlyWhitelist, _onlyWhitelist)] | |
434 | 441 | ||
435 | 442 | ||
436 | 443 | ||
437 | 444 | @Callable(i) | |
438 | 445 | func addWhitelist (_list) = if ((i.caller != adminAddress())) | |
439 | 446 | then throw("Invalid addWhitelist params") | |
440 | 447 | else { | |
441 | 448 | func toAddressList (_acc,_addr) = { | |
442 | 449 | let address = addressFromStringValue(_addr) | |
443 | 450 | if ((address == address)) | |
444 | 451 | then (_acc :+ BooleanEntry(toCompositeKey(k_whitelistExecutor, toString(address)), true)) | |
445 | 452 | else throw("Strict value is not equal to itself.") | |
446 | 453 | } | |
447 | 454 | ||
448 | 455 | let $l = split_4C(_list, ",") | |
449 | 456 | let $s = size($l) | |
450 | 457 | let $acc0 = nil | |
451 | 458 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
452 | 459 | then $a | |
453 | 460 | else toAddressList($a, $l[$i]) | |
454 | 461 | ||
455 | 462 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
456 | 463 | then $a | |
457 | 464 | else throw("List size exceeds 20") | |
458 | 465 | ||
459 | 466 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
460 | 467 | } | |
461 | 468 | ||
462 | 469 | ||
463 | 470 | ||
464 | 471 | @Callable(i) | |
465 | 472 | func removeWhitelist (_list) = if ((i.caller != adminAddress())) | |
466 | 473 | then throw("Invalid removeWhitelist params") | |
467 | 474 | else { | |
468 | 475 | func toAddressList (_acc,_addr) = { | |
469 | 476 | let address = addressFromStringValue(_addr) | |
470 | 477 | if ((address == address)) | |
471 | 478 | then (_acc :+ BooleanEntry(toCompositeKey(k_whitelistExecutor, toString(address)), false)) | |
472 | 479 | else throw("Strict value is not equal to itself.") | |
473 | 480 | } | |
474 | 481 | ||
475 | 482 | let $l = split_4C(_list, ",") | |
476 | 483 | let $s = size($l) | |
477 | 484 | let $acc0 = nil | |
478 | 485 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
479 | 486 | then $a | |
480 | 487 | else toAddressList($a, $l[$i]) | |
481 | 488 | ||
482 | 489 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
483 | 490 | then $a | |
484 | 491 | else throw("List size exceeds 20") | |
485 | 492 | ||
486 | 493 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
487 | 494 | } | |
488 | 495 | ||
489 | 496 | ||
490 | 497 | ||
491 | 498 | @Callable(i) | |
492 | 499 | func createOrder (_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink,_stopTriggerPrice,_stopLimitPrice,_takeTriggerPrice,_takeLimitPrice,_expiration,_priceData) = { | |
493 | 500 | let _trader = toString(i.caller) | |
494 | 501 | let updatePrice = invoke(addressFromStringValue(_amm), "updateOracle", [_priceData], nil) | |
495 | 502 | if ((updatePrice == updatePrice)) | |
496 | 503 | then { | |
497 | 504 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
498 | 505 | if ((cleanUp == cleanUp)) | |
499 | 506 | then if ((size(i.payments) > 1)) | |
500 | 507 | then throw("Invalid createOrder parameters: invalid payment count") | |
501 | 508 | else { | |
502 | - | let $ | |
509 | + | let $t01864418896 = if ((size(i.payments) == 1)) | |
503 | 510 | then $Tuple2(toBase58String(valueOrErrorMessage(i.payments[0].assetId, "Invalid asset id")), i.payments[0].amount) | |
504 | 511 | else $Tuple2("", 0) | |
505 | - | let paymentAssetId = $ | |
506 | - | let paymentAmount = $ | |
512 | + | let paymentAssetId = $t01864418896._1 | |
513 | + | let paymentAmount = $t01864418896._2 | |
507 | 514 | let doCall = invoke(this, "internalCreateOrder", [_trader, _amm, _type, _triggerPrice, _limitPrice, _amountIn, _leverage, _side, _refLink, paymentAssetId, paymentAmount, _expiration], nil) | |
508 | 515 | if ((doCall == doCall)) | |
509 | 516 | then { | |
510 | 517 | let orderId = match doCall { | |
511 | 518 | case t: Int => | |
512 | 519 | t | |
513 | 520 | case _ => | |
514 | 521 | throw("Invalid ID of created order") | |
515 | 522 | } | |
516 | 523 | if (if ((_type == LIMIT)) | |
517 | 524 | then true | |
518 | 525 | else (_type == MARKET)) | |
519 | 526 | then { | |
520 | 527 | let makeStop = if ((_stopTriggerPrice > 0)) | |
521 | 528 | then { | |
522 | 529 | let doMakeStop = invoke(this, "internalCreateOrderRequest", [_trader, _amm, orderId, STOP, _stopTriggerPrice, _stopLimitPrice], nil) | |
523 | 530 | if ((doMakeStop == doMakeStop)) | |
524 | 531 | then nil | |
525 | 532 | else throw("Strict value is not equal to itself.") | |
526 | 533 | } | |
527 | 534 | else nil | |
528 | 535 | let makeTake = if ((_takeTriggerPrice > 0)) | |
529 | 536 | then { | |
530 | 537 | let doMakeTake = invoke(this, "internalCreateOrderRequest", [_trader, _amm, orderId, TAKE, _takeTriggerPrice, _takeLimitPrice], nil) | |
531 | 538 | if ((doMakeTake == doMakeTake)) | |
532 | 539 | then nil | |
533 | 540 | else throw("Strict value is not equal to itself.") | |
534 | 541 | } | |
535 | 542 | else nil | |
536 | 543 | (makeStop ++ makeTake) | |
537 | 544 | } | |
538 | 545 | else nil | |
539 | 546 | } | |
540 | 547 | else throw("Strict value is not equal to itself.") | |
541 | 548 | } | |
542 | 549 | else throw("Strict value is not equal to itself.") | |
543 | 550 | } | |
544 | 551 | else throw("Strict value is not equal to itself.") | |
545 | 552 | } | |
546 | 553 | ||
547 | 554 | ||
548 | 555 | ||
549 | 556 | @Callable(i) | |
550 | 557 | func increasePositionWithStopLoss (_amm,_direction,_leverage,_minBaseAssetAmount,_refLink,_stopTriggerPrice,_stopLimitPrice,_takeTriggerPrice,_takeLimitPrice,_priceData) = { | |
551 | 558 | let _trader = toString(i.caller) | |
552 | 559 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
553 | 560 | if ((cleanUp == cleanUp)) | |
554 | 561 | then if (if (!(initialized())) | |
555 | 562 | then true | |
556 | 563 | else !(isWhitelist(_amm))) | |
557 | 564 | then throw("Invalid increasePositionWithStopLoss parameters") | |
558 | 565 | else { | |
559 | 566 | let positionSize = getPositionSize(_amm, _trader, _direction) | |
560 | 567 | if ((positionSize != 0)) | |
561 | 568 | then throw("Invalid increasePositionWithStopLoss parameters: only new position") | |
562 | 569 | else { | |
563 | 570 | let doSetContext = invoke(this, "setContext", [_trader], nil) | |
564 | 571 | if ((doSetContext == doSetContext)) | |
565 | 572 | then { | |
566 | 573 | let doOpenPosition = invoke(addressFromStringValue(_amm), "increasePosition", [_direction, _leverage, _minBaseAssetAmount, _refLink, _priceData], i.payments) | |
567 | 574 | if ((doOpenPosition == doOpenPosition)) | |
568 | 575 | then { | |
569 | 576 | let doResetContext = invoke(this, "resetContext", nil, nil) | |
570 | 577 | if ((doResetContext == doResetContext)) | |
571 | 578 | then { | |
572 | 579 | let openedPositionSize = getPositionSize(_amm, _trader, _direction) | |
573 | 580 | if ((openedPositionSize == openedPositionSize)) | |
574 | 581 | then { | |
575 | 582 | let amountIn = abs(openedPositionSize) | |
576 | 583 | if ((amountIn == amountIn)) | |
577 | 584 | then { | |
578 | 585 | let stopLossSide = if ((0 > openedPositionSize)) | |
579 | 586 | then LONG | |
580 | 587 | else SHORT | |
581 | 588 | let checkAmountIn = if ((0 >= amountIn)) | |
582 | 589 | then { | |
583 | 590 | let data = makeString([_amm, _trader, toString(_direction), toString(_leverage), toString(_minBaseAssetAmount), _refLink, _priceData], ",") | |
584 | 591 | throw(((("Invalid amountIn=" + toString(amountIn)) + " after success increasePosition: ") + data)) | |
585 | 592 | } | |
586 | 593 | else 0 | |
587 | 594 | if ((checkAmountIn == checkAmountIn)) | |
588 | 595 | then { | |
589 | 596 | let doCreateStopOrder = if ((_stopTriggerPrice > 0)) | |
590 | 597 | then { | |
591 | 598 | let doCreateStopOrder = invoke(this, "internalCreateOrder", [_trader, _amm, STOP, _stopTriggerPrice, _stopLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0, 0], nil) | |
592 | 599 | if ((doCreateStopOrder == doCreateStopOrder)) | |
593 | 600 | then nil | |
594 | 601 | else throw("Strict value is not equal to itself.") | |
595 | 602 | } | |
596 | 603 | else nil | |
597 | 604 | if ((doCreateStopOrder == doCreateStopOrder)) | |
598 | 605 | then { | |
599 | 606 | let doCreateTakeOrder = if ((_takeTriggerPrice > 0)) | |
600 | 607 | then { | |
601 | 608 | let doCreateTakeOrder = invoke(this, "internalCreateOrder", [_trader, _amm, TAKE, _takeTriggerPrice, _takeLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0, 0], nil) | |
602 | 609 | if ((doCreateTakeOrder == doCreateTakeOrder)) | |
603 | 610 | then nil | |
604 | 611 | else throw("Strict value is not equal to itself.") | |
605 | 612 | } | |
606 | 613 | else nil | |
607 | 614 | if ((doCreateTakeOrder == doCreateTakeOrder)) | |
608 | 615 | then nil | |
609 | 616 | else throw("Strict value is not equal to itself.") | |
610 | 617 | } | |
611 | 618 | else throw("Strict value is not equal to itself.") | |
612 | 619 | } | |
613 | 620 | else throw("Strict value is not equal to itself.") | |
614 | 621 | } | |
615 | 622 | else throw("Strict value is not equal to itself.") | |
616 | 623 | } | |
617 | 624 | else throw("Strict value is not equal to itself.") | |
618 | 625 | } | |
619 | 626 | else throw("Strict value is not equal to itself.") | |
620 | 627 | } | |
621 | 628 | else throw("Strict value is not equal to itself.") | |
622 | 629 | } | |
623 | 630 | else throw("Strict value is not equal to itself.") | |
624 | 631 | } | |
625 | 632 | } | |
626 | 633 | else throw("Strict value is not equal to itself.") | |
627 | 634 | } | |
628 | 635 | ||
629 | 636 | ||
630 | 637 | ||
631 | 638 | @Callable(i) | |
632 | 639 | func internalMarkOrderExecuted (_amm,_trader,_orderId) = if (if (if (!(initialized())) | |
633 | 640 | then true | |
634 | 641 | else !(isWhitelist(_amm))) | |
635 | 642 | then true | |
636 | 643 | else !((i.caller == this))) | |
637 | 644 | then throw("Invalid internalMarkOrderExecuted parameters") | |
638 | 645 | else { | |
639 | 646 | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) - 1) | |
640 | 647 | ((updateTraderOrderCount(_amm, _trader, newTraderOrderCount) ++ addRemoveOrderId(_orderId, _amm, _trader, false)) ++ markExecuteOrder(_orderId)) | |
641 | 648 | } | |
642 | 649 | ||
643 | 650 | ||
644 | 651 | ||
645 | 652 | @Callable(i) | |
646 | 653 | func internalCreateOrderRequest (_trader,_amm,_orderId,_type,_triggerPrice,_limitPrice) = if (if (if (if (if (!(initialized())) | |
647 | 654 | then true | |
648 | 655 | else !(isWhitelist(_amm))) | |
649 | 656 | then true | |
650 | 657 | else (0 >= _triggerPrice)) | |
651 | 658 | then true | |
652 | 659 | else (0 > _limitPrice)) | |
653 | 660 | then true | |
654 | 661 | else !((i.caller == this))) | |
655 | 662 | then throw("Invalid internalCreateOrderRequest parameters") | |
656 | 663 | else saveOrderRequest(_orderId, _amm, _trader, _type, _triggerPrice, _limitPrice) | |
657 | 664 | ||
658 | 665 | ||
659 | 666 | ||
660 | 667 | @Callable(i) | |
661 | 668 | 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())) | |
662 | 669 | then true | |
663 | 670 | else !(isWhitelist(_amm))) | |
664 | 671 | then true | |
665 | 672 | else (0 > _triggerPrice)) | |
666 | 673 | then true | |
667 | 674 | else (0 > _limitPrice)) | |
668 | 675 | then true | |
669 | 676 | else (0 >= _amountIn)) | |
670 | 677 | then true | |
671 | 678 | else (0 > _leverage)) | |
672 | 679 | then true | |
673 | 680 | else !(if ((_side == LONG)) | |
674 | 681 | then true | |
675 | 682 | else (_side == SHORT))) | |
676 | 683 | then true | |
677 | 684 | else !(if (if (if ((_type == STOP)) | |
678 | 685 | then true | |
679 | 686 | else (_type == TAKE)) | |
680 | 687 | then true | |
681 | 688 | else (_type == LIMIT)) | |
682 | 689 | then true | |
683 | 690 | else (_type == MARKET))) | |
684 | 691 | then true | |
685 | 692 | else !((i.caller == this))) | |
686 | 693 | then true | |
687 | 694 | else (0 > _expiration)) | |
688 | 695 | then throw("Invalid internalCreateOrder parameters") | |
689 | 696 | else { | |
690 | 697 | let orderId = (currentOrderId() + 1) | |
691 | 698 | let positionDirection = getPositionDirection(_side, _type) | |
692 | 699 | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) + 1) | |
693 | 700 | let positionSize = getPositionSize(_amm, _trader, positionDirection) | |
694 | 701 | let orderMarketPrice = getMarketPrice(_amm) | |
695 | 702 | let _direction = if (if (if ((positionSize == 0)) | |
696 | 703 | then true | |
697 | 704 | else if ((positionSize > 0)) | |
698 | 705 | then (_side == LONG) | |
699 | 706 | else false) | |
700 | 707 | then true | |
701 | 708 | else if ((0 > positionSize)) | |
702 | 709 | then (_side == SHORT) | |
703 | 710 | else false) | |
704 | 711 | then INCREASE | |
705 | 712 | else DECREASE | |
706 | 713 | if (if ((positionSize == 0)) | |
707 | 714 | then if ((_type == STOP)) | |
708 | 715 | then true | |
709 | 716 | else (_type == TAKE) | |
710 | 717 | else false) | |
711 | 718 | then throw("Can not create STOP/TAKE order: no position") | |
712 | 719 | else { | |
713 | 720 | let usdnPayment = if ((_direction == INCREASE)) | |
714 | 721 | then if (if ((_paymentAssetId != toBase58String(quoteAsset()))) | |
715 | 722 | then true | |
716 | 723 | else (_paymentAmount != _amountIn)) | |
717 | 724 | then throw("Invalid createLimitOrder parameters: invalid payment") | |
718 | 725 | else { | |
719 | 726 | let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _paymentAmount)]) | |
720 | 727 | if ((stake == stake)) | |
721 | 728 | then _paymentAmount | |
722 | 729 | else throw("Strict value is not equal to itself.") | |
723 | 730 | } | |
724 | 731 | else 0 | |
725 | 732 | if ((usdnPayment == usdnPayment)) | |
726 | 733 | then { | |
727 | 734 | let positionId = if ((positionSize != 0)) | |
728 | 735 | then getPositionId(_amm, _trader, positionDirection) | |
729 | 736 | else 0 | |
730 | 737 | if (if (if ((_type == STOP)) | |
731 | 738 | then true | |
732 | 739 | else (_type == TAKE)) | |
733 | 740 | then (positionId == 0) | |
734 | 741 | else false) | |
735 | 742 | then throw("STOP and TAKE order should be assigned to position with id != 0") | |
736 | 743 | else if ((newTraderOrderCount > MAX_TRADER_ORDERS_PER_AMM)) | |
737 | 744 | then throw("Invalid createLimitOrder parameters: order count") | |
738 | 745 | else { | |
739 | 746 | let changeSet = (((saveOrder(orderId, _amm, _trader, _amountIn, _leverage, _type, _triggerPrice, usdnPayment, _side, _refLink, positionId, _limitPrice, _expiration, orderMarketPrice) ++ addRemoveOrderId(orderId, _amm, _trader, true)) ++ updateTraderOrderCount(_amm, _trader, newTraderOrderCount)) ++ updateLastOrderId(orderId)) | |
740 | 747 | $Tuple2(changeSet, orderId) | |
741 | 748 | } | |
742 | 749 | } | |
743 | 750 | else throw("Strict value is not equal to itself.") | |
744 | 751 | } | |
745 | 752 | } | |
746 | 753 | ||
747 | 754 | ||
748 | 755 | ||
749 | 756 | @Callable(i) | |
750 | 757 | func cancelOrder (_orderId) = { | |
751 | - | let $ | |
752 | - | let _amm = $ | |
753 | - | let _trader = $ | |
754 | - | let _amountIn = $ | |
755 | - | let _leverage = $ | |
756 | - | let _type = $ | |
757 | - | let _triggerPrice = $ | |
758 | - | let _amountUsdn = $ | |
758 | + | let $t02856928719 = getOrder(_orderId) | |
759 | + | let _amm = $t02856928719._1 | |
760 | + | let _trader = $t02856928719._2 | |
761 | + | let _amountIn = $t02856928719._3 | |
762 | + | let _leverage = $t02856928719._4 | |
763 | + | let _type = $t02856928719._5 | |
764 | + | let _triggerPrice = $t02856928719._6 | |
765 | + | let _amountUsdn = $t02856928719._7 | |
759 | 766 | if (if (if (!(initialized())) | |
760 | 767 | then true | |
761 | 768 | else !(isValid(_orderId))) | |
762 | 769 | then true | |
763 | 770 | else !((toString(i.caller) == _trader))) | |
764 | 771 | then throw("Invalid cancelOrder parameters") | |
765 | 772 | else { | |
766 | 773 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
767 | 774 | if ((cleanUp == cleanUp)) | |
768 | 775 | then { | |
769 | 776 | let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) - 1) | |
770 | 777 | let withdraw = if ((_amountUsdn > 0)) | |
771 | 778 | then { | |
772 | 779 | let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), _amountUsdn], nil) | |
773 | 780 | if ((unstake == unstake)) | |
774 | 781 | then nil | |
775 | 782 | else throw("Strict value is not equal to itself.") | |
776 | 783 | } | |
777 | 784 | else nil | |
778 | 785 | if ((withdraw == withdraw)) | |
779 | 786 | then (((markCancelOrder(_orderId) ++ addRemoveOrderId(_orderId, _amm, _trader, false)) ++ updateTraderOrderCount(_amm, _trader, newTraderOrderCount)) ++ (if ((_amountUsdn > 0)) | |
780 | 787 | then [ScriptTransfer(i.caller, _amountUsdn, quoteAsset())] | |
781 | 788 | else nil)) | |
782 | 789 | else throw("Strict value is not equal to itself.") | |
783 | 790 | } | |
784 | 791 | else throw("Strict value is not equal to itself.") | |
785 | 792 | } | |
786 | 793 | } | |
787 | 794 | ||
788 | 795 | ||
789 | 796 | ||
790 | 797 | @Callable(i) | |
791 | 798 | func executeOrder (_orderId,_priceData) = { | |
792 | - | let $ | |
793 | - | let _amm = $ | |
794 | - | let _trader = $ | |
795 | - | let _amountIn = $ | |
796 | - | let _leverage = $ | |
797 | - | let _type = $ | |
798 | - | let _triggerPrice = $ | |
799 | - | let _amountUsdn = $ | |
800 | - | let _side = $ | |
801 | - | let _refLink = $ | |
802 | - | let _positionId = $ | |
803 | - | let _limitPrice = $ | |
804 | - | let _expiration = $ | |
805 | - | let _orderMarketPrice = $ | |
799 | + | let $t02993730200 = getOrder(_orderId) | |
800 | + | let _amm = $t02993730200._1 | |
801 | + | let _trader = $t02993730200._2 | |
802 | + | let _amountIn = $t02993730200._3 | |
803 | + | let _leverage = $t02993730200._4 | |
804 | + | let _type = $t02993730200._5 | |
805 | + | let _triggerPrice = $t02993730200._6 | |
806 | + | let _amountUsdn = $t02993730200._7 | |
807 | + | let _side = $t02993730200._8 | |
808 | + | let _refLink = $t02993730200._9 | |
809 | + | let _positionId = $t02993730200._10 | |
810 | + | let _limitPrice = $t02993730200._11 | |
811 | + | let _expiration = $t02993730200._12 | |
812 | + | let _orderMarketPrice = $t02993730200._13 | |
806 | 813 | let updatePrice = invoke(addressFromStringValue(_amm), "updateOracle", [_priceData], nil) | |
807 | 814 | if ((updatePrice == updatePrice)) | |
808 | 815 | then { | |
809 | 816 | let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil) | |
810 | 817 | if ((cleanUp == cleanUp)) | |
811 | 818 | then { | |
812 | 819 | let _caller = if ((i.caller == this)) | |
813 | 820 | then i.originCaller | |
814 | 821 | else i.caller | |
815 | 822 | if ((_caller == _caller)) | |
816 | 823 | then { | |
817 | 824 | let positionDirection = getPositionDirection(_side, _type) | |
818 | 825 | if (if (if (!(initialized())) | |
819 | 826 | then true | |
820 | 827 | else !(isValid(_orderId))) | |
821 | 828 | then true | |
822 | 829 | else !(checkValidExecutor(_caller))) | |
823 | 830 | then throw("Invalid executeOrder parameters") | |
824 | 831 | else { | |
825 | 832 | let positionSize = getPositionSize(_amm, _trader, positionDirection) | |
826 | 833 | if ((positionSize == positionSize)) | |
827 | 834 | then { | |
828 | 835 | let currentPositionId = if ((positionSize != 0)) | |
829 | 836 | then getPositionId(_amm, _trader, positionDirection) | |
830 | 837 | else 0 | |
831 | - | let $ | |
838 | + | let $t03094636197 = if ((_type == STOP)) | |
832 | 839 | then { | |
833 | 840 | let _positionDirection = if ((positionSize > 0)) | |
834 | 841 | then LONG | |
835 | 842 | else if ((0 > positionSize)) | |
836 | 843 | then SHORT | |
837 | 844 | else throw("Can not execute STOP order: no open position") | |
838 | 845 | let marketPrice = getMarketPrice(_amm) | |
839 | 846 | let isExecutable = if ((_side == _positionDirection)) | |
840 | 847 | then throw("Can not execute STOP order: reduce only") | |
841 | 848 | else if ((currentPositionId != _positionId)) | |
842 | 849 | then throw("Can not execute STOP order: position closed") | |
843 | 850 | else if ((_positionDirection == LONG)) | |
844 | 851 | then (_triggerPrice >= marketPrice) | |
845 | 852 | else (marketPrice >= _triggerPrice) | |
846 | 853 | if (isExecutable) | |
847 | 854 | then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false, _priceData], nil) | |
848 | 855 | else throw("Can not execute STOP order: triggerPrice mismatch") | |
849 | 856 | } | |
850 | 857 | else if ((_type == TAKE)) | |
851 | 858 | then { | |
852 | 859 | let _positionDirection = if ((positionSize > 0)) | |
853 | 860 | then LONG | |
854 | 861 | else if ((0 > positionSize)) | |
855 | 862 | then SHORT | |
856 | 863 | else throw("Can not execute STOP order: no open position") | |
857 | 864 | let marketPrice = getMarketPrice(_amm) | |
858 | 865 | let isExecutable = if ((_side == _positionDirection)) | |
859 | 866 | then throw("Can not execute TAKE order: reduce only") | |
860 | 867 | else if ((currentPositionId != _positionId)) | |
861 | 868 | then throw(((("Can not execute TAKE order: position closed " + toString(currentPositionId)) + "!=") + toString(_positionId))) | |
862 | 869 | else if ((_positionDirection == LONG)) | |
863 | 870 | then (marketPrice >= _triggerPrice) | |
864 | 871 | else (_triggerPrice >= marketPrice) | |
865 | 872 | if (isExecutable) | |
866 | 873 | then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false, _priceData], nil) | |
867 | 874 | else throw("Can not execute TAKE order: triggerPrice mismatch") | |
868 | 875 | } | |
869 | 876 | else if ((_type == LIMIT)) | |
870 | 877 | then { | |
871 | 878 | let marketPrice = getMarketPrice(_amm) | |
872 | 879 | let isExecutableByStop = if ((_limitPrice == 0)) | |
873 | 880 | then true | |
874 | - | else if ((_ | |
881 | + | else if ((_side == LONG)) | |
875 | 882 | then (marketPrice >= _limitPrice) | |
876 | 883 | else (_limitPrice >= marketPrice) | |
877 | 884 | let isExecutableForTriggerPrice = if ((_side == LONG)) | |
878 | 885 | then (_triggerPrice >= marketPrice) | |
879 | 886 | else (marketPrice >= _triggerPrice) | |
880 | 887 | let isExecutableByTimestamp = if (if ((_expiration == 0)) | |
881 | 888 | then true | |
882 | 889 | else (_expiration >= TIME)) | |
883 | 890 | then true | |
884 | 891 | else false | |
885 | 892 | let isExecutable = if (if (isExecutableByStop) | |
886 | 893 | then isExecutableForTriggerPrice | |
887 | 894 | else false) | |
888 | 895 | then isExecutableByTimestamp | |
889 | 896 | else false | |
890 | 897 | if (isExecutable) | |
891 | 898 | then { | |
892 | 899 | let marginAmount = divd(_amountUsdn, (muld(getFee(_amm, _trader), _leverage) + DECIMAL_UNIT)) | |
893 | 900 | let openNotional = muld(marginAmount, _leverage) | |
894 | 901 | let idealMinBaseAssetAmount = divd(openNotional, _triggerPrice) | |
895 | 902 | let minBaseAssetAmount = (idealMinBaseAssetAmount - muld(idealMinBaseAssetAmount, getSpreadLimit())) | |
896 | 903 | $Tuple3("increasePosition", [_side, _leverage, minBaseAssetAmount, _refLink, _priceData], [AttachedPayment(quoteAsset(), _amountUsdn)]) | |
897 | 904 | } | |
898 | - | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
905 | + | else if (if (if (isExecutableByStop) | |
906 | + | then isExecutableByTimestamp | |
907 | + | else false) | |
908 | + | then (_limitPrice != 0) | |
909 | + | else false) | |
910 | + | then { | |
911 | + | let doUpdateOrder = invoke(this, "internalSaveOrder", [_orderId, _amm, _trader, _amountIn, _leverage, _type, _triggerPrice, _amountUsdn, _side, _refLink, _positionId, 0, _expiration, _orderMarketPrice], nil) | |
912 | + | if ((doUpdateOrder == doUpdateOrder)) | |
913 | + | then $Tuple3("", nil, nil) | |
914 | + | else throw("Strict value is not equal to itself.") | |
915 | + | } | |
916 | + | else throw("Can not execute LIMIT order: triggerPrice mismatch") | |
899 | 917 | } | |
900 | 918 | else if ((_type == MARKET)) | |
901 | 919 | then { | |
902 | 920 | let marketPrice = getMarketPrice(_amm) | |
903 | 921 | let isExecutableByTimestamp = if (if ((_expiration == 0)) | |
904 | 922 | then true | |
905 | 923 | else (_expiration >= TIME)) | |
906 | 924 | then true | |
907 | 925 | else false | |
908 | 926 | let isExecutable = isExecutableByTimestamp | |
909 | 927 | if (isExecutable) | |
910 | 928 | then $Tuple3("increasePosition", [_side, _leverage, 0, _refLink, _priceData], [AttachedPayment(quoteAsset(), _amountUsdn)]) | |
911 | 929 | else throw("Can not execute MARKET order: expiration mismatch") | |
912 | 930 | } | |
913 | 931 | else throw(("Invalid order type: " + toString(_type))) | |
914 | - | let method = $ | |
915 | - | let args = $ | |
916 | - | let payments = $ | |
932 | + | let method = $t03094636197._1 | |
933 | + | let args = $t03094636197._2 | |
934 | + | let payments = $t03094636197._3 | |
917 | 935 | let withdraw = if ((size(payments) == 1)) | |
918 | 936 | then { | |
919 | 937 | let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), payments[0].amount], nil) | |
920 | 938 | if ((unstake == unstake)) | |
921 | 939 | then nil | |
922 | 940 | else throw("Strict value is not equal to itself.") | |
923 | 941 | } | |
924 | 942 | else nil | |
925 | 943 | if ((withdraw == withdraw)) | |
926 | - | then { | |
927 | - | let doSetContext = invoke(this, "setContext", [_trader], nil) | |
928 | - | if ((doSetContext == doSetContext)) | |
929 | - | then { | |
930 | - | let doClosePosition = invoke(addressFromStringValue(_amm), method, args, payments) | |
931 | - | if ((doClosePosition == doClosePosition)) | |
932 | - | then { | |
933 | - | let doResetContext = invoke(this, "resetContext", nil, nil) | |
934 | - | if ((doResetContext == doResetContext)) | |
935 | - | then { | |
936 | - | let executeOrderRequest = if (if ((_type == LIMIT)) | |
937 | - | then true | |
938 | - | else (_type == MARKET)) | |
939 | - | then { | |
940 | - | let newPositionSize = getPositionSize(_amm, _trader, positionDirection) | |
941 | - | if ((newPositionSize == newPositionSize)) | |
942 | - | then { | |
943 | - | let newPositionId = getPositionId(_amm, _trader, positionDirection) | |
944 | - | if ((newPositionId == newPositionId)) | |
945 | - | then { | |
946 | - | let positionSizeDelta = (newPositionSize - positionSize) | |
947 | - | let closeOrderSide = if ((newPositionSize > 0)) | |
948 | - | then SHORT | |
949 | - | else LONG | |
950 | - | let makeTakeOrder = if (haveOrderRequest(_orderId, TAKE)) | |
951 | - | then { | |
952 | - | let $t03593236131 = getOrderRequest(_orderId, TAKE) | |
953 | - | let newOrderId = $t03593236131._1 | |
954 | - | let newAmm = $t03593236131._2 | |
955 | - | let newTrader = $t03593236131._3 | |
956 | - | let newType = $t03593236131._4 | |
957 | - | let newTriggerPrice = $t03593236131._5 | |
958 | - | let newLimitPrice = $t03593236131._6 | |
959 | - | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
960 | - | if ((doCall == doCall)) | |
961 | - | then nil | |
962 | - | else throw("Strict value is not equal to itself.") | |
963 | - | } | |
964 | - | else nil | |
965 | - | if ((makeTakeOrder == makeTakeOrder)) | |
966 | - | then { | |
967 | - | let makeStopOrder = if (haveOrderRequest(_orderId, STOP)) | |
968 | - | then { | |
969 | - | let $t03670436903 = getOrderRequest(_orderId, STOP) | |
970 | - | let newOrderId = $t03670436903._1 | |
971 | - | let newAmm = $t03670436903._2 | |
972 | - | let newTrader = $t03670436903._3 | |
973 | - | let newType = $t03670436903._4 | |
974 | - | let newTriggerPrice = $t03670436903._5 | |
975 | - | let newLimitPrice = $t03670436903._6 | |
976 | - | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
977 | - | if ((doCall == doCall)) | |
978 | - | then nil | |
979 | - | else throw("Strict value is not equal to itself.") | |
980 | - | } | |
981 | - | else nil | |
982 | - | if ((makeStopOrder == makeStopOrder)) | |
983 | - | then (makeTakeOrder ++ makeStopOrder) | |
984 | - | else throw("Strict value is not equal to itself.") | |
985 | - | } | |
986 | - | else throw("Strict value is not equal to itself.") | |
987 | - | } | |
988 | - | else throw("Strict value is not equal to itself.") | |
989 | - | } | |
990 | - | else throw("Strict value is not equal to itself.") | |
991 | - | } | |
992 | - | else nil | |
993 | - | if ((executeOrderRequest == executeOrderRequest)) | |
994 | - | then { | |
995 | - | let doMarkOrderExecuted = invoke(this, "internalMarkOrderExecuted", [_amm, _trader, _orderId], nil) | |
996 | - | if ((doMarkOrderExecuted == doMarkOrderExecuted)) | |
997 | - | then nil | |
998 | - | else throw("Strict value is not equal to itself.") | |
999 | - | } | |
1000 | - | else throw("Strict value is not equal to itself.") | |
1001 | - | } | |
1002 | - | else throw("Strict value is not equal to itself.") | |
1003 | - | } | |
1004 | - | else throw("Strict value is not equal to itself.") | |
1005 | - | } | |
1006 | - | else throw("Strict value is not equal to itself.") | |
1007 | - | } | |
944 | + | then if ((method != "")) | |
945 | + | then { | |
946 | + | let doSetContext = invoke(this, "setContext", [_trader], nil) | |
947 | + | if ((doSetContext == doSetContext)) | |
948 | + | then { | |
949 | + | let doClosePosition = invoke(addressFromStringValue(_amm), method, args, payments) | |
950 | + | if ((doClosePosition == doClosePosition)) | |
951 | + | then { | |
952 | + | let doResetContext = invoke(this, "resetContext", nil, nil) | |
953 | + | if ((doResetContext == doResetContext)) | |
954 | + | then { | |
955 | + | let executeOrderRequest = if (if ((_type == LIMIT)) | |
956 | + | then true | |
957 | + | else (_type == MARKET)) | |
958 | + | then { | |
959 | + | let newPositionSize = getPositionSize(_amm, _trader, positionDirection) | |
960 | + | if ((newPositionSize == newPositionSize)) | |
961 | + | then { | |
962 | + | let newPositionId = getPositionId(_amm, _trader, positionDirection) | |
963 | + | if ((newPositionId == newPositionId)) | |
964 | + | then { | |
965 | + | let positionSizeDelta = (newPositionSize - positionSize) | |
966 | + | let closeOrderSide = if ((newPositionSize > 0)) | |
967 | + | then SHORT | |
968 | + | else LONG | |
969 | + | let makeTakeOrder = if (haveOrderRequest(_orderId, TAKE)) | |
970 | + | then { | |
971 | + | let $t03723137444 = getOrderRequest(_orderId, TAKE) | |
972 | + | let newOrderId = $t03723137444._1 | |
973 | + | let newAmm = $t03723137444._2 | |
974 | + | let newTrader = $t03723137444._3 | |
975 | + | let newType = $t03723137444._4 | |
976 | + | let newTriggerPrice = $t03723137444._5 | |
977 | + | let newLimitPrice = $t03723137444._6 | |
978 | + | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
979 | + | if ((doCall == doCall)) | |
980 | + | then nil | |
981 | + | else throw("Strict value is not equal to itself.") | |
982 | + | } | |
983 | + | else nil | |
984 | + | if ((makeTakeOrder == makeTakeOrder)) | |
985 | + | then { | |
986 | + | let makeStopOrder = if (haveOrderRequest(_orderId, STOP)) | |
987 | + | then { | |
988 | + | let $t03806738280 = getOrderRequest(_orderId, STOP) | |
989 | + | let newOrderId = $t03806738280._1 | |
990 | + | let newAmm = $t03806738280._2 | |
991 | + | let newTrader = $t03806738280._3 | |
992 | + | let newType = $t03806738280._4 | |
993 | + | let newTriggerPrice = $t03806738280._5 | |
994 | + | let newLimitPrice = $t03806738280._6 | |
995 | + | let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil) | |
996 | + | if ((doCall == doCall)) | |
997 | + | then nil | |
998 | + | else throw("Strict value is not equal to itself.") | |
999 | + | } | |
1000 | + | else nil | |
1001 | + | if ((makeStopOrder == makeStopOrder)) | |
1002 | + | then (makeTakeOrder ++ makeStopOrder) | |
1003 | + | else throw("Strict value is not equal to itself.") | |
1004 | + | } | |
1005 | + | else throw("Strict value is not equal to itself.") | |
1006 | + | } | |
1007 | + | else throw("Strict value is not equal to itself.") | |
1008 | + | } | |
1009 | + | else throw("Strict value is not equal to itself.") | |
1010 | + | } | |
1011 | + | else nil | |
1012 | + | if ((executeOrderRequest == executeOrderRequest)) | |
1013 | + | then { | |
1014 | + | let doMarkOrderExecuted = invoke(this, "internalMarkOrderExecuted", [_amm, _trader, _orderId], nil) | |
1015 | + | if ((doMarkOrderExecuted == doMarkOrderExecuted)) | |
1016 | + | then nil | |
1017 | + | else throw("Strict value is not equal to itself.") | |
1018 | + | } | |
1019 | + | else throw("Strict value is not equal to itself.") | |
1020 | + | } | |
1021 | + | else throw("Strict value is not equal to itself.") | |
1022 | + | } | |
1023 | + | else throw("Strict value is not equal to itself.") | |
1024 | + | } | |
1025 | + | else throw("Strict value is not equal to itself.") | |
1026 | + | } | |
1027 | + | else nil | |
1008 | 1028 | else throw("Strict value is not equal to itself.") | |
1009 | 1029 | } | |
1010 | 1030 | else throw("Strict value is not equal to itself.") | |
1011 | 1031 | } | |
1012 | 1032 | } | |
1013 | 1033 | else throw("Strict value is not equal to itself.") | |
1014 | 1034 | } | |
1015 | 1035 | else throw("Strict value is not equal to itself.") | |
1016 | 1036 | } | |
1017 | 1037 | else throw("Strict value is not equal to itself.") | |
1018 | 1038 | } | |
1019 | 1039 | ||
1020 | 1040 | ||
1021 | 1041 | ||
1022 | 1042 | @Callable(i) | |
1023 | 1043 | func view_canExecuteOrder (_orderId,_priceData) = { | |
1024 | 1044 | let s = invoke(this, "executeOrder", [_orderId, _priceData], nil) | |
1025 | 1045 | if ((s == s)) | |
1026 | 1046 | then throw("Success") | |
1027 | 1047 | else throw("Strict value is not equal to itself.") | |
1028 | 1048 | } | |
1029 | 1049 | ||
1030 | 1050 | ||
1051 | + | ||
1052 | + | @Callable(i) | |
1053 | + | func view_canActivateStopOrder (_orderId,_priceData) = { | |
1054 | + | let s = invoke(this, "activateStopOrder", [_orderId, _priceData], nil) | |
1055 | + | if ((s == s)) | |
1056 | + | then throw("Success") | |
1057 | + | else throw("Strict value is not equal to itself.") | |
1058 | + | } | |
1059 | + | ||
1060 | + | ||
1031 | 1061 | @Verifier(tx) | |
1032 | 1062 | func verify () = { | |
1033 | 1063 | let coordinatorStr = getString(this, k_coordinatorAddress) | |
1034 | 1064 | if (isDefined(coordinatorStr)) | |
1035 | 1065 | then { | |
1036 | 1066 | let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address) | |
1037 | 1067 | if (isDefined(admin)) | |
1038 | 1068 | then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false) | |
1039 | 1069 | else throw("unable to verify: admin not set in coordinator") | |
1040 | 1070 | } | |
1041 | 1071 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
1042 | 1072 | } | |
1043 | 1073 |
github/deemru/w8io/169f3d6 121.36 ms ◑