tx · 7God5FyXiGRMJzWgSrsUFwBT4aYDhahRkcvrtj6ntsZm 3MxovuqBEhcF2ntmodWMkDdxAVnEAqujjT3: -0.03600000 Waves 2023.01.19 17:12 [2411914] smart account 3MxovuqBEhcF2ntmodWMkDdxAVnEAqujjT3 > SELF 0.00000000 Waves
{ "type": 13, "id": "7God5FyXiGRMJzWgSrsUFwBT4aYDhahRkcvrtj6ntsZm", "fee": 3600000, "feeAssetId": null, "timestamp": 1674137582712, "version": 1, "sender": "3MxovuqBEhcF2ntmodWMkDdxAVnEAqujjT3", "senderPublicKey": "FAVJX2qy2zc6fCuKMe7HCeNh2jCUmbnvqzvsAY6nc7TB", "proofs": [ "3CEGJksvi8DBpbiZ55w9ki9gmQsVCNtqK6WqSmdJieYDZTmsiSGhQ8mH14XioJWFJctCQUJtg7ihGaRYbgLusVnw" ], "script": "base64:BgLcLQgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlkeExQQXNzZ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kAwEFAmNsCQDMCAIJAKQDAQUCY2kJAMwIAgkApgMBBQJjbwkAzAgCCQCkAwEFAmNoBQNuaWwFAWoBAmdHAQJnSAAEAmdJBAJkVAkBAmVXAAMJAAECBQJkVAIKQnl0ZVZlY3RvcgQCZmEFAmRUBQJmYQMJAAECBQJkVAIEVW5pdAgFAmdHD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yBAJkVAUCZ0cDCQABAgUCZFQCBU9yZGVyBAJkeQUCZFQEAmdKCQECYVMABAJhQwkBAmR4AQUCZHkEAmFECQD0AwMIBQJkeQlib2R5Qnl0ZXMJAJEDAggFAmR5BnByb29mcwAACAUCZHkPc2VuZGVyUHVibGljS2V5BAJhRQkA9AMDCAUCZHkJYm9keUJ5dGVzCQCRAwIIBQJkeQZwcm9vZnMAAQUCZ0oDAwMFAmFDBQJhRAcFAmFFBwYJAQJhQgMFAmFDBQJhRAUCYUUDCQABAgUCZFQCFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJlWAUCZFQEAmdLCQD2AwEJAQV2YWx1ZQEIBQJlWAZzY3JpcHQEAmdMCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYU0JAQJhegAEAmdNCQDxBwEFBHRoaXMDAwkAAAIFAmdMBQJnSwkBAiE9AgUCZ00FAmdLBwYJAPQDAwgFAmdHCWJvZHlCeXRlcwkAkQMCCAUCZ0cGcHJvb2ZzAAAFAmdJCQD0AwMIBQJnRwlib2R5Qnl0ZXMJAJEDAggFAmdHBnByb29mcwAABQJnSYeWoQs=", "chainId": 84, "height": 2411914, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CKrgi6ohaK9Rk5WYVWLZYRAVyFrSBxnf7wPdenCGJghY Next: none Diff:
Old | New | Differences | |
---|---|---|---|
60 | 60 | let idxFactorySlippageContract = 7 | |
61 | 61 | ||
62 | 62 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
63 | + | ||
64 | + | ||
65 | + | func toX18BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult) | |
63 | 66 | ||
64 | 67 | ||
65 | 68 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
213 | 216 | ||
214 | 217 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
215 | 218 | ||
216 | - | let $ | |
219 | + | let $t083448510 = poolConfigParsed | |
217 | 220 | ||
218 | - | let cfgPoolAddress = $ | |
221 | + | let cfgPoolAddress = $t083448510._1 | |
219 | 222 | ||
220 | - | let cfgPoolStatus = $ | |
223 | + | let cfgPoolStatus = $t083448510._2 | |
221 | 224 | ||
222 | - | let cfgLpAssetId = $ | |
225 | + | let cfgLpAssetId = $t083448510._3 | |
223 | 226 | ||
224 | - | let cfgAmountAssetId = $ | |
227 | + | let cfgAmountAssetId = $t083448510._4 | |
225 | 228 | ||
226 | - | let cfgPriceAssetId = $ | |
229 | + | let cfgPriceAssetId = $t083448510._5 | |
227 | 230 | ||
228 | - | let cfgAmountAssetDecimals = $ | |
231 | + | let cfgAmountAssetDecimals = $t083448510._6 | |
229 | 232 | ||
230 | - | let cfgPriceAssetDecimals = $ | |
233 | + | let cfgPriceAssetDecimals = $t083448510._7 | |
231 | 234 | ||
232 | 235 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
233 | 236 | ||
394 | 397 | ||
395 | 398 | ||
396 | 399 | func calcKLp (amountBalance,priceBalance,lpEmission) = { | |
397 | - | let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission) | |
400 | + | let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)) | |
401 | + | let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals)) | |
402 | + | let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission) | |
398 | 403 | if ((lpEmission == big0)) | |
399 | 404 | then big0 | |
400 | 405 | else updatedKLp | |
428 | 433 | func validateMatcherOrderAllowed (order) = { | |
429 | 434 | let amountAssetAmount = order.amount | |
430 | 435 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
431 | - | let $ | |
436 | + | let $t02126221474 = if ((order.orderType == Buy)) | |
432 | 437 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
433 | 438 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
434 | - | let amountAssetBalanceDelta = $ | |
435 | - | let priceAssetBalanceDelta = $ | |
439 | + | let amountAssetBalanceDelta = $t02126221474._1 | |
440 | + | let priceAssetBalanceDelta = $t02126221474._2 | |
436 | 441 | if (if (if (isGlobalShutdown()) | |
437 | 442 | then true | |
438 | 443 | else (cfgPoolStatus == PoolMatcherDisabled)) | |
445 | 450 | then throw("Wrong order assets.") | |
446 | 451 | else { | |
447 | 452 | let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp")) | |
448 | - | let $ | |
449 | - | let unusedActions = $ | |
450 | - | let kLpNew = $ | |
453 | + | let $t02194522045 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
454 | + | let unusedActions = $t02194522045._1 | |
455 | + | let kLpNew = $t02194522045._2 | |
451 | 456 | let isOrderValid = (kLpNew >= kLp) | |
452 | 457 | isOrderValid | |
453 | 458 | } | |
525 | 530 | else if ((paymentAssetId == cfgPriceAssetId)) | |
526 | 531 | then false | |
527 | 532 | else throwErr("invalid asset") | |
528 | - | let $ | |
533 | + | let $t02476625059 = if (isEval) | |
529 | 534 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
530 | 535 | else if (paymentInAmountAsset) | |
531 | 536 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
532 | 537 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
533 | - | let amountBalanceOld = $ | |
534 | - | let priceBalanceOld = $ | |
535 | - | let $ | |
538 | + | let amountBalanceOld = $t02476625059._1 | |
539 | + | let priceBalanceOld = $t02476625059._2 | |
540 | + | let $t02506325212 = if (paymentInAmountAsset) | |
536 | 541 | then $Tuple2(paymentAmountRaw, 0) | |
537 | 542 | else $Tuple2(0, paymentAmountRaw) | |
538 | - | let amountAssetAmountRaw = $ | |
539 | - | let priceAssetAmountRaw = $ | |
543 | + | let amountAssetAmountRaw = $t02506325212._1 | |
544 | + | let priceAssetAmountRaw = $t02506325212._2 | |
540 | 545 | let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1 | |
541 | 546 | let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1 | |
542 | - | let $ | |
543 | - | let paymentAmount = $ | |
544 | - | let feeAmount = $ | |
547 | + | let $t02534425408 = takeFee(paymentAmountRaw, inFee) | |
548 | + | let paymentAmount = $t02534425408._1 | |
549 | + | let feeAmount = $t02534425408._2 | |
545 | 550 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
546 | 551 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
547 | 552 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
564 | 569 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
565 | 570 | let priceOld = fromX18(priceOldX18, scale8) | |
566 | 571 | let loss = { | |
567 | - | let $ | |
572 | + | let $t02708927256 = if (paymentInAmountAsset) | |
568 | 573 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
569 | 574 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
570 | - | let amount = $ | |
571 | - | let balance = $ | |
575 | + | let amount = $t02708927256._1 | |
576 | + | let balance = $t02708927256._2 | |
572 | 577 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
573 | 578 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
574 | 579 | } | |
608 | 613 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
609 | 614 | let redeemedBigInt = toBigInt(paymentAmount) | |
610 | 615 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
611 | - | let $ | |
612 | - | let totalAmount = $ | |
613 | - | let feeAmount = $ | |
614 | - | let $ | |
616 | + | let $t02933429390 = takeFee(amountRaw, outFee) | |
617 | + | let totalAmount = $t02933429390._1 | |
618 | + | let feeAmount = $t02933429390._2 | |
619 | + | let $t02939429620 = if (outInAmountAsset) | |
615 | 620 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
616 | 621 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
617 | - | let outAmAmount = $ | |
618 | - | let outPrAmount = $ | |
619 | - | let amBalanceNew = $ | |
620 | - | let prBalanceNew = $ | |
622 | + | let outAmAmount = $t02939429620._1 | |
623 | + | let outPrAmount = $t02939429620._2 | |
624 | + | let amBalanceNew = $t02939429620._3 | |
625 | + | let prBalanceNew = $t02939429620._4 | |
621 | 626 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
622 | 627 | let priceNew = fromX18(priceNewX18, scale8) | |
623 | 628 | let commonState = if (isEval) | |
763 | 768 | else throw("Strict value is not equal to itself.") | |
764 | 769 | } | |
765 | 770 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
766 | - | let $ | |
767 | - | if (($ | |
771 | + | let $t03414834610 = refreshKLpInternal(0, 0, 0) | |
772 | + | if (($t03414834610 == $t03414834610)) | |
768 | 773 | then { | |
769 | - | let updatedKLp = $ | |
770 | - | let refreshKLpActions = $ | |
774 | + | let updatedKLp = $t03414834610._2 | |
775 | + | let refreshKLpActions = $t03414834610._1 | |
771 | 776 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
772 | 777 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
773 | 778 | then ((state ++ lpTransfer) ++ refreshKLpActions) | |
799 | 804 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
800 | 805 | if ((currentKLp == currentKLp)) | |
801 | 806 | then { | |
802 | - | let $ | |
803 | - | let refreshKLpActions = $ | |
804 | - | let updatedKLp = $ | |
807 | + | let $t03517235237 = refreshKLpInternal(0, 0, 0) | |
808 | + | let refreshKLpActions = $t03517235237._1 | |
809 | + | let updatedKLp = $t03517235237._2 | |
805 | 810 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
806 | 811 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
807 | 812 | then (state ++ refreshKLpActions) | |
848 | 853 | then { | |
849 | 854 | let userAddress = i.caller | |
850 | 855 | let txId = i.transactionId | |
851 | - | let $ | |
852 | - | if (($ | |
856 | + | let $t03642536577 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
857 | + | if (($t03642536577 == $t03642536577)) | |
853 | 858 | then { | |
854 | - | let paymentInAmountAsset = $ | |
855 | - | let bonus = $ | |
856 | - | let feeAmount = $ | |
857 | - | let commonState = $ | |
858 | - | let emitAmountEstimated = $ | |
859 | + | let paymentInAmountAsset = $t03642536577._5 | |
860 | + | let bonus = $t03642536577._4 | |
861 | + | let feeAmount = $t03642536577._3 | |
862 | + | let commonState = $t03642536577._2 | |
863 | + | let emitAmountEstimated = $t03642536577._1 | |
859 | 864 | let emitAmount = if (if ((minOutAmount > 0)) | |
860 | 865 | then (minOutAmount > emitAmountEstimated) | |
861 | 866 | else false) | |
875 | 880 | let sendFee = if ((feeAmount > 0)) | |
876 | 881 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
877 | 882 | else nil | |
878 | - | let $ | |
883 | + | let $t03716337360 = if ((this == feeCollectorAddress)) | |
879 | 884 | then $Tuple2(0, 0) | |
880 | 885 | else if (paymentInAmountAsset) | |
881 | 886 | then $Tuple2(-(feeAmount), 0) | |
882 | 887 | else $Tuple2(0, -(feeAmount)) | |
883 | - | let amountAssetBalanceDelta = $ | |
884 | - | let priceAssetBalanceDelta = $ | |
885 | - | let $ | |
886 | - | let refreshKLpActions = $ | |
887 | - | let updatedKLp = $ | |
888 | + | let amountAssetBalanceDelta = $t03716337360._1 | |
889 | + | let priceAssetBalanceDelta = $t03716337360._2 | |
890 | + | let $t03736337471 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
891 | + | let refreshKLpActions = $t03736337471._1 | |
892 | + | let updatedKLp = $t03736337471._2 | |
888 | 893 | let kLp = value(getString(keyKLp)) | |
889 | 894 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
890 | 895 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
904 | 909 | ||
905 | 910 | @Callable(i) | |
906 | 911 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
907 | - | let $ | |
908 | - | let emitAmountEstimated = $ | |
909 | - | let commonState = $ | |
910 | - | let feeAmount = $ | |
911 | - | let bonus = $ | |
912 | - | let paymentInAmountAsset = $ | |
912 | + | let $t03777737934 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
913 | + | let emitAmountEstimated = $t03777737934._1 | |
914 | + | let commonState = $t03777737934._2 | |
915 | + | let feeAmount = $t03777737934._3 | |
916 | + | let bonus = $t03777737934._4 | |
917 | + | let paymentInAmountAsset = $t03777737934._5 | |
913 | 918 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
914 | 919 | } | |
915 | 920 | ||
946 | 951 | then { | |
947 | 952 | let userAddress = i.caller | |
948 | 953 | let txId = i.transactionId | |
949 | - | let $ | |
950 | - | if (($ | |
954 | + | let $t03881938972 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
955 | + | if (($t03881938972 == $t03881938972)) | |
951 | 956 | then { | |
952 | - | let outInAmountAsset = $ | |
953 | - | let bonus = $ | |
954 | - | let feeAmount = $ | |
955 | - | let commonState = $ | |
956 | - | let amountEstimated = $ | |
957 | + | let outInAmountAsset = $t03881938972._5 | |
958 | + | let bonus = $t03881938972._4 | |
959 | + | let feeAmount = $t03881938972._3 | |
960 | + | let commonState = $t03881938972._2 | |
961 | + | let amountEstimated = $t03881938972._1 | |
957 | 962 | let amount = if (if ((minOutAmount > 0)) | |
958 | 963 | then (minOutAmount > amountEstimated) | |
959 | 964 | else false) | |
966 | 971 | let sendFee = if ((feeAmount > 0)) | |
967 | 972 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
968 | 973 | else nil | |
969 | - | let $ | |
974 | + | let $t03947239719 = { | |
970 | 975 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
971 | 976 | then 0 | |
972 | 977 | else feeAmount | |
974 | 979 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
975 | 980 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
976 | 981 | } | |
977 | - | let amountAssetBalanceDelta = $ | |
978 | - | let priceAssetBalanceDelta = $ | |
979 | - | let $ | |
980 | - | let refreshKLpActions = $ | |
981 | - | let updatedKLp = $ | |
982 | + | let amountAssetBalanceDelta = $t03947239719._1 | |
983 | + | let priceAssetBalanceDelta = $t03947239719._2 | |
984 | + | let $t03972239830 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
985 | + | let refreshKLpActions = $t03972239830._1 | |
986 | + | let updatedKLp = $t03972239830._2 | |
982 | 987 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
983 | 988 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
984 | 989 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
997 | 1002 | ||
998 | 1003 | @Callable(i) | |
999 | 1004 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
1000 | - | let $ | |
1001 | - | let amountEstimated = $ | |
1002 | - | let commonState = $ | |
1003 | - | let feeAmount = $ | |
1004 | - | let bonus = $ | |
1005 | - | let outInAmountAsset = $ | |
1005 | + | let $t04008740243 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
1006 | + | let amountEstimated = $t04008740243._1 | |
1007 | + | let commonState = $t04008740243._2 | |
1008 | + | let feeAmount = $t04008740243._3 | |
1009 | + | let bonus = $t04008740243._4 | |
1010 | + | let outInAmountAsset = $t04008740243._5 | |
1006 | 1011 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
1007 | 1012 | } | |
1008 | 1013 | ||
1039 | 1044 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1040 | 1045 | if ((unstakeInv == unstakeInv)) | |
1041 | 1046 | then { | |
1042 | - | let $ | |
1043 | - | if (($ | |
1047 | + | let $t04114841299 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1048 | + | if (($t04114841299 == $t04114841299)) | |
1044 | 1049 | then { | |
1045 | - | let outInAmountAsset = $ | |
1046 | - | let bonus = $ | |
1047 | - | let feeAmount = $ | |
1048 | - | let commonState = $ | |
1049 | - | let amountEstimated = $ | |
1050 | + | let outInAmountAsset = $t04114841299._5 | |
1051 | + | let bonus = $t04114841299._4 | |
1052 | + | let feeAmount = $t04114841299._3 | |
1053 | + | let commonState = $t04114841299._2 | |
1054 | + | let amountEstimated = $t04114841299._1 | |
1050 | 1055 | let amount = if (if ((minOutAmount > 0)) | |
1051 | 1056 | then (minOutAmount > amountEstimated) | |
1052 | 1057 | else false) | |
1059 | 1064 | let sendFee = if ((feeAmount > 0)) | |
1060 | 1065 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1061 | 1066 | else nil | |
1062 | - | let $ | |
1067 | + | let $t04179442041 = { | |
1063 | 1068 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1064 | 1069 | then 0 | |
1065 | 1070 | else feeAmount | |
1067 | 1072 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1068 | 1073 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1069 | 1074 | } | |
1070 | - | let amountAssetBalanceDelta = $ | |
1071 | - | let priceAssetBalanceDelta = $ | |
1072 | - | let $ | |
1073 | - | let refreshKLpActions = $ | |
1074 | - | let updatedKLp = $ | |
1075 | + | let amountAssetBalanceDelta = $t04179442041._1 | |
1076 | + | let priceAssetBalanceDelta = $t04179442041._2 | |
1077 | + | let $t04204442152 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1078 | + | let refreshKLpActions = $t04204442152._1 | |
1079 | + | let updatedKLp = $t04204442152._2 | |
1075 | 1080 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1076 | 1081 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1077 | 1082 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1104 | 1109 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1105 | 1110 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1106 | 1111 | then { | |
1107 | - | let $ | |
1108 | - | let refreshKLpActions = $ | |
1109 | - | let updatedKLp = $ | |
1112 | + | let $t04309843180 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1113 | + | let refreshKLpActions = $t04309843180._1 | |
1114 | + | let updatedKLp = $t04309843180._2 | |
1110 | 1115 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1111 | 1116 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1112 | 1117 | then (state ++ refreshKLpActions) | |
1138 | 1143 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1139 | 1144 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1140 | 1145 | then { | |
1141 | - | let $ | |
1142 | - | let refreshKLpActions = $ | |
1143 | - | let updatedKLp = $ | |
1146 | + | let $t04412944210 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1147 | + | let refreshKLpActions = $t04412944210._1 | |
1148 | + | let updatedKLp = $t04412944210._2 | |
1144 | 1149 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1145 | 1150 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1146 | 1151 | then (state ++ refreshKLpActions) | |
1184 | 1189 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1185 | 1190 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1186 | 1191 | then { | |
1187 | - | let $ | |
1188 | - | let refreshKLpActions = $ | |
1189 | - | let updatedKLp = $ | |
1192 | + | let $t04533645417 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1193 | + | let refreshKLpActions = $t04533645417._1 | |
1194 | + | let updatedKLp = $t04533645417._2 | |
1190 | 1195 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1191 | 1196 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1192 | 1197 | then (state ++ refreshKLpActions) | |
1237 | 1242 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1238 | 1243 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1239 | 1244 | then { | |
1240 | - | let $ | |
1241 | - | let refreshKLpActions = $ | |
1242 | - | let updatedKLp = $ | |
1245 | + | let $t04671246793 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1246 | + | let refreshKLpActions = $t04671246793._1 | |
1247 | + | let updatedKLp = $t04671246793._2 | |
1243 | 1248 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1244 | 1249 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1245 | 1250 | then (state ++ refreshKLpActions) | |
1274 | 1279 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1275 | 1280 | then { | |
1276 | 1281 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1277 | - | let $ | |
1278 | - | let kLpUpdateActions = $ | |
1279 | - | let updatedKLp = $ | |
1282 | + | let $t04798048044 = refreshKLpInternal(0, 0, 0) | |
1283 | + | let kLpUpdateActions = $t04798048044._1 | |
1284 | + | let updatedKLp = $t04798048044._2 | |
1280 | 1285 | let actions = if ((kLp != updatedKLp)) | |
1281 | 1286 | then kLpUpdateActions | |
1282 | 1287 | else throwErr("nothing to refresh") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let lPdecimals = 8 | |
5 | 5 | ||
6 | 6 | let scale8 = 100000000 | |
7 | 7 | ||
8 | 8 | let scale8BigInt = toBigInt(100000000) | |
9 | 9 | ||
10 | 10 | let scale18 = toBigInt(1000000000000000000) | |
11 | 11 | ||
12 | 12 | let zeroBigInt = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big0 = toBigInt(0) | |
15 | 15 | ||
16 | 16 | let big1 = toBigInt(1) | |
17 | 17 | ||
18 | 18 | let big2 = toBigInt(2) | |
19 | 19 | ||
20 | 20 | let wavesString = "WAVES" | |
21 | 21 | ||
22 | 22 | let SEP = "__" | |
23 | 23 | ||
24 | 24 | let PoolActive = 1 | |
25 | 25 | ||
26 | 26 | let PoolPutDisabled = 2 | |
27 | 27 | ||
28 | 28 | let PoolMatcherDisabled = 3 | |
29 | 29 | ||
30 | 30 | let PoolShutdown = 4 | |
31 | 31 | ||
32 | 32 | let idxPoolAddress = 1 | |
33 | 33 | ||
34 | 34 | let idxPoolStatus = 2 | |
35 | 35 | ||
36 | 36 | let idxPoolLPAssetId = 3 | |
37 | 37 | ||
38 | 38 | let idxAmtAssetId = 4 | |
39 | 39 | ||
40 | 40 | let idxPriceAssetId = 5 | |
41 | 41 | ||
42 | 42 | let idxAmtAssetDcm = 6 | |
43 | 43 | ||
44 | 44 | let idxPriceAssetDcm = 7 | |
45 | 45 | ||
46 | 46 | let idxIAmtAssetId = 8 | |
47 | 47 | ||
48 | 48 | let idxIPriceAssetId = 9 | |
49 | 49 | ||
50 | 50 | let idxLPAssetDcm = 10 | |
51 | 51 | ||
52 | 52 | let idxPoolAmtAssetAmt = 1 | |
53 | 53 | ||
54 | 54 | let idxPoolPriceAssetAmt = 2 | |
55 | 55 | ||
56 | 56 | let idxPoolLPAssetAmt = 3 | |
57 | 57 | ||
58 | 58 | let idxFactoryStakingContract = 1 | |
59 | 59 | ||
60 | 60 | let idxFactorySlippageContract = 7 | |
61 | 61 | ||
62 | 62 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
63 | + | ||
64 | + | ||
65 | + | func toX18BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult) | |
63 | 66 | ||
64 | 67 | ||
65 | 68 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
66 | 69 | ||
67 | 70 | ||
68 | 71 | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
69 | 72 | ||
70 | 73 | ||
71 | 74 | func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
72 | 75 | ||
73 | 76 | ||
74 | 77 | func abs (val) = if ((0 > val)) | |
75 | 78 | then -(val) | |
76 | 79 | else val | |
77 | 80 | ||
78 | 81 | ||
79 | 82 | func absBigInt (val) = if ((zeroBigInt > val)) | |
80 | 83 | then -(val) | |
81 | 84 | else val | |
82 | 85 | ||
83 | 86 | ||
84 | 87 | func fc () = "%s__factoryContract" | |
85 | 88 | ||
86 | 89 | ||
87 | 90 | func mpk () = "%s__managerPublicKey" | |
88 | 91 | ||
89 | 92 | ||
90 | 93 | func pmpk () = "%s__pendingManagerPublicKey" | |
91 | 94 | ||
92 | 95 | ||
93 | 96 | func pl () = "%s%s__price__last" | |
94 | 97 | ||
95 | 98 | ||
96 | 99 | func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP) | |
97 | 100 | ||
98 | 101 | ||
99 | 102 | func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId) | |
100 | 103 | ||
101 | 104 | ||
102 | 105 | func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId) | |
103 | 106 | ||
104 | 107 | ||
105 | 108 | func aa () = "%s__amountAsset" | |
106 | 109 | ||
107 | 110 | ||
108 | 111 | func pa () = "%s__priceAsset" | |
109 | 112 | ||
110 | 113 | ||
111 | 114 | let keyFee = "%s__fee" | |
112 | 115 | ||
113 | 116 | let feeDefault = fraction(10, scale8, 10000) | |
114 | 117 | ||
115 | 118 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
116 | 119 | ||
117 | 120 | let keyKLp = makeString(["%s", "kLp"], SEP) | |
118 | 121 | ||
119 | 122 | let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP) | |
120 | 123 | ||
121 | 124 | let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP) | |
122 | 125 | ||
123 | 126 | let kLpRefreshDelayDefault = 30 | |
124 | 127 | ||
125 | 128 | let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault) | |
126 | 129 | ||
127 | 130 | func keyFactoryConfig () = "%s__factoryConfig" | |
128 | 131 | ||
129 | 132 | ||
130 | 133 | func keyMatcherPub () = "%s%s__matcher__publicKey" | |
131 | 134 | ||
132 | 135 | ||
133 | 136 | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
134 | 137 | ||
135 | 138 | ||
136 | 139 | func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config") | |
137 | 140 | ||
138 | 141 | ||
139 | 142 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
140 | 143 | ||
141 | 144 | ||
142 | 145 | func keyAllPoolsShutdown () = "%s__shutdown" | |
143 | 146 | ||
144 | 147 | ||
145 | 148 | func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress) | |
146 | 149 | ||
147 | 150 | ||
148 | 151 | func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash" | |
149 | 152 | ||
150 | 153 | ||
151 | 154 | let keyFeeCollectorAddress = "%s__feeCollectorAddress" | |
152 | 155 | ||
153 | 156 | func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
154 | 157 | ||
155 | 158 | ||
156 | 159 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
157 | 160 | ||
158 | 161 | ||
159 | 162 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
160 | 163 | ||
161 | 164 | ||
162 | 165 | func throwErr (msg) = throw(makeString(["lp.ride:", msg], " ")) | |
163 | 166 | ||
164 | 167 | ||
165 | 168 | func fmtErr (msg) = makeString(["lp.ride:", msg], " ") | |
166 | 169 | ||
167 | 170 | ||
168 | 171 | let factoryContract = addressFromStringValue(getStringOrFail(this, fc())) | |
169 | 172 | ||
170 | 173 | let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress)) | |
171 | 174 | ||
172 | 175 | let inFee = { | |
173 | 176 | let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil) | |
174 | 177 | if ($isInstanceOf(@, "Int")) | |
175 | 178 | then @ | |
176 | 179 | else throw(($getType(@) + " couldn't be cast to Int")) | |
177 | 180 | } | |
178 | 181 | ||
179 | 182 | let outFee = { | |
180 | 183 | let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil) | |
181 | 184 | if ($isInstanceOf(@, "Int")) | |
182 | 185 | then @ | |
183 | 186 | else throw(($getType(@) + " couldn't be cast to Int")) | |
184 | 187 | } | |
185 | 188 | ||
186 | 189 | func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false) | |
187 | 190 | ||
188 | 191 | ||
189 | 192 | func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub())) | |
190 | 193 | ||
191 | 194 | ||
192 | 195 | func getPoolConfig () = { | |
193 | 196 | let amtAsset = getStringOrFail(this, aa()) | |
194 | 197 | let priceAsset = getStringOrFail(this, pa()) | |
195 | 198 | let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset)) | |
196 | 199 | let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset)) | |
197 | 200 | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP) | |
198 | 201 | } | |
199 | 202 | ||
200 | 203 | ||
201 | 204 | func parseAssetId (input) = if ((input == wavesString)) | |
202 | 205 | then unit | |
203 | 206 | else fromBase58String(input) | |
204 | 207 | ||
205 | 208 | ||
206 | 209 | func assetIdToString (input) = if ((input == unit)) | |
207 | 210 | then wavesString | |
208 | 211 | else toBase58String(value(input)) | |
209 | 212 | ||
210 | 213 | ||
211 | 214 | func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolStatus]), fromBase58String(poolConfig[idxPoolLPAssetId]), parseAssetId(poolConfig[idxAmtAssetId]), parseAssetId(poolConfig[idxPriceAssetId]), parseIntValue(poolConfig[idxAmtAssetDcm]), parseIntValue(poolConfig[idxPriceAssetDcm])) | |
212 | 215 | ||
213 | 216 | ||
214 | 217 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
215 | 218 | ||
216 | - | let $ | |
219 | + | let $t083448510 = poolConfigParsed | |
217 | 220 | ||
218 | - | let cfgPoolAddress = $ | |
221 | + | let cfgPoolAddress = $t083448510._1 | |
219 | 222 | ||
220 | - | let cfgPoolStatus = $ | |
223 | + | let cfgPoolStatus = $t083448510._2 | |
221 | 224 | ||
222 | - | let cfgLpAssetId = $ | |
225 | + | let cfgLpAssetId = $t083448510._3 | |
223 | 226 | ||
224 | - | let cfgAmountAssetId = $ | |
227 | + | let cfgAmountAssetId = $t083448510._4 | |
225 | 228 | ||
226 | - | let cfgPriceAssetId = $ | |
229 | + | let cfgPriceAssetId = $t083448510._5 | |
227 | 230 | ||
228 | - | let cfgAmountAssetDecimals = $ | |
231 | + | let cfgAmountAssetDecimals = $t083448510._6 | |
229 | 232 | ||
230 | - | let cfgPriceAssetDecimals = $ | |
233 | + | let cfgPriceAssetDecimals = $t083448510._7 | |
231 | 234 | ||
232 | 235 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
233 | 236 | ||
234 | 237 | ||
235 | 238 | let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address") | |
236 | 239 | ||
237 | 240 | let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address") | |
238 | 241 | ||
239 | 242 | func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,slippageToleranceReal,txHeight,txTimestamp,slipageAmtAssetAmt,slipagePriceAssetAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(slippageToleranceReal), toString(txHeight), toString(txTimestamp), toString(slipageAmtAssetAmt), toString(slipagePriceAssetAmt)], SEP) | |
240 | 243 | ||
241 | 244 | ||
242 | 245 | func dataGetActionInfo (outAmtAssetAmt,outPriceAssetAmt,inLpAmt,price,txHeight,txTimestamp) = makeString(["%d%d%d%d%d%d", toString(outAmtAssetAmt), toString(outPriceAssetAmt), toString(inLpAmt), toString(price), toString(txHeight), toString(txTimestamp)], SEP) | |
243 | 246 | ||
244 | 247 | ||
245 | 248 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
246 | 249 | then wavesBalance(this).available | |
247 | 250 | else assetBalance(this, fromBase58String(assetId)) | |
248 | 251 | ||
249 | 252 | ||
250 | 253 | func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
251 | 254 | ||
252 | 255 | ||
253 | 256 | func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
254 | 257 | ||
255 | 258 | ||
256 | 259 | func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
257 | 260 | let amtAssetAmtX18 = toX18(amAmt, amAssetDcm) | |
258 | 261 | let priceAssetAmtX18 = toX18(prAmt, prAssetDcm) | |
259 | 262 | calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
260 | 263 | } | |
261 | 264 | ||
262 | 265 | ||
263 | 266 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
264 | 267 | let cfg = getPoolConfig() | |
265 | 268 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
266 | 269 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
267 | 270 | let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt) | |
268 | 271 | let amAmtX18 = toX18(amAmt, amtAssetDcm) | |
269 | 272 | let prAmtX18 = toX18(prAmt, priceAssetDcm) | |
270 | 273 | let lpAmtX18 = toX18(lpAmt, scale8) | |
271 | 274 | let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18) | |
272 | 275 | let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18) | |
273 | 276 | [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18] | |
274 | 277 | } | |
275 | 278 | ||
276 | 279 | ||
277 | 280 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
278 | 281 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
279 | 282 | [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)] | |
280 | 283 | } | |
281 | 284 | ||
282 | 285 | ||
283 | 286 | func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
284 | 287 | let cfg = getPoolConfig() | |
285 | 288 | let lpAssetId = cfg[idxPoolLPAssetId] | |
286 | 289 | let amAssetId = cfg[idxAmtAssetId] | |
287 | 290 | let prAssetId = cfg[idxPriceAssetId] | |
288 | 291 | let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
289 | 292 | let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
290 | 293 | let poolStatus = cfg[idxPoolStatus] | |
291 | 294 | let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity | |
292 | 295 | if ((lpAssetId != pmtAssetId)) | |
293 | 296 | then throw("Invalid asset passed.") | |
294 | 297 | else { | |
295 | 298 | let amBalance = getAccBalance(amAssetId) | |
296 | 299 | let amBalanceX18 = toX18(amBalance, amAssetDcm) | |
297 | 300 | let prBalance = getAccBalance(prAssetId) | |
298 | 301 | let prBalanceX18 = toX18(prBalance, prAssetDcm) | |
299 | 302 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
300 | 303 | let curPrice = fromX18(curPriceX18, scale8) | |
301 | 304 | let pmtLpAmtX18 = toX18(pmtLpAmt, scale8) | |
302 | 305 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
303 | 306 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
304 | 307 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
305 | 308 | let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR) | |
306 | 309 | let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR) | |
307 | 310 | let state = if ((txId58 == "")) | |
308 | 311 | then nil | |
309 | 312 | else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES")) | |
310 | 313 | then unit | |
311 | 314 | else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES")) | |
312 | 315 | then unit | |
313 | 316 | else fromBase58String(prAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)] | |
314 | 317 | $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state) | |
315 | 318 | } | |
316 | 319 | } | |
317 | 320 | ||
318 | 321 | ||
319 | 322 | func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = { | |
320 | 323 | let cfg = getPoolConfig() | |
321 | 324 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
322 | 325 | let amAssetIdStr = cfg[idxAmtAssetId] | |
323 | 326 | let prAssetIdStr = cfg[idxPriceAssetId] | |
324 | 327 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
325 | 328 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
326 | 329 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
327 | 330 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
328 | 331 | let poolStatus = cfg[idxPoolStatus] | |
329 | 332 | let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
330 | 333 | let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES"))) | |
331 | 334 | let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES"))) | |
332 | 335 | if (if ((amAssetIdStr != inAmAssetIdStr)) | |
333 | 336 | then true | |
334 | 337 | else (prAssetIdStr != inPrAssetIdStr)) | |
335 | 338 | then throw("Invalid amt or price asset passed.") | |
336 | 339 | else { | |
337 | 340 | let amBalance = if (isEvaluate) | |
338 | 341 | then getAccBalance(amAssetIdStr) | |
339 | 342 | else (getAccBalance(amAssetIdStr) - inAmAssetAmt) | |
340 | 343 | let prBalance = if (isEvaluate) | |
341 | 344 | then getAccBalance(prAssetIdStr) | |
342 | 345 | else (getAccBalance(prAssetIdStr) - inPrAssetAmt) | |
343 | 346 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
344 | 347 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
345 | 348 | let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18) | |
346 | 349 | let amBalanceX18 = toX18(amBalance, amtAssetDcm) | |
347 | 350 | let prBalanceX18 = toX18(prBalance, priceAssetDcm) | |
348 | 351 | let res = if ((lpEmission == 0)) | |
349 | 352 | then { | |
350 | 353 | let curPriceX18 = zeroBigInt | |
351 | 354 | let slippageX18 = zeroBigInt | |
352 | 355 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
353 | 356 | $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
354 | 357 | } | |
355 | 358 | else { | |
356 | 359 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
357 | 360 | let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
358 | 361 | let slippageToleranceX18 = toX18(slippageTolerance, scale8) | |
359 | 362 | if (if ((curPriceX18 != zeroBigInt)) | |
360 | 363 | then (slippageX18 > slippageToleranceX18) | |
361 | 364 | else false) | |
362 | 365 | then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18))) | |
363 | 366 | else { | |
364 | 367 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
365 | 368 | let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
366 | 369 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
367 | 370 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
368 | 371 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
369 | 372 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
370 | 373 | let expAmtAssetAmtX18 = expectedAmts._1 | |
371 | 374 | let expPriceAssetAmtX18 = expectedAmts._2 | |
372 | 375 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR) | |
373 | 376 | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18) | |
374 | 377 | } | |
375 | 378 | } | |
376 | 379 | let calcLpAmt = res._1 | |
377 | 380 | let calcAmAssetPmt = res._2 | |
378 | 381 | let calcPrAssetPmt = res._3 | |
379 | 382 | let curPrice = fromX18(res._4, scale8) | |
380 | 383 | let slippageCalc = fromX18(res._5, scale8) | |
381 | 384 | if ((0 >= calcLpAmt)) | |
382 | 385 | then throw("Invalid calculations. LP calculated is less than zero.") | |
383 | 386 | else { | |
384 | 387 | let emitLpAmt = if (!(emitLp)) | |
385 | 388 | then 0 | |
386 | 389 | else calcLpAmt | |
387 | 390 | let amDiff = (inAmAssetAmt - calcAmAssetPmt) | |
388 | 391 | let prDiff = (inPrAssetAmt - calcPrAssetPmt) | |
389 | 392 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(calcAmAssetPmt, calcPrAssetPmt, emitLpAmt, curPrice, slippageTolerance, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
390 | 393 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId) | |
391 | 394 | } | |
392 | 395 | } | |
393 | 396 | } | |
394 | 397 | ||
395 | 398 | ||
396 | 399 | func calcKLp (amountBalance,priceBalance,lpEmission) = { | |
397 | - | let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission) | |
400 | + | let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)) | |
401 | + | let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals)) | |
402 | + | let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission) | |
398 | 403 | if ((lpEmission == big0)) | |
399 | 404 | then big0 | |
400 | 405 | else updatedKLp | |
401 | 406 | } | |
402 | 407 | ||
403 | 408 | ||
404 | 409 | func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
405 | 410 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
406 | 411 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
407 | 412 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
408 | 413 | let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
409 | 414 | currentKLp | |
410 | 415 | } | |
411 | 416 | ||
412 | 417 | ||
413 | 418 | func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
414 | 419 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
415 | 420 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
416 | 421 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
417 | 422 | let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
418 | 423 | let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))] | |
419 | 424 | $Tuple2(actions, updatedKLp) | |
420 | 425 | } | |
421 | 426 | ||
422 | 427 | ||
423 | 428 | func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp)) | |
424 | 429 | then true | |
425 | 430 | else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " ")) | |
426 | 431 | ||
427 | 432 | ||
428 | 433 | func validateMatcherOrderAllowed (order) = { | |
429 | 434 | let amountAssetAmount = order.amount | |
430 | 435 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
431 | - | let $ | |
436 | + | let $t02126221474 = if ((order.orderType == Buy)) | |
432 | 437 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
433 | 438 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
434 | - | let amountAssetBalanceDelta = $ | |
435 | - | let priceAssetBalanceDelta = $ | |
439 | + | let amountAssetBalanceDelta = $t02126221474._1 | |
440 | + | let priceAssetBalanceDelta = $t02126221474._2 | |
436 | 441 | if (if (if (isGlobalShutdown()) | |
437 | 442 | then true | |
438 | 443 | else (cfgPoolStatus == PoolMatcherDisabled)) | |
439 | 444 | then true | |
440 | 445 | else (cfgPoolStatus == PoolShutdown)) | |
441 | 446 | then throw("Exchange operations disabled") | |
442 | 447 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
443 | 448 | then true | |
444 | 449 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
445 | 450 | then throw("Wrong order assets.") | |
446 | 451 | else { | |
447 | 452 | let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp")) | |
448 | - | let $ | |
449 | - | let unusedActions = $ | |
450 | - | let kLpNew = $ | |
453 | + | let $t02194522045 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
454 | + | let unusedActions = $t02194522045._1 | |
455 | + | let kLpNew = $t02194522045._2 | |
451 | 456 | let isOrderValid = (kLpNew >= kLp) | |
452 | 457 | isOrderValid | |
453 | 458 | } | |
454 | 459 | } | |
455 | 460 | ||
456 | 461 | ||
457 | 462 | func commonGet (i) = if ((size(i.payments) != 1)) | |
458 | 463 | then throw("exactly 1 payment is expected") | |
459 | 464 | else { | |
460 | 465 | let pmt = value(i.payments[0]) | |
461 | 466 | let pmtAssetId = value(pmt.assetId) | |
462 | 467 | let pmtAmt = pmt.amount | |
463 | 468 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
464 | 469 | let outAmAmt = res._1 | |
465 | 470 | let outPrAmt = res._2 | |
466 | 471 | let poolStatus = parseIntValue(res._9) | |
467 | 472 | let state = res._10 | |
468 | 473 | if (if (isGlobalShutdown()) | |
469 | 474 | then true | |
470 | 475 | else (poolStatus == PoolShutdown)) | |
471 | 476 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
472 | 477 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
473 | 478 | } | |
474 | 479 | ||
475 | 480 | ||
476 | 481 | func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2)) | |
477 | 482 | then throw("exactly 2 payments are expected") | |
478 | 483 | else { | |
479 | 484 | let amAssetPmt = value(i.payments[0]) | |
480 | 485 | let prAssetPmt = value(i.payments[1]) | |
481 | 486 | let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp) | |
482 | 487 | let poolStatus = parseIntValue(estPut._8) | |
483 | 488 | if (if (if (isGlobalShutdown()) | |
484 | 489 | then true | |
485 | 490 | else (poolStatus == PoolPutDisabled)) | |
486 | 491 | then true | |
487 | 492 | else (poolStatus == PoolShutdown)) | |
488 | 493 | then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus))) | |
489 | 494 | else estPut | |
490 | 495 | } | |
491 | 496 | ||
492 | 497 | ||
493 | 498 | func emit (amount) = { | |
494 | 499 | let emitInv = invoke(factoryContract, "emit", [amount], nil) | |
495 | 500 | if ((emitInv == emitInv)) | |
496 | 501 | then { | |
497 | 502 | let emitInvLegacy = match emitInv { | |
498 | 503 | case legacyFactoryContract: Address => | |
499 | 504 | invoke(legacyFactoryContract, "emit", [amount], nil) | |
500 | 505 | case _ => | |
501 | 506 | unit | |
502 | 507 | } | |
503 | 508 | if ((emitInvLegacy == emitInvLegacy)) | |
504 | 509 | then amount | |
505 | 510 | else throw("Strict value is not equal to itself.") | |
506 | 511 | } | |
507 | 512 | else throw("Strict value is not equal to itself.") | |
508 | 513 | } | |
509 | 514 | ||
510 | 515 | ||
511 | 516 | func takeFee (amount,fee) = { | |
512 | 517 | let feeAmount = if ((fee == 0)) | |
513 | 518 | then 0 | |
514 | 519 | else fraction(amount, fee, scale8) | |
515 | 520 | $Tuple2((amount - feeAmount), feeAmount) | |
516 | 521 | } | |
517 | 522 | ||
518 | 523 | ||
519 | 524 | func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = { | |
520 | 525 | let isEval = (txId == unit) | |
521 | 526 | let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
522 | 527 | let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
523 | 528 | let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId)) | |
524 | 529 | then true | |
525 | 530 | else if ((paymentAssetId == cfgPriceAssetId)) | |
526 | 531 | then false | |
527 | 532 | else throwErr("invalid asset") | |
528 | - | let $ | |
533 | + | let $t02476625059 = if (isEval) | |
529 | 534 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
530 | 535 | else if (paymentInAmountAsset) | |
531 | 536 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
532 | 537 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
533 | - | let amountBalanceOld = $ | |
534 | - | let priceBalanceOld = $ | |
535 | - | let $ | |
538 | + | let amountBalanceOld = $t02476625059._1 | |
539 | + | let priceBalanceOld = $t02476625059._2 | |
540 | + | let $t02506325212 = if (paymentInAmountAsset) | |
536 | 541 | then $Tuple2(paymentAmountRaw, 0) | |
537 | 542 | else $Tuple2(0, paymentAmountRaw) | |
538 | - | let amountAssetAmountRaw = $ | |
539 | - | let priceAssetAmountRaw = $ | |
543 | + | let amountAssetAmountRaw = $t02506325212._1 | |
544 | + | let priceAssetAmountRaw = $t02506325212._2 | |
540 | 545 | let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1 | |
541 | 546 | let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1 | |
542 | - | let $ | |
543 | - | let paymentAmount = $ | |
544 | - | let feeAmount = $ | |
547 | + | let $t02534425408 = takeFee(paymentAmountRaw, inFee) | |
548 | + | let paymentAmount = $t02534425408._1 | |
549 | + | let feeAmount = $t02534425408._2 | |
545 | 550 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
546 | 551 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
547 | 552 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
548 | 553 | let priceNew = fromX18(priceNewX18, scale8) | |
549 | 554 | let paymentBalance = if (paymentInAmountAsset) | |
550 | 555 | then amountBalanceOld | |
551 | 556 | else priceBalanceOld | |
552 | 557 | let paymentBalanceBigInt = toBigInt(paymentBalance) | |
553 | 558 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
554 | 559 | let chechSupply = if ((supplyBigInt > big0)) | |
555 | 560 | then true | |
556 | 561 | else throwErr("initial deposit requires all coins") | |
557 | 562 | if ((chechSupply == chechSupply)) | |
558 | 563 | then { | |
559 | 564 | let depositBigInt = toBigInt(paymentAmount) | |
560 | 565 | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))]) | |
561 | 566 | let commonState = if (isEval) | |
562 | 567 | then nil | |
563 | 568 | else [IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew), StringEntry(pau(toString(value(userAddress)), toBase58String(value(txId))), dataPutActionInfo(amountAssetAmountRaw, priceAssetAmountRaw, issueAmount, priceNew, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
564 | 569 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
565 | 570 | let priceOld = fromX18(priceOldX18, scale8) | |
566 | 571 | let loss = { | |
567 | - | let $ | |
572 | + | let $t02708927256 = if (paymentInAmountAsset) | |
568 | 573 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
569 | 574 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
570 | - | let amount = $ | |
571 | - | let balance = $ | |
575 | + | let amount = $t02708927256._1 | |
576 | + | let balance = $t02708927256._2 | |
572 | 577 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
573 | 578 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
574 | 579 | } | |
575 | 580 | $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset) | |
576 | 581 | } | |
577 | 582 | else throw("Strict value is not equal to itself.") | |
578 | 583 | } | |
579 | 584 | ||
580 | 585 | ||
581 | 586 | func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = { | |
582 | 587 | let isEval = (txId == unit) | |
583 | 588 | let cfg = getPoolConfig() | |
584 | 589 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
585 | 590 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
586 | 591 | let checks = [if ((paymentAssetId == cfgLpAssetId)) | |
587 | 592 | then true | |
588 | 593 | else throwErr("invalid lp asset")] | |
589 | 594 | if ((checks == checks)) | |
590 | 595 | then { | |
591 | 596 | let outInAmountAsset = if ((outAssetId == cfgAmountAssetId)) | |
592 | 597 | then true | |
593 | 598 | else if ((outAssetId == cfgPriceAssetId)) | |
594 | 599 | then false | |
595 | 600 | else throwErr("invalid asset") | |
596 | 601 | let balanceBigInt = if (outInAmountAsset) | |
597 | 602 | then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) | |
598 | 603 | else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) | |
599 | 604 | let outInAmountAssetDecimals = if (outInAmountAsset) | |
600 | 605 | then amtAssetDcm | |
601 | 606 | else priceAssetDcm | |
602 | 607 | let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
603 | 608 | let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
604 | 609 | let outBalance = if (outInAmountAsset) | |
605 | 610 | then amBalanceOld | |
606 | 611 | else prBalanceOld | |
607 | 612 | let outBalanceBigInt = toBigInt(outBalance) | |
608 | 613 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
609 | 614 | let redeemedBigInt = toBigInt(paymentAmount) | |
610 | 615 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
611 | - | let $ | |
612 | - | let totalAmount = $ | |
613 | - | let feeAmount = $ | |
614 | - | let $ | |
616 | + | let $t02933429390 = takeFee(amountRaw, outFee) | |
617 | + | let totalAmount = $t02933429390._1 | |
618 | + | let feeAmount = $t02933429390._2 | |
619 | + | let $t02939429620 = if (outInAmountAsset) | |
615 | 620 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
616 | 621 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
617 | - | let outAmAmount = $ | |
618 | - | let outPrAmount = $ | |
619 | - | let amBalanceNew = $ | |
620 | - | let prBalanceNew = $ | |
622 | + | let outAmAmount = $t02939429620._1 | |
623 | + | let outPrAmount = $t02939429620._2 | |
624 | + | let amBalanceNew = $t02939429620._3 | |
625 | + | let prBalanceNew = $t02939429620._4 | |
621 | 626 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
622 | 627 | let priceNew = fromX18(priceNewX18, scale8) | |
623 | 628 | let commonState = if (isEval) | |
624 | 629 | then nil | |
625 | 630 | else [StringEntry(gau(toString(value(userAddress)), toBase58String(value(txId))), dataGetActionInfo(outAmAmount, outPrAmount, paymentAmount, priceNew, height, lastBlock.timestamp)), IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew)] | |
626 | 631 | let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals)) | |
627 | 632 | let priceOld = fromX18(priceOldX18, scale8) | |
628 | 633 | let loss = { | |
629 | 634 | let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2) | |
630 | 635 | fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset) | |
631 | 636 | } | |
632 | 637 | $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset) | |
633 | 638 | } | |
634 | 639 | else throw("Strict value is not equal to itself.") | |
635 | 640 | } | |
636 | 641 | ||
637 | 642 | ||
638 | 643 | func managerPublicKeyOrUnit () = match getString(mpk()) { | |
639 | 644 | case s: String => | |
640 | 645 | fromBase58String(s) | |
641 | 646 | case _: Unit => | |
642 | 647 | unit | |
643 | 648 | case _ => | |
644 | 649 | throw("Match error") | |
645 | 650 | } | |
646 | 651 | ||
647 | 652 | ||
648 | 653 | func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) { | |
649 | 654 | case s: String => | |
650 | 655 | fromBase58String(s) | |
651 | 656 | case _: Unit => | |
652 | 657 | unit | |
653 | 658 | case _ => | |
654 | 659 | throw("Match error") | |
655 | 660 | } | |
656 | 661 | ||
657 | 662 | ||
658 | 663 | func isManager (i) = match managerPublicKeyOrUnit() { | |
659 | 664 | case pk: ByteVector => | |
660 | 665 | (i.callerPublicKey == pk) | |
661 | 666 | case _: Unit => | |
662 | 667 | (i.caller == this) | |
663 | 668 | case _ => | |
664 | 669 | throw("Match error") | |
665 | 670 | } | |
666 | 671 | ||
667 | 672 | ||
668 | 673 | func mustManager (i) = { | |
669 | 674 | let pd = throw("Permission denied") | |
670 | 675 | match managerPublicKeyOrUnit() { | |
671 | 676 | case pk: ByteVector => | |
672 | 677 | if ((i.callerPublicKey == pk)) | |
673 | 678 | then true | |
674 | 679 | else pd | |
675 | 680 | case _: Unit => | |
676 | 681 | if ((i.caller == this)) | |
677 | 682 | then true | |
678 | 683 | else pd | |
679 | 684 | case _ => | |
680 | 685 | throw("Match error") | |
681 | 686 | } | |
682 | 687 | } | |
683 | 688 | ||
684 | 689 | ||
685 | 690 | @Callable(i) | |
686 | 691 | func setManager (pendingManagerPublicKey) = { | |
687 | 692 | let checkCaller = mustManager(i) | |
688 | 693 | if ((checkCaller == checkCaller)) | |
689 | 694 | then { | |
690 | 695 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
691 | 696 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
692 | 697 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
693 | 698 | else throw("Strict value is not equal to itself.") | |
694 | 699 | } | |
695 | 700 | else throw("Strict value is not equal to itself.") | |
696 | 701 | } | |
697 | 702 | ||
698 | 703 | ||
699 | 704 | ||
700 | 705 | @Callable(i) | |
701 | 706 | func confirmManager () = { | |
702 | 707 | let pm = pendingManagerPublicKeyOrUnit() | |
703 | 708 | let hasPM = if (isDefined(pm)) | |
704 | 709 | then true | |
705 | 710 | else throw("No pending manager") | |
706 | 711 | if ((hasPM == hasPM)) | |
707 | 712 | then { | |
708 | 713 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
709 | 714 | then true | |
710 | 715 | else throw("You are not pending manager") | |
711 | 716 | if ((checkPM == checkPM)) | |
712 | 717 | then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())] | |
713 | 718 | else throw("Strict value is not equal to itself.") | |
714 | 719 | } | |
715 | 720 | else throw("Strict value is not equal to itself.") | |
716 | 721 | } | |
717 | 722 | ||
718 | 723 | ||
719 | 724 | ||
720 | 725 | @Callable(i) | |
721 | 726 | func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance)) | |
722 | 727 | then throw("Invalid slippageTolerance passed") | |
723 | 728 | else { | |
724 | 729 | let estPut = commonPut(i, slippageTolerance, true) | |
725 | 730 | let emitLpAmt = estPut._2 | |
726 | 731 | let lpAssetId = estPut._7 | |
727 | 732 | let state = estPut._9 | |
728 | 733 | let amDiff = estPut._10 | |
729 | 734 | let prDiff = estPut._11 | |
730 | 735 | let amId = estPut._12 | |
731 | 736 | let prId = estPut._13 | |
732 | 737 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
733 | 738 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
734 | 739 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
735 | 740 | if ((currentKLp == currentKLp)) | |
736 | 741 | then { | |
737 | 742 | let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil) | |
738 | 743 | if ((emitInv == emitInv)) | |
739 | 744 | then { | |
740 | 745 | let emitInvLegacy = match emitInv { | |
741 | 746 | case legacyFactoryContract: Address => | |
742 | 747 | invoke(legacyFactoryContract, "emit", [emitLpAmt], nil) | |
743 | 748 | case _ => | |
744 | 749 | unit | |
745 | 750 | } | |
746 | 751 | if ((emitInvLegacy == emitInvLegacy)) | |
747 | 752 | then { | |
748 | 753 | let slippageAInv = if ((amDiff > 0)) | |
749 | 754 | then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)]) | |
750 | 755 | else nil | |
751 | 756 | if ((slippageAInv == slippageAInv)) | |
752 | 757 | then { | |
753 | 758 | let slippagePInv = if ((prDiff > 0)) | |
754 | 759 | then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)]) | |
755 | 760 | else nil | |
756 | 761 | if ((slippagePInv == slippagePInv)) | |
757 | 762 | then { | |
758 | 763 | let lpTransfer = if (shouldAutoStake) | |
759 | 764 | then { | |
760 | 765 | let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
761 | 766 | if ((slpStakeInv == slpStakeInv)) | |
762 | 767 | then nil | |
763 | 768 | else throw("Strict value is not equal to itself.") | |
764 | 769 | } | |
765 | 770 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
766 | - | let $ | |
767 | - | if (($ | |
771 | + | let $t03414834610 = refreshKLpInternal(0, 0, 0) | |
772 | + | if (($t03414834610 == $t03414834610)) | |
768 | 773 | then { | |
769 | - | let updatedKLp = $ | |
770 | - | let refreshKLpActions = $ | |
774 | + | let updatedKLp = $t03414834610._2 | |
775 | + | let refreshKLpActions = $t03414834610._1 | |
771 | 776 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
772 | 777 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
773 | 778 | then ((state ++ lpTransfer) ++ refreshKLpActions) | |
774 | 779 | else throw("Strict value is not equal to itself.") | |
775 | 780 | } | |
776 | 781 | else throw("Strict value is not equal to itself.") | |
777 | 782 | } | |
778 | 783 | else throw("Strict value is not equal to itself.") | |
779 | 784 | } | |
780 | 785 | else throw("Strict value is not equal to itself.") | |
781 | 786 | } | |
782 | 787 | else throw("Strict value is not equal to itself.") | |
783 | 788 | } | |
784 | 789 | else throw("Strict value is not equal to itself.") | |
785 | 790 | } | |
786 | 791 | else throw("Strict value is not equal to itself.") | |
787 | 792 | } | |
788 | 793 | ||
789 | 794 | ||
790 | 795 | ||
791 | 796 | @Callable(i) | |
792 | 797 | func putForFree (maxSlippage) = if ((0 > maxSlippage)) | |
793 | 798 | then throw("Invalid value passed") | |
794 | 799 | else { | |
795 | 800 | let estPut = commonPut(i, maxSlippage, false) | |
796 | 801 | let state = estPut._9 | |
797 | 802 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
798 | 803 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
799 | 804 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
800 | 805 | if ((currentKLp == currentKLp)) | |
801 | 806 | then { | |
802 | - | let $ | |
803 | - | let refreshKLpActions = $ | |
804 | - | let updatedKLp = $ | |
807 | + | let $t03517235237 = refreshKLpInternal(0, 0, 0) | |
808 | + | let refreshKLpActions = $t03517235237._1 | |
809 | + | let updatedKLp = $t03517235237._2 | |
805 | 810 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
806 | 811 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
807 | 812 | then (state ++ refreshKLpActions) | |
808 | 813 | else throw("Strict value is not equal to itself.") | |
809 | 814 | } | |
810 | 815 | else throw("Strict value is not equal to itself.") | |
811 | 816 | } | |
812 | 817 | ||
813 | 818 | ||
814 | 819 | ||
815 | 820 | @Callable(i) | |
816 | 821 | func putOneTkn (minOutAmount,autoStake) = { | |
817 | 822 | let isPoolOneTokenOperationsDisabled = { | |
818 | 823 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
819 | 824 | if ($isInstanceOf(@, "Boolean")) | |
820 | 825 | then @ | |
821 | 826 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
822 | 827 | } | |
823 | 828 | let isPutDisabled = if (if (if (isGlobalShutdown()) | |
824 | 829 | then true | |
825 | 830 | else (cfgPoolStatus == PoolPutDisabled)) | |
826 | 831 | then true | |
827 | 832 | else (cfgPoolStatus == PoolShutdown)) | |
828 | 833 | then true | |
829 | 834 | else isPoolOneTokenOperationsDisabled | |
830 | 835 | let checks = [if (if (!(isPutDisabled)) | |
831 | 836 | then true | |
832 | 837 | else isManager(i)) | |
833 | 838 | then true | |
834 | 839 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
835 | 840 | then true | |
836 | 841 | else throwErr("exactly 1 payment are expected")] | |
837 | 842 | if ((checks == checks)) | |
838 | 843 | then { | |
839 | 844 | let payment = i.payments[0] | |
840 | 845 | let paymentAssetId = payment.assetId | |
841 | 846 | let paymentAmountRaw = payment.amount | |
842 | 847 | let currentKLp = if ((paymentAssetId == cfgAmountAssetId)) | |
843 | 848 | then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0)) | |
844 | 849 | else if ((paymentAssetId == cfgPriceAssetId)) | |
845 | 850 | then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0)) | |
846 | 851 | else throwErr("payment asset is not supported") | |
847 | 852 | if ((currentKLp == currentKLp)) | |
848 | 853 | then { | |
849 | 854 | let userAddress = i.caller | |
850 | 855 | let txId = i.transactionId | |
851 | - | let $ | |
852 | - | if (($ | |
856 | + | let $t03642536577 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
857 | + | if (($t03642536577 == $t03642536577)) | |
853 | 858 | then { | |
854 | - | let paymentInAmountAsset = $ | |
855 | - | let bonus = $ | |
856 | - | let feeAmount = $ | |
857 | - | let commonState = $ | |
858 | - | let emitAmountEstimated = $ | |
859 | + | let paymentInAmountAsset = $t03642536577._5 | |
860 | + | let bonus = $t03642536577._4 | |
861 | + | let feeAmount = $t03642536577._3 | |
862 | + | let commonState = $t03642536577._2 | |
863 | + | let emitAmountEstimated = $t03642536577._1 | |
859 | 864 | let emitAmount = if (if ((minOutAmount > 0)) | |
860 | 865 | then (minOutAmount > emitAmountEstimated) | |
861 | 866 | else false) | |
862 | 867 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
863 | 868 | else emitAmountEstimated | |
864 | 869 | let emitInv = emit(emitAmount) | |
865 | 870 | if ((emitInv == emitInv)) | |
866 | 871 | then { | |
867 | 872 | let lpTransfer = if (autoStake) | |
868 | 873 | then { | |
869 | 874 | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
870 | 875 | if ((stakeInv == stakeInv)) | |
871 | 876 | then nil | |
872 | 877 | else throw("Strict value is not equal to itself.") | |
873 | 878 | } | |
874 | 879 | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
875 | 880 | let sendFee = if ((feeAmount > 0)) | |
876 | 881 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
877 | 882 | else nil | |
878 | - | let $ | |
883 | + | let $t03716337360 = if ((this == feeCollectorAddress)) | |
879 | 884 | then $Tuple2(0, 0) | |
880 | 885 | else if (paymentInAmountAsset) | |
881 | 886 | then $Tuple2(-(feeAmount), 0) | |
882 | 887 | else $Tuple2(0, -(feeAmount)) | |
883 | - | let amountAssetBalanceDelta = $ | |
884 | - | let priceAssetBalanceDelta = $ | |
885 | - | let $ | |
886 | - | let refreshKLpActions = $ | |
887 | - | let updatedKLp = $ | |
888 | + | let amountAssetBalanceDelta = $t03716337360._1 | |
889 | + | let priceAssetBalanceDelta = $t03716337360._2 | |
890 | + | let $t03736337471 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
891 | + | let refreshKLpActions = $t03736337471._1 | |
892 | + | let updatedKLp = $t03736337471._2 | |
888 | 893 | let kLp = value(getString(keyKLp)) | |
889 | 894 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
890 | 895 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
891 | 896 | then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount) | |
892 | 897 | else throw("Strict value is not equal to itself.") | |
893 | 898 | } | |
894 | 899 | else throw("Strict value is not equal to itself.") | |
895 | 900 | } | |
896 | 901 | else throw("Strict value is not equal to itself.") | |
897 | 902 | } | |
898 | 903 | else throw("Strict value is not equal to itself.") | |
899 | 904 | } | |
900 | 905 | else throw("Strict value is not equal to itself.") | |
901 | 906 | } | |
902 | 907 | ||
903 | 908 | ||
904 | 909 | ||
905 | 910 | @Callable(i) | |
906 | 911 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
907 | - | let $ | |
908 | - | let emitAmountEstimated = $ | |
909 | - | let commonState = $ | |
910 | - | let feeAmount = $ | |
911 | - | let bonus = $ | |
912 | - | let paymentInAmountAsset = $ | |
912 | + | let $t03777737934 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
913 | + | let emitAmountEstimated = $t03777737934._1 | |
914 | + | let commonState = $t03777737934._2 | |
915 | + | let feeAmount = $t03777737934._3 | |
916 | + | let bonus = $t03777737934._4 | |
917 | + | let paymentInAmountAsset = $t03777737934._5 | |
913 | 918 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
914 | 919 | } | |
915 | 920 | ||
916 | 921 | ||
917 | 922 | ||
918 | 923 | @Callable(i) | |
919 | 924 | func getOneTkn (outAssetIdStr,minOutAmount) = { | |
920 | 925 | let isPoolOneTokenOperationsDisabled = { | |
921 | 926 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
922 | 927 | if ($isInstanceOf(@, "Boolean")) | |
923 | 928 | then @ | |
924 | 929 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
925 | 930 | } | |
926 | 931 | let isGetDisabled = if (if (isGlobalShutdown()) | |
927 | 932 | then true | |
928 | 933 | else (cfgPoolStatus == PoolShutdown)) | |
929 | 934 | then true | |
930 | 935 | else isPoolOneTokenOperationsDisabled | |
931 | 936 | let checks = [if (if (!(isGetDisabled)) | |
932 | 937 | then true | |
933 | 938 | else isManager(i)) | |
934 | 939 | then true | |
935 | 940 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
936 | 941 | then true | |
937 | 942 | else throwErr("exactly 1 payment are expected")] | |
938 | 943 | if ((checks == checks)) | |
939 | 944 | then { | |
940 | 945 | let outAssetId = parseAssetId(outAssetIdStr) | |
941 | 946 | let payment = i.payments[0] | |
942 | 947 | let paymentAssetId = payment.assetId | |
943 | 948 | let paymentAmount = payment.amount | |
944 | 949 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
945 | 950 | if ((currentKLp == currentKLp)) | |
946 | 951 | then { | |
947 | 952 | let userAddress = i.caller | |
948 | 953 | let txId = i.transactionId | |
949 | - | let $ | |
950 | - | if (($ | |
954 | + | let $t03881938972 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
955 | + | if (($t03881938972 == $t03881938972)) | |
951 | 956 | then { | |
952 | - | let outInAmountAsset = $ | |
953 | - | let bonus = $ | |
954 | - | let feeAmount = $ | |
955 | - | let commonState = $ | |
956 | - | let amountEstimated = $ | |
957 | + | let outInAmountAsset = $t03881938972._5 | |
958 | + | let bonus = $t03881938972._4 | |
959 | + | let feeAmount = $t03881938972._3 | |
960 | + | let commonState = $t03881938972._2 | |
961 | + | let amountEstimated = $t03881938972._1 | |
957 | 962 | let amount = if (if ((minOutAmount > 0)) | |
958 | 963 | then (minOutAmount > amountEstimated) | |
959 | 964 | else false) | |
960 | 965 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
961 | 966 | else amountEstimated | |
962 | 967 | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
963 | 968 | if ((burnInv == burnInv)) | |
964 | 969 | then { | |
965 | 970 | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
966 | 971 | let sendFee = if ((feeAmount > 0)) | |
967 | 972 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
968 | 973 | else nil | |
969 | - | let $ | |
974 | + | let $t03947239719 = { | |
970 | 975 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
971 | 976 | then 0 | |
972 | 977 | else feeAmount | |
973 | 978 | if (outInAmountAsset) | |
974 | 979 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
975 | 980 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
976 | 981 | } | |
977 | - | let amountAssetBalanceDelta = $ | |
978 | - | let priceAssetBalanceDelta = $ | |
979 | - | let $ | |
980 | - | let refreshKLpActions = $ | |
981 | - | let updatedKLp = $ | |
982 | + | let amountAssetBalanceDelta = $t03947239719._1 | |
983 | + | let priceAssetBalanceDelta = $t03947239719._2 | |
984 | + | let $t03972239830 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
985 | + | let refreshKLpActions = $t03972239830._1 | |
986 | + | let updatedKLp = $t03972239830._2 | |
982 | 987 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
983 | 988 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
984 | 989 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
985 | 990 | else throw("Strict value is not equal to itself.") | |
986 | 991 | } | |
987 | 992 | else throw("Strict value is not equal to itself.") | |
988 | 993 | } | |
989 | 994 | else throw("Strict value is not equal to itself.") | |
990 | 995 | } | |
991 | 996 | else throw("Strict value is not equal to itself.") | |
992 | 997 | } | |
993 | 998 | else throw("Strict value is not equal to itself.") | |
994 | 999 | } | |
995 | 1000 | ||
996 | 1001 | ||
997 | 1002 | ||
998 | 1003 | @Callable(i) | |
999 | 1004 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
1000 | - | let $ | |
1001 | - | let amountEstimated = $ | |
1002 | - | let commonState = $ | |
1003 | - | let feeAmount = $ | |
1004 | - | let bonus = $ | |
1005 | - | let outInAmountAsset = $ | |
1005 | + | let $t04008740243 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
1006 | + | let amountEstimated = $t04008740243._1 | |
1007 | + | let commonState = $t04008740243._2 | |
1008 | + | let feeAmount = $t04008740243._3 | |
1009 | + | let bonus = $t04008740243._4 | |
1010 | + | let outInAmountAsset = $t04008740243._5 | |
1006 | 1011 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
1007 | 1012 | } | |
1008 | 1013 | ||
1009 | 1014 | ||
1010 | 1015 | ||
1011 | 1016 | @Callable(i) | |
1012 | 1017 | func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = { | |
1013 | 1018 | let isPoolOneTokenOperationsDisabled = { | |
1014 | 1019 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1015 | 1020 | if ($isInstanceOf(@, "Boolean")) | |
1016 | 1021 | then @ | |
1017 | 1022 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1018 | 1023 | } | |
1019 | 1024 | let isGetDisabled = if (if (isGlobalShutdown()) | |
1020 | 1025 | then true | |
1021 | 1026 | else (cfgPoolStatus == PoolShutdown)) | |
1022 | 1027 | then true | |
1023 | 1028 | else isPoolOneTokenOperationsDisabled | |
1024 | 1029 | let checks = [if (if (!(isGetDisabled)) | |
1025 | 1030 | then true | |
1026 | 1031 | else isManager(i)) | |
1027 | 1032 | then true | |
1028 | 1033 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1029 | 1034 | then true | |
1030 | 1035 | else throwErr("no payments are expected")] | |
1031 | 1036 | if ((checks == checks)) | |
1032 | 1037 | then { | |
1033 | 1038 | let outAssetId = parseAssetId(outAssetIdStr) | |
1034 | 1039 | let userAddress = i.caller | |
1035 | 1040 | let txId = i.transactionId | |
1036 | 1041 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1037 | 1042 | if ((currentKLp == currentKLp)) | |
1038 | 1043 | then { | |
1039 | 1044 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1040 | 1045 | if ((unstakeInv == unstakeInv)) | |
1041 | 1046 | then { | |
1042 | - | let $ | |
1043 | - | if (($ | |
1047 | + | let $t04114841299 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1048 | + | if (($t04114841299 == $t04114841299)) | |
1044 | 1049 | then { | |
1045 | - | let outInAmountAsset = $ | |
1046 | - | let bonus = $ | |
1047 | - | let feeAmount = $ | |
1048 | - | let commonState = $ | |
1049 | - | let amountEstimated = $ | |
1050 | + | let outInAmountAsset = $t04114841299._5 | |
1051 | + | let bonus = $t04114841299._4 | |
1052 | + | let feeAmount = $t04114841299._3 | |
1053 | + | let commonState = $t04114841299._2 | |
1054 | + | let amountEstimated = $t04114841299._1 | |
1050 | 1055 | let amount = if (if ((minOutAmount > 0)) | |
1051 | 1056 | then (minOutAmount > amountEstimated) | |
1052 | 1057 | else false) | |
1053 | 1058 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1054 | 1059 | else amountEstimated | |
1055 | 1060 | let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1056 | 1061 | if ((burnInv == burnInv)) | |
1057 | 1062 | then { | |
1058 | 1063 | let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)] | |
1059 | 1064 | let sendFee = if ((feeAmount > 0)) | |
1060 | 1065 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1061 | 1066 | else nil | |
1062 | - | let $ | |
1067 | + | let $t04179442041 = { | |
1063 | 1068 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1064 | 1069 | then 0 | |
1065 | 1070 | else feeAmount | |
1066 | 1071 | if (outInAmountAsset) | |
1067 | 1072 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1068 | 1073 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1069 | 1074 | } | |
1070 | - | let amountAssetBalanceDelta = $ | |
1071 | - | let priceAssetBalanceDelta = $ | |
1072 | - | let $ | |
1073 | - | let refreshKLpActions = $ | |
1074 | - | let updatedKLp = $ | |
1075 | + | let amountAssetBalanceDelta = $t04179442041._1 | |
1076 | + | let priceAssetBalanceDelta = $t04179442041._2 | |
1077 | + | let $t04204442152 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1078 | + | let refreshKLpActions = $t04204442152._1 | |
1079 | + | let updatedKLp = $t04204442152._2 | |
1075 | 1080 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1076 | 1081 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1077 | 1082 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1078 | 1083 | else throw("Strict value is not equal to itself.") | |
1079 | 1084 | } | |
1080 | 1085 | else throw("Strict value is not equal to itself.") | |
1081 | 1086 | } | |
1082 | 1087 | else throw("Strict value is not equal to itself.") | |
1083 | 1088 | } | |
1084 | 1089 | else throw("Strict value is not equal to itself.") | |
1085 | 1090 | } | |
1086 | 1091 | else throw("Strict value is not equal to itself.") | |
1087 | 1092 | } | |
1088 | 1093 | else throw("Strict value is not equal to itself.") | |
1089 | 1094 | } | |
1090 | 1095 | ||
1091 | 1096 | ||
1092 | 1097 | ||
1093 | 1098 | @Callable(i) | |
1094 | 1099 | func get () = { | |
1095 | 1100 | let res = commonGet(i) | |
1096 | 1101 | let outAmtAmt = res._1 | |
1097 | 1102 | let outPrAmt = res._2 | |
1098 | 1103 | let pmtAmt = res._3 | |
1099 | 1104 | let pmtAssetId = res._4 | |
1100 | 1105 | let state = res._5 | |
1101 | 1106 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1102 | 1107 | if ((currentKLp == currentKLp)) | |
1103 | 1108 | then { | |
1104 | 1109 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1105 | 1110 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1106 | 1111 | then { | |
1107 | - | let $ | |
1108 | - | let refreshKLpActions = $ | |
1109 | - | let updatedKLp = $ | |
1112 | + | let $t04309843180 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1113 | + | let refreshKLpActions = $t04309843180._1 | |
1114 | + | let updatedKLp = $t04309843180._2 | |
1110 | 1115 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1111 | 1116 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1112 | 1117 | then (state ++ refreshKLpActions) | |
1113 | 1118 | else throw("Strict value is not equal to itself.") | |
1114 | 1119 | } | |
1115 | 1120 | else throw("Strict value is not equal to itself.") | |
1116 | 1121 | } | |
1117 | 1122 | else throw("Strict value is not equal to itself.") | |
1118 | 1123 | } | |
1119 | 1124 | ||
1120 | 1125 | ||
1121 | 1126 | ||
1122 | 1127 | @Callable(i) | |
1123 | 1128 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1124 | 1129 | let res = commonGet(i) | |
1125 | 1130 | let outAmAmt = res._1 | |
1126 | 1131 | let outPrAmt = res._2 | |
1127 | 1132 | let pmtAmt = res._3 | |
1128 | 1133 | let pmtAssetId = res._4 | |
1129 | 1134 | let state = res._5 | |
1130 | 1135 | if ((noLessThenAmtAsset > outAmAmt)) | |
1131 | 1136 | then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1132 | 1137 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1133 | 1138 | then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1134 | 1139 | else { | |
1135 | 1140 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1136 | 1141 | if ((currentKLp == currentKLp)) | |
1137 | 1142 | then { | |
1138 | 1143 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1139 | 1144 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1140 | 1145 | then { | |
1141 | - | let $ | |
1142 | - | let refreshKLpActions = $ | |
1143 | - | let updatedKLp = $ | |
1146 | + | let $t04412944210 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1147 | + | let refreshKLpActions = $t04412944210._1 | |
1148 | + | let updatedKLp = $t04412944210._2 | |
1144 | 1149 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1145 | 1150 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1146 | 1151 | then (state ++ refreshKLpActions) | |
1147 | 1152 | else throw("Strict value is not equal to itself.") | |
1148 | 1153 | } | |
1149 | 1154 | else throw("Strict value is not equal to itself.") | |
1150 | 1155 | } | |
1151 | 1156 | else throw("Strict value is not equal to itself.") | |
1152 | 1157 | } | |
1153 | 1158 | } | |
1154 | 1159 | ||
1155 | 1160 | ||
1156 | 1161 | ||
1157 | 1162 | @Callable(i) | |
1158 | 1163 | func unstakeAndGet (amount) = { | |
1159 | 1164 | let checkPayments = if ((size(i.payments) != 0)) | |
1160 | 1165 | then throw("No payments are expected") | |
1161 | 1166 | else true | |
1162 | 1167 | if ((checkPayments == checkPayments)) | |
1163 | 1168 | then { | |
1164 | 1169 | let cfg = getPoolConfig() | |
1165 | 1170 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1166 | 1171 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1167 | 1172 | if ((currentKLp == currentKLp)) | |
1168 | 1173 | then { | |
1169 | 1174 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1170 | 1175 | if ((unstakeInv == unstakeInv)) | |
1171 | 1176 | then { | |
1172 | 1177 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1173 | 1178 | let outAmAmt = res._1 | |
1174 | 1179 | let outPrAmt = res._2 | |
1175 | 1180 | let poolStatus = parseIntValue(res._9) | |
1176 | 1181 | let state = res._10 | |
1177 | 1182 | let checkPoolStatus = if (if (isGlobalShutdown()) | |
1178 | 1183 | then true | |
1179 | 1184 | else (poolStatus == PoolShutdown)) | |
1180 | 1185 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
1181 | 1186 | else true | |
1182 | 1187 | if ((checkPoolStatus == checkPoolStatus)) | |
1183 | 1188 | then { | |
1184 | 1189 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1185 | 1190 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1186 | 1191 | then { | |
1187 | - | let $ | |
1188 | - | let refreshKLpActions = $ | |
1189 | - | let updatedKLp = $ | |
1192 | + | let $t04533645417 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1193 | + | let refreshKLpActions = $t04533645417._1 | |
1194 | + | let updatedKLp = $t04533645417._2 | |
1190 | 1195 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1191 | 1196 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1192 | 1197 | then (state ++ refreshKLpActions) | |
1193 | 1198 | else throw("Strict value is not equal to itself.") | |
1194 | 1199 | } | |
1195 | 1200 | else throw("Strict value is not equal to itself.") | |
1196 | 1201 | } | |
1197 | 1202 | else throw("Strict value is not equal to itself.") | |
1198 | 1203 | } | |
1199 | 1204 | else throw("Strict value is not equal to itself.") | |
1200 | 1205 | } | |
1201 | 1206 | else throw("Strict value is not equal to itself.") | |
1202 | 1207 | } | |
1203 | 1208 | else throw("Strict value is not equal to itself.") | |
1204 | 1209 | } | |
1205 | 1210 | ||
1206 | 1211 | ||
1207 | 1212 | ||
1208 | 1213 | @Callable(i) | |
1209 | 1214 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1210 | 1215 | let isGetDisabled = if (isGlobalShutdown()) | |
1211 | 1216 | then true | |
1212 | 1217 | else (cfgPoolStatus == PoolShutdown) | |
1213 | 1218 | let checks = [if (!(isGetDisabled)) | |
1214 | 1219 | then true | |
1215 | 1220 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1216 | 1221 | then true | |
1217 | 1222 | else throw("no payments are expected")] | |
1218 | 1223 | if ((checks == checks)) | |
1219 | 1224 | then { | |
1220 | 1225 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1221 | 1226 | if ((currentKLp == currentKLp)) | |
1222 | 1227 | then { | |
1223 | 1228 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1224 | 1229 | if ((unstakeInv == unstakeInv)) | |
1225 | 1230 | then { | |
1226 | 1231 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1227 | 1232 | let outAmAmt = res._1 | |
1228 | 1233 | let outPrAmt = res._2 | |
1229 | 1234 | let state = res._10 | |
1230 | 1235 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1231 | 1236 | then true | |
1232 | 1237 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1233 | 1238 | then true | |
1234 | 1239 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1235 | 1240 | if ((checkAmounts == checkAmounts)) | |
1236 | 1241 | then { | |
1237 | 1242 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1238 | 1243 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1239 | 1244 | then { | |
1240 | - | let $ | |
1241 | - | let refreshKLpActions = $ | |
1242 | - | let updatedKLp = $ | |
1245 | + | let $t04671246793 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1246 | + | let refreshKLpActions = $t04671246793._1 | |
1247 | + | let updatedKLp = $t04671246793._2 | |
1243 | 1248 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1244 | 1249 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1245 | 1250 | then (state ++ refreshKLpActions) | |
1246 | 1251 | else throw("Strict value is not equal to itself.") | |
1247 | 1252 | } | |
1248 | 1253 | else throw("Strict value is not equal to itself.") | |
1249 | 1254 | } | |
1250 | 1255 | else throw("Strict value is not equal to itself.") | |
1251 | 1256 | } | |
1252 | 1257 | else throw("Strict value is not equal to itself.") | |
1253 | 1258 | } | |
1254 | 1259 | else throw("Strict value is not equal to itself.") | |
1255 | 1260 | } | |
1256 | 1261 | else throw("Strict value is not equal to itself.") | |
1257 | 1262 | } | |
1258 | 1263 | ||
1259 | 1264 | ||
1260 | 1265 | ||
1261 | 1266 | @Callable(i) | |
1262 | 1267 | func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract))) | |
1263 | 1268 | then throw("permissions denied") | |
1264 | 1269 | else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success") | |
1265 | 1270 | ||
1266 | 1271 | ||
1267 | 1272 | ||
1268 | 1273 | @Callable(i) | |
1269 | 1274 | func refreshKLp () = { | |
1270 | 1275 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0) | |
1271 | 1276 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay)) | |
1272 | 1277 | then unit | |
1273 | 1278 | else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1274 | 1279 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1275 | 1280 | then { | |
1276 | 1281 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1277 | - | let $ | |
1278 | - | let kLpUpdateActions = $ | |
1279 | - | let updatedKLp = $ | |
1282 | + | let $t04798048044 = refreshKLpInternal(0, 0, 0) | |
1283 | + | let kLpUpdateActions = $t04798048044._1 | |
1284 | + | let updatedKLp = $t04798048044._2 | |
1280 | 1285 | let actions = if ((kLp != updatedKLp)) | |
1281 | 1286 | then kLpUpdateActions | |
1282 | 1287 | else throwErr("nothing to refresh") | |
1283 | 1288 | $Tuple2(actions, toString(updatedKLp)) | |
1284 | 1289 | } | |
1285 | 1290 | else throw("Strict value is not equal to itself.") | |
1286 | 1291 | } | |
1287 | 1292 | ||
1288 | 1293 | ||
1289 | 1294 | ||
1290 | 1295 | @Callable(i) | |
1291 | 1296 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig()) | |
1292 | 1297 | ||
1293 | 1298 | ||
1294 | 1299 | ||
1295 | 1300 | @Callable(i) | |
1296 | 1301 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1297 | 1302 | ||
1298 | 1303 | ||
1299 | 1304 | ||
1300 | 1305 | @Callable(i) | |
1301 | 1306 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1302 | 1307 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
1303 | 1308 | $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])]) | |
1304 | 1309 | } | |
1305 | 1310 | ||
1306 | 1311 | ||
1307 | 1312 | ||
1308 | 1313 | @Callable(i) | |
1309 | 1314 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult))) | |
1310 | 1315 | ||
1311 | 1316 | ||
1312 | 1317 | ||
1313 | 1318 | @Callable(i) | |
1314 | 1319 | func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult)) | |
1315 | 1320 | ||
1316 | 1321 | ||
1317 | 1322 | ||
1318 | 1323 | @Callable(i) | |
1319 | 1324 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1320 | 1325 | ||
1321 | 1326 | ||
1322 | 1327 | ||
1323 | 1328 | @Callable(i) | |
1324 | 1329 | func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp)) | |
1325 | 1330 | ||
1326 | 1331 | ||
1327 | 1332 | ||
1328 | 1333 | @Callable(i) | |
1329 | 1334 | func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
1330 | 1335 | let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress)) | |
1331 | 1336 | $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10)) | |
1332 | 1337 | } | |
1333 | 1338 | ||
1334 | 1339 | ||
1335 | 1340 | ||
1336 | 1341 | @Callable(i) | |
1337 | 1342 | func statsREADONLY () = { | |
1338 | 1343 | let cfg = getPoolConfig() | |
1339 | 1344 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1340 | 1345 | let amtAssetId = cfg[idxAmtAssetId] | |
1341 | 1346 | let priceAssetId = cfg[idxPriceAssetId] | |
1342 | 1347 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
1343 | 1348 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
1344 | 1349 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1345 | 1350 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1346 | 1351 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1347 | 1352 | let accAmtAssetBalance = getAccBalance(amtAssetId) | |
1348 | 1353 | let accPriceAssetBalance = getAccBalance(priceAssetId) | |
1349 | 1354 | let pricesList = if ((poolLPBalance == 0)) | |
1350 | 1355 | then [zeroBigInt, zeroBigInt, zeroBigInt] | |
1351 | 1356 | else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance) | |
1352 | 1357 | let curPrice = 0 | |
1353 | 1358 | let lpAmtAssetShare = fromX18(pricesList[1], scale8) | |
1354 | 1359 | let lpPriceAssetShare = fromX18(pricesList[2], scale8) | |
1355 | 1360 | let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this)))) | |
1356 | 1361 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(accAmtAssetBalance), toString(accPriceAssetBalance), toString(poolLPBalance), toString(curPrice), toString(lpAmtAssetShare), toString(lpPriceAssetShare), toString(poolWeight)], SEP)) | |
1357 | 1362 | } | |
1358 | 1363 | ||
1359 | 1364 | ||
1360 | 1365 | ||
1361 | 1366 | @Callable(i) | |
1362 | 1367 | func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = { | |
1363 | 1368 | let cfg = getPoolConfig() | |
1364 | 1369 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1365 | 1370 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1366 | 1371 | let amAssetId = fromBase58String(amAssetIdStr) | |
1367 | 1372 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1368 | 1373 | let prAssetId = fromBase58String(prAssetIdStr) | |
1369 | 1374 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1370 | 1375 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1371 | 1376 | let poolStatus = cfg[idxPoolStatus] | |
1372 | 1377 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1373 | 1378 | let accAmtAssetBalance = getAccBalance(amAssetIdStr) | |
1374 | 1379 | let accPriceAssetBalance = getAccBalance(prAssetIdStr) | |
1375 | 1380 | let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm) | |
1376 | 1381 | let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm) | |
1377 | 1382 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1378 | 1383 | then zeroBigInt | |
1379 | 1384 | else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
1380 | 1385 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
1381 | 1386 | let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
1382 | 1387 | let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm) | |
1383 | 1388 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1384 | 1389 | let calcLpAmt = estPut._1 | |
1385 | 1390 | let curPriceCalc = estPut._3 | |
1386 | 1391 | let amBalance = estPut._4 | |
1387 | 1392 | let prBalance = estPut._5 | |
1388 | 1393 | let lpEmission = estPut._6 | |
1389 | 1394 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP)) | |
1390 | 1395 | } | |
1391 | 1396 | ||
1392 | 1397 | ||
1393 | 1398 | ||
1394 | 1399 | @Callable(i) | |
1395 | 1400 | func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = { | |
1396 | 1401 | let cfg = getPoolConfig() | |
1397 | 1402 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1398 | 1403 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1399 | 1404 | let amAssetId = fromBase58String(amAssetIdStr) | |
1400 | 1405 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1401 | 1406 | let prAssetId = fromBase58String(prAssetIdStr) | |
1402 | 1407 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1403 | 1408 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1404 | 1409 | let poolStatus = cfg[idxPoolStatus] | |
1405 | 1410 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1406 | 1411 | let amBalanceRaw = getAccBalance(amAssetIdStr) | |
1407 | 1412 | let prBalanceRaw = getAccBalance(prAssetIdStr) | |
1408 | 1413 | let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm) | |
1409 | 1414 | let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm) | |
1410 | 1415 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1411 | 1416 | then zeroBigInt | |
1412 | 1417 | else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18) | |
1413 | 1418 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
1414 | 1419 | let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
1415 | 1420 | let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm) | |
1416 | 1421 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1417 | 1422 | let calcLpAmt = estPut._1 | |
1418 | 1423 | let curPriceCalc = estPut._3 | |
1419 | 1424 | let amBalance = estPut._4 | |
1420 | 1425 | let prBalance = estPut._5 | |
1421 | 1426 | let lpEmission = estPut._6 | |
1422 | 1427 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP)) | |
1423 | 1428 | } | |
1424 | 1429 | ||
1425 | 1430 | ||
1426 | 1431 | ||
1427 | 1432 | @Callable(i) | |
1428 | 1433 | func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = { | |
1429 | 1434 | let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this) | |
1430 | 1435 | let outAmAmt = res._1 | |
1431 | 1436 | let outPrAmt = res._2 | |
1432 | 1437 | let amBalance = res._5 | |
1433 | 1438 | let prBalance = res._6 | |
1434 | 1439 | let lpEmission = res._7 | |
1435 | 1440 | let curPrice = res._8 | |
1436 | 1441 | let poolStatus = parseIntValue(res._9) | |
1437 | 1442 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(outAmAmt), toString(outPrAmt), toString(amBalance), toString(prBalance), toString(lpEmission), toString(curPrice), toString(poolStatus)], SEP)) | |
1438 | 1443 | } | |
1439 | 1444 | ||
1440 | 1445 | ||
1441 | 1446 | @Verifier(tx) | |
1442 | 1447 | func verify () = { | |
1443 | 1448 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1444 | 1449 | case pk: ByteVector => | |
1445 | 1450 | pk | |
1446 | 1451 | case _: Unit => | |
1447 | 1452 | tx.senderPublicKey | |
1448 | 1453 | case _ => | |
1449 | 1454 | throw("Match error") | |
1450 | 1455 | } | |
1451 | 1456 | match tx { | |
1452 | 1457 | case order: Order => | |
1453 | 1458 | let matcherPub = getMatcherPubOrFail() | |
1454 | 1459 | let orderValid = validateMatcherOrderAllowed(order) | |
1455 | 1460 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1456 | 1461 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1457 | 1462 | if (if (if (orderValid) | |
1458 | 1463 | then senderValid | |
1459 | 1464 | else false) | |
1460 | 1465 | then matcherValid | |
1461 | 1466 | else false) | |
1462 | 1467 | then true | |
1463 | 1468 | else throwOrderError(orderValid, senderValid, matcherValid) | |
1464 | 1469 | case s: SetScriptTransaction => | |
1465 | 1470 | let newHash = blake2b256(value(s.script)) | |
1466 | 1471 | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash()))) | |
1467 | 1472 | let currentHash = scriptHash(this) | |
1468 | 1473 | if (if ((allowedHash == newHash)) | |
1469 | 1474 | then (currentHash != newHash) | |
1470 | 1475 | else false) | |
1471 | 1476 | then true | |
1472 | 1477 | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1473 | 1478 | case _ => | |
1474 | 1479 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1475 | 1480 | } | |
1476 | 1481 | } | |
1477 | 1482 |
github/deemru/w8io/026f985 223.24 ms ◑