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