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