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