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