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