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