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