tx · NPfrjd7jFwnFDy2cdaaj35Bnuggps7Hk2oi7NeSSW4x

3N6VKmg8fcTLVZtzTGJTd2gfjmK3VYobQf1:  -0.03700000 Waves

2023.07.04 17:00 [2651250] smart account 3N6VKmg8fcTLVZtzTGJTd2gfjmK3VYobQf1 > SELF 0.00000000 Waves

{ "type": 13, "id": "NPfrjd7jFwnFDy2cdaaj35Bnuggps7Hk2oi7NeSSW4x", "fee": 3700000, "feeAssetId": null, "timestamp": 1688479236056, "version": 2, "chainId": 84, "sender": "3N6VKmg8fcTLVZtzTGJTd2gfjmK3VYobQf1", "senderPublicKey": "A2kf7bN5S7rrpJUdubvPFNzkrSEL8uTN8Hc2Sya5cZth", "proofs": [ "5UMQ8keHnpKmJ9vDvs11hxAd6bp9XmbJDAHoXkbPWoEnx6ffc1LE3mjTRDWHBqqAs5eCAFsbwMR4CtnySt7Z5YaE" ], "script": "base64:BgJ3CAISBAoCCAgSAwoBCBIAEgQKAggBEgQKAgEEEgMKAQgSAwoBCBIQCg4IAQEBAQEBCAEBAQEBCBIMCgoIAQEBCAEBAQEIEgUKAwgIARIICgYICAEBAQESDgoMCAgBAQEBAQEICAEBEgMKAQESBAoCAQgSBAoCAQhKABRrX2Nvb3JkaW5hdG9yQWRkcmVzcwIUa19jb29yZGluYXRvckFkZHJlc3MAD2tfYWRtaW5fYWRkcmVzcwIPa19hZG1pbl9hZGRyZXNzAA1rX3F1b3RlX2Fzc2V0Ag1rX3F1b3RlX2Fzc2V0AAVrX2FtbQIFa19hbW0AEWtfbWFuYWdlcl9hZGRyZXNzAhFrX21hbmFnZXJfYWRkcmVzcwASa19wb3NpdGlvblNlcXVlbmNlAhJrX3Bvc2l0aW9uU2VxdWVuY2UADmtfcG9zaXRpb25TaXplAg5rX3Bvc2l0aW9uU2l6ZQAQa19leGVjdXRlZE9yZGVycwIQa19leGVjdXRlZE9yZGVycwAQa19jYW5jZWxlZE9yZGVycwIQa19jYW5jZWxlZE9yZGVycwAHa19vcmRlcgIHa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ifferences
3131
3232 let k_spreadLimit = "k_spreadLimit"
3333
34+let k_onlyWhitelist = "k_onlyWhitelist"
35+
36+let k_whitelistExecutor = "k_whitelistExecutor"
37+
3438 let k_sender = "k_sender"
3539
3640 let k_initialized = "k_initialized"
4044 let TAKE = 2
4145
4246 let LIMIT = 3
47+
48+let MARKET = 4
4349
4450 let LONG = 1
4551
242248 func getSpread (_price) = muld(_price, getSpreadLimit())
243249
244250
251+func isOnlyWhitelistExecutors () = valueOrElse(getBoolean(this, k_onlyWhitelist), false)
252+
253+
254+func isWhitelistExecutor (_executor) = valueOrElse(getBoolean(this, toCompositeKey(k_whitelistExecutor, _executor)), false)
255+
256+
245257 func saveOrder (_orderId,_amm,_trader,_amountIn,_leverage,_type,_triggerPrice,_paymentUsdn,_side,_refLink,_positionId,_limitPrice,_expiration,_orderMarketPrice) = {
246258 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)], ",")
247259 [StringEntry(orderKey(_orderId), orderStr)]
300312 }
301313
302314
315+func checkValidExecutor (_caller) = if (isOnlyWhitelistExecutors())
316+ then isWhitelistExecutor(toString(_caller))
317+ else true
318+
319+
303320 @Callable(i)
304321 func cleanUpStaleOrders (_amm,_trader) = {
305322 let orders = traderAmmOrdersIds(_amm, _trader)
306323 let positionIds = getPositionIds(_amm, _trader)
307324 func cleanUpOne (_acc,_orderId) = {
308325 let orderIdInt = valueOrErrorMessage(parseInt(_orderId), "Invalid order id")
309- let $t01176611982 = getOrder(orderIdInt)
310- let _x1 = $t01176611982._1
311- let _x2 = $t01176611982._2
312- let _x3 = $t01176611982._3
313- let _x4 = $t01176611982._4
314- let _type = $t01176611982._5
315- let _x5 = $t01176611982._6
316- let _x6 = $t01176611982._7
317- let _x7 = $t01176611982._8
318- let _x8 = $t01176611982._9
319- let _positionId = $t01176611982._10
320- let _x9 = $t01176611982._11
321- let _expiration = $t01176611982._12
326+ let $t01236712592 = getOrder(orderIdInt)
327+ let _x1 = $t01236712592._1
328+ let _x2 = $t01236712592._2
329+ let _x3 = $t01236712592._3
330+ let _x4 = $t01236712592._4
331+ let _type = $t01236712592._5
332+ let _x5 = $t01236712592._6
333+ let _paymentUsdn = $t01236712592._7
334+ let _x6 = $t01236712592._8
335+ let _x7 = $t01236712592._9
336+ let _positionId = $t01236712592._10
337+ let _x8 = $t01236712592._11
338+ let _expiration = $t01236712592._12
322339 let cancelTakeStopOfNoPosition = if (if (if ((_type == STOP))
323340 then true
324341 else (_type == TAKE))
326343 else false)
327344 then (positionIds[1] != _positionId)
328345 else false
329- let cancelLimitIfExpired = if ((_type == LIMIT))
330- then (lastBlock.timestamp >= _expiration)
346+ let cancelLimitIfExpired = if (if ((_type == LIMIT))
347+ then true
348+ else (_type == MARKET))
349+ then (TIME >= _expiration)
331350 else false
332351 if (if (cancelTakeStopOfNoPosition)
333352 then true
335354 then {
336355 let change = markCancelOrder(orderIdInt)
337356 let newOrderList = addRemoveOrderIdList(_acc._1, orderIdInt, _amm, _trader, false)
338- $Tuple2(newOrderList, (_acc._2 ++ change))
357+ let paymentToReturn = if (if ((_type == LIMIT))
358+ then true
359+ else (_type == MARKET))
360+ then _paymentUsdn
361+ else 0
362+ $Tuple3(newOrderList, (_acc._2 ++ change), (_acc._3 + paymentToReturn))
339363 }
340364 else _acc
341365 }
342366
343- let $t01251412589 = {
367+ let $t01329313388 = {
344368 let $l = orders
345369 let $s = size($l)
346- let $acc0 = $Tuple2(orders, nil)
370+ let $acc0 = $Tuple3(orders, nil, 0)
347371 func $f0_1 ($a,$i) = if (($i >= $s))
348372 then $a
349373 else cleanUpOne($a, $l[$i])
354378
355379 $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)
356380 }
357- let newOrders = $t01251412589._1
358- let cancelActions = $t01251412589._2
359- ((cancelActions ++ updateTraderOrderCount(_amm, _trader, size(newOrders))) ++ updateOrderIdStr(makeString(newOrders, ","), _amm, _trader))
381+ let newOrders = $t01329313388._1
382+ let cancelActions = $t01329313388._2
383+ let paymentToReturn = $t01329313388._3
384+ let withdraw = if ((paymentToReturn > 0))
385+ then {
386+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), paymentToReturn], nil)
387+ if ((unstake == unstake))
388+ then nil
389+ else throw("Strict value is not equal to itself.")
390+ }
391+ else nil
392+ if ((withdraw == withdraw))
393+ then (((cancelActions ++ updateTraderOrderCount(_amm, _trader, size(newOrders))) ++ updateOrderIdStr(makeString(newOrders, ","), _amm, _trader)) ++ [ScriptTransfer(addressFromStringValue(_trader), paymentToReturn, quoteAsset())])
394+ else throw("Strict value is not equal to itself.")
360395 }
361396
362397
389424
390425
391426 @Callable(i)
392-func changeSettings (_spreadLimit) = if (if ((i.caller != adminAddress()))
427+func changeSettings (_spreadLimit,_onlyWhitelist) = if (if ((i.caller != adminAddress()))
393428 then true
394429 else if ((0 > _spreadLimit))
395430 then true
396431 else (_spreadLimit > (DECIMAL_UNIT / 10)))
397432 then throw("Invalid changeSettings params")
398- else [IntegerEntry(k_spreadLimit, _spreadLimit)]
433+ else [IntegerEntry(k_spreadLimit, _spreadLimit), BooleanEntry(k_onlyWhitelist, _onlyWhitelist)]
434+
435+
436+
437+@Callable(i)
438+func addWhitelist (_list) = if ((i.caller != adminAddress()))
439+ then throw("Invalid addWhitelist params")
440+ else {
441+ func toAddressList (_acc,_addr) = {
442+ let address = addressFromStringValue(_addr)
443+ if ((address == address))
444+ then (_acc :+ BooleanEntry(toCompositeKey(k_whitelistExecutor, toString(address)), true))
445+ else throw("Strict value is not equal to itself.")
446+ }
447+
448+ let $l = split_4C(_list, ",")
449+ let $s = size($l)
450+ let $acc0 = nil
451+ func $f0_1 ($a,$i) = if (($i >= $s))
452+ then $a
453+ else toAddressList($a, $l[$i])
454+
455+ func $f0_2 ($a,$i) = if (($i >= $s))
456+ then $a
457+ else throw("List size exceeds 20")
458+
459+ $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+ }
461+
462+
463+
464+@Callable(i)
465+func removeWhitelist (_list) = if ((i.caller != adminAddress()))
466+ then throw("Invalid removeWhitelist params")
467+ else {
468+ func toAddressList (_acc,_addr) = {
469+ let address = addressFromStringValue(_addr)
470+ if ((address == address))
471+ then (_acc :+ BooleanEntry(toCompositeKey(k_whitelistExecutor, toString(address)), false))
472+ else throw("Strict value is not equal to itself.")
473+ }
474+
475+ let $l = split_4C(_list, ",")
476+ let $s = size($l)
477+ let $acc0 = nil
478+ func $f0_1 ($a,$i) = if (($i >= $s))
479+ then $a
480+ else toAddressList($a, $l[$i])
481+
482+ func $f0_2 ($a,$i) = if (($i >= $s))
483+ then $a
484+ else throw("List size exceeds 20")
485+
486+ $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+ }
399488
400489
401490
410499 then if ((size(i.payments) > 1))
411500 then throw("Invalid createOrder parameters: invalid payment count")
412501 else {
413- let $t01570315955 = if ((size(i.payments) == 1))
502+ let $t01789718149 = if ((size(i.payments) == 1))
414503 then $Tuple2(toBase58String(valueOrErrorMessage(i.payments[0].assetId, "Invalid asset id")), i.payments[0].amount)
415504 else $Tuple2("", 0)
416- let paymentAssetId = $t01570315955._1
417- let paymentAmount = $t01570315955._2
505+ let paymentAssetId = $t01789718149._1
506+ let paymentAmount = $t01789718149._2
418507 let doCall = invoke(this, "internalCreateOrder", [_trader, _amm, _type, _triggerPrice, _limitPrice, _amountIn, _leverage, _side, _refLink, paymentAssetId, paymentAmount, _expiration], nil)
419508 if ((doCall == doCall))
420509 then {
424513 case _ =>
425514 throw("Invalid ID of created order")
426515 }
427- if ((_type == LIMIT))
516+ if (if ((_type == LIMIT))
517+ then true
518+ else (_type == MARKET))
428519 then {
429520 let makeStop = if ((_stopTriggerPrice > 0))
430521 then {
571662 then true
572663 else !(isWhitelist(_amm)))
573664 then true
574- else (0 >= _triggerPrice))
665+ else (0 > _triggerPrice))
575666 then true
576667 else (0 > _limitPrice))
577668 then true
583674 then true
584675 else (_side == SHORT)))
585676 then true
586- else !(if (if ((_type == STOP))
677+ else !(if (if (if ((_type == STOP))
587678 then true
588679 else (_type == TAKE))
589680 then true
590- else (_type == LIMIT)))
681+ else (_type == LIMIT))
682+ then true
683+ else (_type == MARKET)))
591684 then true
592685 else !((i.caller == this)))
593686 then true
655748
656749 @Callable(i)
657750 func cancelOrder (_orderId) = {
658- let $t02559125741 = getOrder(_orderId)
659- let _amm = $t02559125741._1
660- let _trader = $t02559125741._2
661- let _amountIn = $t02559125741._3
662- let _leverage = $t02559125741._4
663- let _type = $t02559125741._5
664- let _triggerPrice = $t02559125741._6
665- let _amountUsdn = $t02559125741._7
751+ let $t02782227972 = getOrder(_orderId)
752+ let _amm = $t02782227972._1
753+ let _trader = $t02782227972._2
754+ let _amountIn = $t02782227972._3
755+ let _leverage = $t02782227972._4
756+ let _type = $t02782227972._5
757+ let _triggerPrice = $t02782227972._6
758+ let _amountUsdn = $t02782227972._7
666759 if (if (if (!(initialized()))
667760 then true
668761 else !(isValid(_orderId)))
696789
697790 @Callable(i)
698791 func executeOrder (_orderId,_priceData) = {
699- let $t02695927221 = getOrder(_orderId)
700- let _amm = $t02695927221._1
701- let _trader = $t02695927221._2
702- let _amountIn = $t02695927221._3
703- let _leverage = $t02695927221._4
704- let _type = $t02695927221._5
705- let _triggerPrice = $t02695927221._6
706- let _amountUsdn = $t02695927221._7
707- let _side = $t02695927221._8
708- let _refLink = $t02695927221._9
709- let _positionId = $t02695927221._10
710- let _limitPrice = $t02695927221._11
711- let _timestamp = $t02695927221._12
712- let _orderMarketPrice = $t02695927221._13
792+ let $t02919029453 = getOrder(_orderId)
793+ let _amm = $t02919029453._1
794+ let _trader = $t02919029453._2
795+ let _amountIn = $t02919029453._3
796+ let _leverage = $t02919029453._4
797+ let _type = $t02919029453._5
798+ let _triggerPrice = $t02919029453._6
799+ let _amountUsdn = $t02919029453._7
800+ let _side = $t02919029453._8
801+ let _refLink = $t02919029453._9
802+ let _positionId = $t02919029453._10
803+ let _limitPrice = $t02919029453._11
804+ let _expiration = $t02919029453._12
805+ let _orderMarketPrice = $t02919029453._13
713806 let updatePrice = invoke(addressFromStringValue(_amm), "updateOracle", [_priceData], nil)
714807 if ((updatePrice == updatePrice))
715808 then {
716809 let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil)
717810 if ((cleanUp == cleanUp))
718811 then {
719- let positionDirection = getPositionDirection(_side, _type)
720- if (if (!(initialized()))
721- then true
722- else !(isValid(_orderId)))
723- then throw("Invalid executeOrder parameters")
724- else {
725- let positionSize = getPositionSize(_amm, _trader, positionDirection)
726- if ((positionSize == positionSize))
727- then {
728- let currentPositionId = if ((positionSize != 0))
729- then getPositionId(_amm, _trader, positionDirection)
730- else 0
731- let $t02783031791 = if ((_type == STOP))
812+ let _caller = if ((i.caller == this))
813+ then i.originCaller
814+ else i.caller
815+ if ((_caller == _caller))
816+ then {
817+ let positionDirection = getPositionDirection(_side, _type)
818+ if (if (if (!(initialized()))
819+ then true
820+ else !(isValid(_orderId)))
821+ then true
822+ else !(checkValidExecutor(_caller)))
823+ then throw("Invalid executeOrder parameters")
824+ else {
825+ let positionSize = getPositionSize(_amm, _trader, positionDirection)
826+ if ((positionSize == positionSize))
732827 then {
733- let _positionDirection = if ((positionSize > 0))
734- then LONG
735- else if ((0 > positionSize))
736- then SHORT
737- else throw("Can not execute STOP order: no open position")
738- let marketPrice = getMarketPrice(_amm)
739- let isExecutable = if ((_side == _positionDirection))
740- then throw("Can not execute STOP order: reduce only")
741- else if ((currentPositionId != _positionId))
742- then throw("Can not execute STOP order: position closed")
743- else if ((_positionDirection == LONG))
744- then (_triggerPrice >= marketPrice)
745- else (marketPrice >= _triggerPrice)
746- if (isExecutable)
747- then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false, _priceData], nil)
748- else throw("Can not execute STOP order: triggerPrice mismatch")
749- }
750- else if ((_type == TAKE))
751- then {
752- let _positionDirection = if ((positionSize > 0))
753- then LONG
754- else if ((0 > positionSize))
755- then SHORT
756- else throw("Can not execute STOP order: no open position")
757- let marketPrice = getMarketPrice(_amm)
758- let isExecutable = if ((_side == _positionDirection))
759- then throw("Can not execute TAKE order: reduce only")
760- else if ((currentPositionId != _positionId))
761- then throw(((("Can not execute TAKE order: position closed " + toString(currentPositionId)) + "!=") + toString(_positionId)))
762- else if ((_positionDirection == LONG))
763- then (marketPrice >= _triggerPrice)
764- else (_triggerPrice >= marketPrice)
765- if (isExecutable)
766- then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false, _priceData], nil)
767- else throw("Can not execute TAKE order: triggerPrice mismatch")
768- }
769- else if ((_type == LIMIT))
828+ let currentPositionId = if ((positionSize != 0))
829+ then getPositionId(_amm, _trader, positionDirection)
830+ else 0
831+ let $t03019934951 = if ((_type == STOP))
770832 then {
833+ let _positionDirection = if ((positionSize > 0))
834+ then LONG
835+ else if ((0 > positionSize))
836+ then SHORT
837+ else throw("Can not execute STOP order: no open position")
771838 let marketPrice = getMarketPrice(_amm)
772- let isExecutableByStop = if ((_limitPrice == 0))
773- then true
774- else if ((_limitPrice > _orderMarketPrice))
775- then (marketPrice >= _limitPrice)
776- else (_limitPrice >= marketPrice)
777- let isExecutableForTriggerPrice = if ((_side == LONG))
778- then (_triggerPrice >= marketPrice)
779- else (marketPrice >= _triggerPrice)
780- let isExecutable = if (isExecutableByStop)
781- then isExecutableForTriggerPrice
782- else false
839+ let isExecutable = if ((_side == _positionDirection))
840+ then throw("Can not execute STOP order: reduce only")
841+ else if ((currentPositionId != _positionId))
842+ then throw("Can not execute STOP order: position closed")
843+ else if ((_positionDirection == LONG))
844+ then (_triggerPrice >= marketPrice)
845+ else (marketPrice >= _triggerPrice)
783846 if (isExecutable)
847+ then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false, _priceData], nil)
848+ else throw("Can not execute STOP order: triggerPrice mismatch")
849+ }
850+ else if ((_type == TAKE))
851+ then {
852+ let _positionDirection = if ((positionSize > 0))
853+ then LONG
854+ else if ((0 > positionSize))
855+ then SHORT
856+ else throw("Can not execute STOP order: no open position")
857+ let marketPrice = getMarketPrice(_amm)
858+ let isExecutable = if ((_side == _positionDirection))
859+ then throw("Can not execute TAKE order: reduce only")
860+ else if ((currentPositionId != _positionId))
861+ then throw(((("Can not execute TAKE order: position closed " + toString(currentPositionId)) + "!=") + toString(_positionId)))
862+ else if ((_positionDirection == LONG))
863+ then (marketPrice >= _triggerPrice)
864+ else (_triggerPrice >= marketPrice)
865+ if (isExecutable)
866+ then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false, _priceData], nil)
867+ else throw("Can not execute TAKE order: triggerPrice mismatch")
868+ }
869+ else if ((_type == LIMIT))
784870 then {
785- let marginAmount = divd(_amountUsdn, (muld(getFee(_amm, _trader), _leverage) + DECIMAL_UNIT))
786- let openNotional = muld(marginAmount, _leverage)
787- let idealMinBaseAssetAmount = divd(openNotional, _triggerPrice)
788- let minBaseAssetAmount = (idealMinBaseAssetAmount - muld(idealMinBaseAssetAmount, getSpreadLimit()))
789- $Tuple3("increasePosition", [_side, _leverage, minBaseAssetAmount, _refLink, _priceData], [AttachedPayment(quoteAsset(), _amountUsdn)])
871+ let marketPrice = getMarketPrice(_amm)
872+ let isExecutableByStop = if ((_limitPrice == 0))
873+ then true
874+ else if ((_limitPrice > _orderMarketPrice))
875+ then (marketPrice >= _limitPrice)
876+ else (_limitPrice >= marketPrice)
877+ let isExecutableForTriggerPrice = if ((_side == LONG))
878+ then (_triggerPrice >= marketPrice)
879+ else (marketPrice >= _triggerPrice)
880+ let isExecutableByTimestamp = if (if ((_expiration == 0))
881+ then true
882+ else (_expiration >= TIME))
883+ then true
884+ else false
885+ let isExecutable = if (if (isExecutableByStop)
886+ then isExecutableForTriggerPrice
887+ else false)
888+ then isExecutableByTimestamp
889+ else false
890+ if (isExecutable)
891+ then {
892+ let marginAmount = divd(_amountUsdn, (muld(getFee(_amm, _trader), _leverage) + DECIMAL_UNIT))
893+ let openNotional = muld(marginAmount, _leverage)
894+ let idealMinBaseAssetAmount = divd(openNotional, _triggerPrice)
895+ let minBaseAssetAmount = (idealMinBaseAssetAmount - muld(idealMinBaseAssetAmount, getSpreadLimit()))
896+ $Tuple3("increasePosition", [_side, _leverage, minBaseAssetAmount, _refLink, _priceData], [AttachedPayment(quoteAsset(), _amountUsdn)])
897+ }
898+ else throw("Can not execute LIMIT order: triggerPrice mismatch")
790899 }
791- else throw("Can not execute LIMIT order: triggerPrice mismatch")
900+ else if ((_type == MARKET))
901+ then {
902+ let marketPrice = getMarketPrice(_amm)
903+ let isExecutableByTimestamp = if (if ((_expiration == 0))
904+ then true
905+ else (_expiration >= TIME))
906+ then true
907+ else false
908+ let isExecutable = isExecutableByTimestamp
909+ if (isExecutable)
910+ then $Tuple3("increasePosition", [_side, _leverage, 0, _refLink, _priceData], [AttachedPayment(quoteAsset(), _amountUsdn)])
911+ else throw("Can not execute MARKET order: expiration mismatch")
912+ }
913+ else throw(("Invalid order type: " + toString(_type)))
914+ let method = $t03019934951._1
915+ let args = $t03019934951._2
916+ let payments = $t03019934951._3
917+ let withdraw = if ((size(payments) == 1))
918+ then {
919+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), payments[0].amount], nil)
920+ if ((unstake == unstake))
921+ then nil
922+ else throw("Strict value is not equal to itself.")
792923 }
793- else throw(("Invalid order type: " + toString(_type)))
794- let method = $t02783031791._1
795- let args = $t02783031791._2
796- let payments = $t02783031791._3
797- let withdraw = if ((size(payments) == 1))
798- then {
799- let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), payments[0].amount], nil)
800- if ((unstake == unstake))
801- then nil
802- else throw("Strict value is not equal to itself.")
803- }
804- else nil
805- if ((withdraw == withdraw))
806- then {
807- let doSetContext = invoke(this, "setContext", [_trader], nil)
808- if ((doSetContext == doSetContext))
924+ else nil
925+ if ((withdraw == withdraw))
809926 then {
810- let doClosePosition = invoke(addressFromStringValue(_amm), method, args, payments)
811- if ((doClosePosition == doClosePosition))
927+ let doSetContext = invoke(this, "setContext", [_trader], nil)
928+ if ((doSetContext == doSetContext))
812929 then {
813- let doResetContext = invoke(this, "resetContext", nil, nil)
814- if ((doResetContext == doResetContext))
930+ let doClosePosition = invoke(addressFromStringValue(_amm), method, args, payments)
931+ if ((doClosePosition == doClosePosition))
815932 then {
816- let executeOrderRequest = if ((_type == LIMIT))
933+ let doResetContext = invoke(this, "resetContext", nil, nil)
934+ if ((doResetContext == doResetContext))
817935 then {
818- let newPositionSize = getPositionSize(_amm, _trader, positionDirection)
819- if ((newPositionSize == newPositionSize))
936+ let executeOrderRequest = if (if ((_type == LIMIT))
937+ then true
938+ else (_type == MARKET))
820939 then {
821- let newPositionId = getPositionId(_amm, _trader, positionDirection)
822- if ((newPositionId == newPositionId))
940+ let newPositionSize = getPositionSize(_amm, _trader, positionDirection)
941+ if ((newPositionSize == newPositionSize))
823942 then {
824- let positionSizeDelta = (newPositionSize - positionSize)
825- let closeOrderSide = if ((newPositionSize > 0))
826- then SHORT
827- else LONG
828- let makeTakeOrder = if (haveOrderRequest(_orderId, TAKE))
943+ let newPositionId = getPositionId(_amm, _trader, positionDirection)
944+ if ((newPositionId == newPositionId))
829945 then {
830- let $t03275332952 = getOrderRequest(_orderId, TAKE)
831- let newOrderId = $t03275332952._1
832- let newAmm = $t03275332952._2
833- let newTrader = $t03275332952._3
834- let newType = $t03275332952._4
835- let newTriggerPrice = $t03275332952._5
836- let newLimitPrice = $t03275332952._6
837- let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil)
838- if ((doCall == doCall))
839- then nil
840- else throw("Strict value is not equal to itself.")
841- }
842- else nil
843- if ((makeTakeOrder == makeTakeOrder))
844- then {
845- let makeStopOrder = if (haveOrderRequest(_orderId, STOP))
946+ let positionSizeDelta = (newPositionSize - positionSize)
947+ let closeOrderSide = if ((newPositionSize > 0))
948+ then SHORT
949+ else LONG
950+ let makeTakeOrder = if (haveOrderRequest(_orderId, TAKE))
846951 then {
847- let $t03352533724 = getOrderRequest(_orderId, STOP)
848- let newOrderId = $t03352533724._1
849- let newAmm = $t03352533724._2
850- let newTrader = $t03352533724._3
851- let newType = $t03352533724._4
852- let newTriggerPrice = $t03352533724._5
853- let newLimitPrice = $t03352533724._6
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
854959 let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil)
855960 if ((doCall == doCall))
856961 then nil
857962 else throw("Strict value is not equal to itself.")
858963 }
859964 else nil
860- if ((makeStopOrder == makeStopOrder))
861- then (makeTakeOrder ++ makeStopOrder)
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+ }
862986 else throw("Strict value is not equal to itself.")
863987 }
864988 else throw("Strict value is not equal to itself.")
865989 }
866990 else throw("Strict value is not equal to itself.")
867991 }
868- else throw("Strict value is not equal to itself.")
869- }
870- else nil
871- if ((executeOrderRequest == executeOrderRequest))
872- then {
873- let doMarkOrderExecuted = invoke(this, "internalMarkOrderExecuted", [_amm, _trader, _orderId], nil)
874- if ((doMarkOrderExecuted == doMarkOrderExecuted))
875- then nil
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+ }
8761000 else throw("Strict value is not equal to itself.")
8771001 }
8781002 else throw("Strict value is not equal to itself.")
8851009 }
8861010 else throw("Strict value is not equal to itself.")
8871011 }
888- else throw("Strict value is not equal to itself.")
8891012 }
1013+ else throw("Strict value is not equal to itself.")
8901014 }
8911015 else throw("Strict value is not equal to itself.")
8921016 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let k_coordinatorAddress = "k_coordinatorAddress"
55
66 let k_admin_address = "k_admin_address"
77
88 let k_quote_asset = "k_quote_asset"
99
1010 let k_amm = "k_amm"
1111
1212 let k_manager_address = "k_manager_address"
1313
1414 let k_positionSequence = "k_positionSequence"
1515
1616 let k_positionSize = "k_positionSize"
1717
1818 let k_executedOrders = "k_executedOrders"
1919
2020 let k_canceledOrders = "k_canceledOrders"
2121
2222 let k_order = "k_order"
2323
2424 let k_orderRequest = "k_orderReq"
2525
2626 let k_lastOrderId = "k_lastOrderId"
2727
2828 let k_traderOrderCnt = "k_traderOrderCnt"
2929
3030 let k_traderOrderIds = "k_traderOrderIds"
3131
3232 let k_spreadLimit = "k_spreadLimit"
3333
34+let k_onlyWhitelist = "k_onlyWhitelist"
35+
36+let k_whitelistExecutor = "k_whitelistExecutor"
37+
3438 let k_sender = "k_sender"
3539
3640 let k_initialized = "k_initialized"
3741
3842 let STOP = 1
3943
4044 let TAKE = 2
4145
4246 let LIMIT = 3
47+
48+let MARKET = 4
4349
4450 let LONG = 1
4551
4652 let SHORT = 2
4753
4854 let INCREASE = 1
4955
5056 let DECREASE = 2
5157
5258 let MAX_TRADER_ORDERS_PER_AMM = 10
5359
5460 let TIME = lastBlock.timestamp
5561
5662 let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10))
5763
5864 func abs (_x) = if ((_x > 0))
5965 then _x
6066 else -(_x)
6167
6268
6369 func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN)
6470
6571
6672 func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN)
6773
6874
6975 func minv (_x,_y) = if ((_x > _y))
7076 then _y
7177 else _x
7278
7379
7480 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
7581
7682
7783 func executedOrderKey (_orderId) = ((k_executedOrders + "_") + toString(_orderId))
7884
7985
8086 func canceledOrderKey (_orderId) = ((k_canceledOrders + "_") + toString(_orderId))
8187
8288
8389 func orderKey (_orderId) = toCompositeKey(k_order, toString(_orderId))
8490
8591
8692 func orderRequestKey (_orderId,_type) = ((((k_orderRequest + "_") + toString(_orderId)) + "_") + toString(_type))
8793
8894
8995 func traderOrderCountKey (_amm,_trader) = ((((k_traderOrderCnt + "_") + _amm) + "_") + _trader)
9096
9197
9298 func traderOrderIdsKey (_amm,_trader) = ((((k_traderOrderIds + "_") + _amm) + "_") + _trader)
9399
94100
95101 func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set")
96102
97103
98104 func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address))
99105
100106
101107 func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
102108
103109
104110 func managerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_manager_address)), "Manager not set")
105111
106112
107113 func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
108114
109115
110116 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
111117
112118
113119 func isValid (_orderId) = if (valueOrElse(getBoolean(this, executedOrderKey(_orderId)), false))
114120 then throw(("Order already executed: " + toString(_orderId)))
115121 else if (valueOrElse(getBoolean(this, canceledOrderKey(_orderId)), false))
116122 then throw(("Order already cancelled: " + toString(_orderId)))
117123 else true
118124
119125
120126 func getSpreadLimit () = valueOrErrorMessage(getInteger(this, k_spreadLimit), "Spread limit not set")
121127
122128
123129 func currentOrderId () = valueOrElse(getInteger(this, k_lastOrderId), 0)
124130
125131
126132 func getTraderOrderCount (_amm,_trader) = {
127133 let key = traderOrderCountKey(_amm, _trader)
128134 valueOrElse(getInteger(this, key), 0)
129135 }
130136
131137
132138 func traderAmmOrdersIds (_amm,_trader) = {
133139 let key = traderOrderIdsKey(_amm, _trader)
134140 let val = valueOrElse(getString(this, key), "")
135141 if ((val == ""))
136142 then nil
137143 else split(val, ",")
138144 }
139145
140146
141147 func haveOrderRequest (_orderId,_type) = {
142148 let key = orderRequestKey(_orderId, _type)
143149 isDefined(getString(this, key))
144150 }
145151
146152
147153 func getOrderRequest (_orderId,_type) = {
148154 let key = orderRequestKey(_orderId, _type)
149155 let orderRequestStr = valueOrErrorMessage(getString(this, key), ("Not order request for key: " + key))
150156 let orderRequestPartList = split(orderRequestStr, ",")
151157 let orderId = valueOrErrorMessage(parseInt(orderRequestPartList[0]), "Invalid orderId")
152158 let amm = orderRequestPartList[1]
153159 let trader = orderRequestPartList[2]
154160 let type = valueOrErrorMessage(parseInt(orderRequestPartList[3]), "Invalid type")
155161 let triggerPrice = valueOrErrorMessage(parseInt(orderRequestPartList[4]), "Invalid triggerPrice")
156162 let limitPrice = valueOrErrorMessage(parseInt(orderRequestPartList[5]), "Invalid limitPrice")
157163 $Tuple6(orderId, amm, trader, type, triggerPrice, limitPrice)
158164 }
159165
160166
161167 func getOrder (_orderId) = {
162168 let orderStr = valueOrErrorMessage(getString(this, orderKey(_orderId)), ("Invalid order id: " + toString(_orderId)))
163169 let orderPartList = split(orderStr, ",")
164170 let amm = orderPartList[0]
165171 let trader = orderPartList[1]
166172 let amountIn = valueOrErrorMessage(parseInt(orderPartList[2]), "Invalid amountIn")
167173 let leverage = valueOrErrorMessage(parseInt(orderPartList[3]), "Invalid leverage")
168174 let type = valueOrErrorMessage(parseInt(orderPartList[4]), "Invalid type")
169175 let triggerPrice = valueOrErrorMessage(parseInt(orderPartList[5]), "Invalid triggerPrice")
170176 let paymentUsdn = valueOrErrorMessage(parseInt(orderPartList[6]), "Invalid paymentUsdn")
171177 let side = valueOrErrorMessage(parseInt(orderPartList[7]), "Invalid side")
172178 let refLink = orderPartList[8]
173179 let positionId = valueOrErrorMessage(parseInt(orderPartList[9]), "Invalid positionId")
174180 let limitPrice = valueOrErrorMessage(parseInt(orderPartList[10]), "Invalid limitPrice")
175181 let expiration = if ((size(orderPartList) > 11))
176182 then valueOrErrorMessage(parseInt(orderPartList[11]), "Invalid expiration")
177183 else 0
178184 let marketPrice = if ((size(orderPartList) > 12))
179185 then valueOrErrorMessage(parseInt(orderPartList[12]), "Invalid orderMarketPrice")
180186 else 0
181187 $Tuple13(amm, trader, amountIn, leverage, type, triggerPrice, paymentUsdn, side, refLink, positionId, limitPrice, expiration, marketPrice)
182188 }
183189
184190
185191 func getMarketPrice (_amm) = {
186192 let s = invoke(addressFromStringValue(_amm), "computeSpotPrice", nil, nil)
187193 if ((s == s))
188194 then {
189195 let res = match s {
190196 case t: Int =>
191197 t
192198 case _ =>
193199 throw("Invalid computeSpotPrice result")
194200 }
195201 value(res)
196202 }
197203 else throw("Strict value is not equal to itself.")
198204 }
199205
200206
201207 func getFee (_amm,_trader) = {
202208 let s = invoke(addressFromStringValue(_amm), "computeFeeForTraderWithArtifact", [_trader, ""], nil)
203209 if ((s == s))
204210 then {
205211 let res = match s {
206212 case t: (Int, Boolean) =>
207213 t._1
208214 case _ =>
209215 throw("Invalid computeFeeForTraderWithArtifact result")
210216 }
211217 value(res)
212218 }
213219 else throw("Strict value is not equal to itself.")
214220 }
215221
216222
217223 func getPositionDirection (_orderSide,_orderType) = if (if ((_orderType == TAKE))
218224 then true
219225 else (_orderType == STOP))
220226 then if ((_orderSide == LONG))
221227 then SHORT
222228 else LONG
223229 else _orderSide
224230
225231
226232 func getPositionSize (_amm,_trader,_direction) = {
227233 let amm = addressFromStringValue(_amm)
228234 let positionKey = ((_trader + "_") + toString(_direction))
229235 let sizeKey = toCompositeKey(k_positionSize, positionKey)
230236 valueOrElse(getInteger(amm, sizeKey), 0)
231237 }
232238
233239
234240 func getPositionId (_amm,_trader,_direction) = {
235241 let amm = addressFromStringValue(_amm)
236242 let positionKey = ((_trader + "_") + toString(_direction))
237243 let seqKey = toCompositeKey(k_positionSequence, positionKey)
238244 valueOrElse(getInteger(amm, seqKey), 0)
239245 }
240246
241247
242248 func getSpread (_price) = muld(_price, getSpreadLimit())
243249
244250
251+func isOnlyWhitelistExecutors () = valueOrElse(getBoolean(this, k_onlyWhitelist), false)
252+
253+
254+func isWhitelistExecutor (_executor) = valueOrElse(getBoolean(this, toCompositeKey(k_whitelistExecutor, _executor)), false)
255+
256+
245257 func saveOrder (_orderId,_amm,_trader,_amountIn,_leverage,_type,_triggerPrice,_paymentUsdn,_side,_refLink,_positionId,_limitPrice,_expiration,_orderMarketPrice) = {
246258 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)], ",")
247259 [StringEntry(orderKey(_orderId), orderStr)]
248260 }
249261
250262
251263 func saveOrderRequest (_orderId,_amm,_trader,_type,_triggerPrice,_limitPrice) = {
252264 let orderReqStr = makeString([toString(_orderId), _amm, _trader, toString(_type), toString(_triggerPrice), toString(_limitPrice)], ",")
253265 [StringEntry(orderRequestKey(_orderId, _type), orderReqStr)]
254266 }
255267
256268
257269 func updateOrderIdStr (_orderIdsNewStr,_amm,_trader) = [StringEntry(traderOrderIdsKey(_amm, _trader), _orderIdsNewStr)]
258270
259271
260272 func addRemoveOrderIdList (_orderIds,_orderId,_amm,_trader,_add) = {
261273 let orderIdsNew = if (_add)
262274 then (_orderIds :+ toString(_orderId))
263275 else removeByIndex(_orderIds, valueOrErrorMessage(indexOf(_orderIds, toString(_orderId)), ("No order with id: " + toString(_orderId))))
264276 orderIdsNew
265277 }
266278
267279
268280 func addRemoveOrderId (_orderId,_amm,_trader,_add) = {
269281 let orderIds = traderAmmOrdersIds(_amm, _trader)
270282 let orderIdsNew = addRemoveOrderIdList(orderIds, _orderId, _amm, _trader, _add)
271283 let orderIdsNewStr = makeString(orderIdsNew, ",")
272284 updateOrderIdStr(orderIdsNewStr, _amm, _trader)
273285 }
274286
275287
276288 func updateTraderOrderCount (_amm,_trader,_count) = if ((0 > _count))
277289 then throw(("Invalid order count: " + toString(_count)))
278290 else [IntegerEntry(traderOrderCountKey(_amm, _trader), _count)]
279291
280292
281293 func updateLastOrderId (_lastOrderId) = [IntegerEntry(k_lastOrderId, _lastOrderId)]
282294
283295
284296 func markExecuteOrder (_orderId) = [BooleanEntry(toCompositeKey(k_executedOrders, toString(_orderId)), true)]
285297
286298
287299 func markCancelOrder (_orderId) = [BooleanEntry(toCompositeKey(k_canceledOrders, toString(_orderId)), true)]
288300
289301
290302 func getPositionIds (_amm,_trader) = {
291303 let longPositionSize = getPositionSize(_amm, _trader, LONG)
292304 let currentLongPositionId = if ((longPositionSize != 0))
293305 then getPositionId(_amm, _trader, LONG)
294306 else 0
295307 let shortPositionSize = getPositionSize(_amm, _trader, SHORT)
296308 let currentShortPositionId = if ((shortPositionSize != 0))
297309 then getPositionId(_amm, _trader, SHORT)
298310 else 0
299311 [currentLongPositionId, currentShortPositionId]
300312 }
301313
302314
315+func checkValidExecutor (_caller) = if (isOnlyWhitelistExecutors())
316+ then isWhitelistExecutor(toString(_caller))
317+ else true
318+
319+
303320 @Callable(i)
304321 func cleanUpStaleOrders (_amm,_trader) = {
305322 let orders = traderAmmOrdersIds(_amm, _trader)
306323 let positionIds = getPositionIds(_amm, _trader)
307324 func cleanUpOne (_acc,_orderId) = {
308325 let orderIdInt = valueOrErrorMessage(parseInt(_orderId), "Invalid order id")
309- let $t01176611982 = getOrder(orderIdInt)
310- let _x1 = $t01176611982._1
311- let _x2 = $t01176611982._2
312- let _x3 = $t01176611982._3
313- let _x4 = $t01176611982._4
314- let _type = $t01176611982._5
315- let _x5 = $t01176611982._6
316- let _x6 = $t01176611982._7
317- let _x7 = $t01176611982._8
318- let _x8 = $t01176611982._9
319- let _positionId = $t01176611982._10
320- let _x9 = $t01176611982._11
321- let _expiration = $t01176611982._12
326+ let $t01236712592 = getOrder(orderIdInt)
327+ let _x1 = $t01236712592._1
328+ let _x2 = $t01236712592._2
329+ let _x3 = $t01236712592._3
330+ let _x4 = $t01236712592._4
331+ let _type = $t01236712592._5
332+ let _x5 = $t01236712592._6
333+ let _paymentUsdn = $t01236712592._7
334+ let _x6 = $t01236712592._8
335+ let _x7 = $t01236712592._9
336+ let _positionId = $t01236712592._10
337+ let _x8 = $t01236712592._11
338+ let _expiration = $t01236712592._12
322339 let cancelTakeStopOfNoPosition = if (if (if ((_type == STOP))
323340 then true
324341 else (_type == TAKE))
325342 then (positionIds[0] != _positionId)
326343 else false)
327344 then (positionIds[1] != _positionId)
328345 else false
329- let cancelLimitIfExpired = if ((_type == LIMIT))
330- then (lastBlock.timestamp >= _expiration)
346+ let cancelLimitIfExpired = if (if ((_type == LIMIT))
347+ then true
348+ else (_type == MARKET))
349+ then (TIME >= _expiration)
331350 else false
332351 if (if (cancelTakeStopOfNoPosition)
333352 then true
334353 else cancelLimitIfExpired)
335354 then {
336355 let change = markCancelOrder(orderIdInt)
337356 let newOrderList = addRemoveOrderIdList(_acc._1, orderIdInt, _amm, _trader, false)
338- $Tuple2(newOrderList, (_acc._2 ++ change))
357+ let paymentToReturn = if (if ((_type == LIMIT))
358+ then true
359+ else (_type == MARKET))
360+ then _paymentUsdn
361+ else 0
362+ $Tuple3(newOrderList, (_acc._2 ++ change), (_acc._3 + paymentToReturn))
339363 }
340364 else _acc
341365 }
342366
343- let $t01251412589 = {
367+ let $t01329313388 = {
344368 let $l = orders
345369 let $s = size($l)
346- let $acc0 = $Tuple2(orders, nil)
370+ let $acc0 = $Tuple3(orders, nil, 0)
347371 func $f0_1 ($a,$i) = if (($i >= $s))
348372 then $a
349373 else cleanUpOne($a, $l[$i])
350374
351375 func $f0_2 ($a,$i) = if (($i >= $s))
352376 then $a
353377 else throw("List size exceeds 10")
354378
355379 $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)
356380 }
357- let newOrders = $t01251412589._1
358- let cancelActions = $t01251412589._2
359- ((cancelActions ++ updateTraderOrderCount(_amm, _trader, size(newOrders))) ++ updateOrderIdStr(makeString(newOrders, ","), _amm, _trader))
381+ let newOrders = $t01329313388._1
382+ let cancelActions = $t01329313388._2
383+ let paymentToReturn = $t01329313388._3
384+ let withdraw = if ((paymentToReturn > 0))
385+ then {
386+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), paymentToReturn], nil)
387+ if ((unstake == unstake))
388+ then nil
389+ else throw("Strict value is not equal to itself.")
390+ }
391+ else nil
392+ if ((withdraw == withdraw))
393+ then (((cancelActions ++ updateTraderOrderCount(_amm, _trader, size(newOrders))) ++ updateOrderIdStr(makeString(newOrders, ","), _amm, _trader)) ++ [ScriptTransfer(addressFromStringValue(_trader), paymentToReturn, quoteAsset())])
394+ else throw("Strict value is not equal to itself.")
360395 }
361396
362397
363398
364399 @Callable(i)
365400 func setContext (_sender) = if ((i.caller != this))
366401 then throw("Only self-call")
367402 else [StringEntry(k_sender, _sender)]
368403
369404
370405
371406 @Callable(i)
372407 func resetContext () = if ((i.caller != this))
373408 then throw("Only self-call")
374409 else [DeleteEntry(k_sender)]
375410
376411
377412
378413 @Callable(i)
379414 func initialize (_coordinator,_spreadLimit) = if (if (if (initialized())
380415 then true
381416 else if ((0 > _spreadLimit))
382417 then true
383418 else (_spreadLimit > (DECIMAL_UNIT / 10)))
384419 then true
385420 else (i.caller != this))
386421 then throw("Unable to initialize")
387422 else [StringEntry(k_coordinatorAddress, toString(addressFromStringValue(_coordinator))), IntegerEntry(k_spreadLimit, _spreadLimit), BooleanEntry(k_initialized, true)]
388423
389424
390425
391426 @Callable(i)
392-func changeSettings (_spreadLimit) = if (if ((i.caller != adminAddress()))
427+func changeSettings (_spreadLimit,_onlyWhitelist) = if (if ((i.caller != adminAddress()))
393428 then true
394429 else if ((0 > _spreadLimit))
395430 then true
396431 else (_spreadLimit > (DECIMAL_UNIT / 10)))
397432 then throw("Invalid changeSettings params")
398- else [IntegerEntry(k_spreadLimit, _spreadLimit)]
433+ else [IntegerEntry(k_spreadLimit, _spreadLimit), BooleanEntry(k_onlyWhitelist, _onlyWhitelist)]
434+
435+
436+
437+@Callable(i)
438+func addWhitelist (_list) = if ((i.caller != adminAddress()))
439+ then throw("Invalid addWhitelist params")
440+ else {
441+ func toAddressList (_acc,_addr) = {
442+ let address = addressFromStringValue(_addr)
443+ if ((address == address))
444+ then (_acc :+ BooleanEntry(toCompositeKey(k_whitelistExecutor, toString(address)), true))
445+ else throw("Strict value is not equal to itself.")
446+ }
447+
448+ let $l = split_4C(_list, ",")
449+ let $s = size($l)
450+ let $acc0 = nil
451+ func $f0_1 ($a,$i) = if (($i >= $s))
452+ then $a
453+ else toAddressList($a, $l[$i])
454+
455+ func $f0_2 ($a,$i) = if (($i >= $s))
456+ then $a
457+ else throw("List size exceeds 20")
458+
459+ $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+ }
461+
462+
463+
464+@Callable(i)
465+func removeWhitelist (_list) = if ((i.caller != adminAddress()))
466+ then throw("Invalid removeWhitelist params")
467+ else {
468+ func toAddressList (_acc,_addr) = {
469+ let address = addressFromStringValue(_addr)
470+ if ((address == address))
471+ then (_acc :+ BooleanEntry(toCompositeKey(k_whitelistExecutor, toString(address)), false))
472+ else throw("Strict value is not equal to itself.")
473+ }
474+
475+ let $l = split_4C(_list, ",")
476+ let $s = size($l)
477+ let $acc0 = nil
478+ func $f0_1 ($a,$i) = if (($i >= $s))
479+ then $a
480+ else toAddressList($a, $l[$i])
481+
482+ func $f0_2 ($a,$i) = if (($i >= $s))
483+ then $a
484+ else throw("List size exceeds 20")
485+
486+ $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+ }
399488
400489
401490
402491 @Callable(i)
403492 func createOrder (_amm,_type,_triggerPrice,_limitPrice,_amountIn,_leverage,_side,_refLink,_stopTriggerPrice,_stopLimitPrice,_takeTriggerPrice,_takeLimitPrice,_expiration,_priceData) = {
404493 let _trader = toString(i.caller)
405494 let updatePrice = invoke(addressFromStringValue(_amm), "updateOracle", [_priceData], nil)
406495 if ((updatePrice == updatePrice))
407496 then {
408497 let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil)
409498 if ((cleanUp == cleanUp))
410499 then if ((size(i.payments) > 1))
411500 then throw("Invalid createOrder parameters: invalid payment count")
412501 else {
413- let $t01570315955 = if ((size(i.payments) == 1))
502+ let $t01789718149 = if ((size(i.payments) == 1))
414503 then $Tuple2(toBase58String(valueOrErrorMessage(i.payments[0].assetId, "Invalid asset id")), i.payments[0].amount)
415504 else $Tuple2("", 0)
416- let paymentAssetId = $t01570315955._1
417- let paymentAmount = $t01570315955._2
505+ let paymentAssetId = $t01789718149._1
506+ let paymentAmount = $t01789718149._2
418507 let doCall = invoke(this, "internalCreateOrder", [_trader, _amm, _type, _triggerPrice, _limitPrice, _amountIn, _leverage, _side, _refLink, paymentAssetId, paymentAmount, _expiration], nil)
419508 if ((doCall == doCall))
420509 then {
421510 let orderId = match doCall {
422511 case t: Int =>
423512 t
424513 case _ =>
425514 throw("Invalid ID of created order")
426515 }
427- if ((_type == LIMIT))
516+ if (if ((_type == LIMIT))
517+ then true
518+ else (_type == MARKET))
428519 then {
429520 let makeStop = if ((_stopTriggerPrice > 0))
430521 then {
431522 let doMakeStop = invoke(this, "internalCreateOrderRequest", [_trader, _amm, orderId, STOP, _stopTriggerPrice, _stopLimitPrice], nil)
432523 if ((doMakeStop == doMakeStop))
433524 then nil
434525 else throw("Strict value is not equal to itself.")
435526 }
436527 else nil
437528 let makeTake = if ((_takeTriggerPrice > 0))
438529 then {
439530 let doMakeTake = invoke(this, "internalCreateOrderRequest", [_trader, _amm, orderId, TAKE, _takeTriggerPrice, _takeLimitPrice], nil)
440531 if ((doMakeTake == doMakeTake))
441532 then nil
442533 else throw("Strict value is not equal to itself.")
443534 }
444535 else nil
445536 (makeStop ++ makeTake)
446537 }
447538 else nil
448539 }
449540 else throw("Strict value is not equal to itself.")
450541 }
451542 else throw("Strict value is not equal to itself.")
452543 }
453544 else throw("Strict value is not equal to itself.")
454545 }
455546
456547
457548
458549 @Callable(i)
459550 func increasePositionWithStopLoss (_amm,_direction,_leverage,_minBaseAssetAmount,_refLink,_stopTriggerPrice,_stopLimitPrice,_takeTriggerPrice,_takeLimitPrice,_priceData) = {
460551 let _trader = toString(i.caller)
461552 let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil)
462553 if ((cleanUp == cleanUp))
463554 then if (if (!(initialized()))
464555 then true
465556 else !(isWhitelist(_amm)))
466557 then throw("Invalid increasePositionWithStopLoss parameters")
467558 else {
468559 let positionSize = getPositionSize(_amm, _trader, _direction)
469560 if ((positionSize != 0))
470561 then throw("Invalid increasePositionWithStopLoss parameters: only new position")
471562 else {
472563 let doSetContext = invoke(this, "setContext", [_trader], nil)
473564 if ((doSetContext == doSetContext))
474565 then {
475566 let doOpenPosition = invoke(addressFromStringValue(_amm), "increasePosition", [_direction, _leverage, _minBaseAssetAmount, _refLink, _priceData], i.payments)
476567 if ((doOpenPosition == doOpenPosition))
477568 then {
478569 let doResetContext = invoke(this, "resetContext", nil, nil)
479570 if ((doResetContext == doResetContext))
480571 then {
481572 let openedPositionSize = getPositionSize(_amm, _trader, _direction)
482573 if ((openedPositionSize == openedPositionSize))
483574 then {
484575 let amountIn = abs(openedPositionSize)
485576 if ((amountIn == amountIn))
486577 then {
487578 let stopLossSide = if ((0 > openedPositionSize))
488579 then LONG
489580 else SHORT
490581 let checkAmountIn = if ((0 >= amountIn))
491582 then {
492583 let data = makeString([_amm, _trader, toString(_direction), toString(_leverage), toString(_minBaseAssetAmount), _refLink, _priceData], ",")
493584 throw(((("Invalid amountIn=" + toString(amountIn)) + " after success increasePosition: ") + data))
494585 }
495586 else 0
496587 if ((checkAmountIn == checkAmountIn))
497588 then {
498589 let doCreateStopOrder = if ((_stopTriggerPrice > 0))
499590 then {
500591 let doCreateStopOrder = invoke(this, "internalCreateOrder", [_trader, _amm, STOP, _stopTriggerPrice, _stopLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0, 0], nil)
501592 if ((doCreateStopOrder == doCreateStopOrder))
502593 then nil
503594 else throw("Strict value is not equal to itself.")
504595 }
505596 else nil
506597 if ((doCreateStopOrder == doCreateStopOrder))
507598 then {
508599 let doCreateTakeOrder = if ((_takeTriggerPrice > 0))
509600 then {
510601 let doCreateTakeOrder = invoke(this, "internalCreateOrder", [_trader, _amm, TAKE, _takeTriggerPrice, _takeLimitPrice, amountIn, 0, stopLossSide, _refLink, "", 0, 0], nil)
511602 if ((doCreateTakeOrder == doCreateTakeOrder))
512603 then nil
513604 else throw("Strict value is not equal to itself.")
514605 }
515606 else nil
516607 if ((doCreateTakeOrder == doCreateTakeOrder))
517608 then nil
518609 else throw("Strict value is not equal to itself.")
519610 }
520611 else throw("Strict value is not equal to itself.")
521612 }
522613 else throw("Strict value is not equal to itself.")
523614 }
524615 else throw("Strict value is not equal to itself.")
525616 }
526617 else throw("Strict value is not equal to itself.")
527618 }
528619 else throw("Strict value is not equal to itself.")
529620 }
530621 else throw("Strict value is not equal to itself.")
531622 }
532623 else throw("Strict value is not equal to itself.")
533624 }
534625 }
535626 else throw("Strict value is not equal to itself.")
536627 }
537628
538629
539630
540631 @Callable(i)
541632 func internalMarkOrderExecuted (_amm,_trader,_orderId) = if (if (if (!(initialized()))
542633 then true
543634 else !(isWhitelist(_amm)))
544635 then true
545636 else !((i.caller == this)))
546637 then throw("Invalid internalMarkOrderExecuted parameters")
547638 else {
548639 let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) - 1)
549640 ((updateTraderOrderCount(_amm, _trader, newTraderOrderCount) ++ addRemoveOrderId(_orderId, _amm, _trader, false)) ++ markExecuteOrder(_orderId))
550641 }
551642
552643
553644
554645 @Callable(i)
555646 func internalCreateOrderRequest (_trader,_amm,_orderId,_type,_triggerPrice,_limitPrice) = if (if (if (if (if (!(initialized()))
556647 then true
557648 else !(isWhitelist(_amm)))
558649 then true
559650 else (0 >= _triggerPrice))
560651 then true
561652 else (0 > _limitPrice))
562653 then true
563654 else !((i.caller == this)))
564655 then throw("Invalid internalCreateOrderRequest parameters")
565656 else saveOrderRequest(_orderId, _amm, _trader, _type, _triggerPrice, _limitPrice)
566657
567658
568659
569660 @Callable(i)
570661 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()))
571662 then true
572663 else !(isWhitelist(_amm)))
573664 then true
574- else (0 >= _triggerPrice))
665+ else (0 > _triggerPrice))
575666 then true
576667 else (0 > _limitPrice))
577668 then true
578669 else (0 >= _amountIn))
579670 then true
580671 else (0 > _leverage))
581672 then true
582673 else !(if ((_side == LONG))
583674 then true
584675 else (_side == SHORT)))
585676 then true
586- else !(if (if ((_type == STOP))
677+ else !(if (if (if ((_type == STOP))
587678 then true
588679 else (_type == TAKE))
589680 then true
590- else (_type == LIMIT)))
681+ else (_type == LIMIT))
682+ then true
683+ else (_type == MARKET)))
591684 then true
592685 else !((i.caller == this)))
593686 then true
594687 else (0 > _expiration))
595688 then throw("Invalid internalCreateOrder parameters")
596689 else {
597690 let orderId = (currentOrderId() + 1)
598691 let positionDirection = getPositionDirection(_side, _type)
599692 let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) + 1)
600693 let positionSize = getPositionSize(_amm, _trader, positionDirection)
601694 let orderMarketPrice = getMarketPrice(_amm)
602695 let _direction = if (if (if ((positionSize == 0))
603696 then true
604697 else if ((positionSize > 0))
605698 then (_side == LONG)
606699 else false)
607700 then true
608701 else if ((0 > positionSize))
609702 then (_side == SHORT)
610703 else false)
611704 then INCREASE
612705 else DECREASE
613706 if (if ((positionSize == 0))
614707 then if ((_type == STOP))
615708 then true
616709 else (_type == TAKE)
617710 else false)
618711 then throw("Can not create STOP/TAKE order: no position")
619712 else {
620713 let usdnPayment = if ((_direction == INCREASE))
621714 then if (if ((_paymentAssetId != toBase58String(quoteAsset())))
622715 then true
623716 else (_paymentAmount != _amountIn))
624717 then throw("Invalid createLimitOrder parameters: invalid payment")
625718 else {
626719 let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _paymentAmount)])
627720 if ((stake == stake))
628721 then _paymentAmount
629722 else throw("Strict value is not equal to itself.")
630723 }
631724 else 0
632725 if ((usdnPayment == usdnPayment))
633726 then {
634727 let positionId = if ((positionSize != 0))
635728 then getPositionId(_amm, _trader, positionDirection)
636729 else 0
637730 if (if (if ((_type == STOP))
638731 then true
639732 else (_type == TAKE))
640733 then (positionId == 0)
641734 else false)
642735 then throw("STOP and TAKE order should be assigned to position with id != 0")
643736 else if ((newTraderOrderCount > MAX_TRADER_ORDERS_PER_AMM))
644737 then throw("Invalid createLimitOrder parameters: order count")
645738 else {
646739 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))
647740 $Tuple2(changeSet, orderId)
648741 }
649742 }
650743 else throw("Strict value is not equal to itself.")
651744 }
652745 }
653746
654747
655748
656749 @Callable(i)
657750 func cancelOrder (_orderId) = {
658- let $t02559125741 = getOrder(_orderId)
659- let _amm = $t02559125741._1
660- let _trader = $t02559125741._2
661- let _amountIn = $t02559125741._3
662- let _leverage = $t02559125741._4
663- let _type = $t02559125741._5
664- let _triggerPrice = $t02559125741._6
665- let _amountUsdn = $t02559125741._7
751+ let $t02782227972 = getOrder(_orderId)
752+ let _amm = $t02782227972._1
753+ let _trader = $t02782227972._2
754+ let _amountIn = $t02782227972._3
755+ let _leverage = $t02782227972._4
756+ let _type = $t02782227972._5
757+ let _triggerPrice = $t02782227972._6
758+ let _amountUsdn = $t02782227972._7
666759 if (if (if (!(initialized()))
667760 then true
668761 else !(isValid(_orderId)))
669762 then true
670763 else !((toString(i.caller) == _trader)))
671764 then throw("Invalid cancelOrder parameters")
672765 else {
673766 let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil)
674767 if ((cleanUp == cleanUp))
675768 then {
676769 let newTraderOrderCount = (getTraderOrderCount(_amm, _trader) - 1)
677770 let withdraw = if ((_amountUsdn > 0))
678771 then {
679772 let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), _amountUsdn], nil)
680773 if ((unstake == unstake))
681774 then nil
682775 else throw("Strict value is not equal to itself.")
683776 }
684777 else nil
685778 if ((withdraw == withdraw))
686779 then (((markCancelOrder(_orderId) ++ addRemoveOrderId(_orderId, _amm, _trader, false)) ++ updateTraderOrderCount(_amm, _trader, newTraderOrderCount)) ++ (if ((_amountUsdn > 0))
687780 then [ScriptTransfer(i.caller, _amountUsdn, quoteAsset())]
688781 else nil))
689782 else throw("Strict value is not equal to itself.")
690783 }
691784 else throw("Strict value is not equal to itself.")
692785 }
693786 }
694787
695788
696789
697790 @Callable(i)
698791 func executeOrder (_orderId,_priceData) = {
699- let $t02695927221 = getOrder(_orderId)
700- let _amm = $t02695927221._1
701- let _trader = $t02695927221._2
702- let _amountIn = $t02695927221._3
703- let _leverage = $t02695927221._4
704- let _type = $t02695927221._5
705- let _triggerPrice = $t02695927221._6
706- let _amountUsdn = $t02695927221._7
707- let _side = $t02695927221._8
708- let _refLink = $t02695927221._9
709- let _positionId = $t02695927221._10
710- let _limitPrice = $t02695927221._11
711- let _timestamp = $t02695927221._12
712- let _orderMarketPrice = $t02695927221._13
792+ let $t02919029453 = getOrder(_orderId)
793+ let _amm = $t02919029453._1
794+ let _trader = $t02919029453._2
795+ let _amountIn = $t02919029453._3
796+ let _leverage = $t02919029453._4
797+ let _type = $t02919029453._5
798+ let _triggerPrice = $t02919029453._6
799+ let _amountUsdn = $t02919029453._7
800+ let _side = $t02919029453._8
801+ let _refLink = $t02919029453._9
802+ let _positionId = $t02919029453._10
803+ let _limitPrice = $t02919029453._11
804+ let _expiration = $t02919029453._12
805+ let _orderMarketPrice = $t02919029453._13
713806 let updatePrice = invoke(addressFromStringValue(_amm), "updateOracle", [_priceData], nil)
714807 if ((updatePrice == updatePrice))
715808 then {
716809 let cleanUp = invoke(this, "cleanUpStaleOrders", [_amm, _trader], nil)
717810 if ((cleanUp == cleanUp))
718811 then {
719- let positionDirection = getPositionDirection(_side, _type)
720- if (if (!(initialized()))
721- then true
722- else !(isValid(_orderId)))
723- then throw("Invalid executeOrder parameters")
724- else {
725- let positionSize = getPositionSize(_amm, _trader, positionDirection)
726- if ((positionSize == positionSize))
727- then {
728- let currentPositionId = if ((positionSize != 0))
729- then getPositionId(_amm, _trader, positionDirection)
730- else 0
731- let $t02783031791 = if ((_type == STOP))
812+ let _caller = if ((i.caller == this))
813+ then i.originCaller
814+ else i.caller
815+ if ((_caller == _caller))
816+ then {
817+ let positionDirection = getPositionDirection(_side, _type)
818+ if (if (if (!(initialized()))
819+ then true
820+ else !(isValid(_orderId)))
821+ then true
822+ else !(checkValidExecutor(_caller)))
823+ then throw("Invalid executeOrder parameters")
824+ else {
825+ let positionSize = getPositionSize(_amm, _trader, positionDirection)
826+ if ((positionSize == positionSize))
732827 then {
733- let _positionDirection = if ((positionSize > 0))
734- then LONG
735- else if ((0 > positionSize))
736- then SHORT
737- else throw("Can not execute STOP order: no open position")
738- let marketPrice = getMarketPrice(_amm)
739- let isExecutable = if ((_side == _positionDirection))
740- then throw("Can not execute STOP order: reduce only")
741- else if ((currentPositionId != _positionId))
742- then throw("Can not execute STOP order: position closed")
743- else if ((_positionDirection == LONG))
744- then (_triggerPrice >= marketPrice)
745- else (marketPrice >= _triggerPrice)
746- if (isExecutable)
747- then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false, _priceData], nil)
748- else throw("Can not execute STOP order: triggerPrice mismatch")
749- }
750- else if ((_type == TAKE))
751- then {
752- let _positionDirection = if ((positionSize > 0))
753- then LONG
754- else if ((0 > positionSize))
755- then SHORT
756- else throw("Can not execute STOP order: no open position")
757- let marketPrice = getMarketPrice(_amm)
758- let isExecutable = if ((_side == _positionDirection))
759- then throw("Can not execute TAKE order: reduce only")
760- else if ((currentPositionId != _positionId))
761- then throw(((("Can not execute TAKE order: position closed " + toString(currentPositionId)) + "!=") + toString(_positionId)))
762- else if ((_positionDirection == LONG))
763- then (marketPrice >= _triggerPrice)
764- else (_triggerPrice >= marketPrice)
765- if (isExecutable)
766- then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false, _priceData], nil)
767- else throw("Can not execute TAKE order: triggerPrice mismatch")
768- }
769- else if ((_type == LIMIT))
828+ let currentPositionId = if ((positionSize != 0))
829+ then getPositionId(_amm, _trader, positionDirection)
830+ else 0
831+ let $t03019934951 = if ((_type == STOP))
770832 then {
833+ let _positionDirection = if ((positionSize > 0))
834+ then LONG
835+ else if ((0 > positionSize))
836+ then SHORT
837+ else throw("Can not execute STOP order: no open position")
771838 let marketPrice = getMarketPrice(_amm)
772- let isExecutableByStop = if ((_limitPrice == 0))
773- then true
774- else if ((_limitPrice > _orderMarketPrice))
775- then (marketPrice >= _limitPrice)
776- else (_limitPrice >= marketPrice)
777- let isExecutableForTriggerPrice = if ((_side == LONG))
778- then (_triggerPrice >= marketPrice)
779- else (marketPrice >= _triggerPrice)
780- let isExecutable = if (isExecutableByStop)
781- then isExecutableForTriggerPrice
782- else false
839+ let isExecutable = if ((_side == _positionDirection))
840+ then throw("Can not execute STOP order: reduce only")
841+ else if ((currentPositionId != _positionId))
842+ then throw("Can not execute STOP order: position closed")
843+ else if ((_positionDirection == LONG))
844+ then (_triggerPrice >= marketPrice)
845+ else (marketPrice >= _triggerPrice)
783846 if (isExecutable)
847+ then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false, _priceData], nil)
848+ else throw("Can not execute STOP order: triggerPrice mismatch")
849+ }
850+ else if ((_type == TAKE))
851+ then {
852+ let _positionDirection = if ((positionSize > 0))
853+ then LONG
854+ else if ((0 > positionSize))
855+ then SHORT
856+ else throw("Can not execute STOP order: no open position")
857+ let marketPrice = getMarketPrice(_amm)
858+ let isExecutable = if ((_side == _positionDirection))
859+ then throw("Can not execute TAKE order: reduce only")
860+ else if ((currentPositionId != _positionId))
861+ then throw(((("Can not execute TAKE order: position closed " + toString(currentPositionId)) + "!=") + toString(_positionId)))
862+ else if ((_positionDirection == LONG))
863+ then (marketPrice >= _triggerPrice)
864+ else (_triggerPrice >= marketPrice)
865+ if (isExecutable)
866+ then $Tuple3("closePosition", [minv(_amountIn, abs(positionSize)), positionDirection, muld(_limitPrice, abs(positionSize)), false, _priceData], nil)
867+ else throw("Can not execute TAKE order: triggerPrice mismatch")
868+ }
869+ else if ((_type == LIMIT))
784870 then {
785- let marginAmount = divd(_amountUsdn, (muld(getFee(_amm, _trader), _leverage) + DECIMAL_UNIT))
786- let openNotional = muld(marginAmount, _leverage)
787- let idealMinBaseAssetAmount = divd(openNotional, _triggerPrice)
788- let minBaseAssetAmount = (idealMinBaseAssetAmount - muld(idealMinBaseAssetAmount, getSpreadLimit()))
789- $Tuple3("increasePosition", [_side, _leverage, minBaseAssetAmount, _refLink, _priceData], [AttachedPayment(quoteAsset(), _amountUsdn)])
871+ let marketPrice = getMarketPrice(_amm)
872+ let isExecutableByStop = if ((_limitPrice == 0))
873+ then true
874+ else if ((_limitPrice > _orderMarketPrice))
875+ then (marketPrice >= _limitPrice)
876+ else (_limitPrice >= marketPrice)
877+ let isExecutableForTriggerPrice = if ((_side == LONG))
878+ then (_triggerPrice >= marketPrice)
879+ else (marketPrice >= _triggerPrice)
880+ let isExecutableByTimestamp = if (if ((_expiration == 0))
881+ then true
882+ else (_expiration >= TIME))
883+ then true
884+ else false
885+ let isExecutable = if (if (isExecutableByStop)
886+ then isExecutableForTriggerPrice
887+ else false)
888+ then isExecutableByTimestamp
889+ else false
890+ if (isExecutable)
891+ then {
892+ let marginAmount = divd(_amountUsdn, (muld(getFee(_amm, _trader), _leverage) + DECIMAL_UNIT))
893+ let openNotional = muld(marginAmount, _leverage)
894+ let idealMinBaseAssetAmount = divd(openNotional, _triggerPrice)
895+ let minBaseAssetAmount = (idealMinBaseAssetAmount - muld(idealMinBaseAssetAmount, getSpreadLimit()))
896+ $Tuple3("increasePosition", [_side, _leverage, minBaseAssetAmount, _refLink, _priceData], [AttachedPayment(quoteAsset(), _amountUsdn)])
897+ }
898+ else throw("Can not execute LIMIT order: triggerPrice mismatch")
790899 }
791- else throw("Can not execute LIMIT order: triggerPrice mismatch")
900+ else if ((_type == MARKET))
901+ then {
902+ let marketPrice = getMarketPrice(_amm)
903+ let isExecutableByTimestamp = if (if ((_expiration == 0))
904+ then true
905+ else (_expiration >= TIME))
906+ then true
907+ else false
908+ let isExecutable = isExecutableByTimestamp
909+ if (isExecutable)
910+ then $Tuple3("increasePosition", [_side, _leverage, 0, _refLink, _priceData], [AttachedPayment(quoteAsset(), _amountUsdn)])
911+ else throw("Can not execute MARKET order: expiration mismatch")
912+ }
913+ else throw(("Invalid order type: " + toString(_type)))
914+ let method = $t03019934951._1
915+ let args = $t03019934951._2
916+ let payments = $t03019934951._3
917+ let withdraw = if ((size(payments) == 1))
918+ then {
919+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), payments[0].amount], nil)
920+ if ((unstake == unstake))
921+ then nil
922+ else throw("Strict value is not equal to itself.")
792923 }
793- else throw(("Invalid order type: " + toString(_type)))
794- let method = $t02783031791._1
795- let args = $t02783031791._2
796- let payments = $t02783031791._3
797- let withdraw = if ((size(payments) == 1))
798- then {
799- let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), payments[0].amount], nil)
800- if ((unstake == unstake))
801- then nil
802- else throw("Strict value is not equal to itself.")
803- }
804- else nil
805- if ((withdraw == withdraw))
806- then {
807- let doSetContext = invoke(this, "setContext", [_trader], nil)
808- if ((doSetContext == doSetContext))
924+ else nil
925+ if ((withdraw == withdraw))
809926 then {
810- let doClosePosition = invoke(addressFromStringValue(_amm), method, args, payments)
811- if ((doClosePosition == doClosePosition))
927+ let doSetContext = invoke(this, "setContext", [_trader], nil)
928+ if ((doSetContext == doSetContext))
812929 then {
813- let doResetContext = invoke(this, "resetContext", nil, nil)
814- if ((doResetContext == doResetContext))
930+ let doClosePosition = invoke(addressFromStringValue(_amm), method, args, payments)
931+ if ((doClosePosition == doClosePosition))
815932 then {
816- let executeOrderRequest = if ((_type == LIMIT))
933+ let doResetContext = invoke(this, "resetContext", nil, nil)
934+ if ((doResetContext == doResetContext))
817935 then {
818- let newPositionSize = getPositionSize(_amm, _trader, positionDirection)
819- if ((newPositionSize == newPositionSize))
936+ let executeOrderRequest = if (if ((_type == LIMIT))
937+ then true
938+ else (_type == MARKET))
820939 then {
821- let newPositionId = getPositionId(_amm, _trader, positionDirection)
822- if ((newPositionId == newPositionId))
940+ let newPositionSize = getPositionSize(_amm, _trader, positionDirection)
941+ if ((newPositionSize == newPositionSize))
823942 then {
824- let positionSizeDelta = (newPositionSize - positionSize)
825- let closeOrderSide = if ((newPositionSize > 0))
826- then SHORT
827- else LONG
828- let makeTakeOrder = if (haveOrderRequest(_orderId, TAKE))
943+ let newPositionId = getPositionId(_amm, _trader, positionDirection)
944+ if ((newPositionId == newPositionId))
829945 then {
830- let $t03275332952 = getOrderRequest(_orderId, TAKE)
831- let newOrderId = $t03275332952._1
832- let newAmm = $t03275332952._2
833- let newTrader = $t03275332952._3
834- let newType = $t03275332952._4
835- let newTriggerPrice = $t03275332952._5
836- let newLimitPrice = $t03275332952._6
837- let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil)
838- if ((doCall == doCall))
839- then nil
840- else throw("Strict value is not equal to itself.")
841- }
842- else nil
843- if ((makeTakeOrder == makeTakeOrder))
844- then {
845- let makeStopOrder = if (haveOrderRequest(_orderId, STOP))
946+ let positionSizeDelta = (newPositionSize - positionSize)
947+ let closeOrderSide = if ((newPositionSize > 0))
948+ then SHORT
949+ else LONG
950+ let makeTakeOrder = if (haveOrderRequest(_orderId, TAKE))
846951 then {
847- let $t03352533724 = getOrderRequest(_orderId, STOP)
848- let newOrderId = $t03352533724._1
849- let newAmm = $t03352533724._2
850- let newTrader = $t03352533724._3
851- let newType = $t03352533724._4
852- let newTriggerPrice = $t03352533724._5
853- let newLimitPrice = $t03352533724._6
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
854959 let doCall = invoke(this, "internalCreateOrder", [newTrader, newAmm, newType, newTriggerPrice, newLimitPrice, positionSizeDelta, 0, closeOrderSide, "", "", 0, 0], nil)
855960 if ((doCall == doCall))
856961 then nil
857962 else throw("Strict value is not equal to itself.")
858963 }
859964 else nil
860- if ((makeStopOrder == makeStopOrder))
861- then (makeTakeOrder ++ makeStopOrder)
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+ }
862986 else throw("Strict value is not equal to itself.")
863987 }
864988 else throw("Strict value is not equal to itself.")
865989 }
866990 else throw("Strict value is not equal to itself.")
867991 }
868- else throw("Strict value is not equal to itself.")
869- }
870- else nil
871- if ((executeOrderRequest == executeOrderRequest))
872- then {
873- let doMarkOrderExecuted = invoke(this, "internalMarkOrderExecuted", [_amm, _trader, _orderId], nil)
874- if ((doMarkOrderExecuted == doMarkOrderExecuted))
875- then nil
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+ }
8761000 else throw("Strict value is not equal to itself.")
8771001 }
8781002 else throw("Strict value is not equal to itself.")
8791003 }
8801004 else throw("Strict value is not equal to itself.")
8811005 }
8821006 else throw("Strict value is not equal to itself.")
8831007 }
8841008 else throw("Strict value is not equal to itself.")
8851009 }
8861010 else throw("Strict value is not equal to itself.")
8871011 }
888- else throw("Strict value is not equal to itself.")
8891012 }
1013+ else throw("Strict value is not equal to itself.")
8901014 }
8911015 else throw("Strict value is not equal to itself.")
8921016 }
8931017 else throw("Strict value is not equal to itself.")
8941018 }
8951019
8961020
8971021
8981022 @Callable(i)
8991023 func view_canExecuteOrder (_orderId,_priceData) = {
9001024 let s = invoke(this, "executeOrder", [_orderId, _priceData], nil)
9011025 if ((s == s))
9021026 then throw("Success")
9031027 else throw("Strict value is not equal to itself.")
9041028 }
9051029
9061030
9071031 @Verifier(tx)
9081032 func verify () = {
9091033 let coordinatorStr = getString(this, k_coordinatorAddress)
9101034 if (isDefined(coordinatorStr))
9111035 then {
9121036 let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address)
9131037 if (isDefined(admin))
9141038 then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false)
9151039 else throw("unable to verify: admin not set in coordinator")
9161040 }
9171041 else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
9181042 }
9191043

github/deemru/w8io/026f985 
190.77 ms