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