tx · FR5Uc7GJ3s4bdDGrjbHQZ3XAWHTvHWn14WWjqGbYKe2t 3N9yYa7DXfSFLkgzWHmwzTpwd21GUxQApy9: -0.05000000 Waves 2021.08.23 20:35 [1671279] smart account 3N9yYa7DXfSFLkgzWHmwzTpwd21GUxQApy9 > SELF 0.00000000 Waves
{ "type": 13, "id": "FR5Uc7GJ3s4bdDGrjbHQZ3XAWHTvHWn14WWjqGbYKe2t", "fee": 5000000, "feeAssetId": null, "timestamp": 1629740099522, "version": 2, "chainId": 84, "sender": "3N9yYa7DXfSFLkgzWHmwzTpwd21GUxQApy9", "senderPublicKey": "AzWZ4rwReUMi2EBexU5XceFGKPvTcfdkZnygszAEtnYv", "proofs": [ "T4445xoEzQM69vSBKHvkp6LeNFSzHqET4SsXnH5mgi8BqBcdAx9HfqnJyTQSe6oxnqnbihjGacQFn6Aq3bUdgit" ], "script": "base64:AAIFAAAAAAAAABIIAhIDCgEBEgASBwoFCAgICAEAAAA5AAAAAApsUGRlY2ltYWxzAAAAAAAAAAAIAAAAABFkZWNpbWFsc011bHRQcmljZQkAAGgAAAACCQAAaAAAAAIAAAAAAAAAAGQAAAAAAAAAA+gAAAAAAAAAA+gAAAAAA1NFUAIAAAACX18AAAAAClBvb2xBY3RpdmUAAAAAAAAAAAEAAAAAD1Bvb2xQdXREaXNhYmxlZAAAAAAAAAAAAgAAAAATUG9vbE1hdGNoZXJEaXNhYmxlZAAAAAAAAAAAAwAAAAAMUG9vbFNodXRkb3duAAAAAAAAAAAEAAAAAAxidXlPcmRlclR5cGUAAAAAAAAAAAAAAAAADXNlbGxPcmRlclR5cGUAAAAAAAAAAAEAAAAAFGZhY3RvcnlBZGRyZXNzU3RyaW5nAgAAACw2cEprcndmV3loWmptM0xvUVdSampOVmFMdDVDUXpxZmdnelh5cXI3bnJ3QQAAAAAOaWR4UG9vbEFkZHJlc3MAAAAAAAAAAAEAAAAADWlkeFBvb2xTdGF0dXMAAAAAAAAAAAIAAAAAEGlkeFBvb2xMU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QAAABJscEFzc2V0SXNzdWVBY3Rpb24JAARMAAAAAgkBAAAABEJ1cm4AAAACBQAAAAlscEFzc2V0SWQAAAAAAAAAAAEJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAADmtleUFtb3VudEFzc2V0AAAAAAUAAAAOYW1vdW50QXNzZXRTdHIJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAADWtleVByaWNlQXNzZXQAAAAABQAAAA1wcmljZUFzc2V0U3RyBQAAAANuaWwFAAAAEWxwQXNzZXRJZEFzU3RyaW5nAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABU9yZGVyBAAAAAVvcmRlcgUAAAAHJG1hdGNoMAkAAZEAAAACCQEAAAAbdmFsaWRhdGVNYXRjaGVyT3JkZXJBbGxvd2VkAAAAAQUAAAAFb3JkZXIAAAAAAAAAAAEDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE0V4Y2hhbmdlVHJhbnNhY3Rpb24EAAAACmV4Y2hhbmdlVHgFAAAAByRtYXRjaDAJAAGRAAAAAgkBAAAAIHZhbGlkYXRlTWF0Y2hlckV4Y2hhbmdlVHhBbGxvd2VkAAAAAQUAAAAKZXhjaGFuZ2VUeAAAAAAAAAAAAQkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXmd+z/T", "height": 1671279, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AE2c8vYYqRg33kUJx2Xk7piFaLX3XQKVnGyxh8D4XERg Next: 9xPRvbbTLDDkXNugEjxhZhBnMqX6jR9xLWe3DNiYdkec Diff:
Old | New | Differences | |
---|---|---|---|
15 | 15 | ||
16 | 16 | let PoolShutdown = 4 | |
17 | 17 | ||
18 | - | let factoryPublicKey = fromBase58String("6pJkrwfWyhZjm3LoQWRjjNVaLt5CQzqfggzXyqr7nrwA") | |
18 | + | let buyOrderType = 0 | |
19 | + | ||
20 | + | let sellOrderType = 1 | |
21 | + | ||
22 | + | let factoryAddressString = "6pJkrwfWyhZjm3LoQWRjjNVaLt5CQzqfggzXyqr7nrwA" | |
19 | 23 | ||
20 | 24 | let idxPoolAddress = 1 | |
21 | 25 | ||
36 | 40 | let idxPriceAssetInternalId = 9 | |
37 | 41 | ||
38 | 42 | let idxPoolWeight = 10 | |
43 | + | ||
44 | + | let idxLPAssetDecimals = 11 | |
45 | + | ||
46 | + | let idxMatcherPublicKey = 12 | |
47 | + | ||
48 | + | let idmaxAllowedOrderPriceDifferencePct = 13 | |
39 | 49 | ||
40 | 50 | let idxPoolAmountAssetAmt = 1 | |
41 | 51 | ||
61 | 71 | func keyGetActionByUser (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId) | |
62 | 72 | ||
63 | 73 | ||
74 | + | func keyAmountAsset () = "%s_amountAsset" | |
75 | + | ||
76 | + | ||
77 | + | func keyPriceAsset () = "%s_priceAsset" | |
78 | + | ||
79 | + | ||
64 | 80 | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
65 | 81 | ||
66 | 82 | ||
67 | 83 | func keyPoolConfig (amountAssetInternal,priceAssetInternal) = (((("%d%d%s__" + amountAssetInternal) + "__") + priceAssetInternal) + "__config") | |
68 | 84 | ||
69 | 85 | ||
86 | + | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
87 | + | ||
88 | + | ||
89 | + | func keyAllPoolsShutdown () = "%s__shutdown" | |
90 | + | ||
91 | + | ||
92 | + | func isGlobalShutdown () = valueOrElse(getBoolean(value(addressFromString(factoryAddressString)), keyAllPoolsShutdown()), false) | |
93 | + | ||
94 | + | ||
70 | 95 | func getPoolConfig () = { | |
71 | - | let factoryAddress = addressFromPublicKey(factoryPublicKey) | |
72 | - | let currentPoolAssets = split(valueOrErrorMessage(getString(factoryAddress, keyMappingPoolContractAddressToPoolAssets(toString(this))), "No factory config found for pool address."), SEP) | |
73 | - | let currentPoolConfig = split(valueOrErrorMessage(getString(factoryAddress, keyPoolConfig(currentPoolAssets[1], currentPoolAssets[2])), "No factory config found for pool assets."), SEP) | |
74 | - | currentPoolConfig | |
96 | + | let poolAmountAsset = valueOrErrorMessage(getString(keyAmountAsset()), "No config for amount asset found") | |
97 | + | let poolPriceAsset = valueOrErrorMessage(getString(keyPriceAsset()), "No config for price asset found") | |
98 | + | let poolAmountAssetInternal = valueOrErrorMessage(getString(value(addressFromString(factoryAddressString)), keyMappingsBaseAsset2internalId(poolAmountAsset)), "No config for internal amount asset found") | |
99 | + | let poolPriceAssetInternal = valueOrErrorMessage(getString(value(addressFromString(factoryAddressString)), keyMappingsBaseAsset2internalId(poolPriceAsset)), "No config for internal price asset found") | |
100 | + | split(valueOrErrorMessage(getString(addressFromStringValue(factoryAddressString), keyPoolConfig(poolAmountAssetInternal, poolPriceAssetInternal)), "No factory config found for pool assets."), SEP) | |
75 | 101 | } | |
76 | 102 | ||
77 | 103 | ||
94 | 120 | func dataPoolLiquidity (amountAssetLocked,priceAssetLocked,lpTokenLocked) = makeString(["%d%d%d", toString(amountAssetLocked), toString(priceAssetLocked), toString(lpTokenLocked)], SEP) | |
95 | 121 | ||
96 | 122 | ||
97 | - | func dataPutActionInfo (inAmountAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,txHeight,txTimestamp) = makeString(["%d%d%d%d%d%d%d", toString(inAmountAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(txHeight), toString(txTimestamp)], SEP) | |
123 | + | func dataPutActionInfo (inAmountAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,slippageToleranceReal,txHeight,txTimestamp) = makeString(["%d%d%d%d%d%d%d", toString(inAmountAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(slippageToleranceReal), toString(txHeight), toString(txTimestamp)], SEP) | |
98 | 124 | ||
99 | 125 | ||
100 | 126 | func dataGetActionInfo (outAmountAssetAmt,outPriceAssetAmt,inLpAmt,price,txHeight,txTimestamp) = makeString(["%d%d%d%d%d%d", toString(outAmountAssetAmt), toString(outPriceAssetAmt), toString(inLpAmt), toString(price), toString(txHeight), toString(txTimestamp)], SEP) | |
138 | 164 | let poolAmountAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolAmountAssetAmt]) | |
139 | 165 | let poolPriceAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolPriceAssetAmt]) | |
140 | 166 | let poolLPBalance = parseIntValue(poolLiquidityDataList[idxPoolLPAssetAmt]) | |
141 | - | let userLiquidityList = getPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, userAddress) | |
142 | - | let userLPBalance = parseIntValue(userLiquidityList[idxPoolLPAssetAmt]) | |
143 | - | let userAmountAssetBalance = parseIntValue(userLiquidityList[idxPoolAmountAssetAmt]) | |
144 | - | let userPriceAssetBalance = parseIntValue(userLiquidityList[idxPoolPriceAssetAmt]) | |
145 | 167 | let amountAssetPoolLockedAmt = privateCastAssetToLPDecimals(amoutAssetDecimals, poolAmountAssetBalance)._1 | |
146 | 168 | let priceAssetPoolLockedAmt = privateCastAssetToLPDecimals(priceAssetDecimals, poolPriceAssetBalance)._1 | |
147 | 169 | let lpPriceInAmountAsset = fraction(amountAssetPoolLockedAmt, (1 * decimalsMultPrice), poolLPBalance) | |
148 | 170 | let lpPriceInPriceAsset = fraction(priceAssetPoolLockedAmt, (1 * decimalsMultPrice), poolLPBalance) | |
149 | 171 | let currentPrice = privateCalculatePrice(amoutAssetDecimals, priceAssetDecimals, poolAmountAssetBalance, poolPriceAssetBalance) | |
150 | - | [poolAmountAssetBalance, poolPriceAssetBalance, poolLPBalance, currentPrice, lpPriceInAmountAsset, lpPriceInPriceAsset | |
172 | + | [poolAmountAssetBalance, poolPriceAssetBalance, poolLPBalance, currentPrice, lpPriceInAmountAsset, lpPriceInPriceAsset] | |
151 | 173 | } | |
152 | 174 | ||
153 | 175 | ||
160 | 182 | let priceAssetInternalId = poolConfigList[idxPriceAssetInternalId] | |
161 | 183 | let amoutAssetDecimals = parseIntValue(poolConfigList[idxAmountAssetDecimals]) | |
162 | 184 | let priceAssetDecimals = parseIntValue(poolConfigList[idxPriceAssetDecimals]) | |
185 | + | let poolStatus = poolConfigList[idxPoolStatus] | |
163 | 186 | let userLiquidityList = getPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, userAddress) | |
164 | 187 | let userLPBalance = parseIntValue(userLiquidityList[idxPoolLPAssetAmt]) | |
165 | 188 | let userAmountAssetBalance = parseIntValue(userLiquidityList[idxPoolAmountAssetAmt]) | |
180 | 203 | let outAmountAssetAmtFinal = privateCastAssetToOriginDecimals(amoutAssetDecimals, outAmountAssetAmt)._1 | |
181 | 204 | let outPriceAssetAmtFinal = privateCastAssetToOriginDecimals(priceAssetDecimals, outPriceAssetAmt)._1 | |
182 | 205 | let currentPrice = fraction(priceAssetPoolLockedAmt, decimalsMultPrice, amountAssetPoolLockedAmt) | |
183 | - | $Tuple14( | |
206 | + | $Tuple14(outAmountAssetAmtFinal, outPriceAssetAmtFinal, amountAssetInternalId, priceAssetInternalId, userAmountAssetBalance, amountAssetId, userPriceAssetBalance, priceAssetId, userLPBalance, poolAmountAssetBalance, poolPriceAssetBalance, poolLPBalance, currentPrice, poolStatus) | |
184 | 207 | } | |
185 | 208 | } | |
186 | 209 | ||
194 | 217 | let priceAssetInternalId = poolConfigDataList[idxPriceAssetInternalId] | |
195 | 218 | let amoutAssetDecimals = parseIntValue(poolConfigDataList[idxAmountAssetDecimals]) | |
196 | 219 | let priceAssetDecimals = parseIntValue(poolConfigDataList[idxPriceAssetDecimals]) | |
220 | + | let poolStatus = poolConfigDataList[idxPoolStatus] | |
197 | 221 | let poolLiquidityDataList = getPoolLiquidity(amountAssetInternalId, priceAssetInternalId) | |
198 | 222 | let poolAmountAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolAmountAssetAmt]) | |
199 | 223 | let poolPriceAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolPriceAssetAmt]) | |
217 | 241 | let curentPrice = if ((poolLPBalance == 0)) | |
218 | 242 | then 0 | |
219 | 243 | else fraction(priceAssetPoolLockedAmt, decimalsMultPrice, amountAssetPoolLockedAmt) | |
220 | - | let outLpAmount = if ((poolLPBalance == 0)) | |
221 | - | then { | |
222 | - | let partA = pow(inAmountAssetAmtCalculated, 0, 5, 1, 0, DOWN) | |
223 | - | let partB = pow(inPriceAssetAmtCalculated, 0, 5, 1, 0, DOWN) | |
224 | - | (partA * partB) | |
225 | - | } | |
244 | + | let slippage = if ((curentPrice > userPrice)) | |
245 | + | then fraction((curentPrice - userPrice), 100, curentPrice) | |
246 | + | else fraction((userPrice - curentPrice), 100, curentPrice) | |
247 | + | if (if ((curentPrice != 0)) | |
248 | + | then ((slippage * decimalsMultPrice) > slippageTolerance) | |
249 | + | else false) | |
250 | + | then throw(((("Price slippage " + toString(slippage)) + " exceeded the passed limit of ") + toString(slippageTolerance))) | |
226 | 251 | else { | |
227 | - | let slippage = fraction(curentPrice, 100, userPrice) | |
228 | - | if ((slippage > slippageTolerance)) | |
229 | - | then throw(((("Price slippage " + toString(slippage)) + " exceeded the passed limit of ") + toString(slippageTolerance))) | |
252 | + | let outLpAmount = if ((poolLPBalance == 0)) | |
253 | + | then { | |
254 | + | let partA = pow(inAmountAssetAmtCalculated, 0, 5, 1, 0, DOWN) | |
255 | + | let partB = pow(inPriceAssetAmtCalculated, 0, 5, 1, 0, DOWN) | |
256 | + | (partA * partB) | |
257 | + | } | |
230 | 258 | else { | |
231 | 259 | let lpAmtByAmountAsset = fraction(poolLPBalance, inAmountAssetAmtCalculated, amountAssetPoolLockedAmt) | |
232 | 260 | let lpAmtByPriceAsset = fraction(poolLPBalance, inPriceAssetAmtCalculated, priceAssetPoolLockedAmt) | |
234 | 262 | then lpAmtByAmountAsset | |
235 | 263 | else lpAmtByPriceAsset | |
236 | 264 | } | |
265 | + | $Tuple13(outLpAmount, curentPrice, userAmountAssetBalance, userPriceAssetBalance, userLPBalance, poolAmountAssetBalance, poolPriceAssetBalance, poolLPBalance, amountAssetInternalId, priceAssetInternalId, lpAssetId, slippage, poolStatus) | |
237 | 266 | } | |
238 | - | $Tuple11(outLpAmount, curentPrice, userAmountAssetBalance, userPriceAssetBalance, userLPBalance, poolAmountAssetBalance, poolPriceAssetBalance, poolLPBalance, amountAssetInternalId, priceAssetInternalId, lpAssetId) | |
239 | 267 | } | |
268 | + | } | |
269 | + | ||
270 | + | ||
271 | + | func estimatePutOperationBasedOnAmountAsset (slippageTolerance,inAmountAssetAmt,userAddress) = { | |
272 | + | let poolConfigDataList = getPoolConfig() | |
273 | + | let lpAssetId = fromBase58String(poolConfigDataList[idxPoolLPAssetId]) | |
274 | + | let amountAssetId = poolConfigDataList[idxAmountAssetId] | |
275 | + | let priceAssetId = poolConfigDataList[idxPriceAssetId] | |
276 | + | let amountAssetInternalId = poolConfigDataList[idxAmountAssetInternalId] | |
277 | + | let priceAssetInternalId = poolConfigDataList[idxPriceAssetInternalId] | |
278 | + | let amoutAssetDecimals = parseIntValue(poolConfigDataList[idxAmountAssetDecimals]) | |
279 | + | let priceAssetDecimals = parseIntValue(poolConfigDataList[idxPriceAssetDecimals]) | |
280 | + | let poolStatus = poolConfigDataList[idxPoolStatus] | |
281 | + | let poolLiquidityDataList = getPoolLiquidity(amountAssetInternalId, priceAssetInternalId) | |
282 | + | let poolAmountAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolAmountAssetAmt]) | |
283 | + | let poolPriceAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolPriceAssetAmt]) | |
284 | + | let poolLPBalance = parseIntValue(poolLiquidityDataList[idxPoolLPAssetAmt]) | |
285 | + | let amountAssetAmtCalculatedTuple = privateCastAssetToLPDecimals(amoutAssetDecimals, poolAmountAssetBalance) | |
286 | + | let priceAssetAmtCalculatedTuple = privateCastAssetToLPDecimals(priceAssetDecimals, poolPriceAssetBalance) | |
287 | + | let curentPrice = if ((poolLPBalance == 0)) | |
288 | + | then 0 | |
289 | + | else fraction(priceAssetAmtCalculatedTuple._1, decimalsMultPrice, amountAssetAmtCalculatedTuple._1) | |
290 | + | let inPriceAssetAmtCalculated = (amountAssetAmtCalculatedTuple._2 * curentPrice) | |
291 | + | let inPriceAssetAmt = privateCastAssetToOriginDecimals(amoutAssetDecimals, inPriceAssetAmtCalculated)._1 | |
292 | + | privateEstimatePutOperation(slippageTolerance, inAmountAssetAmt, amountAssetId, inPriceAssetAmt, priceAssetId, userAddress) | |
293 | + | } | |
294 | + | ||
295 | + | ||
296 | + | func estimatePutOperationBasedOnPriceAsset (slippageTolerance,inPriceAssetAmt,userAddress) = { | |
297 | + | let poolConfigDataList = getPoolConfig() | |
298 | + | let lpAssetId = fromBase58String(poolConfigDataList[idxPoolLPAssetId]) | |
299 | + | let amountAssetId = poolConfigDataList[idxAmountAssetId] | |
300 | + | let priceAssetId = poolConfigDataList[idxPriceAssetId] | |
301 | + | let amountAssetInternalId = poolConfigDataList[idxAmountAssetInternalId] | |
302 | + | let priceAssetInternalId = poolConfigDataList[idxPriceAssetInternalId] | |
303 | + | let amoutAssetDecimals = parseIntValue(poolConfigDataList[idxAmountAssetDecimals]) | |
304 | + | let priceAssetDecimals = parseIntValue(poolConfigDataList[idxPriceAssetDecimals]) | |
305 | + | let poolStatus = poolConfigDataList[idxPoolStatus] | |
306 | + | let poolLiquidityDataList = getPoolLiquidity(amountAssetInternalId, priceAssetInternalId) | |
307 | + | let poolAmountAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolAmountAssetAmt]) | |
308 | + | let poolPriceAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolPriceAssetAmt]) | |
309 | + | let poolLPBalance = parseIntValue(poolLiquidityDataList[idxPoolLPAssetAmt]) | |
310 | + | let amountAssetAmtCalculatedTuple = privateCastAssetToLPDecimals(amoutAssetDecimals, poolAmountAssetBalance) | |
311 | + | let priceAssetAmtCalculatedTuple = privateCastAssetToLPDecimals(priceAssetDecimals, poolPriceAssetBalance) | |
312 | + | let curentPrice = if ((poolLPBalance == 0)) | |
313 | + | then 0 | |
314 | + | else fraction(priceAssetAmtCalculatedTuple._1, decimalsMultPrice, amountAssetAmtCalculatedTuple._1) | |
315 | + | let inAmountAssetAmtCalculated = (amountAssetAmtCalculatedTuple._2 / curentPrice) | |
316 | + | let inAmountAssetAmt = privateCastAssetToOriginDecimals(amoutAssetDecimals, inAmountAssetAmtCalculated)._1 | |
317 | + | privateEstimatePutOperation(slippageTolerance, inAmountAssetAmt, amountAssetId, inPriceAssetAmt, priceAssetId, userAddress) | |
318 | + | } | |
319 | + | ||
320 | + | ||
321 | + | func validateMatcherOrderAllowed (order) = { | |
322 | + | let poolConfigDataList = getPoolConfig() | |
323 | + | let amountAssetId = poolConfigDataList[idxAmountAssetId] | |
324 | + | let priceAssetId = poolConfigDataList[idxPriceAssetId] | |
325 | + | let poolStatus = parseIntValue(poolConfigDataList[idxPoolStatus]) | |
326 | + | let matcherPublicKeyStr = poolConfigDataList[idxMatcherPublicKey] | |
327 | + | let amountAssetInternalId = poolConfigDataList[idxAmountAssetInternalId] | |
328 | + | let priceAssetInternalId = poolConfigDataList[idxPriceAssetInternalId] | |
329 | + | let amountAssetDecimals = parseIntValue(poolConfigDataList[idxAmountAssetDecimals]) | |
330 | + | let priceAssetDecimals = parseIntValue(poolConfigDataList[idxPriceAssetDecimals]) | |
331 | + | let maxAllowedOrderPriceDifferencePct = parseIntValue(poolConfigDataList[idmaxAllowedOrderPriceDifferencePct]) | |
332 | + | let poolLiquidityDataList = getPoolLiquidity(amountAssetInternalId, priceAssetInternalId) | |
333 | + | let poolAmountAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolAmountAssetAmt]) | |
334 | + | let poolPriceAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolPriceAssetAmt]) | |
335 | + | let currentPrice = privateCalculatePrice(amountAssetDecimals, priceAssetDecimals, poolAmountAssetBalance, poolPriceAssetBalance) | |
336 | + | let isPoolStatusValid = if (if (if (isGlobalShutdown()) | |
337 | + | then true | |
338 | + | else (poolStatus == PoolMatcherDisabled)) | |
339 | + | then true | |
340 | + | else (poolStatus == PoolShutdown)) | |
341 | + | then false | |
342 | + | else true | |
343 | + | let isValidMatcherSign = sigVerify(order.bodyBytes, order.proofs[0], fromBase58String(matcherPublicKeyStr)) | |
344 | + | let orderAmountAsset = order.assetPair.amountAsset | |
345 | + | let orderAmountAssetStr = if ((orderAmountAsset == unit)) | |
346 | + | then "" | |
347 | + | else toBase58String(value(orderAmountAsset)) | |
348 | + | let orderPriceAsset = order.assetPair.priceAsset | |
349 | + | let orderPriceAssetStr = if ((orderPriceAsset == unit)) | |
350 | + | then "" | |
351 | + | else toBase58String(value(orderPriceAsset)) | |
352 | + | let isValidAssetPair = if (if ((orderAmountAssetStr != amountAssetId)) | |
353 | + | then true | |
354 | + | else (orderPriceAssetStr != priceAssetId)) | |
355 | + | then false | |
356 | + | else true | |
357 | + | let orderPrice = order.price | |
358 | + | let priceDecimals = ((8 + priceAssetDecimals) - amountAssetDecimals) | |
359 | + | let castedOrderPrice = privateCastAssetToLPDecimals(priceDecimals, orderPrice) | |
360 | + | let difference = if ((castedOrderPrice._1 > currentPrice)) | |
361 | + | then fraction((castedOrderPrice._1 - currentPrice), 100, currentPrice) | |
362 | + | else fraction((currentPrice - castedOrderPrice._1), 100, currentPrice) | |
363 | + | let isOrderPriceValid = (maxAllowedOrderPriceDifferencePct >= (difference * decimalsMultPrice)) | |
364 | + | [if (if (if (isValidAssetPair) | |
365 | + | then isValidMatcherSign | |
366 | + | else false) | |
367 | + | then isPoolStatusValid | |
368 | + | else false) | |
369 | + | then isOrderPriceValid | |
370 | + | else false] | |
371 | + | } | |
372 | + | ||
373 | + | ||
374 | + | func validateMatcherExchangeTxAllowed (ex) = { | |
375 | + | let poolConfigDataList = getPoolConfig() | |
376 | + | let amountAssetId = poolConfigDataList[idxAmountAssetId] | |
377 | + | let priceAssetId = poolConfigDataList[idxPriceAssetId] | |
378 | + | let poolStatus = parseIntValue(poolConfigDataList[idxPoolStatus]) | |
379 | + | let matcherPublicKeyStr = poolConfigDataList[idxMatcherPublicKey] | |
380 | + | let isPoolStatusValid = if (if (if (isGlobalShutdown()) | |
381 | + | then true | |
382 | + | else (poolStatus == PoolMatcherDisabled)) | |
383 | + | then true | |
384 | + | else (poolStatus == PoolShutdown)) | |
385 | + | then false | |
386 | + | else true | |
387 | + | let isValidMatcherSign = sigVerify(ex.bodyBytes, ex.proofs[0], fromBase58String(matcherPublicKeyStr)) | |
388 | + | let exchangeAmountAsset = ex.buyOrder.assetPair.amountAsset | |
389 | + | let exchangeAmountAssetStr = if ((exchangeAmountAsset == unit)) | |
390 | + | then "" | |
391 | + | else toBase58String(value(exchangeAmountAsset)) | |
392 | + | let exchangePriceAsset = ex.buyOrder.assetPair.priceAsset | |
393 | + | let exchangePriceAssetStr = if ((exchangePriceAsset == unit)) | |
394 | + | then "" | |
395 | + | else toBase58String(value(exchangePriceAsset)) | |
396 | + | let isValidAssetPair = if (if ((exchangeAmountAssetStr != amountAssetId)) | |
397 | + | then true | |
398 | + | else (exchangePriceAssetStr != priceAssetId)) | |
399 | + | then false | |
400 | + | else true | |
401 | + | let orderAmountAssetAmt = toBigInt(ex.amount) | |
402 | + | let executedOrderType = if ((ex.buyOrder.sender == this)) | |
403 | + | then buyOrderType | |
404 | + | else sellOrderType | |
405 | + | let orderPriceAssetAmt = fraction(orderAmountAssetAmt, toBigInt(ex.price), toBigInt(decimalsMultPrice)) | |
406 | + | let currentAmountAssetBalance = if ((amountAssetId == "")) | |
407 | + | then value(wavesBalance(this)).available | |
408 | + | else value(assetBalance(this, fromBase58String(amountAssetId))) | |
409 | + | let currentPriceAssetBalance = if ((priceAssetId == "")) | |
410 | + | then value(wavesBalance(this)).available | |
411 | + | else value(assetBalance(this, fromBase58String(priceAssetId))) | |
412 | + | let currentK = fraction(toBigInt(currentAmountAssetBalance), toBigInt(currentPriceAssetBalance), toBigInt(decimalsMultPrice)) | |
413 | + | let calculatedKAfterTransaction = if ((executedOrderType == buyOrderType)) | |
414 | + | then fraction((toBigInt(currentAmountAssetBalance) + orderAmountAssetAmt), (toBigInt(currentPriceAssetBalance) - orderPriceAssetAmt), toBigInt(decimalsMultPrice)) | |
415 | + | else fraction((toBigInt(currentAmountAssetBalance) - orderAmountAssetAmt), (toBigInt(currentPriceAssetBalance) + orderPriceAssetAmt), toBigInt(decimalsMultPrice)) | |
416 | + | let isKIncreasing = (calculatedKAfterTransaction > currentK) | |
417 | + | [if (if (if (isValidAssetPair) | |
418 | + | then isKIncreasing | |
419 | + | else false) | |
420 | + | then isValidMatcherSign | |
421 | + | else false) | |
422 | + | then isPoolStatusValid | |
423 | + | else false] | |
240 | 424 | } | |
241 | 425 | ||
242 | 426 | ||
262 | 446 | let amountAssetInternalId = estimatedPutResults._9 | |
263 | 447 | let priceAssetInternalId = estimatedPutResults._10 | |
264 | 448 | let lpAssetId = estimatedPutResults._11 | |
265 | - | [StringEntry(keyPriceLast(), ("%s__" + toString(curentPrice))), StringEntry(keyPriceHistory(height, lastBlock.timestamp), ("%s__" + toString(curentPrice))), StringEntry(keyPutActionByUser(toString(i.caller), toBase58String(i.transactionId)), dataPutActionInfo(inAmountAssetAmt, inPriceAssetAmt, outLpAmount, curentPrice, slippageTolerance, height, lastBlock.timestamp)), StringEntry(keyPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, toString(i.caller)), dataPoolLiquidity((userAmountAssetBalance + inAmountAssetAmt), (userPriceAssetBalance + inPriceAssetAmt), (userLPBalance + outLpAmount))), StringEntry(keyPoolLiquidity(amountAssetInternalId, priceAssetInternalId), dataPoolLiquidity((poolAmountAssetBalance + inAmountAssetAmt), (poolPriceAssetBalance + inPriceAssetAmt), (poolLPBalance + outLpAmount))), Reissue(lpAssetId, outLpAmount, true), ScriptTransfer(i.caller, outLpAmount, lpAssetId)] | |
449 | + | let slippageCalculated = estimatedPutResults._12 | |
450 | + | let poolStatus = parseIntValue(estimatedPutResults._13) | |
451 | + | if (if (if (isGlobalShutdown()) | |
452 | + | then true | |
453 | + | else (poolStatus == PoolPutDisabled)) | |
454 | + | then true | |
455 | + | else (poolStatus == PoolShutdown)) | |
456 | + | then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus))) | |
457 | + | else [StringEntry(keyPriceLast(), ("%s__" + toString(curentPrice))), StringEntry(keyPriceHistory(height, lastBlock.timestamp), ("%s__" + toString(curentPrice))), StringEntry(keyPutActionByUser(toString(i.caller), toBase58String(i.transactionId)), dataPutActionInfo(inAmountAssetAmt, inPriceAssetAmt, outLpAmount, curentPrice, slippageTolerance, slippageCalculated, height, lastBlock.timestamp)), StringEntry(keyPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, toString(i.caller)), dataPoolLiquidity((userAmountAssetBalance + inAmountAssetAmt), (userPriceAssetBalance + inPriceAssetAmt), (userLPBalance + outLpAmount))), StringEntry(keyPoolLiquidity(amountAssetInternalId, priceAssetInternalId), dataPoolLiquidity((poolAmountAssetBalance + inAmountAssetAmt), (poolPriceAssetBalance + inPriceAssetAmt), (poolLPBalance + outLpAmount))), Reissue(lpAssetId, outLpAmount, true), ScriptTransfer(i.caller, outLpAmount, lpAssetId)] | |
266 | 458 | } | |
267 | 459 | ||
268 | 460 | ||
273 | 465 | let pmtAssetId = value(pmtAmountAsset.assetId) | |
274 | 466 | let pmtAssetAmount = pmtAmountAsset.amount | |
275 | 467 | let results = privateEstimateGetOperation(toBase58String(pmtAssetId), pmtAssetAmount, toString(i.caller)) | |
276 | - | let | |
277 | - | let | |
468 | + | let outAmountAssetAmt = results._1 | |
469 | + | let outPriceAssetAmt = results._2 | |
278 | 470 | let amountAssetInternalId = results._3 | |
279 | 471 | let priceAssetInternalId = results._4 | |
280 | 472 | let userAmountAssetBalance = results._5 | |
281 | - | let | |
473 | + | let amountAssetId = results._6 | |
282 | 474 | let userPriceAssetBalance = results._7 | |
283 | - | let | |
475 | + | let priceAssetId = results._8 | |
284 | 476 | let userLPBalance = results._9 | |
285 | - | let poolAmountAssetBalance = results._11 | |
286 | - | let poolPriceAssetBalance = results._12 | |
287 | - | let poolLPBalance = results._13 | |
288 | - | let currentPrice = results._14 | |
289 | - | [Burn(pmtAssetId, pmtAssetAmount), ScriptTransfer(i.caller, outAmountAssetAmt, if ((amountAssetId == "")) | |
290 | - | then unit | |
291 | - | else fromBase58String(amountAssetId)), ScriptTransfer(i.caller, outPriceAssetAmt, fromBase58String(priceAssetId)), StringEntry(keyPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, toString(i.caller)), dataPoolLiquidity((userAmountAssetBalance - outAmountAssetAmt), (userPriceAssetBalance - outPriceAssetAmt), (userLPBalance - pmtAssetAmount))), StringEntry(keyPoolLiquidity(amountAssetInternalId, priceAssetInternalId), dataPoolLiquidity((poolAmountAssetBalance - outAmountAssetAmt), (poolPriceAssetBalance - outPriceAssetAmt), (poolLPBalance - pmtAssetAmount))), StringEntry(keyGetActionByUser(toString(i.caller), toBase58String(i.transactionId)), dataGetActionInfo(outAmountAssetAmt, outPriceAssetAmt, pmtAssetAmount, currentPrice, height, lastBlock.timestamp)), StringEntry(keyPriceLast(), ("%s__" + toString(currentPrice))), StringEntry(keyPriceHistory(height, lastBlock.timestamp), ("%s__" + toString(currentPrice)))] | |
477 | + | let poolAmountAssetBalance = results._10 | |
478 | + | let poolPriceAssetBalance = results._11 | |
479 | + | let poolLPBalance = results._12 | |
480 | + | let currentPrice = results._13 | |
481 | + | let poolStatus = parseIntValue(results._14) | |
482 | + | if (if (isGlobalShutdown()) | |
483 | + | then true | |
484 | + | else (poolStatus == PoolShutdown)) | |
485 | + | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
486 | + | else [Burn(pmtAssetId, pmtAssetAmount), ScriptTransfer(i.caller, outAmountAssetAmt, if ((amountAssetId == "")) | |
487 | + | then unit | |
488 | + | else fromBase58String(amountAssetId)), ScriptTransfer(i.caller, outPriceAssetAmt, fromBase58String(priceAssetId)), StringEntry(keyPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, toString(i.caller)), dataPoolLiquidity((userAmountAssetBalance - outAmountAssetAmt), (userPriceAssetBalance - outPriceAssetAmt), (userLPBalance - pmtAssetAmount))), StringEntry(keyPoolLiquidity(amountAssetInternalId, priceAssetInternalId), dataPoolLiquidity((poolAmountAssetBalance - outAmountAssetAmt), (poolPriceAssetBalance - outPriceAssetAmt), (poolLPBalance - pmtAssetAmount))), StringEntry(keyGetActionByUser(toString(i.caller), toBase58String(i.transactionId)), dataGetActionInfo(outAmountAssetAmt, outPriceAssetAmt, pmtAssetAmount, currentPrice, height, lastBlock.timestamp)), StringEntry(keyPriceLast(), ("%s__" + toString(currentPrice))), StringEntry(keyPriceHistory(height, lastBlock.timestamp), ("%s__" + toString(currentPrice)))] | |
292 | 489 | } | |
293 | 490 | ||
294 | 491 | ||
295 | 492 | ||
296 | 493 | @Callable(i) | |
297 | - | func activate (amountAssetStr,priceAssetStr,lpAssetName,lpAssetDescr,poolWeight) = if ((i. | |
494 | + | func activate (amountAssetStr,priceAssetStr,lpAssetName,lpAssetDescr,poolWeight) = if ((toString(i.caller) != factoryAddressString)) | |
298 | 495 | then throw("permissions denied") | |
299 | 496 | else { | |
300 | 497 | let amountAssetId = fromBase58String(amountAssetStr) | |
304 | 501 | let lpAssetIssueAction = Issue(lpAssetName, lpAssetDescr, 1, 8, true) | |
305 | 502 | let lpAssetId = calculateAssetId(lpAssetIssueAction) | |
306 | 503 | let lpAssetIdAsString = toBase58String(lpAssetId) | |
307 | - | $Tuple2([lpAssetIssueAction, Burn(lpAssetId, 1)], lpAssetIdAsString) | |
504 | + | $Tuple2([lpAssetIssueAction, Burn(lpAssetId, 1), StringEntry(keyAmountAsset(), amountAssetStr), StringEntry(keyPriceAsset(), priceAssetStr)], lpAssetIdAsString) | |
308 | 505 | } | |
309 | 506 | ||
310 | 507 | ||
311 | - | ||
312 | - | @Callable(i) | |
313 | - | func manage (status) = nil | |
314 | - | ||
315 | - | ||
316 | 508 | @Verifier(tx) | |
317 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
509 | + | func verify () = match tx { | |
510 | + | case order: Order => | |
511 | + | validateMatcherOrderAllowed(order)[1] | |
512 | + | case exchangeTx: ExchangeTransaction => | |
513 | + | validateMatcherExchangeTxAllowed(exchangeTx)[1] | |
514 | + | case _ => | |
515 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
516 | + | } | |
318 | 517 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let lPdecimals = 8 | |
5 | 5 | ||
6 | 6 | let decimalsMultPrice = ((100 * 1000) * 1000) | |
7 | 7 | ||
8 | 8 | let SEP = "__" | |
9 | 9 | ||
10 | 10 | let PoolActive = 1 | |
11 | 11 | ||
12 | 12 | let PoolPutDisabled = 2 | |
13 | 13 | ||
14 | 14 | let PoolMatcherDisabled = 3 | |
15 | 15 | ||
16 | 16 | let PoolShutdown = 4 | |
17 | 17 | ||
18 | - | let factoryPublicKey = fromBase58String("6pJkrwfWyhZjm3LoQWRjjNVaLt5CQzqfggzXyqr7nrwA") | |
18 | + | let buyOrderType = 0 | |
19 | + | ||
20 | + | let sellOrderType = 1 | |
21 | + | ||
22 | + | let factoryAddressString = "6pJkrwfWyhZjm3LoQWRjjNVaLt5CQzqfggzXyqr7nrwA" | |
19 | 23 | ||
20 | 24 | let idxPoolAddress = 1 | |
21 | 25 | ||
22 | 26 | let idxPoolStatus = 2 | |
23 | 27 | ||
24 | 28 | let idxPoolLPAssetId = 3 | |
25 | 29 | ||
26 | 30 | let idxAmountAssetId = 4 | |
27 | 31 | ||
28 | 32 | let idxPriceAssetId = 5 | |
29 | 33 | ||
30 | 34 | let idxAmountAssetDecimals = 6 | |
31 | 35 | ||
32 | 36 | let idxPriceAssetDecimals = 7 | |
33 | 37 | ||
34 | 38 | let idxAmountAssetInternalId = 8 | |
35 | 39 | ||
36 | 40 | let idxPriceAssetInternalId = 9 | |
37 | 41 | ||
38 | 42 | let idxPoolWeight = 10 | |
43 | + | ||
44 | + | let idxLPAssetDecimals = 11 | |
45 | + | ||
46 | + | let idxMatcherPublicKey = 12 | |
47 | + | ||
48 | + | let idmaxAllowedOrderPriceDifferencePct = 13 | |
39 | 49 | ||
40 | 50 | let idxPoolAmountAssetAmt = 1 | |
41 | 51 | ||
42 | 52 | let idxPoolPriceAssetAmt = 2 | |
43 | 53 | ||
44 | 54 | let idxPoolLPAssetAmt = 3 | |
45 | 55 | ||
46 | 56 | func keyPriceLast () = "%s%s__price__last" | |
47 | 57 | ||
48 | 58 | ||
49 | 59 | func keyPriceHistory (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP) | |
50 | 60 | ||
51 | 61 | ||
52 | 62 | func keyPoolLiquidity (internalAmountAsset,internalPriceAsset) = (((("%d%d%s__" + internalAmountAsset) + "__") + internalPriceAsset) + "__locked") | |
53 | 63 | ||
54 | 64 | ||
55 | 65 | func keyPoolLiquidityByUser (internalAmountAsset,internalPriceAsset,userAddress) = (((((("%d%d%s%s__" + internalAmountAsset) + "__") + internalPriceAsset) + "__") + userAddress) + "__locked") | |
56 | 66 | ||
57 | 67 | ||
58 | 68 | func keyPutActionByUser (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId) | |
59 | 69 | ||
60 | 70 | ||
61 | 71 | func keyGetActionByUser (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId) | |
62 | 72 | ||
63 | 73 | ||
74 | + | func keyAmountAsset () = "%s_amountAsset" | |
75 | + | ||
76 | + | ||
77 | + | func keyPriceAsset () = "%s_priceAsset" | |
78 | + | ||
79 | + | ||
64 | 80 | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
65 | 81 | ||
66 | 82 | ||
67 | 83 | func keyPoolConfig (amountAssetInternal,priceAssetInternal) = (((("%d%d%s__" + amountAssetInternal) + "__") + priceAssetInternal) + "__config") | |
68 | 84 | ||
69 | 85 | ||
86 | + | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
87 | + | ||
88 | + | ||
89 | + | func keyAllPoolsShutdown () = "%s__shutdown" | |
90 | + | ||
91 | + | ||
92 | + | func isGlobalShutdown () = valueOrElse(getBoolean(value(addressFromString(factoryAddressString)), keyAllPoolsShutdown()), false) | |
93 | + | ||
94 | + | ||
70 | 95 | func getPoolConfig () = { | |
71 | - | let factoryAddress = addressFromPublicKey(factoryPublicKey) | |
72 | - | let currentPoolAssets = split(valueOrErrorMessage(getString(factoryAddress, keyMappingPoolContractAddressToPoolAssets(toString(this))), "No factory config found for pool address."), SEP) | |
73 | - | let currentPoolConfig = split(valueOrErrorMessage(getString(factoryAddress, keyPoolConfig(currentPoolAssets[1], currentPoolAssets[2])), "No factory config found for pool assets."), SEP) | |
74 | - | currentPoolConfig | |
96 | + | let poolAmountAsset = valueOrErrorMessage(getString(keyAmountAsset()), "No config for amount asset found") | |
97 | + | let poolPriceAsset = valueOrErrorMessage(getString(keyPriceAsset()), "No config for price asset found") | |
98 | + | let poolAmountAssetInternal = valueOrErrorMessage(getString(value(addressFromString(factoryAddressString)), keyMappingsBaseAsset2internalId(poolAmountAsset)), "No config for internal amount asset found") | |
99 | + | let poolPriceAssetInternal = valueOrErrorMessage(getString(value(addressFromString(factoryAddressString)), keyMappingsBaseAsset2internalId(poolPriceAsset)), "No config for internal price asset found") | |
100 | + | split(valueOrErrorMessage(getString(addressFromStringValue(factoryAddressString), keyPoolConfig(poolAmountAssetInternal, poolPriceAssetInternal)), "No factory config found for pool assets."), SEP) | |
75 | 101 | } | |
76 | 102 | ||
77 | 103 | ||
78 | 104 | func getPoolLiquidity (amountAssetInternalId,priceAssetInternalId) = { | |
79 | 105 | let currentPoolLiquidityValue = getString(keyPoolLiquidity(amountAssetInternalId, priceAssetInternalId)) | |
80 | 106 | if (!(isDefined(currentPoolLiquidityValue))) | |
81 | 107 | then ["", "0", "0", "0"] | |
82 | 108 | else split(value(currentPoolLiquidityValue), SEP) | |
83 | 109 | } | |
84 | 110 | ||
85 | 111 | ||
86 | 112 | func getPoolLiquidityByUser (amountAssetInternalId,priceAssetInternalId,userAddress) = { | |
87 | 113 | let currentPoolLiquidityValue = getString(keyPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, userAddress)) | |
88 | 114 | if (!(isDefined(currentPoolLiquidityValue))) | |
89 | 115 | then ["", "0", "0", "0", "0"] | |
90 | 116 | else split(value(currentPoolLiquidityValue), SEP) | |
91 | 117 | } | |
92 | 118 | ||
93 | 119 | ||
94 | 120 | func dataPoolLiquidity (amountAssetLocked,priceAssetLocked,lpTokenLocked) = makeString(["%d%d%d", toString(amountAssetLocked), toString(priceAssetLocked), toString(lpTokenLocked)], SEP) | |
95 | 121 | ||
96 | 122 | ||
97 | - | func dataPutActionInfo (inAmountAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,txHeight,txTimestamp) = makeString(["%d%d%d%d%d%d%d", toString(inAmountAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(txHeight), toString(txTimestamp)], SEP) | |
123 | + | func dataPutActionInfo (inAmountAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,slippageToleranceReal,txHeight,txTimestamp) = makeString(["%d%d%d%d%d%d%d", toString(inAmountAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(slippageToleranceReal), toString(txHeight), toString(txTimestamp)], SEP) | |
98 | 124 | ||
99 | 125 | ||
100 | 126 | func dataGetActionInfo (outAmountAssetAmt,outPriceAssetAmt,inLpAmt,price,txHeight,txTimestamp) = makeString(["%d%d%d%d%d%d", toString(outAmountAssetAmt), toString(outPriceAssetAmt), toString(inLpAmt), toString(price), toString(txHeight), toString(txTimestamp)], SEP) | |
101 | 127 | ||
102 | 128 | ||
103 | 129 | func dataPoolLiquidityByUser (amountAssetLocked,priceAssetLocked,lpTokenLocked,userAddress) = makeString(["%d%d%d", toString(amountAssetLocked), toString(priceAssetLocked), toString(lpTokenLocked)], SEP) | |
104 | 130 | ||
105 | 131 | ||
106 | 132 | func getScriptHash () = toBase64String(value(scriptHash(this))) | |
107 | 133 | ||
108 | 134 | ||
109 | 135 | func privateCastAssetToLPDecimals (assetDecimals,assetAmount) = { | |
110 | 136 | let decimalsMult = pow(10, 0, (lPdecimals - assetDecimals), 0, 0, DOWN) | |
111 | 137 | $Tuple2((assetAmount * decimalsMult), decimalsMult) | |
112 | 138 | } | |
113 | 139 | ||
114 | 140 | ||
115 | 141 | func privateCastAssetToOriginDecimals (assetDecimals,assetAmount) = { | |
116 | 142 | let decimalsMult = pow(10, 0, (lPdecimals - assetDecimals), 0, 0, DOWN) | |
117 | 143 | $Tuple2((assetAmount / decimalsMult), decimalsMult) | |
118 | 144 | } | |
119 | 145 | ||
120 | 146 | ||
121 | 147 | func privateCalculatePrice (amoutAssetDecimals,priceAssetDecimals,amountAssetAmt,priceAssetAmt) = { | |
122 | 148 | let amountAssetPoolLockedAmt = privateCastAssetToLPDecimals(amoutAssetDecimals, amountAssetAmt)._1 | |
123 | 149 | let priceAssetPoolLockedAmt = privateCastAssetToLPDecimals(priceAssetDecimals, priceAssetAmt)._1 | |
124 | 150 | fraction(priceAssetPoolLockedAmt, decimalsMultPrice, amountAssetPoolLockedAmt) | |
125 | 151 | } | |
126 | 152 | ||
127 | 153 | ||
128 | 154 | func privateGetPoolStatistics (userAddress) = { | |
129 | 155 | let poolConfigDataList = getPoolConfig() | |
130 | 156 | let lpAssetId = fromBase58String(poolConfigDataList[idxPoolLPAssetId]) | |
131 | 157 | let amountAssetId = poolConfigDataList[idxAmountAssetId] | |
132 | 158 | let priceAssetId = poolConfigDataList[idxPriceAssetId] | |
133 | 159 | let amountAssetInternalId = poolConfigDataList[idxAmountAssetInternalId] | |
134 | 160 | let priceAssetInternalId = poolConfigDataList[idxPriceAssetInternalId] | |
135 | 161 | let amoutAssetDecimals = parseIntValue(poolConfigDataList[idxAmountAssetDecimals]) | |
136 | 162 | let priceAssetDecimals = parseIntValue(poolConfigDataList[idxPriceAssetDecimals]) | |
137 | 163 | let poolLiquidityDataList = getPoolLiquidity(amountAssetInternalId, priceAssetInternalId) | |
138 | 164 | let poolAmountAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolAmountAssetAmt]) | |
139 | 165 | let poolPriceAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolPriceAssetAmt]) | |
140 | 166 | let poolLPBalance = parseIntValue(poolLiquidityDataList[idxPoolLPAssetAmt]) | |
141 | - | let userLiquidityList = getPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, userAddress) | |
142 | - | let userLPBalance = parseIntValue(userLiquidityList[idxPoolLPAssetAmt]) | |
143 | - | let userAmountAssetBalance = parseIntValue(userLiquidityList[idxPoolAmountAssetAmt]) | |
144 | - | let userPriceAssetBalance = parseIntValue(userLiquidityList[idxPoolPriceAssetAmt]) | |
145 | 167 | let amountAssetPoolLockedAmt = privateCastAssetToLPDecimals(amoutAssetDecimals, poolAmountAssetBalance)._1 | |
146 | 168 | let priceAssetPoolLockedAmt = privateCastAssetToLPDecimals(priceAssetDecimals, poolPriceAssetBalance)._1 | |
147 | 169 | let lpPriceInAmountAsset = fraction(amountAssetPoolLockedAmt, (1 * decimalsMultPrice), poolLPBalance) | |
148 | 170 | let lpPriceInPriceAsset = fraction(priceAssetPoolLockedAmt, (1 * decimalsMultPrice), poolLPBalance) | |
149 | 171 | let currentPrice = privateCalculatePrice(amoutAssetDecimals, priceAssetDecimals, poolAmountAssetBalance, poolPriceAssetBalance) | |
150 | - | [poolAmountAssetBalance, poolPriceAssetBalance, poolLPBalance, currentPrice, lpPriceInAmountAsset, lpPriceInPriceAsset | |
172 | + | [poolAmountAssetBalance, poolPriceAssetBalance, poolLPBalance, currentPrice, lpPriceInAmountAsset, lpPriceInPriceAsset] | |
151 | 173 | } | |
152 | 174 | ||
153 | 175 | ||
154 | 176 | func privateEstimateGetOperation (paymentLpAssetId,paymentLpAmount,userAddress) = { | |
155 | 177 | let poolConfigList = getPoolConfig() | |
156 | 178 | let lpAssetId = poolConfigList[idxPoolLPAssetId] | |
157 | 179 | let amountAssetId = poolConfigList[idxAmountAssetId] | |
158 | 180 | let priceAssetId = poolConfigList[idxPriceAssetId] | |
159 | 181 | let amountAssetInternalId = poolConfigList[idxAmountAssetInternalId] | |
160 | 182 | let priceAssetInternalId = poolConfigList[idxPriceAssetInternalId] | |
161 | 183 | let amoutAssetDecimals = parseIntValue(poolConfigList[idxAmountAssetDecimals]) | |
162 | 184 | let priceAssetDecimals = parseIntValue(poolConfigList[idxPriceAssetDecimals]) | |
185 | + | let poolStatus = poolConfigList[idxPoolStatus] | |
163 | 186 | let userLiquidityList = getPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, userAddress) | |
164 | 187 | let userLPBalance = parseIntValue(userLiquidityList[idxPoolLPAssetAmt]) | |
165 | 188 | let userAmountAssetBalance = parseIntValue(userLiquidityList[idxPoolAmountAssetAmt]) | |
166 | 189 | let userPriceAssetBalance = parseIntValue(userLiquidityList[idxPoolPriceAssetAmt]) | |
167 | 190 | let poolLiquidityList = getPoolLiquidity(amountAssetInternalId, priceAssetInternalId) | |
168 | 191 | let poolLPBalance = parseIntValue(poolLiquidityList[idxPoolLPAssetAmt]) | |
169 | 192 | let poolAmountAssetBalance = parseIntValue(poolLiquidityList[idxPoolAmountAssetAmt]) | |
170 | 193 | let poolPriceAssetBalance = parseIntValue(poolLiquidityList[idxPoolPriceAssetAmt]) | |
171 | 194 | if ((lpAssetId != paymentLpAssetId)) | |
172 | 195 | then throw("Invalid asset passed.") | |
173 | 196 | else if ((paymentLpAmount > userLPBalance)) | |
174 | 197 | then throw("Invalid amount passed. Amount less than available.") | |
175 | 198 | else { | |
176 | 199 | let amountAssetPoolLockedAmt = privateCastAssetToLPDecimals(amoutAssetDecimals, poolAmountAssetBalance)._1 | |
177 | 200 | let priceAssetPoolLockedAmt = privateCastAssetToLPDecimals(priceAssetDecimals, poolPriceAssetBalance)._1 | |
178 | 201 | let outAmountAssetAmt = fraction(amountAssetPoolLockedAmt, paymentLpAmount, poolLPBalance) | |
179 | 202 | let outPriceAssetAmt = fraction(priceAssetPoolLockedAmt, paymentLpAmount, poolLPBalance) | |
180 | 203 | let outAmountAssetAmtFinal = privateCastAssetToOriginDecimals(amoutAssetDecimals, outAmountAssetAmt)._1 | |
181 | 204 | let outPriceAssetAmtFinal = privateCastAssetToOriginDecimals(priceAssetDecimals, outPriceAssetAmt)._1 | |
182 | 205 | let currentPrice = fraction(priceAssetPoolLockedAmt, decimalsMultPrice, amountAssetPoolLockedAmt) | |
183 | - | $Tuple14( | |
206 | + | $Tuple14(outAmountAssetAmtFinal, outPriceAssetAmtFinal, amountAssetInternalId, priceAssetInternalId, userAmountAssetBalance, amountAssetId, userPriceAssetBalance, priceAssetId, userLPBalance, poolAmountAssetBalance, poolPriceAssetBalance, poolLPBalance, currentPrice, poolStatus) | |
184 | 207 | } | |
185 | 208 | } | |
186 | 209 | ||
187 | 210 | ||
188 | 211 | func privateEstimatePutOperation (slippageTolerance,inAmountAssetAmt,inAmountAssetId,inPriceAssetAmt,inPriceAssetId,userAddress) = { | |
189 | 212 | let poolConfigDataList = getPoolConfig() | |
190 | 213 | let lpAssetId = fromBase58String(poolConfigDataList[idxPoolLPAssetId]) | |
191 | 214 | let amountAssetId = poolConfigDataList[idxAmountAssetId] | |
192 | 215 | let priceAssetId = poolConfigDataList[idxPriceAssetId] | |
193 | 216 | let amountAssetInternalId = poolConfigDataList[idxAmountAssetInternalId] | |
194 | 217 | let priceAssetInternalId = poolConfigDataList[idxPriceAssetInternalId] | |
195 | 218 | let amoutAssetDecimals = parseIntValue(poolConfigDataList[idxAmountAssetDecimals]) | |
196 | 219 | let priceAssetDecimals = parseIntValue(poolConfigDataList[idxPriceAssetDecimals]) | |
220 | + | let poolStatus = poolConfigDataList[idxPoolStatus] | |
197 | 221 | let poolLiquidityDataList = getPoolLiquidity(amountAssetInternalId, priceAssetInternalId) | |
198 | 222 | let poolAmountAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolAmountAssetAmt]) | |
199 | 223 | let poolPriceAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolPriceAssetAmt]) | |
200 | 224 | let poolLPBalance = parseIntValue(poolLiquidityDataList[idxPoolLPAssetAmt]) | |
201 | 225 | let userLiquidityDataList = getPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, userAddress) | |
202 | 226 | let userAmountAssetBalance = parseIntValue(userLiquidityDataList[idxPoolAmountAssetAmt]) | |
203 | 227 | let userPriceAssetBalance = parseIntValue(userLiquidityDataList[idxPoolPriceAssetAmt]) | |
204 | 228 | let userLPBalance = parseIntValue(userLiquidityDataList[idxPoolLPAssetAmt]) | |
205 | 229 | if (if ((amountAssetId != inAmountAssetId)) | |
206 | 230 | then true | |
207 | 231 | else (priceAssetId != inPriceAssetId)) | |
208 | 232 | then throw("Invalid amount or price asset passed.") | |
209 | 233 | else { | |
210 | 234 | let inAmountAssetAmtCalculatedTuple = privateCastAssetToLPDecimals(amoutAssetDecimals, inAmountAssetAmt) | |
211 | 235 | let inPriceAssetAmtCalculatedTuple = privateCastAssetToLPDecimals(priceAssetDecimals, inPriceAssetAmt) | |
212 | 236 | let inAmountAssetAmtCalculated = inAmountAssetAmtCalculatedTuple._1 | |
213 | 237 | let inPriceAssetAmtCalculated = inPriceAssetAmtCalculatedTuple._1 | |
214 | 238 | let userPrice = fraction(inPriceAssetAmtCalculated, decimalsMultPrice, inAmountAssetAmtCalculated) | |
215 | 239 | let amountAssetPoolLockedAmt = (poolAmountAssetBalance * inAmountAssetAmtCalculatedTuple._2) | |
216 | 240 | let priceAssetPoolLockedAmt = (poolPriceAssetBalance * inPriceAssetAmtCalculatedTuple._2) | |
217 | 241 | let curentPrice = if ((poolLPBalance == 0)) | |
218 | 242 | then 0 | |
219 | 243 | else fraction(priceAssetPoolLockedAmt, decimalsMultPrice, amountAssetPoolLockedAmt) | |
220 | - | let outLpAmount = if ((poolLPBalance == 0)) | |
221 | - | then { | |
222 | - | let partA = pow(inAmountAssetAmtCalculated, 0, 5, 1, 0, DOWN) | |
223 | - | let partB = pow(inPriceAssetAmtCalculated, 0, 5, 1, 0, DOWN) | |
224 | - | (partA * partB) | |
225 | - | } | |
244 | + | let slippage = if ((curentPrice > userPrice)) | |
245 | + | then fraction((curentPrice - userPrice), 100, curentPrice) | |
246 | + | else fraction((userPrice - curentPrice), 100, curentPrice) | |
247 | + | if (if ((curentPrice != 0)) | |
248 | + | then ((slippage * decimalsMultPrice) > slippageTolerance) | |
249 | + | else false) | |
250 | + | then throw(((("Price slippage " + toString(slippage)) + " exceeded the passed limit of ") + toString(slippageTolerance))) | |
226 | 251 | else { | |
227 | - | let slippage = fraction(curentPrice, 100, userPrice) | |
228 | - | if ((slippage > slippageTolerance)) | |
229 | - | then throw(((("Price slippage " + toString(slippage)) + " exceeded the passed limit of ") + toString(slippageTolerance))) | |
252 | + | let outLpAmount = if ((poolLPBalance == 0)) | |
253 | + | then { | |
254 | + | let partA = pow(inAmountAssetAmtCalculated, 0, 5, 1, 0, DOWN) | |
255 | + | let partB = pow(inPriceAssetAmtCalculated, 0, 5, 1, 0, DOWN) | |
256 | + | (partA * partB) | |
257 | + | } | |
230 | 258 | else { | |
231 | 259 | let lpAmtByAmountAsset = fraction(poolLPBalance, inAmountAssetAmtCalculated, amountAssetPoolLockedAmt) | |
232 | 260 | let lpAmtByPriceAsset = fraction(poolLPBalance, inPriceAssetAmtCalculated, priceAssetPoolLockedAmt) | |
233 | 261 | if ((lpAmtByPriceAsset > lpAmtByAmountAsset)) | |
234 | 262 | then lpAmtByAmountAsset | |
235 | 263 | else lpAmtByPriceAsset | |
236 | 264 | } | |
265 | + | $Tuple13(outLpAmount, curentPrice, userAmountAssetBalance, userPriceAssetBalance, userLPBalance, poolAmountAssetBalance, poolPriceAssetBalance, poolLPBalance, amountAssetInternalId, priceAssetInternalId, lpAssetId, slippage, poolStatus) | |
237 | 266 | } | |
238 | - | $Tuple11(outLpAmount, curentPrice, userAmountAssetBalance, userPriceAssetBalance, userLPBalance, poolAmountAssetBalance, poolPriceAssetBalance, poolLPBalance, amountAssetInternalId, priceAssetInternalId, lpAssetId) | |
239 | 267 | } | |
268 | + | } | |
269 | + | ||
270 | + | ||
271 | + | func estimatePutOperationBasedOnAmountAsset (slippageTolerance,inAmountAssetAmt,userAddress) = { | |
272 | + | let poolConfigDataList = getPoolConfig() | |
273 | + | let lpAssetId = fromBase58String(poolConfigDataList[idxPoolLPAssetId]) | |
274 | + | let amountAssetId = poolConfigDataList[idxAmountAssetId] | |
275 | + | let priceAssetId = poolConfigDataList[idxPriceAssetId] | |
276 | + | let amountAssetInternalId = poolConfigDataList[idxAmountAssetInternalId] | |
277 | + | let priceAssetInternalId = poolConfigDataList[idxPriceAssetInternalId] | |
278 | + | let amoutAssetDecimals = parseIntValue(poolConfigDataList[idxAmountAssetDecimals]) | |
279 | + | let priceAssetDecimals = parseIntValue(poolConfigDataList[idxPriceAssetDecimals]) | |
280 | + | let poolStatus = poolConfigDataList[idxPoolStatus] | |
281 | + | let poolLiquidityDataList = getPoolLiquidity(amountAssetInternalId, priceAssetInternalId) | |
282 | + | let poolAmountAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolAmountAssetAmt]) | |
283 | + | let poolPriceAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolPriceAssetAmt]) | |
284 | + | let poolLPBalance = parseIntValue(poolLiquidityDataList[idxPoolLPAssetAmt]) | |
285 | + | let amountAssetAmtCalculatedTuple = privateCastAssetToLPDecimals(amoutAssetDecimals, poolAmountAssetBalance) | |
286 | + | let priceAssetAmtCalculatedTuple = privateCastAssetToLPDecimals(priceAssetDecimals, poolPriceAssetBalance) | |
287 | + | let curentPrice = if ((poolLPBalance == 0)) | |
288 | + | then 0 | |
289 | + | else fraction(priceAssetAmtCalculatedTuple._1, decimalsMultPrice, amountAssetAmtCalculatedTuple._1) | |
290 | + | let inPriceAssetAmtCalculated = (amountAssetAmtCalculatedTuple._2 * curentPrice) | |
291 | + | let inPriceAssetAmt = privateCastAssetToOriginDecimals(amoutAssetDecimals, inPriceAssetAmtCalculated)._1 | |
292 | + | privateEstimatePutOperation(slippageTolerance, inAmountAssetAmt, amountAssetId, inPriceAssetAmt, priceAssetId, userAddress) | |
293 | + | } | |
294 | + | ||
295 | + | ||
296 | + | func estimatePutOperationBasedOnPriceAsset (slippageTolerance,inPriceAssetAmt,userAddress) = { | |
297 | + | let poolConfigDataList = getPoolConfig() | |
298 | + | let lpAssetId = fromBase58String(poolConfigDataList[idxPoolLPAssetId]) | |
299 | + | let amountAssetId = poolConfigDataList[idxAmountAssetId] | |
300 | + | let priceAssetId = poolConfigDataList[idxPriceAssetId] | |
301 | + | let amountAssetInternalId = poolConfigDataList[idxAmountAssetInternalId] | |
302 | + | let priceAssetInternalId = poolConfigDataList[idxPriceAssetInternalId] | |
303 | + | let amoutAssetDecimals = parseIntValue(poolConfigDataList[idxAmountAssetDecimals]) | |
304 | + | let priceAssetDecimals = parseIntValue(poolConfigDataList[idxPriceAssetDecimals]) | |
305 | + | let poolStatus = poolConfigDataList[idxPoolStatus] | |
306 | + | let poolLiquidityDataList = getPoolLiquidity(amountAssetInternalId, priceAssetInternalId) | |
307 | + | let poolAmountAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolAmountAssetAmt]) | |
308 | + | let poolPriceAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolPriceAssetAmt]) | |
309 | + | let poolLPBalance = parseIntValue(poolLiquidityDataList[idxPoolLPAssetAmt]) | |
310 | + | let amountAssetAmtCalculatedTuple = privateCastAssetToLPDecimals(amoutAssetDecimals, poolAmountAssetBalance) | |
311 | + | let priceAssetAmtCalculatedTuple = privateCastAssetToLPDecimals(priceAssetDecimals, poolPriceAssetBalance) | |
312 | + | let curentPrice = if ((poolLPBalance == 0)) | |
313 | + | then 0 | |
314 | + | else fraction(priceAssetAmtCalculatedTuple._1, decimalsMultPrice, amountAssetAmtCalculatedTuple._1) | |
315 | + | let inAmountAssetAmtCalculated = (amountAssetAmtCalculatedTuple._2 / curentPrice) | |
316 | + | let inAmountAssetAmt = privateCastAssetToOriginDecimals(amoutAssetDecimals, inAmountAssetAmtCalculated)._1 | |
317 | + | privateEstimatePutOperation(slippageTolerance, inAmountAssetAmt, amountAssetId, inPriceAssetAmt, priceAssetId, userAddress) | |
318 | + | } | |
319 | + | ||
320 | + | ||
321 | + | func validateMatcherOrderAllowed (order) = { | |
322 | + | let poolConfigDataList = getPoolConfig() | |
323 | + | let amountAssetId = poolConfigDataList[idxAmountAssetId] | |
324 | + | let priceAssetId = poolConfigDataList[idxPriceAssetId] | |
325 | + | let poolStatus = parseIntValue(poolConfigDataList[idxPoolStatus]) | |
326 | + | let matcherPublicKeyStr = poolConfigDataList[idxMatcherPublicKey] | |
327 | + | let amountAssetInternalId = poolConfigDataList[idxAmountAssetInternalId] | |
328 | + | let priceAssetInternalId = poolConfigDataList[idxPriceAssetInternalId] | |
329 | + | let amountAssetDecimals = parseIntValue(poolConfigDataList[idxAmountAssetDecimals]) | |
330 | + | let priceAssetDecimals = parseIntValue(poolConfigDataList[idxPriceAssetDecimals]) | |
331 | + | let maxAllowedOrderPriceDifferencePct = parseIntValue(poolConfigDataList[idmaxAllowedOrderPriceDifferencePct]) | |
332 | + | let poolLiquidityDataList = getPoolLiquidity(amountAssetInternalId, priceAssetInternalId) | |
333 | + | let poolAmountAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolAmountAssetAmt]) | |
334 | + | let poolPriceAssetBalance = parseIntValue(poolLiquidityDataList[idxPoolPriceAssetAmt]) | |
335 | + | let currentPrice = privateCalculatePrice(amountAssetDecimals, priceAssetDecimals, poolAmountAssetBalance, poolPriceAssetBalance) | |
336 | + | let isPoolStatusValid = if (if (if (isGlobalShutdown()) | |
337 | + | then true | |
338 | + | else (poolStatus == PoolMatcherDisabled)) | |
339 | + | then true | |
340 | + | else (poolStatus == PoolShutdown)) | |
341 | + | then false | |
342 | + | else true | |
343 | + | let isValidMatcherSign = sigVerify(order.bodyBytes, order.proofs[0], fromBase58String(matcherPublicKeyStr)) | |
344 | + | let orderAmountAsset = order.assetPair.amountAsset | |
345 | + | let orderAmountAssetStr = if ((orderAmountAsset == unit)) | |
346 | + | then "" | |
347 | + | else toBase58String(value(orderAmountAsset)) | |
348 | + | let orderPriceAsset = order.assetPair.priceAsset | |
349 | + | let orderPriceAssetStr = if ((orderPriceAsset == unit)) | |
350 | + | then "" | |
351 | + | else toBase58String(value(orderPriceAsset)) | |
352 | + | let isValidAssetPair = if (if ((orderAmountAssetStr != amountAssetId)) | |
353 | + | then true | |
354 | + | else (orderPriceAssetStr != priceAssetId)) | |
355 | + | then false | |
356 | + | else true | |
357 | + | let orderPrice = order.price | |
358 | + | let priceDecimals = ((8 + priceAssetDecimals) - amountAssetDecimals) | |
359 | + | let castedOrderPrice = privateCastAssetToLPDecimals(priceDecimals, orderPrice) | |
360 | + | let difference = if ((castedOrderPrice._1 > currentPrice)) | |
361 | + | then fraction((castedOrderPrice._1 - currentPrice), 100, currentPrice) | |
362 | + | else fraction((currentPrice - castedOrderPrice._1), 100, currentPrice) | |
363 | + | let isOrderPriceValid = (maxAllowedOrderPriceDifferencePct >= (difference * decimalsMultPrice)) | |
364 | + | [if (if (if (isValidAssetPair) | |
365 | + | then isValidMatcherSign | |
366 | + | else false) | |
367 | + | then isPoolStatusValid | |
368 | + | else false) | |
369 | + | then isOrderPriceValid | |
370 | + | else false] | |
371 | + | } | |
372 | + | ||
373 | + | ||
374 | + | func validateMatcherExchangeTxAllowed (ex) = { | |
375 | + | let poolConfigDataList = getPoolConfig() | |
376 | + | let amountAssetId = poolConfigDataList[idxAmountAssetId] | |
377 | + | let priceAssetId = poolConfigDataList[idxPriceAssetId] | |
378 | + | let poolStatus = parseIntValue(poolConfigDataList[idxPoolStatus]) | |
379 | + | let matcherPublicKeyStr = poolConfigDataList[idxMatcherPublicKey] | |
380 | + | let isPoolStatusValid = if (if (if (isGlobalShutdown()) | |
381 | + | then true | |
382 | + | else (poolStatus == PoolMatcherDisabled)) | |
383 | + | then true | |
384 | + | else (poolStatus == PoolShutdown)) | |
385 | + | then false | |
386 | + | else true | |
387 | + | let isValidMatcherSign = sigVerify(ex.bodyBytes, ex.proofs[0], fromBase58String(matcherPublicKeyStr)) | |
388 | + | let exchangeAmountAsset = ex.buyOrder.assetPair.amountAsset | |
389 | + | let exchangeAmountAssetStr = if ((exchangeAmountAsset == unit)) | |
390 | + | then "" | |
391 | + | else toBase58String(value(exchangeAmountAsset)) | |
392 | + | let exchangePriceAsset = ex.buyOrder.assetPair.priceAsset | |
393 | + | let exchangePriceAssetStr = if ((exchangePriceAsset == unit)) | |
394 | + | then "" | |
395 | + | else toBase58String(value(exchangePriceAsset)) | |
396 | + | let isValidAssetPair = if (if ((exchangeAmountAssetStr != amountAssetId)) | |
397 | + | then true | |
398 | + | else (exchangePriceAssetStr != priceAssetId)) | |
399 | + | then false | |
400 | + | else true | |
401 | + | let orderAmountAssetAmt = toBigInt(ex.amount) | |
402 | + | let executedOrderType = if ((ex.buyOrder.sender == this)) | |
403 | + | then buyOrderType | |
404 | + | else sellOrderType | |
405 | + | let orderPriceAssetAmt = fraction(orderAmountAssetAmt, toBigInt(ex.price), toBigInt(decimalsMultPrice)) | |
406 | + | let currentAmountAssetBalance = if ((amountAssetId == "")) | |
407 | + | then value(wavesBalance(this)).available | |
408 | + | else value(assetBalance(this, fromBase58String(amountAssetId))) | |
409 | + | let currentPriceAssetBalance = if ((priceAssetId == "")) | |
410 | + | then value(wavesBalance(this)).available | |
411 | + | else value(assetBalance(this, fromBase58String(priceAssetId))) | |
412 | + | let currentK = fraction(toBigInt(currentAmountAssetBalance), toBigInt(currentPriceAssetBalance), toBigInt(decimalsMultPrice)) | |
413 | + | let calculatedKAfterTransaction = if ((executedOrderType == buyOrderType)) | |
414 | + | then fraction((toBigInt(currentAmountAssetBalance) + orderAmountAssetAmt), (toBigInt(currentPriceAssetBalance) - orderPriceAssetAmt), toBigInt(decimalsMultPrice)) | |
415 | + | else fraction((toBigInt(currentAmountAssetBalance) - orderAmountAssetAmt), (toBigInt(currentPriceAssetBalance) + orderPriceAssetAmt), toBigInt(decimalsMultPrice)) | |
416 | + | let isKIncreasing = (calculatedKAfterTransaction > currentK) | |
417 | + | [if (if (if (isValidAssetPair) | |
418 | + | then isKIncreasing | |
419 | + | else false) | |
420 | + | then isValidMatcherSign | |
421 | + | else false) | |
422 | + | then isPoolStatusValid | |
423 | + | else false] | |
240 | 424 | } | |
241 | 425 | ||
242 | 426 | ||
243 | 427 | @Callable(i) | |
244 | 428 | func put (slippageTolerance) = { | |
245 | 429 | let pmtAmountAsset = value(i.payments[0]) | |
246 | 430 | let inAmountAssetAmt = pmtAmountAsset.amount | |
247 | 431 | let inAmountAssetId = if (!(isDefined(pmtAmountAsset.assetId))) | |
248 | 432 | then fromBase58String("") | |
249 | 433 | else value(pmtAmountAsset.assetId) | |
250 | 434 | let pmtPriceAsset = value(i.payments[1]) | |
251 | 435 | let inPriceAssetAmt = pmtPriceAsset.amount | |
252 | 436 | let inPriceAssetId = value(pmtPriceAsset.assetId) | |
253 | 437 | let estimatedPutResults = privateEstimatePutOperation(slippageTolerance, inAmountAssetAmt, toBase58String(inAmountAssetId), inPriceAssetAmt, toBase58String(inPriceAssetId), toString(i.caller)) | |
254 | 438 | let outLpAmount = estimatedPutResults._1 | |
255 | 439 | let curentPrice = estimatedPutResults._2 | |
256 | 440 | let userAmountAssetBalance = estimatedPutResults._3 | |
257 | 441 | let userPriceAssetBalance = estimatedPutResults._4 | |
258 | 442 | let userLPBalance = estimatedPutResults._5 | |
259 | 443 | let poolAmountAssetBalance = estimatedPutResults._6 | |
260 | 444 | let poolPriceAssetBalance = estimatedPutResults._7 | |
261 | 445 | let poolLPBalance = estimatedPutResults._8 | |
262 | 446 | let amountAssetInternalId = estimatedPutResults._9 | |
263 | 447 | let priceAssetInternalId = estimatedPutResults._10 | |
264 | 448 | let lpAssetId = estimatedPutResults._11 | |
265 | - | [StringEntry(keyPriceLast(), ("%s__" + toString(curentPrice))), StringEntry(keyPriceHistory(height, lastBlock.timestamp), ("%s__" + toString(curentPrice))), StringEntry(keyPutActionByUser(toString(i.caller), toBase58String(i.transactionId)), dataPutActionInfo(inAmountAssetAmt, inPriceAssetAmt, outLpAmount, curentPrice, slippageTolerance, height, lastBlock.timestamp)), StringEntry(keyPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, toString(i.caller)), dataPoolLiquidity((userAmountAssetBalance + inAmountAssetAmt), (userPriceAssetBalance + inPriceAssetAmt), (userLPBalance + outLpAmount))), StringEntry(keyPoolLiquidity(amountAssetInternalId, priceAssetInternalId), dataPoolLiquidity((poolAmountAssetBalance + inAmountAssetAmt), (poolPriceAssetBalance + inPriceAssetAmt), (poolLPBalance + outLpAmount))), Reissue(lpAssetId, outLpAmount, true), ScriptTransfer(i.caller, outLpAmount, lpAssetId)] | |
449 | + | let slippageCalculated = estimatedPutResults._12 | |
450 | + | let poolStatus = parseIntValue(estimatedPutResults._13) | |
451 | + | if (if (if (isGlobalShutdown()) | |
452 | + | then true | |
453 | + | else (poolStatus == PoolPutDisabled)) | |
454 | + | then true | |
455 | + | else (poolStatus == PoolShutdown)) | |
456 | + | then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus))) | |
457 | + | else [StringEntry(keyPriceLast(), ("%s__" + toString(curentPrice))), StringEntry(keyPriceHistory(height, lastBlock.timestamp), ("%s__" + toString(curentPrice))), StringEntry(keyPutActionByUser(toString(i.caller), toBase58String(i.transactionId)), dataPutActionInfo(inAmountAssetAmt, inPriceAssetAmt, outLpAmount, curentPrice, slippageTolerance, slippageCalculated, height, lastBlock.timestamp)), StringEntry(keyPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, toString(i.caller)), dataPoolLiquidity((userAmountAssetBalance + inAmountAssetAmt), (userPriceAssetBalance + inPriceAssetAmt), (userLPBalance + outLpAmount))), StringEntry(keyPoolLiquidity(amountAssetInternalId, priceAssetInternalId), dataPoolLiquidity((poolAmountAssetBalance + inAmountAssetAmt), (poolPriceAssetBalance + inPriceAssetAmt), (poolLPBalance + outLpAmount))), Reissue(lpAssetId, outLpAmount, true), ScriptTransfer(i.caller, outLpAmount, lpAssetId)] | |
266 | 458 | } | |
267 | 459 | ||
268 | 460 | ||
269 | 461 | ||
270 | 462 | @Callable(i) | |
271 | 463 | func get () = { | |
272 | 464 | let pmtAmountAsset = value(i.payments[0]) | |
273 | 465 | let pmtAssetId = value(pmtAmountAsset.assetId) | |
274 | 466 | let pmtAssetAmount = pmtAmountAsset.amount | |
275 | 467 | let results = privateEstimateGetOperation(toBase58String(pmtAssetId), pmtAssetAmount, toString(i.caller)) | |
276 | - | let | |
277 | - | let | |
468 | + | let outAmountAssetAmt = results._1 | |
469 | + | let outPriceAssetAmt = results._2 | |
278 | 470 | let amountAssetInternalId = results._3 | |
279 | 471 | let priceAssetInternalId = results._4 | |
280 | 472 | let userAmountAssetBalance = results._5 | |
281 | - | let | |
473 | + | let amountAssetId = results._6 | |
282 | 474 | let userPriceAssetBalance = results._7 | |
283 | - | let | |
475 | + | let priceAssetId = results._8 | |
284 | 476 | let userLPBalance = results._9 | |
285 | - | let poolAmountAssetBalance = results._11 | |
286 | - | let poolPriceAssetBalance = results._12 | |
287 | - | let poolLPBalance = results._13 | |
288 | - | let currentPrice = results._14 | |
289 | - | [Burn(pmtAssetId, pmtAssetAmount), ScriptTransfer(i.caller, outAmountAssetAmt, if ((amountAssetId == "")) | |
290 | - | then unit | |
291 | - | else fromBase58String(amountAssetId)), ScriptTransfer(i.caller, outPriceAssetAmt, fromBase58String(priceAssetId)), StringEntry(keyPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, toString(i.caller)), dataPoolLiquidity((userAmountAssetBalance - outAmountAssetAmt), (userPriceAssetBalance - outPriceAssetAmt), (userLPBalance - pmtAssetAmount))), StringEntry(keyPoolLiquidity(amountAssetInternalId, priceAssetInternalId), dataPoolLiquidity((poolAmountAssetBalance - outAmountAssetAmt), (poolPriceAssetBalance - outPriceAssetAmt), (poolLPBalance - pmtAssetAmount))), StringEntry(keyGetActionByUser(toString(i.caller), toBase58String(i.transactionId)), dataGetActionInfo(outAmountAssetAmt, outPriceAssetAmt, pmtAssetAmount, currentPrice, height, lastBlock.timestamp)), StringEntry(keyPriceLast(), ("%s__" + toString(currentPrice))), StringEntry(keyPriceHistory(height, lastBlock.timestamp), ("%s__" + toString(currentPrice)))] | |
477 | + | let poolAmountAssetBalance = results._10 | |
478 | + | let poolPriceAssetBalance = results._11 | |
479 | + | let poolLPBalance = results._12 | |
480 | + | let currentPrice = results._13 | |
481 | + | let poolStatus = parseIntValue(results._14) | |
482 | + | if (if (isGlobalShutdown()) | |
483 | + | then true | |
484 | + | else (poolStatus == PoolShutdown)) | |
485 | + | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
486 | + | else [Burn(pmtAssetId, pmtAssetAmount), ScriptTransfer(i.caller, outAmountAssetAmt, if ((amountAssetId == "")) | |
487 | + | then unit | |
488 | + | else fromBase58String(amountAssetId)), ScriptTransfer(i.caller, outPriceAssetAmt, fromBase58String(priceAssetId)), StringEntry(keyPoolLiquidityByUser(amountAssetInternalId, priceAssetInternalId, toString(i.caller)), dataPoolLiquidity((userAmountAssetBalance - outAmountAssetAmt), (userPriceAssetBalance - outPriceAssetAmt), (userLPBalance - pmtAssetAmount))), StringEntry(keyPoolLiquidity(amountAssetInternalId, priceAssetInternalId), dataPoolLiquidity((poolAmountAssetBalance - outAmountAssetAmt), (poolPriceAssetBalance - outPriceAssetAmt), (poolLPBalance - pmtAssetAmount))), StringEntry(keyGetActionByUser(toString(i.caller), toBase58String(i.transactionId)), dataGetActionInfo(outAmountAssetAmt, outPriceAssetAmt, pmtAssetAmount, currentPrice, height, lastBlock.timestamp)), StringEntry(keyPriceLast(), ("%s__" + toString(currentPrice))), StringEntry(keyPriceHistory(height, lastBlock.timestamp), ("%s__" + toString(currentPrice)))] | |
292 | 489 | } | |
293 | 490 | ||
294 | 491 | ||
295 | 492 | ||
296 | 493 | @Callable(i) | |
297 | - | func activate (amountAssetStr,priceAssetStr,lpAssetName,lpAssetDescr,poolWeight) = if ((i. | |
494 | + | func activate (amountAssetStr,priceAssetStr,lpAssetName,lpAssetDescr,poolWeight) = if ((toString(i.caller) != factoryAddressString)) | |
298 | 495 | then throw("permissions denied") | |
299 | 496 | else { | |
300 | 497 | let amountAssetId = fromBase58String(amountAssetStr) | |
301 | 498 | let amountAssetDecimals = value(assetInfo(amountAssetId)).decimals | |
302 | 499 | let priceAssetId = fromBase58String(priceAssetStr) | |
303 | 500 | let priceAssetDecimals = value(assetInfo(priceAssetId)).decimals | |
304 | 501 | let lpAssetIssueAction = Issue(lpAssetName, lpAssetDescr, 1, 8, true) | |
305 | 502 | let lpAssetId = calculateAssetId(lpAssetIssueAction) | |
306 | 503 | let lpAssetIdAsString = toBase58String(lpAssetId) | |
307 | - | $Tuple2([lpAssetIssueAction, Burn(lpAssetId, 1)], lpAssetIdAsString) | |
504 | + | $Tuple2([lpAssetIssueAction, Burn(lpAssetId, 1), StringEntry(keyAmountAsset(), amountAssetStr), StringEntry(keyPriceAsset(), priceAssetStr)], lpAssetIdAsString) | |
308 | 505 | } | |
309 | 506 | ||
310 | 507 | ||
311 | - | ||
312 | - | @Callable(i) | |
313 | - | func manage (status) = nil | |
314 | - | ||
315 | - | ||
316 | 508 | @Verifier(tx) | |
317 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
509 | + | func verify () = match tx { | |
510 | + | case order: Order => | |
511 | + | validateMatcherOrderAllowed(order)[1] | |
512 | + | case exchangeTx: ExchangeTransaction => | |
513 | + | validateMatcherExchangeTxAllowed(exchangeTx)[1] | |
514 | + | case _ => | |
515 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
516 | + | } | |
318 | 517 |
github/deemru/w8io/026f985 65.65 ms ◑