tx · 7BJiHH1qQiA4gD1dkNzJsk8Pavkw6FnSDgPHVhNoX5Mx 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT: -0.04100000 Waves 2023.05.10 13:15 [2571654] smart account 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT > SELF 0.00000000 Waves
{ "type": 13, "id": "7BJiHH1qQiA4gD1dkNzJsk8Pavkw6FnSDgPHVhNoX5Mx", "fee": 4100000, "feeAssetId": null, "timestamp": 1683713688855, "version": 2, "chainId": 84, "sender": "3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT", "senderPublicKey": "D1BL65meykxFZTCuq7jq9HSGLLnWvQamQPUNrguW5w39", "proofs": [ "5MkAyepUuAWuiCi8NTANV8xTx4UzbgX6bjJT6nRQkrUxtSxE7METZa3jiGqe1Q2RPQvhGySGJpg6KP5MMd9TEgkY" ], "script": "base64:BgKxLQgCEgUKAwEEARIHCgUBBAEIARIDCgEIEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIAEgQKAggBEgQKAggBEgQKAgEBEgMKAQESBQoDAQEBEgUKAwEIARIECgIBCBIECgIBCBIECgIICBIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgRiaWczIgRiaWc0IgpzbGlwcGFnZTREIgt3YXZlc1N0cmluZyIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFzSWQiDWlkeElQcmljZU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xBAJhSwgFAmlCAl8yBAJhTAkA9AMDCAUCZmkJYm9keUJ5dGVzCQCRAwIIBQJmaQZwcm9vZnMAAAgFAmZpD3NlbmRlclB1YmxpY0tleQQCYU0JAPQDAwgFAmZpCWJvZHlCeXRlcwkAkQMCCAUCZmkGcHJvb2ZzAAEFAmlBAwMDBQJhSgUCYUwHBQJhTQcGCQECYUkEBQJhSgUCYUsFAmFMBQJhTQMJAAECBQJhUAIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAmFVBQJhUAMJAPQDAwgFAml4CWJvZHlCeXRlcwkAkQMCCAUCaXgGcHJvb2ZzAAAFAml6BgQCaUMJAPYDAQkBBXZhbHVlAQgFAmFVBnNjcmlwdAQCaUQJANsEAQkBBXZhbHVlAQkAnQgCBQJhVAkBAmFFAAQCaUUJAPEHAQUEdGhpcwMJAAACBQJpRAUCaUMJAQIhPQIFAmlFBQJpQwcJAPQDAwgFAml4CWJvZHlCeXRlcwkAkQMCCAUCaXgGcHJvb2ZzAAAFAml6CFKkNA==", "height": 2571654, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8VC9TU7P6uhQTkta7oti1VYZe7dN5UpBri166An8kncz Next: 4NLcA3oeRiKPnhYjWAupGhstGp4CtsGsvUX6bcv2gNSq Diff:
Old | New | Differences | |
---|---|---|---|
101 | 101 | func fc () = "%s__factoryContract" | |
102 | 102 | ||
103 | 103 | ||
104 | - | func | |
104 | + | func keyManagerPublicKey () = "%s__managerPublicKey" | |
105 | 105 | ||
106 | 106 | ||
107 | - | func | |
107 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func pl () = "%s%s__price__last" | |
175 | 175 | func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
176 | 176 | ||
177 | 177 | ||
178 | + | func addressFromStringOrThis (addressString) = match addressFromString(addressString) { | |
179 | + | case a: Address => | |
180 | + | a | |
181 | + | case _ => | |
182 | + | this | |
183 | + | } | |
184 | + | ||
185 | + | ||
186 | + | func getManagerVaultAddressOrThis () = { | |
187 | + | let factoryAddress = match addressFromStringOrThis(fc()) { | |
188 | + | case fca: Address => | |
189 | + | fca | |
190 | + | case _ => | |
191 | + | this | |
192 | + | } | |
193 | + | match getString(factoryAddress, keyManagerVaultAddress()) { | |
194 | + | case s: String => | |
195 | + | addressFromStringOrThis(s) | |
196 | + | case _ => | |
197 | + | this | |
198 | + | } | |
199 | + | } | |
200 | + | ||
201 | + | ||
178 | 202 | func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
179 | 203 | ||
180 | 204 | ||
237 | 261 | ||
238 | 262 | let poolConfigParsed = parsePoolConfig(gpc()) | |
239 | 263 | ||
240 | - | let $ | |
264 | + | let $t086768905 = poolConfigParsed | |
241 | 265 | ||
242 | - | let cfgPoolAddress = $ | |
266 | + | let cfgPoolAddress = $t086768905._1 | |
243 | 267 | ||
244 | - | let cfgPoolStatus = $ | |
268 | + | let cfgPoolStatus = $t086768905._2 | |
245 | 269 | ||
246 | - | let cfgLpAssetId = $ | |
270 | + | let cfgLpAssetId = $t086768905._3 | |
247 | 271 | ||
248 | - | let cfgAmountAssetId = $ | |
272 | + | let cfgAmountAssetId = $t086768905._4 | |
249 | 273 | ||
250 | - | let cfgPriceAssetId = $ | |
274 | + | let cfgPriceAssetId = $t086768905._5 | |
251 | 275 | ||
252 | - | let cfgAmountAssetDecimals = $ | |
276 | + | let cfgAmountAssetDecimals = $t086768905._6 | |
253 | 277 | ||
254 | - | let cfgPriceAssetDecimals = $ | |
278 | + | let cfgPriceAssetDecimals = $t086768905._7 | |
255 | 279 | ||
256 | - | let cfgInAmountAssedId = $ | |
280 | + | let cfgInAmountAssedId = $t086768905._8 | |
257 | 281 | ||
258 | - | let cfgInPriceAssetId = $ | |
282 | + | let cfgInPriceAssetId = $t086768905._9 | |
259 | 283 | ||
260 | 284 | func gfc () = split(strf(fca, fcfg()), SEP) | |
261 | 285 | ||
376 | 400 | } | |
377 | 401 | ||
378 | 402 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | |
379 | - | let $ | |
403 | + | let $t01341013458 = { | |
380 | 404 | let $l = arr | |
381 | 405 | let $s = size($l) | |
382 | 406 | let $acc0 = $Tuple2(s, false) | |
390 | 414 | ||
391 | 415 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17) | |
392 | 416 | } | |
393 | - | let d = $ | |
394 | - | let found = $ | |
417 | + | let d = $t01341013458._1 | |
418 | + | let found = $t01341013458._2 | |
395 | 419 | if (found) | |
396 | 420 | then d | |
397 | 421 | else throw(("D calculation error, D = " + toString(d))) | |
527 | 551 | else calcLpAmt | |
528 | 552 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
529 | 553 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
530 | - | let $ | |
554 | + | let $t02129721642 = if (if (isOneAsset) | |
531 | 555 | then (pmtId == amIdStr) | |
532 | 556 | else false) | |
533 | 557 | then $Tuple2(pmtAmt, 0) | |
536 | 560 | else false) | |
537 | 561 | then $Tuple2(0, pmtAmt) | |
538 | 562 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
539 | - | let writeAmAmt = $ | |
540 | - | let writePrAmt = $ | |
563 | + | let writeAmAmt = $t02129721642._1 | |
564 | + | let writePrAmt = $t02129721642._2 | |
541 | 565 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
542 | 566 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
543 | 567 | } | |
556 | 580 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
557 | 581 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
558 | 582 | func calc (acc,cur) = { | |
559 | - | let $ | |
560 | - | let y = $ | |
561 | - | let found = $ | |
583 | + | let $t02283722857 = acc | |
584 | + | let y = $t02283722857._1 | |
585 | + | let found = $t02283722857._2 | |
562 | 586 | if ((found != unit)) | |
563 | 587 | then acc | |
564 | 588 | else { | |
571 | 595 | } | |
572 | 596 | ||
573 | 597 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
574 | - | let $ | |
598 | + | let $t02316423211 = { | |
575 | 599 | let $l = arr | |
576 | 600 | let $s = size($l) | |
577 | 601 | let $acc0 = $Tuple2(D, unit) | |
585 | 609 | ||
586 | 610 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
587 | 611 | } | |
588 | - | let y = $ | |
589 | - | let found = $ | |
612 | + | let y = $t02316423211._1 | |
613 | + | let found = $t02316423211._2 | |
590 | 614 | if ((found != unit)) | |
591 | 615 | then y | |
592 | 616 | else throw(("Y calculation error, Y = " + toString(y))) | |
630 | 654 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
631 | 655 | let amountAssetAmount = order.amount | |
632 | 656 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
633 | - | let $ | |
657 | + | let $t02540925621 = if ((order.orderType == Buy)) | |
634 | 658 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
635 | 659 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
636 | - | let amountAssetBalanceDelta = $ | |
637 | - | let priceAssetBalanceDelta = $ | |
660 | + | let amountAssetBalanceDelta = $t02540925621._1 | |
661 | + | let priceAssetBalanceDelta = $t02540925621._2 | |
638 | 662 | if (if (if (igs()) | |
639 | 663 | then true | |
640 | 664 | else (cfgPoolStatus == PoolMatcherDis)) | |
647 | 671 | then throw("Wr assets") | |
648 | 672 | else { | |
649 | 673 | let dLp = parseBigIntValue(valueOrElse(getString(this, keyDLp), "0")) | |
650 | - | let $ | |
651 | - | let unusedActions = $ | |
652 | - | let dLpNew = $ | |
674 | + | let $t02596326063 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
675 | + | let unusedActions = $t02596326063._1 | |
676 | + | let dLpNew = $t02596326063._2 | |
653 | 677 | let isOrderValid = (dLpNew >= dLp) | |
654 | 678 | let info = makeString(["dLp=", toString(dLp), " dLpNew=", toString(dLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
655 | 679 | $Tuple2(isOrderValid, info) | |
703 | 727 | then { | |
704 | 728 | let amBalance = getAccBalance(amId) | |
705 | 729 | let prBalance = getAccBalance(prId) | |
706 | - | let $ | |
730 | + | let $t02871929181 = if ((txId == "")) | |
707 | 731 | then $Tuple2(amBalance, prBalance) | |
708 | 732 | else if ((pmtAssetId == amId)) | |
709 | 733 | then if ((pmtAmtRaw > amBalance)) | |
714 | 738 | then throw("invalid payment amount") | |
715 | 739 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
716 | 740 | else throw("wrong pmtAssetId") | |
717 | - | let amBalanceOld = $ | |
718 | - | let prBalanceOld = $ | |
719 | - | let $ | |
741 | + | let amBalanceOld = $t02871929181._1 | |
742 | + | let prBalanceOld = $t02871929181._2 | |
743 | + | let $t02918729363 = if ((pmtAssetId == amId)) | |
720 | 744 | then $Tuple2(pmtAmtRaw, 0) | |
721 | 745 | else if ((pmtAssetId == prId)) | |
722 | 746 | then $Tuple2(0, pmtAmtRaw) | |
723 | 747 | else throw("invalid payment") | |
724 | - | let amAmountRaw = $ | |
725 | - | let prAmountRaw = $ | |
726 | - | let $ | |
748 | + | let amAmountRaw = $t02918729363._1 | |
749 | + | let prAmountRaw = $t02918729363._2 | |
750 | + | let $t02936729621 = if (withTakeFee) | |
727 | 751 | then $Tuple3(takeFee(amAmountRaw, inFee)._1, takeFee(prAmountRaw, inFee)._1, takeFee(pmtAmtRaw, inFee)._2) | |
728 | 752 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
729 | - | let amAmount = $ | |
730 | - | let prAmount = $ | |
731 | - | let feeAmount = $ | |
753 | + | let amAmount = $t02936729621._1 | |
754 | + | let prAmount = $t02936729621._2 | |
755 | + | let feeAmount = $t02936729621._3 | |
732 | 756 | let amBalanceNew = (amBalanceOld + amAmount) | |
733 | 757 | let prBalanceNew = (prBalanceOld + prAmount) | |
734 | 758 | let D0 = getD([t1(amBalanceOld, cfgAmountAssetDecimals), t1(prBalanceOld, cfgPriceAssetDecimals)]) | |
776 | 800 | else { | |
777 | 801 | let amBalance = getAccBalance(amId) | |
778 | 802 | let prBalance = getAccBalance(prId) | |
779 | - | let $ | |
803 | + | let $t03173331844 = { | |
780 | 804 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
781 | 805 | if ($isInstanceOf(@, "(Int, Int)")) | |
782 | 806 | then @ | |
783 | 807 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
784 | 808 | } | |
785 | - | if (($ | |
809 | + | if (($t03173331844 == $t03173331844)) | |
786 | 810 | then { | |
787 | - | let feeAmount = $ | |
788 | - | let totalGet = $ | |
811 | + | let feeAmount = $t03173331844._2 | |
812 | + | let totalGet = $t03173331844._1 | |
789 | 813 | let totalAmount = if (if ((minOutAmount > 0)) | |
790 | 814 | then (minOutAmount > totalGet) | |
791 | 815 | else false) | |
792 | 816 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
793 | 817 | else totalGet | |
794 | - | let $ | |
818 | + | let $t03203432341 = if ((outAssetId == amId)) | |
795 | 819 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
796 | 820 | else if ((outAssetId == prId)) | |
797 | 821 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
798 | 822 | else throw("invalid out asset id") | |
799 | - | let outAm = $ | |
800 | - | let outPr = $ | |
801 | - | let amBalanceNew = $ | |
802 | - | let prBalanceNew = $ | |
823 | + | let outAm = $t03203432341._1 | |
824 | + | let outPr = $t03203432341._2 | |
825 | + | let amBalanceNew = $t03203432341._3 | |
826 | + | let prBalanceNew = $t03203432341._4 | |
803 | 827 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
804 | 828 | let curPr = f1(curPrX18, scale8) | |
805 | 829 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
814 | 838 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
815 | 839 | if ((burn == burn)) | |
816 | 840 | then { | |
817 | - | let $ | |
841 | + | let $t03312633476 = { | |
818 | 842 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
819 | 843 | then 0 | |
820 | 844 | else feeAmount | |
825 | 849 | then $Tuple2(-((totalGet + feeAmountForCalc)), 0) | |
826 | 850 | else $Tuple2(0, -((totalGet + feeAmountForCalc))) | |
827 | 851 | } | |
828 | - | let amountAssetBalanceDelta = $ | |
829 | - | let priceAssetBalanceDelta = $ | |
830 | - | let $ | |
831 | - | let refreshDLpActions = $ | |
832 | - | let updatedDLp = $ | |
852 | + | let amountAssetBalanceDelta = $t03312633476._1 | |
853 | + | let priceAssetBalanceDelta = $t03312633476._2 | |
854 | + | let $t03347933587 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
855 | + | let refreshDLpActions = $t03347933587._1 | |
856 | + | let updatedDLp = $t03347933587._2 | |
833 | 857 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
834 | 858 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
835 | 859 | then $Tuple2((state ++ refreshDLpActions), totalAmount) | |
846 | 870 | } | |
847 | 871 | ||
848 | 872 | ||
849 | - | func m () = match getString(mpk()) { | |
850 | - | case s: String => | |
851 | - | fromBase58String(s) | |
852 | - | case _: Unit => | |
853 | - | unit | |
854 | - | case _ => | |
855 | - | throw("Match error") | |
856 | - | } | |
857 | - | ||
858 | - | ||
859 | - | func pm () = match getString(pmpk()) { | |
860 | - | case s: String => | |
861 | - | fromBase58String(s) | |
862 | - | case _: Unit => | |
863 | - | unit | |
864 | - | case _ => | |
865 | - | throw("Match error") | |
866 | - | } | |
873 | + | func managerPublicKeyOrUnit () = { | |
874 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
875 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
876 | + | case s: String => | |
877 | + | fromBase58String(s) | |
878 | + | case _: Unit => | |
879 | + | unit | |
880 | + | case _ => | |
881 | + | throw("Match error") | |
882 | + | } | |
883 | + | } | |
867 | 884 | ||
868 | 885 | ||
869 | 886 | let pd = throw("Permission denied") | |
870 | 887 | ||
871 | - | func isManager (i) = match | |
888 | + | func isManager (i) = match managerPublicKeyOrUnit() { | |
872 | 889 | case pk: ByteVector => | |
873 | 890 | (i.callerPublicKey == pk) | |
874 | 891 | case _: Unit => | |
878 | 895 | } | |
879 | 896 | ||
880 | 897 | ||
881 | - | func | |
898 | + | func mustManager (i) = match managerPublicKeyOrUnit() { | |
882 | 899 | case pk: ByteVector => | |
883 | 900 | if ((i.callerPublicKey == pk)) | |
884 | 901 | then true | |
908 | 925 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
909 | 926 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
910 | 927 | func calc (acc,cur) = { | |
911 | - | let $ | |
912 | - | let y = $ | |
913 | - | let found = $ | |
928 | + | let $t03507435094 = acc | |
929 | + | let y = $t03507435094._1 | |
930 | + | let found = $t03507435094._2 | |
914 | 931 | if ((found != unit)) | |
915 | 932 | then acc | |
916 | 933 | else { | |
923 | 940 | } | |
924 | 941 | ||
925 | 942 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
926 | - | let $ | |
943 | + | let $t03542535472 = { | |
927 | 944 | let $l = arr | |
928 | 945 | let $s = size($l) | |
929 | 946 | let $acc0 = $Tuple2(D, unit) | |
937 | 954 | ||
938 | 955 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
939 | 956 | } | |
940 | - | let y = $ | |
941 | - | let found = $ | |
957 | + | let y = $t03542535472._1 | |
958 | + | let found = $t03542535472._2 | |
942 | 959 | if ((found != unit)) | |
943 | 960 | then y | |
944 | 961 | else throw(("Y calculation error, Y = " + toString(y))) | |
950 | 967 | ||
951 | 968 | @Callable(i) | |
952 | 969 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
953 | - | let $ | |
970 | + | let $t03582436248 = if ((isReverse == false)) | |
954 | 971 | then { | |
955 | 972 | let assetOut = strf(this, pa()) | |
956 | 973 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, aa()))) + toBigInt(cleanAmountIn)) | |
961 | 978 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, pa()))) + toBigInt(cleanAmountIn)) | |
962 | 979 | $Tuple2(assetOut, poolAmountInBalance) | |
963 | 980 | } | |
964 | - | let assetOut = $ | |
965 | - | let poolAmountInBalance = $ | |
981 | + | let assetOut = $t03582436248._1 | |
982 | + | let poolAmountInBalance = $t03582436248._2 | |
966 | 983 | let poolConfig = gpc() | |
967 | 984 | let amId = poolConfig[idxAmAsId] | |
968 | 985 | let prId = poolConfig[idxPrAsId] | |
1002 | 1019 | then { | |
1003 | 1020 | let pmt = value(i.payments[0]) | |
1004 | 1021 | let assetIn = assetIdToString(pmt.assetId) | |
1005 | - | let $ | |
1022 | + | let $t03768438078 = if ((isReverse == false)) | |
1006 | 1023 | then { | |
1007 | 1024 | let assetOut = strf(this, pa()) | |
1008 | 1025 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1013 | 1030 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1014 | 1031 | $Tuple2(assetOut, poolAmountInBalance) | |
1015 | 1032 | } | |
1016 | - | let assetOut = $ | |
1017 | - | let poolAmountInBalance = $ | |
1033 | + | let assetOut = $t03768438078._1 | |
1034 | + | let poolAmountInBalance = $t03768438078._2 | |
1018 | 1035 | let poolConfig = gpc() | |
1019 | 1036 | let amId = poolConfig[idxAmAsId] | |
1020 | 1037 | let prId = poolConfig[idxPrAsId] | |
1050 | 1067 | ||
1051 | 1068 | @Callable(i) | |
1052 | 1069 | func constructor (fc) = { | |
1053 | - | let c = | |
1070 | + | let c = mustManager(i) | |
1054 | 1071 | if ((c == c)) | |
1055 | 1072 | then [StringEntry(fc(), fc)] | |
1056 | - | else throw("Strict value is not equal to itself.") | |
1057 | - | } | |
1058 | - | ||
1059 | - | ||
1060 | - | ||
1061 | - | @Callable(i) | |
1062 | - | func setManager (pendingManagerPublicKey) = { | |
1063 | - | let c = mm(i) | |
1064 | - | if ((c == c)) | |
1065 | - | then { | |
1066 | - | let cm = fromBase58String(pendingManagerPublicKey) | |
1067 | - | if ((cm == cm)) | |
1068 | - | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
1069 | - | else throw("Strict value is not equal to itself.") | |
1070 | - | } | |
1071 | - | else throw("Strict value is not equal to itself.") | |
1072 | - | } | |
1073 | - | ||
1074 | - | ||
1075 | - | ||
1076 | - | @Callable(i) | |
1077 | - | func confirmManager () = { | |
1078 | - | let p = pm() | |
1079 | - | let hpm = if (isDefined(p)) | |
1080 | - | then true | |
1081 | - | else throw("No pending manager") | |
1082 | - | if ((hpm == hpm)) | |
1083 | - | then { | |
1084 | - | let cpm = if ((i.callerPublicKey == value(p))) | |
1085 | - | then true | |
1086 | - | else throw("You are not pending manager") | |
1087 | - | if ((cpm == cpm)) | |
1088 | - | then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())] | |
1089 | - | else throw("Strict value is not equal to itself.") | |
1090 | - | } | |
1091 | 1073 | else throw("Strict value is not equal to itself.") | |
1092 | 1074 | } | |
1093 | 1075 | ||
1154 | 1136 | else throw("Strict value is not equal to itself.") | |
1155 | 1137 | } | |
1156 | 1138 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1157 | - | let $ | |
1158 | - | let refreshDLpActions = $ | |
1159 | - | let updatedDLp = $ | |
1139 | + | let $t04222242364 = refreshDLpInternal(0, 0, 0) | |
1140 | + | let refreshDLpActions = $t04222242364._1 | |
1141 | + | let updatedDLp = $t04222242364._2 | |
1160 | 1142 | let check = if ((updatedDLp >= currentDLp)) | |
1161 | 1143 | then true | |
1162 | 1144 | else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(amDiff), toString(prDiff)], " ")) | |
1229 | 1211 | else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0)) | |
1230 | 1212 | if ((currentDLp == currentDLp)) | |
1231 | 1213 | then { | |
1232 | - | let $ | |
1233 | - | if (($ | |
1214 | + | let $t04400544163 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
1215 | + | if (($t04400544163 == $t04400544163)) | |
1234 | 1216 | then { | |
1235 | - | let feeAmount = $ | |
1236 | - | let state = $ | |
1237 | - | let estimLP = $ | |
1217 | + | let feeAmount = $t04400544163._3 | |
1218 | + | let state = $t04400544163._2 | |
1219 | + | let estimLP = $t04400544163._1 | |
1238 | 1220 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
1239 | 1221 | then (minOutAmount > estimLP) | |
1240 | 1222 | else false) | |
1262 | 1244 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1263 | 1245 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1264 | 1246 | else nil | |
1265 | - | let $ | |
1247 | + | let $t04504845397 = if ((this == feeCollectorAddress)) | |
1266 | 1248 | then $Tuple2(0, 0) | |
1267 | 1249 | else { | |
1268 | 1250 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1272 | 1254 | then $Tuple2(-(feeAmount), 0) | |
1273 | 1255 | else $Tuple2(0, -(feeAmount)) | |
1274 | 1256 | } | |
1275 | - | let amountAssetBalanceDelta = $ | |
1276 | - | let priceAssetBalanceDelta = $ | |
1277 | - | let $ | |
1278 | - | let refreshDLpActions = $ | |
1279 | - | let updatedDLp = $ | |
1257 | + | let amountAssetBalanceDelta = $t04504845397._1 | |
1258 | + | let priceAssetBalanceDelta = $t04504845397._2 | |
1259 | + | let $t04540045508 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1260 | + | let refreshDLpActions = $t04540045508._1 | |
1261 | + | let updatedDLp = $t04540045508._2 | |
1280 | 1262 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1281 | 1263 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1282 | 1264 | then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1308 | 1290 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1309 | 1291 | if ((currentDLp == currentDLp)) | |
1310 | 1292 | then { | |
1311 | - | let $ | |
1312 | - | let refreshDLpActions = $ | |
1313 | - | let updatedDLp = $ | |
1293 | + | let $t04653846603 = refreshDLpInternal(0, 0, 0) | |
1294 | + | let refreshDLpActions = $t04653846603._1 | |
1295 | + | let updatedDLp = $t04653846603._2 | |
1314 | 1296 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1315 | 1297 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1316 | 1298 | then (state ++ refreshDLpActions) | |
1335 | 1317 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1336 | 1318 | if ((b == b)) | |
1337 | 1319 | then { | |
1338 | - | let $ | |
1339 | - | let refreshDLpActions = $ | |
1340 | - | let updatedDLp = $ | |
1320 | + | let $t04777647858 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1321 | + | let refreshDLpActions = $t04777647858._1 | |
1322 | + | let updatedDLp = $t04777647858._2 | |
1341 | 1323 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1342 | 1324 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1343 | 1325 | then (state ++ refreshDLpActions) | |
1372 | 1354 | else throwErr("exactly 1 payment are expected")] | |
1373 | 1355 | if ((checks == checks)) | |
1374 | 1356 | then { | |
1375 | - | let $ | |
1376 | - | let state = $ | |
1377 | - | let totalAmount = $ | |
1357 | + | let $t04847648631 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1358 | + | let state = $t04847648631._1 | |
1359 | + | let totalAmount = $t04847648631._2 | |
1378 | 1360 | $Tuple2(state, totalAmount) | |
1379 | 1361 | } | |
1380 | 1362 | else throw("Strict value is not equal to itself.") | |
1391 | 1373 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1392 | 1374 | then { | |
1393 | 1375 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1394 | - | let $ | |
1395 | - | let dLpUpdateActions = $ | |
1396 | - | let updatedDLp = $ | |
1376 | + | let $t04915549219 = refreshDLpInternal(0, 0, 0) | |
1377 | + | let dLpUpdateActions = $t04915549219._1 | |
1378 | + | let updatedDLp = $t04915549219._2 | |
1397 | 1379 | let actions = if ((dLp != updatedDLp)) | |
1398 | 1380 | then dLpUpdateActions | |
1399 | 1381 | else throwErr("nothing to refresh") | |
1421 | 1403 | let newY = getYD(xp, index, D1) | |
1422 | 1404 | let dy = (xp[index] - newY) | |
1423 | 1405 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1424 | - | let $ | |
1425 | - | let totalGet = $ | |
1426 | - | let feeAmount = $ | |
1406 | + | let $t05022950284 = takeFee(totalGetRaw, outFee) | |
1407 | + | let totalGet = $t05022950284._1 | |
1408 | + | let feeAmount = $t05022950284._2 | |
1427 | 1409 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1428 | 1410 | } | |
1429 | 1411 | ||
1436 | 1418 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1437 | 1419 | let amBalance = getAccBalance(amId) | |
1438 | 1420 | let prBalance = getAccBalance(prId) | |
1439 | - | let $ | |
1421 | + | let $t05065950774 = { | |
1440 | 1422 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1441 | 1423 | if ($isInstanceOf(@, "(Int, Int)")) | |
1442 | 1424 | then @ | |
1443 | 1425 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1444 | 1426 | } | |
1445 | - | let totalGet = $ | |
1446 | - | let feeAmount = $ | |
1427 | + | let totalGet = $t05065950774._1 | |
1428 | + | let feeAmount = $t05065950774._2 | |
1447 | 1429 | let r = ego("", lpId, lpAssetAmount, this) | |
1448 | 1430 | let outAmAmt = r._1 | |
1449 | 1431 | let outPrAmt = r._2 | |
1477 | 1459 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1478 | 1460 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1479 | 1461 | then { | |
1480 | - | let $ | |
1481 | - | let refreshDLpActions = $ | |
1482 | - | let updatedDLp = $ | |
1462 | + | let $t05194052021 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1463 | + | let refreshDLpActions = $t05194052021._1 | |
1464 | + | let updatedDLp = $t05194052021._2 | |
1483 | 1465 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1484 | 1466 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1485 | 1467 | then (state ++ refreshDLpActions) | |
1524 | 1506 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1525 | 1507 | if ((burnA == burnA)) | |
1526 | 1508 | then { | |
1527 | - | let $ | |
1528 | - | let refreshDLpActions = $ | |
1529 | - | let updatedDLp = $ | |
1509 | + | let $t05304853129 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1510 | + | let refreshDLpActions = $t05304853129._1 | |
1511 | + | let updatedDLp = $t05304853129._2 | |
1530 | 1512 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1531 | 1513 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1532 | 1514 | then (state ++ refreshDLpActions) | |
1577 | 1559 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1578 | 1560 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1579 | 1561 | then { | |
1580 | - | let $ | |
1581 | - | let refreshDLpActions = $ | |
1582 | - | let updatedDLp = $ | |
1562 | + | let $t05438054461 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1563 | + | let refreshDLpActions = $t05438054461._1 | |
1564 | + | let updatedDLp = $t05438054461._2 | |
1583 | 1565 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1584 | 1566 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1585 | 1567 | then (state ++ refreshDLpActions) | |
1628 | 1610 | let unstakeInv = invoke(staking, "unstakeINTERNAL", [lpAssetId, unstakeAmount, userAddress.bytes, lpAssetRecipientAddress.bytes], nil) | |
1629 | 1611 | if ((unstakeInv == unstakeInv)) | |
1630 | 1612 | then { | |
1631 | - | let $ | |
1632 | - | let state = $ | |
1633 | - | let totalAmount = $ | |
1613 | + | let $t05548355671 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1614 | + | let state = $t05548355671._1 | |
1615 | + | let totalAmount = $t05548355671._2 | |
1634 | 1616 | $Tuple2(state, totalAmount) | |
1635 | 1617 | } | |
1636 | 1618 | else throw("Strict value is not equal to itself.") | |
1642 | 1624 | ||
1643 | 1625 | @Callable(i) | |
1644 | 1626 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1645 | - | let $ | |
1646 | - | let lpAmount = $ | |
1647 | - | let state = $ | |
1648 | - | let feeAmount = $ | |
1649 | - | let bonus = $ | |
1627 | + | let $t05579955902 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1628 | + | let lpAmount = $t05579955902._1 | |
1629 | + | let state = $t05579955902._2 | |
1630 | + | let feeAmount = $t05579955902._3 | |
1631 | + | let bonus = $t05579955902._4 | |
1650 | 1632 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1651 | 1633 | } | |
1652 | 1634 | ||
1654 | 1636 | ||
1655 | 1637 | @Callable(i) | |
1656 | 1638 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1657 | - | let $ | |
1658 | - | let lpAmount = $ | |
1659 | - | let state = $ | |
1660 | - | let feeAmount = $ | |
1661 | - | let bonus = $ | |
1639 | + | let $t05605056154 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1640 | + | let lpAmount = $t05605056154._1 | |
1641 | + | let state = $t05605056154._2 | |
1642 | + | let feeAmount = $t05605056154._3 | |
1643 | + | let bonus = $t05605056154._4 | |
1662 | 1644 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1663 | 1645 | } | |
1664 | 1646 | ||
1720 | 1702 | @Callable(i) | |
1721 | 1703 | func changeAmp () = { | |
1722 | 1704 | let cfg = invoke(fca, "getChangeAmpConfigREADONLY", [toString(this)], nil) | |
1723 | - | let $ | |
1705 | + | let $t05850858707 = match cfg { | |
1724 | 1706 | case list: List[Any] => | |
1725 | 1707 | $Tuple3({ | |
1726 | 1708 | let @ = list[0] | |
1741 | 1723 | case _ => | |
1742 | 1724 | throwErr("invalid entry type") | |
1743 | 1725 | } | |
1744 | - | let delay = $ | |
1745 | - | let delta = $ | |
1746 | - | let target = $ | |
1726 | + | let delay = $t05850858707._1 | |
1727 | + | let delta = $t05850858707._2 | |
1728 | + | let target = $t05850858707._3 | |
1747 | 1729 | let curAmp = parseIntValue(getStringValue(amp())) | |
1748 | 1730 | let newAmpRaw = (curAmp + delta) | |
1749 | 1731 | let newAmp = if ((0 > delta)) | |
1768 | 1750 | ||
1769 | 1751 | @Verifier(tx) | |
1770 | 1752 | func verify () = { | |
1771 | - | let targetPublicKey = match | |
1753 | + | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1772 | 1754 | case pk: ByteVector => | |
1773 | 1755 | pk | |
1774 | 1756 | case _: Unit => | |
1779 | 1761 | match tx { | |
1780 | 1762 | case order: Order => | |
1781 | 1763 | let matcherPub = mp() | |
1782 | - | let $ | |
1764 | + | let $t05964059757 = if (skipOrderValidation()) | |
1783 | 1765 | then $Tuple2(true, "") | |
1784 | 1766 | else validateMatcherOrderAllowed(order) | |
1785 | - | let orderValid = $ | |
1786 | - | let orderValidInfo = $ | |
1767 | + | let orderValid = $t05964059757._1 | |
1768 | + | let orderValidInfo = $t05964059757._2 | |
1787 | 1769 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1788 | 1770 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1789 | 1771 | if (if (if (orderValid) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let scale8 = 100000000 | |
5 | 5 | ||
6 | 6 | let scale8BigInt = toBigInt(100000000) | |
7 | 7 | ||
8 | 8 | let scale18 = toBigInt(1000000000000000000) | |
9 | 9 | ||
10 | 10 | let zeroBigInt = toBigInt(0) | |
11 | 11 | ||
12 | 12 | let big0 = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big1 = toBigInt(1) | |
15 | 15 | ||
16 | 16 | let big2 = toBigInt(2) | |
17 | 17 | ||
18 | 18 | let big3 = toBigInt(3) | |
19 | 19 | ||
20 | 20 | let big4 = toBigInt(4) | |
21 | 21 | ||
22 | 22 | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
23 | 23 | ||
24 | 24 | let wavesString = "WAVES" | |
25 | 25 | ||
26 | 26 | let Amult = "100" | |
27 | 27 | ||
28 | 28 | let Dconv = "1" | |
29 | 29 | ||
30 | 30 | let SEP = "__" | |
31 | 31 | ||
32 | 32 | let EMPTY = "" | |
33 | 33 | ||
34 | 34 | let PoolActive = 1 | |
35 | 35 | ||
36 | 36 | let PoolPutDis = 2 | |
37 | 37 | ||
38 | 38 | let PoolMatcherDis = 3 | |
39 | 39 | ||
40 | 40 | let PoolShutdown = 4 | |
41 | 41 | ||
42 | 42 | let idxPoolAddress = 1 | |
43 | 43 | ||
44 | 44 | let idxPoolSt = 2 | |
45 | 45 | ||
46 | 46 | let idxLPAsId = 3 | |
47 | 47 | ||
48 | 48 | let idxAmAsId = 4 | |
49 | 49 | ||
50 | 50 | let idxPrAsId = 5 | |
51 | 51 | ||
52 | 52 | let idxAmtAsDcm = 6 | |
53 | 53 | ||
54 | 54 | let idxPriceAsDcm = 7 | |
55 | 55 | ||
56 | 56 | let idxIAmtAsId = 8 | |
57 | 57 | ||
58 | 58 | let idxIPriceAsId = 9 | |
59 | 59 | ||
60 | 60 | let idxFactStakCntr = 1 | |
61 | 61 | ||
62 | 62 | let idxFactoryRestCntr = 6 | |
63 | 63 | ||
64 | 64 | let idxFactSlippCntr = 7 | |
65 | 65 | ||
66 | 66 | let idxFactGwxRewCntr = 10 | |
67 | 67 | ||
68 | 68 | let feeDefault = fraction(10, scale8, 10000) | |
69 | 69 | ||
70 | 70 | func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func t1BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func t2 (origVal,origScaleMult) = fraction(origVal, scale18, toBigInt(origScaleMult)) | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func f2 (val,resultScaleMult) = fraction(val, toBigInt(resultScaleMult), scale18) | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func abs (val) = if ((zeroBigInt > val)) | |
92 | 92 | then -(val) | |
93 | 93 | else val | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func absBigInt (val) = if ((zeroBigInt > val)) | |
97 | 97 | then -(val) | |
98 | 98 | else val | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func fc () = "%s__factoryContract" | |
102 | 102 | ||
103 | 103 | ||
104 | - | func | |
104 | + | func keyManagerPublicKey () = "%s__managerPublicKey" | |
105 | 105 | ||
106 | 106 | ||
107 | - | func | |
107 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func pl () = "%s%s__price__last" | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP) | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId) | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId) | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | func aa () = "%s__amountAsset" | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | func pa () = "%s__priceAsset" | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | func amp () = "%s__amp" | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func keyAmpHistory (heightBlocks) = ("%s%d__amp__" + toString(heightBlocks)) | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func keyChangeAmpLastCall () = "%s__changeAmpLastCall" | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | let keyFee = "%s__fee" | |
138 | 138 | ||
139 | 139 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
140 | 140 | ||
141 | 141 | let keyDLp = makeString(["%s", "dLp"], SEP) | |
142 | 142 | ||
143 | 143 | let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP) | |
144 | 144 | ||
145 | 145 | let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP) | |
146 | 146 | ||
147 | 147 | let dLpRefreshDelayDefault = 30 | |
148 | 148 | ||
149 | 149 | let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault) | |
150 | 150 | ||
151 | 151 | func fcfg () = "%s__factoryConfig" | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func mtpk () = "%s%s__matcher__publicKey" | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
161 | 161 | ||
162 | 162 | ||
163 | 163 | func aps () = "%s__shutdown" | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash" | |
167 | 167 | ||
168 | 168 | ||
169 | 169 | func keyFeeCollectorAddress () = "%s__feeCollectorAddress" | |
170 | 170 | ||
171 | 171 | ||
172 | 172 | func keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress) | |
173 | 173 | ||
174 | 174 | ||
175 | 175 | func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
176 | 176 | ||
177 | 177 | ||
178 | + | func addressFromStringOrThis (addressString) = match addressFromString(addressString) { | |
179 | + | case a: Address => | |
180 | + | a | |
181 | + | case _ => | |
182 | + | this | |
183 | + | } | |
184 | + | ||
185 | + | ||
186 | + | func getManagerVaultAddressOrThis () = { | |
187 | + | let factoryAddress = match addressFromStringOrThis(fc()) { | |
188 | + | case fca: Address => | |
189 | + | fca | |
190 | + | case _ => | |
191 | + | this | |
192 | + | } | |
193 | + | match getString(factoryAddress, keyManagerVaultAddress()) { | |
194 | + | case s: String => | |
195 | + | addressFromStringOrThis(s) | |
196 | + | case _ => | |
197 | + | this | |
198 | + | } | |
199 | + | } | |
200 | + | ||
201 | + | ||
178 | 202 | func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
179 | 203 | ||
180 | 204 | ||
181 | 205 | func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
182 | 206 | ||
183 | 207 | ||
184 | 208 | func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " ")) | |
185 | 209 | ||
186 | 210 | ||
187 | 211 | func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ") | |
188 | 212 | ||
189 | 213 | ||
190 | 214 | let fca = addressFromStringValue(strf(this, fc())) | |
191 | 215 | ||
192 | 216 | let inFee = { | |
193 | 217 | let @ = invoke(fca, "getInFeeREADONLY", [toString(this)], nil) | |
194 | 218 | if ($isInstanceOf(@, "Int")) | |
195 | 219 | then @ | |
196 | 220 | else throw(($getType(@) + " couldn't be cast to Int")) | |
197 | 221 | } | |
198 | 222 | ||
199 | 223 | let outFee = { | |
200 | 224 | let @ = invoke(fca, "getOutFeeREADONLY", [toString(this)], nil) | |
201 | 225 | if ($isInstanceOf(@, "Int")) | |
202 | 226 | then @ | |
203 | 227 | else throw(($getType(@) + " couldn't be cast to Int")) | |
204 | 228 | } | |
205 | 229 | ||
206 | 230 | let A = strf(this, amp()) | |
207 | 231 | ||
208 | 232 | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
209 | 233 | ||
210 | 234 | ||
211 | 235 | func mp () = fromBase58String(strf(fca, mtpk())) | |
212 | 236 | ||
213 | 237 | ||
214 | 238 | let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress())) | |
215 | 239 | ||
216 | 240 | func gpc () = { | |
217 | 241 | let amtAs = strf(this, aa()) | |
218 | 242 | let priceAs = strf(this, pa()) | |
219 | 243 | let iPriceAs = intf(fca, mba(priceAs)) | |
220 | 244 | let iAmtAs = intf(fca, mba(amtAs)) | |
221 | 245 | split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP) | |
222 | 246 | } | |
223 | 247 | ||
224 | 248 | ||
225 | 249 | func parseAssetId (input) = if ((input == wavesString)) | |
226 | 250 | then unit | |
227 | 251 | else fromBase58String(input) | |
228 | 252 | ||
229 | 253 | ||
230 | 254 | func assetIdToString (input) = if ((input == unit)) | |
231 | 255 | then wavesString | |
232 | 256 | else toBase58String(value(input)) | |
233 | 257 | ||
234 | 258 | ||
235 | 259 | func parsePoolConfig (poolConfig) = $Tuple9(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolSt]), fromBase58String(poolConfig[idxLPAsId]), parseAssetId(poolConfig[idxAmAsId]), parseAssetId(poolConfig[idxPrAsId]), parseIntValue(poolConfig[idxAmtAsDcm]), parseIntValue(poolConfig[idxPriceAsDcm]), fromBase58String(poolConfig[idxIAmtAsId]), fromBase58String(poolConfig[idxIPriceAsId])) | |
236 | 260 | ||
237 | 261 | ||
238 | 262 | let poolConfigParsed = parsePoolConfig(gpc()) | |
239 | 263 | ||
240 | - | let $ | |
264 | + | let $t086768905 = poolConfigParsed | |
241 | 265 | ||
242 | - | let cfgPoolAddress = $ | |
266 | + | let cfgPoolAddress = $t086768905._1 | |
243 | 267 | ||
244 | - | let cfgPoolStatus = $ | |
268 | + | let cfgPoolStatus = $t086768905._2 | |
245 | 269 | ||
246 | - | let cfgLpAssetId = $ | |
270 | + | let cfgLpAssetId = $t086768905._3 | |
247 | 271 | ||
248 | - | let cfgAmountAssetId = $ | |
272 | + | let cfgAmountAssetId = $t086768905._4 | |
249 | 273 | ||
250 | - | let cfgPriceAssetId = $ | |
274 | + | let cfgPriceAssetId = $t086768905._5 | |
251 | 275 | ||
252 | - | let cfgAmountAssetDecimals = $ | |
276 | + | let cfgAmountAssetDecimals = $t086768905._6 | |
253 | 277 | ||
254 | - | let cfgPriceAssetDecimals = $ | |
278 | + | let cfgPriceAssetDecimals = $t086768905._7 | |
255 | 279 | ||
256 | - | let cfgInAmountAssedId = $ | |
280 | + | let cfgInAmountAssedId = $t086768905._8 | |
257 | 281 | ||
258 | - | let cfgInPriceAssetId = $ | |
282 | + | let cfgInPriceAssetId = $t086768905._9 | |
259 | 283 | ||
260 | 284 | func gfc () = split(strf(fca, fcfg()), SEP) | |
261 | 285 | ||
262 | 286 | ||
263 | 287 | let factoryConfig = gfc() | |
264 | 288 | ||
265 | 289 | let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address") | |
266 | 290 | ||
267 | 291 | let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address") | |
268 | 292 | ||
269 | 293 | let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address") | |
270 | 294 | ||
271 | 295 | let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address") | |
272 | 296 | ||
273 | 297 | func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slipByUser,slippageReal,txHeight,txTimestamp,slipageAmAmt,slipagePrAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slipByUser), toString(slippageReal), toString(txHeight), toString(txTimestamp), toString(slipageAmAmt), toString(slipagePrAmt)], SEP) | |
274 | 298 | ||
275 | 299 | ||
276 | 300 | 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) | |
277 | 301 | ||
278 | 302 | ||
279 | 303 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
280 | 304 | then wavesBalance(this).available | |
281 | 305 | else assetBalance(this, fromBase58String(assetId)) | |
282 | 306 | ||
283 | 307 | ||
284 | 308 | func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
285 | 309 | ||
286 | 310 | ||
287 | 311 | func cpbir (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
288 | 312 | ||
289 | 313 | ||
290 | 314 | func vad (A1,A2,slippage) = { | |
291 | 315 | let diff = fraction((A1 - A2), scale8BigInt, A2) | |
292 | 316 | let pass = ((slippage - abs(diff)) > zeroBigInt) | |
293 | 317 | if (!(pass)) | |
294 | 318 | then throw(("Big slpg: " + toString(diff))) | |
295 | 319 | else $Tuple2(pass, min([A1, A2])) | |
296 | 320 | } | |
297 | 321 | ||
298 | 322 | ||
299 | 323 | func vd (D1,D0,slpg) = { | |
300 | 324 | let diff = fraction(D0, scale8BigInt, D1) | |
301 | 325 | let fail = (slpg > diff) | |
302 | 326 | if (if (fail) | |
303 | 327 | then true | |
304 | 328 | else (D0 > D1)) | |
305 | 329 | then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg))) | |
306 | 330 | else fail | |
307 | 331 | } | |
308 | 332 | ||
309 | 333 | ||
310 | 334 | func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
311 | 335 | let amtAsAmtX18 = t1(amAmt, amAssetDcm) | |
312 | 336 | let prAsAmtX18 = t1(prAmt, prAssetDcm) | |
313 | 337 | cpbi(prAsAmtX18, amtAsAmtX18) | |
314 | 338 | } | |
315 | 339 | ||
316 | 340 | ||
317 | 341 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
318 | 342 | let amtAsDcm = cfgAmountAssetDecimals | |
319 | 343 | let prAsDcm = cfgPriceAssetDecimals | |
320 | 344 | let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt) | |
321 | 345 | let amAmtX18 = t1(amAmt, amtAsDcm) | |
322 | 346 | let prAmtX18 = t1(prAmt, prAsDcm) | |
323 | 347 | let lpAmtX18 = t1(lpAmt, scale8) | |
324 | 348 | let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18) | |
325 | 349 | let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18) | |
326 | 350 | [priceX18, lpPrInAmAsX18, lpPrInPrAsX18] | |
327 | 351 | } | |
328 | 352 | ||
329 | 353 | ||
330 | 354 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
331 | 355 | let p = calcPrices(amAmt, prAmt, lpAmt) | |
332 | 356 | [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)] | |
333 | 357 | } | |
334 | 358 | ||
335 | 359 | ||
336 | 360 | func takeFee (amount,fee) = { | |
337 | 361 | let feeAmount = if ((fee == 0)) | |
338 | 362 | then 0 | |
339 | 363 | else fraction(amount, fee, scale8) | |
340 | 364 | $Tuple2((amount - feeAmount), feeAmount) | |
341 | 365 | } | |
342 | 366 | ||
343 | 367 | ||
344 | 368 | func getD (xp) = { | |
345 | 369 | let xp0 = xp[0] | |
346 | 370 | let xp1 = xp[1] | |
347 | 371 | let s = (xp0 + xp1) | |
348 | 372 | if ((s == big0)) | |
349 | 373 | then big0 | |
350 | 374 | else { | |
351 | 375 | let a = parseIntValue(A) | |
352 | 376 | let ann = (a * 2) | |
353 | 377 | let p = fraction(xp0, xp1, big1) | |
354 | 378 | let xp0_xp1_n_n = fraction(p, big4, big1) | |
355 | 379 | let ann_s = fraction(toBigInt(ann), s, big1) | |
356 | 380 | let ann_1 = toBigInt((ann - 1)) | |
357 | 381 | func calcDNext (d) = { | |
358 | 382 | let dd = fraction(d, d, big1) | |
359 | 383 | let ddd = fraction(dd, d, big1) | |
360 | 384 | let dp = fraction(ddd, big1, xp0_xp1_n_n) | |
361 | 385 | fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1))) | |
362 | 386 | } | |
363 | 387 | ||
364 | 388 | func calc (acc,i) = if (acc._2) | |
365 | 389 | then acc | |
366 | 390 | else { | |
367 | 391 | let d = acc._1 | |
368 | 392 | let dNext = calcDNext(d) | |
369 | 393 | let dDiffRaw = (dNext - value(d)) | |
370 | 394 | let dDiff = if ((big0 > dDiffRaw)) | |
371 | 395 | then -(dDiffRaw) | |
372 | 396 | else dDiffRaw | |
373 | 397 | if ((big1 >= dDiff)) | |
374 | 398 | then $Tuple2(dNext, true) | |
375 | 399 | else $Tuple2(dNext, false) | |
376 | 400 | } | |
377 | 401 | ||
378 | 402 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | |
379 | - | let $ | |
403 | + | let $t01341013458 = { | |
380 | 404 | let $l = arr | |
381 | 405 | let $s = size($l) | |
382 | 406 | let $acc0 = $Tuple2(s, false) | |
383 | 407 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
384 | 408 | then $a | |
385 | 409 | else calc($a, $l[$i]) | |
386 | 410 | ||
387 | 411 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
388 | 412 | then $a | |
389 | 413 | else throw("List size exceeds 17") | |
390 | 414 | ||
391 | 415 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17) | |
392 | 416 | } | |
393 | - | let d = $ | |
394 | - | let found = $ | |
417 | + | let d = $t01341013458._1 | |
418 | + | let found = $t01341013458._2 | |
395 | 419 | if (found) | |
396 | 420 | then d | |
397 | 421 | else throw(("D calculation error, D = " + toString(d))) | |
398 | 422 | } | |
399 | 423 | } | |
400 | 424 | ||
401 | 425 | ||
402 | 426 | func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
403 | 427 | let lpId = cfgLpAssetId | |
404 | 428 | let amId = toBase58String(value(cfgAmountAssetId)) | |
405 | 429 | let prId = toBase58String(value(cfgPriceAssetId)) | |
406 | 430 | let amDcm = cfgAmountAssetDecimals | |
407 | 431 | let prDcm = cfgPriceAssetDecimals | |
408 | 432 | let sts = toString(cfgPoolStatus) | |
409 | 433 | let lpEmiss = valueOrErrorMessage(assetInfo(lpId), "Wrong LP id").quantity | |
410 | 434 | if ((toBase58String(lpId) != pmtAssetId)) | |
411 | 435 | then throw("Wrong pmt asset") | |
412 | 436 | else { | |
413 | 437 | let amBalance = getAccBalance(amId) | |
414 | 438 | let amBalanceX18 = t1(amBalance, amDcm) | |
415 | 439 | let prBalance = getAccBalance(prId) | |
416 | 440 | let prBalanceX18 = t1(prBalance, prDcm) | |
417 | 441 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
418 | 442 | let curPrice = f1(curPriceX18, scale8) | |
419 | 443 | let pmtLpAmtX18 = t1(pmtLpAmt, scale8) | |
420 | 444 | let lpEmissX18 = t1(lpEmiss, scale8) | |
421 | 445 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18) | |
422 | 446 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18) | |
423 | 447 | let outAmAmt = fromX18Round(outAmAmtX18, amDcm, FLOOR) | |
424 | 448 | let outPrAmt = fromX18Round(outPrAmtX18, prDcm, FLOOR) | |
425 | 449 | let state = if ((txId58 == "")) | |
426 | 450 | then nil | |
427 | 451 | else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES")) | |
428 | 452 | then unit | |
429 | 453 | else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES")) | |
430 | 454 | then unit | |
431 | 455 | else fromBase58String(prId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)] | |
432 | 456 | $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state) | |
433 | 457 | } | |
434 | 458 | } | |
435 | 459 | ||
436 | 460 | ||
437 | 461 | func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
438 | 462 | let lpId = cfgLpAssetId | |
439 | 463 | let amIdStr = toBase58String(value(cfgAmountAssetId)) | |
440 | 464 | let prIdStr = toBase58String(value(cfgPriceAssetId)) | |
441 | 465 | let inAmIdStr = cfgInAmountAssedId | |
442 | 466 | let inPrIdStr = cfgInPriceAssetId | |
443 | 467 | let amtDcm = cfgAmountAssetDecimals | |
444 | 468 | let priceDcm = cfgPriceAssetDecimals | |
445 | 469 | let sts = toString(cfgPoolStatus) | |
446 | 470 | let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity | |
447 | 471 | let amBalance = if (isEval) | |
448 | 472 | then getAccBalance(amIdStr) | |
449 | 473 | else if (if (isOneAsset) | |
450 | 474 | then (pmtId == amIdStr) | |
451 | 475 | else false) | |
452 | 476 | then (getAccBalance(amIdStr) - pmtAmt) | |
453 | 477 | else if (isOneAsset) | |
454 | 478 | then getAccBalance(amIdStr) | |
455 | 479 | else (getAccBalance(amIdStr) - inAmAmt) | |
456 | 480 | let prBalance = if (isEval) | |
457 | 481 | then getAccBalance(prIdStr) | |
458 | 482 | else if (if (isOneAsset) | |
459 | 483 | then (pmtId == prIdStr) | |
460 | 484 | else false) | |
461 | 485 | then (getAccBalance(prIdStr) - pmtAmt) | |
462 | 486 | else if (isOneAsset) | |
463 | 487 | then getAccBalance(prIdStr) | |
464 | 488 | else (getAccBalance(prIdStr) - inPrAmt) | |
465 | 489 | let inAmAssetAmtX18 = t1(inAmAmt, amtDcm) | |
466 | 490 | let inPrAssetAmtX18 = t1(inPrAmt, priceDcm) | |
467 | 491 | let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18) | |
468 | 492 | let amBalanceX18 = t1(amBalance, amtDcm) | |
469 | 493 | let prBalanceX18 = t1(prBalance, priceDcm) | |
470 | 494 | let D0 = getD([amBalanceX18, prBalanceX18]) | |
471 | 495 | let r = if ((lpEm == 0)) | |
472 | 496 | then { | |
473 | 497 | let D1 = getD([(amBalanceX18 + inAmAssetAmtX18), (prBalanceX18 + inPrAssetAmtX18)]) | |
474 | 498 | let checkD = if ((D1 > D0)) | |
475 | 499 | then true | |
476 | 500 | else throw("D1 should be greater than D0") | |
477 | 501 | if ((checkD == checkD)) | |
478 | 502 | then { | |
479 | 503 | let curPriceX18 = zeroBigInt | |
480 | 504 | let slippageX18 = zeroBigInt | |
481 | 505 | let lpAmtX18 = D1 | |
482 | 506 | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
483 | 507 | } | |
484 | 508 | else throw("Strict value is not equal to itself.") | |
485 | 509 | } | |
486 | 510 | else { | |
487 | 511 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
488 | 512 | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
489 | 513 | let slippageX18 = t1(slippage, scale8) | |
490 | 514 | if (if (if (validateSlippage) | |
491 | 515 | then (curPriceX18 != zeroBigInt) | |
492 | 516 | else false) | |
493 | 517 | then (slippageRealX18 > slippageX18) | |
494 | 518 | else false) | |
495 | 519 | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
496 | 520 | else { | |
497 | 521 | let lpEmissionX18 = t1(lpEm, scale8) | |
498 | 522 | let prViaAmX18 = fraction(inAmAssetAmtX18, cpbir(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
499 | 523 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, cpbir(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
500 | 524 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
501 | 525 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
502 | 526 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
503 | 527 | let expAmtAssetAmtX18 = expectedAmts._1 | |
504 | 528 | let expPriceAssetAmtX18 = expectedAmts._2 | |
505 | 529 | let D1 = getD([(amBalanceX18 + expAmtAssetAmtX18), (prBalanceX18 + expPriceAssetAmtX18)]) | |
506 | 530 | let checkD = if ((D1 > D0)) | |
507 | 531 | then true | |
508 | 532 | else throw("D1 should be greater than D0") | |
509 | 533 | if ((checkD == checkD)) | |
510 | 534 | then { | |
511 | 535 | let lpAmtX18 = fraction(lpEmissionX18, (D1 - D0), D0) | |
512 | 536 | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceDcm, CEILING), curPriceX18, slippageX18) | |
513 | 537 | } | |
514 | 538 | else throw("Strict value is not equal to itself.") | |
515 | 539 | } | |
516 | 540 | } | |
517 | 541 | let calcLpAmt = r._1 | |
518 | 542 | let calcAmAssetPmt = r._2 | |
519 | 543 | let calcPrAssetPmt = r._3 | |
520 | 544 | let curPrice = f1(r._4, scale8) | |
521 | 545 | let slippageCalc = f1(r._5, scale8) | |
522 | 546 | if ((0 >= calcLpAmt)) | |
523 | 547 | then throw("LP <= 0") | |
524 | 548 | else { | |
525 | 549 | let emitLpAmt = if (!(emitLp)) | |
526 | 550 | then 0 | |
527 | 551 | else calcLpAmt | |
528 | 552 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
529 | 553 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
530 | - | let $ | |
554 | + | let $t02129721642 = if (if (isOneAsset) | |
531 | 555 | then (pmtId == amIdStr) | |
532 | 556 | else false) | |
533 | 557 | then $Tuple2(pmtAmt, 0) | |
534 | 558 | else if (if (isOneAsset) | |
535 | 559 | then (pmtId == prIdStr) | |
536 | 560 | else false) | |
537 | 561 | then $Tuple2(0, pmtAmt) | |
538 | 562 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
539 | - | let writeAmAmt = $ | |
540 | - | let writePrAmt = $ | |
563 | + | let writeAmAmt = $t02129721642._1 | |
564 | + | let writePrAmt = $t02129721642._2 | |
541 | 565 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
542 | 566 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
543 | 567 | } | |
544 | 568 | } | |
545 | 569 | ||
546 | 570 | ||
547 | 571 | func getYD (xp,i,D) = { | |
548 | 572 | let n = big2 | |
549 | 573 | let x = xp[if ((i == 0)) | |
550 | 574 | then 1 | |
551 | 575 | else 0] | |
552 | 576 | let aPrecision = parseBigIntValue(Amult) | |
553 | 577 | let a = (parseBigIntValue(A) * aPrecision) | |
554 | 578 | let s = x | |
555 | 579 | let ann = (a * n) | |
556 | 580 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
557 | 581 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
558 | 582 | func calc (acc,cur) = { | |
559 | - | let $ | |
560 | - | let y = $ | |
561 | - | let found = $ | |
583 | + | let $t02283722857 = acc | |
584 | + | let y = $t02283722857._1 | |
585 | + | let found = $t02283722857._2 | |
562 | 586 | if ((found != unit)) | |
563 | 587 | then acc | |
564 | 588 | else { | |
565 | 589 | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
566 | 590 | let yDiff = absBigInt((yNext - value(y))) | |
567 | 591 | if ((big1 >= yDiff)) | |
568 | 592 | then $Tuple2(yNext, cur) | |
569 | 593 | else $Tuple2(yNext, unit) | |
570 | 594 | } | |
571 | 595 | } | |
572 | 596 | ||
573 | 597 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
574 | - | let $ | |
598 | + | let $t02316423211 = { | |
575 | 599 | let $l = arr | |
576 | 600 | let $s = size($l) | |
577 | 601 | let $acc0 = $Tuple2(D, unit) | |
578 | 602 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
579 | 603 | then $a | |
580 | 604 | else calc($a, $l[$i]) | |
581 | 605 | ||
582 | 606 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
583 | 607 | then $a | |
584 | 608 | else throw("List size exceeds 15") | |
585 | 609 | ||
586 | 610 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
587 | 611 | } | |
588 | - | let y = $ | |
589 | - | let found = $ | |
612 | + | let y = $t02316423211._1 | |
613 | + | let found = $t02316423211._2 | |
590 | 614 | if ((found != unit)) | |
591 | 615 | then y | |
592 | 616 | else throw(("Y calculation error, Y = " + toString(y))) | |
593 | 617 | } | |
594 | 618 | ||
595 | 619 | ||
596 | 620 | func calcDLp (amountBalance,priceBalance,lpEmission) = { | |
597 | 621 | let updatedDLp = fraction(getD([t1BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)), t1BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))]), scale18, lpEmission) | |
598 | 622 | if ((lpEmission == big0)) | |
599 | 623 | then big0 | |
600 | 624 | else updatedDLp | |
601 | 625 | } | |
602 | 626 | ||
603 | 627 | ||
604 | 628 | func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
605 | 629 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
606 | 630 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
607 | 631 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
608 | 632 | let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
609 | 633 | currentDLp | |
610 | 634 | } | |
611 | 635 | ||
612 | 636 | ||
613 | 637 | func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
614 | 638 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
615 | 639 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
616 | 640 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
617 | 641 | let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
618 | 642 | let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))] | |
619 | 643 | $Tuple2(actions, updatedDLp) | |
620 | 644 | } | |
621 | 645 | ||
622 | 646 | ||
623 | 647 | func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp)) | |
624 | 648 | then true | |
625 | 649 | else throwErr("updated DLp lower than current DLp") | |
626 | 650 | ||
627 | 651 | ||
628 | 652 | func validateMatcherOrderAllowed (order) = { | |
629 | 653 | let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
630 | 654 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
631 | 655 | let amountAssetAmount = order.amount | |
632 | 656 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
633 | - | let $ | |
657 | + | let $t02540925621 = if ((order.orderType == Buy)) | |
634 | 658 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
635 | 659 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
636 | - | let amountAssetBalanceDelta = $ | |
637 | - | let priceAssetBalanceDelta = $ | |
660 | + | let amountAssetBalanceDelta = $t02540925621._1 | |
661 | + | let priceAssetBalanceDelta = $t02540925621._2 | |
638 | 662 | if (if (if (igs()) | |
639 | 663 | then true | |
640 | 664 | else (cfgPoolStatus == PoolMatcherDis)) | |
641 | 665 | then true | |
642 | 666 | else (cfgPoolStatus == PoolShutdown)) | |
643 | 667 | then throw("Admin blocked") | |
644 | 668 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
645 | 669 | then true | |
646 | 670 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
647 | 671 | then throw("Wr assets") | |
648 | 672 | else { | |
649 | 673 | let dLp = parseBigIntValue(valueOrElse(getString(this, keyDLp), "0")) | |
650 | - | let $ | |
651 | - | let unusedActions = $ | |
652 | - | let dLpNew = $ | |
674 | + | let $t02596326063 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
675 | + | let unusedActions = $t02596326063._1 | |
676 | + | let dLpNew = $t02596326063._2 | |
653 | 677 | let isOrderValid = (dLpNew >= dLp) | |
654 | 678 | let info = makeString(["dLp=", toString(dLp), " dLpNew=", toString(dLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
655 | 679 | $Tuple2(isOrderValid, info) | |
656 | 680 | } | |
657 | 681 | } | |
658 | 682 | ||
659 | 683 | ||
660 | 684 | func cg (i) = if ((size(i.payments) != 1)) | |
661 | 685 | then throw("1 pmnt exp") | |
662 | 686 | else { | |
663 | 687 | let pmt = value(i.payments[0]) | |
664 | 688 | let pmtAssetId = value(pmt.assetId) | |
665 | 689 | let pmtAmt = pmt.amount | |
666 | 690 | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
667 | 691 | let outAmAmt = r._1 | |
668 | 692 | let outPrAmt = r._2 | |
669 | 693 | let sts = parseIntValue(r._9) | |
670 | 694 | let state = r._10 | |
671 | 695 | if (if (igs()) | |
672 | 696 | then true | |
673 | 697 | else (sts == PoolShutdown)) | |
674 | 698 | then throw(("Admin blocked: " + toString(sts))) | |
675 | 699 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
676 | 700 | } | |
677 | 701 | ||
678 | 702 | ||
679 | 703 | func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
680 | 704 | let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId) | |
681 | 705 | let sts = parseIntValue(r._8) | |
682 | 706 | if (if (if (igs()) | |
683 | 707 | then true | |
684 | 708 | else (sts == PoolPutDis)) | |
685 | 709 | then true | |
686 | 710 | else (sts == PoolShutdown)) | |
687 | 711 | then throw(("Blocked:" + toString(sts))) | |
688 | 712 | else r | |
689 | 713 | } | |
690 | 714 | ||
691 | 715 | ||
692 | 716 | func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = { | |
693 | 717 | let amId = toBase58String(value(cfgAmountAssetId)) | |
694 | 718 | let prId = toBase58String(value(cfgPriceAssetId)) | |
695 | 719 | let lpId = cfgLpAssetId | |
696 | 720 | let amtDcm = cfgAmountAssetDecimals | |
697 | 721 | let priceDcm = cfgPriceAssetDecimals | |
698 | 722 | let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(lpId), "invalid lp asset").quantity) | |
699 | 723 | let chechEmission = if ((lpAssetEmission > big0)) | |
700 | 724 | then true | |
701 | 725 | else throw("initial deposit requires all coins") | |
702 | 726 | if ((chechEmission == chechEmission)) | |
703 | 727 | then { | |
704 | 728 | let amBalance = getAccBalance(amId) | |
705 | 729 | let prBalance = getAccBalance(prId) | |
706 | - | let $ | |
730 | + | let $t02871929181 = if ((txId == "")) | |
707 | 731 | then $Tuple2(amBalance, prBalance) | |
708 | 732 | else if ((pmtAssetId == amId)) | |
709 | 733 | then if ((pmtAmtRaw > amBalance)) | |
710 | 734 | then throw("invalid payment amount") | |
711 | 735 | else $Tuple2((amBalance - pmtAmtRaw), prBalance) | |
712 | 736 | else if ((pmtAssetId == prId)) | |
713 | 737 | then if ((pmtAmtRaw > prBalance)) | |
714 | 738 | then throw("invalid payment amount") | |
715 | 739 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
716 | 740 | else throw("wrong pmtAssetId") | |
717 | - | let amBalanceOld = $ | |
718 | - | let prBalanceOld = $ | |
719 | - | let $ | |
741 | + | let amBalanceOld = $t02871929181._1 | |
742 | + | let prBalanceOld = $t02871929181._2 | |
743 | + | let $t02918729363 = if ((pmtAssetId == amId)) | |
720 | 744 | then $Tuple2(pmtAmtRaw, 0) | |
721 | 745 | else if ((pmtAssetId == prId)) | |
722 | 746 | then $Tuple2(0, pmtAmtRaw) | |
723 | 747 | else throw("invalid payment") | |
724 | - | let amAmountRaw = $ | |
725 | - | let prAmountRaw = $ | |
726 | - | let $ | |
748 | + | let amAmountRaw = $t02918729363._1 | |
749 | + | let prAmountRaw = $t02918729363._2 | |
750 | + | let $t02936729621 = if (withTakeFee) | |
727 | 751 | then $Tuple3(takeFee(amAmountRaw, inFee)._1, takeFee(prAmountRaw, inFee)._1, takeFee(pmtAmtRaw, inFee)._2) | |
728 | 752 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
729 | - | let amAmount = $ | |
730 | - | let prAmount = $ | |
731 | - | let feeAmount = $ | |
753 | + | let amAmount = $t02936729621._1 | |
754 | + | let prAmount = $t02936729621._2 | |
755 | + | let feeAmount = $t02936729621._3 | |
732 | 756 | let amBalanceNew = (amBalanceOld + amAmount) | |
733 | 757 | let prBalanceNew = (prBalanceOld + prAmount) | |
734 | 758 | let D0 = getD([t1(amBalanceOld, cfgAmountAssetDecimals), t1(prBalanceOld, cfgPriceAssetDecimals)]) | |
735 | 759 | let D1 = getD([t1(amBalanceNew, cfgAmountAssetDecimals), t1(prBalanceNew, cfgPriceAssetDecimals)]) | |
736 | 760 | let checkD = if ((D1 > D0)) | |
737 | 761 | then true | |
738 | 762 | else throw() | |
739 | 763 | if ((checkD == checkD)) | |
740 | 764 | then { | |
741 | 765 | let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0, FLOOR) | |
742 | 766 | let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8) | |
743 | 767 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId), dataPutActionInfo(amAmountRaw, prAmountRaw, toInt(lpAmount), curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
744 | 768 | let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld) | |
745 | 769 | let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8)) | |
746 | 770 | let priceAssetPart = (pmtAmtRaw - amountAssetPart) | |
747 | 771 | let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld)) | |
748 | 772 | let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth)) | |
749 | 773 | $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus) | |
750 | 774 | } | |
751 | 775 | else throw("Strict value is not equal to itself.") | |
752 | 776 | } | |
753 | 777 | else throw("Strict value is not equal to itself.") | |
754 | 778 | } | |
755 | 779 | ||
756 | 780 | ||
757 | 781 | func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = { | |
758 | 782 | let lpId = toBase58String(value(cfgLpAssetId)) | |
759 | 783 | let amId = toBase58String(value(cfgAmountAssetId)) | |
760 | 784 | let prId = toBase58String(value(cfgPriceAssetId)) | |
761 | 785 | let amDecimals = cfgAmountAssetDecimals | |
762 | 786 | let prDecimals = cfgPriceAssetDecimals | |
763 | 787 | let poolStatus = cfgPoolStatus | |
764 | 788 | let userAddress = if ((caller == restContract)) | |
765 | 789 | then originCaller | |
766 | 790 | else caller | |
767 | 791 | let pmt = value(payments[0]) | |
768 | 792 | let pmtAssetId = value(pmt.assetId) | |
769 | 793 | let pmtAmt = pmt.amount | |
770 | 794 | let currentDLp = calcCurrentDLp(big0, big0, big0) | |
771 | 795 | if ((currentDLp == currentDLp)) | |
772 | 796 | then { | |
773 | 797 | let txId58 = toBase58String(transactionId) | |
774 | 798 | if ((lpId != toBase58String(pmtAssetId))) | |
775 | 799 | then throw("Wrong LP") | |
776 | 800 | else { | |
777 | 801 | let amBalance = getAccBalance(amId) | |
778 | 802 | let prBalance = getAccBalance(prId) | |
779 | - | let $ | |
803 | + | let $t03173331844 = { | |
780 | 804 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
781 | 805 | if ($isInstanceOf(@, "(Int, Int)")) | |
782 | 806 | then @ | |
783 | 807 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
784 | 808 | } | |
785 | - | if (($ | |
809 | + | if (($t03173331844 == $t03173331844)) | |
786 | 810 | then { | |
787 | - | let feeAmount = $ | |
788 | - | let totalGet = $ | |
811 | + | let feeAmount = $t03173331844._2 | |
812 | + | let totalGet = $t03173331844._1 | |
789 | 813 | let totalAmount = if (if ((minOutAmount > 0)) | |
790 | 814 | then (minOutAmount > totalGet) | |
791 | 815 | else false) | |
792 | 816 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
793 | 817 | else totalGet | |
794 | - | let $ | |
818 | + | let $t03203432341 = if ((outAssetId == amId)) | |
795 | 819 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
796 | 820 | else if ((outAssetId == prId)) | |
797 | 821 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
798 | 822 | else throw("invalid out asset id") | |
799 | - | let outAm = $ | |
800 | - | let outPr = $ | |
801 | - | let amBalanceNew = $ | |
802 | - | let prBalanceNew = $ | |
823 | + | let outAm = $t03203432341._1 | |
824 | + | let outPr = $t03203432341._2 | |
825 | + | let amBalanceNew = $t03203432341._3 | |
826 | + | let prBalanceNew = $t03203432341._4 | |
803 | 827 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
804 | 828 | let curPr = f1(curPrX18, scale8) | |
805 | 829 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
806 | 830 | then unit | |
807 | 831 | else fromBase58String(outAssetId) | |
808 | 832 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
809 | 833 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
810 | 834 | else nil | |
811 | 835 | let state = ([ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] ++ sendFeeToMatcher) | |
812 | 836 | if ((state == state)) | |
813 | 837 | then { | |
814 | 838 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
815 | 839 | if ((burn == burn)) | |
816 | 840 | then { | |
817 | - | let $ | |
841 | + | let $t03312633476 = { | |
818 | 842 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
819 | 843 | then 0 | |
820 | 844 | else feeAmount | |
821 | 845 | let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId)) | |
822 | 846 | then true | |
823 | 847 | else false | |
824 | 848 | if (outInAmountAsset) | |
825 | 849 | then $Tuple2(-((totalGet + feeAmountForCalc)), 0) | |
826 | 850 | else $Tuple2(0, -((totalGet + feeAmountForCalc))) | |
827 | 851 | } | |
828 | - | let amountAssetBalanceDelta = $ | |
829 | - | let priceAssetBalanceDelta = $ | |
830 | - | let $ | |
831 | - | let refreshDLpActions = $ | |
832 | - | let updatedDLp = $ | |
852 | + | let amountAssetBalanceDelta = $t03312633476._1 | |
853 | + | let priceAssetBalanceDelta = $t03312633476._2 | |
854 | + | let $t03347933587 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
855 | + | let refreshDLpActions = $t03347933587._1 | |
856 | + | let updatedDLp = $t03347933587._2 | |
833 | 857 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
834 | 858 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
835 | 859 | then $Tuple2((state ++ refreshDLpActions), totalAmount) | |
836 | 860 | else throw("Strict value is not equal to itself.") | |
837 | 861 | } | |
838 | 862 | else throw("Strict value is not equal to itself.") | |
839 | 863 | } | |
840 | 864 | else throw("Strict value is not equal to itself.") | |
841 | 865 | } | |
842 | 866 | else throw("Strict value is not equal to itself.") | |
843 | 867 | } | |
844 | 868 | } | |
845 | 869 | else throw("Strict value is not equal to itself.") | |
846 | 870 | } | |
847 | 871 | ||
848 | 872 | ||
849 | - | func m () = match getString(mpk()) { | |
850 | - | case s: String => | |
851 | - | fromBase58String(s) | |
852 | - | case _: Unit => | |
853 | - | unit | |
854 | - | case _ => | |
855 | - | throw("Match error") | |
856 | - | } | |
857 | - | ||
858 | - | ||
859 | - | func pm () = match getString(pmpk()) { | |
860 | - | case s: String => | |
861 | - | fromBase58String(s) | |
862 | - | case _: Unit => | |
863 | - | unit | |
864 | - | case _ => | |
865 | - | throw("Match error") | |
866 | - | } | |
873 | + | func managerPublicKeyOrUnit () = { | |
874 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
875 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
876 | + | case s: String => | |
877 | + | fromBase58String(s) | |
878 | + | case _: Unit => | |
879 | + | unit | |
880 | + | case _ => | |
881 | + | throw("Match error") | |
882 | + | } | |
883 | + | } | |
867 | 884 | ||
868 | 885 | ||
869 | 886 | let pd = throw("Permission denied") | |
870 | 887 | ||
871 | - | func isManager (i) = match | |
888 | + | func isManager (i) = match managerPublicKeyOrUnit() { | |
872 | 889 | case pk: ByteVector => | |
873 | 890 | (i.callerPublicKey == pk) | |
874 | 891 | case _: Unit => | |
875 | 892 | (i.caller == this) | |
876 | 893 | case _ => | |
877 | 894 | throw("Match error") | |
878 | 895 | } | |
879 | 896 | ||
880 | 897 | ||
881 | - | func | |
898 | + | func mustManager (i) = match managerPublicKeyOrUnit() { | |
882 | 899 | case pk: ByteVector => | |
883 | 900 | if ((i.callerPublicKey == pk)) | |
884 | 901 | then true | |
885 | 902 | else pd | |
886 | 903 | case _: Unit => | |
887 | 904 | if ((i.caller == this)) | |
888 | 905 | then true | |
889 | 906 | else pd | |
890 | 907 | case _ => | |
891 | 908 | throw("Match error") | |
892 | 909 | } | |
893 | 910 | ||
894 | 911 | ||
895 | 912 | func getY (isReverse,D,poolAmountInBalance) = { | |
896 | 913 | let poolConfig = gpc() | |
897 | 914 | let amId = poolConfig[idxAmAsId] | |
898 | 915 | let prId = poolConfig[idxPrAsId] | |
899 | 916 | let n = big2 | |
900 | 917 | let aPrecision = parseBigIntValue(Amult) | |
901 | 918 | let a = (parseBigIntValue(A) * aPrecision) | |
902 | 919 | let xp = if ((isReverse == false)) | |
903 | 920 | then [(toBigInt(getAccBalance(amId)) + poolAmountInBalance), toBigInt(getAccBalance(prId))] | |
904 | 921 | else [(toBigInt(getAccBalance(prId)) + poolAmountInBalance), toBigInt(getAccBalance(amId))] | |
905 | 922 | let x = xp[0] | |
906 | 923 | let s = x | |
907 | 924 | let ann = (a * n) | |
908 | 925 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
909 | 926 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
910 | 927 | func calc (acc,cur) = { | |
911 | - | let $ | |
912 | - | let y = $ | |
913 | - | let found = $ | |
928 | + | let $t03507435094 = acc | |
929 | + | let y = $t03507435094._1 | |
930 | + | let found = $t03507435094._2 | |
914 | 931 | if ((found != unit)) | |
915 | 932 | then acc | |
916 | 933 | else { | |
917 | 934 | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
918 | 935 | let yDiff = absBigInt((yNext - value(y))) | |
919 | 936 | if ((big1 >= yDiff)) | |
920 | 937 | then $Tuple2(yNext, cur) | |
921 | 938 | else $Tuple2(yNext, unit) | |
922 | 939 | } | |
923 | 940 | } | |
924 | 941 | ||
925 | 942 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
926 | - | let $ | |
943 | + | let $t03542535472 = { | |
927 | 944 | let $l = arr | |
928 | 945 | let $s = size($l) | |
929 | 946 | let $acc0 = $Tuple2(D, unit) | |
930 | 947 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
931 | 948 | then $a | |
932 | 949 | else calc($a, $l[$i]) | |
933 | 950 | ||
934 | 951 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
935 | 952 | then $a | |
936 | 953 | else throw("List size exceeds 15") | |
937 | 954 | ||
938 | 955 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
939 | 956 | } | |
940 | - | let y = $ | |
941 | - | let found = $ | |
957 | + | let y = $t03542535472._1 | |
958 | + | let found = $t03542535472._2 | |
942 | 959 | if ((found != unit)) | |
943 | 960 | then y | |
944 | 961 | else throw(("Y calculation error, Y = " + toString(y))) | |
945 | 962 | } | |
946 | 963 | ||
947 | 964 | ||
948 | 965 | func skipOrderValidation () = valueOrElse(getBoolean(fca, keySkipOrderValidation(toString(this))), false) | |
949 | 966 | ||
950 | 967 | ||
951 | 968 | @Callable(i) | |
952 | 969 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
953 | - | let $ | |
970 | + | let $t03582436248 = if ((isReverse == false)) | |
954 | 971 | then { | |
955 | 972 | let assetOut = strf(this, pa()) | |
956 | 973 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, aa()))) + toBigInt(cleanAmountIn)) | |
957 | 974 | $Tuple2(assetOut, poolAmountInBalance) | |
958 | 975 | } | |
959 | 976 | else { | |
960 | 977 | let assetOut = strf(this, aa()) | |
961 | 978 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, pa()))) + toBigInt(cleanAmountIn)) | |
962 | 979 | $Tuple2(assetOut, poolAmountInBalance) | |
963 | 980 | } | |
964 | - | let assetOut = $ | |
965 | - | let poolAmountInBalance = $ | |
981 | + | let assetOut = $t03582436248._1 | |
982 | + | let poolAmountInBalance = $t03582436248._2 | |
966 | 983 | let poolConfig = gpc() | |
967 | 984 | let amId = poolConfig[idxAmAsId] | |
968 | 985 | let prId = poolConfig[idxPrAsId] | |
969 | 986 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
970 | 987 | let D = getD(xp) | |
971 | 988 | let y = getY(isReverse, D, toBigInt(cleanAmountIn)) | |
972 | 989 | let dy = ((toBigInt(getAccBalance(assetOut)) - y) - toBigInt(1)) | |
973 | 990 | let totalGetRaw = max([0, toInt(dy)]) | |
974 | 991 | let newXp = if ((isReverse == false)) | |
975 | 992 | then [((toBigInt(getAccBalance(amId)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)), (toBigInt(getAccBalance(prId)) - dy)] | |
976 | 993 | else [(toBigInt(getAccBalance(amId)) - dy), ((toBigInt(getAccBalance(prId)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount))] | |
977 | 994 | let newD = getD(newXp) | |
978 | 995 | let checkD = if ((newD >= D)) | |
979 | 996 | then true | |
980 | 997 | else throw(makeString(["new D is fewer error", toString(D), toString(newD)], "__")) | |
981 | 998 | if ((checkD == checkD)) | |
982 | 999 | then $Tuple2(nil, totalGetRaw) | |
983 | 1000 | else throw("Strict value is not equal to itself.") | |
984 | 1001 | } | |
985 | 1002 | ||
986 | 1003 | ||
987 | 1004 | ||
988 | 1005 | @Callable(i) | |
989 | 1006 | func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = { | |
990 | 1007 | let swapContact = { | |
991 | 1008 | let @ = invoke(fca, "getSwapContractREADONLY", nil, nil) | |
992 | 1009 | if ($isInstanceOf(@, "String")) | |
993 | 1010 | then @ | |
994 | 1011 | else throw(($getType(@) + " couldn't be cast to String")) | |
995 | 1012 | } | |
996 | 1013 | let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
997 | 1014 | then true | |
998 | 1015 | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
999 | 1016 | then true | |
1000 | 1017 | else throwErr("Permission denied")] | |
1001 | 1018 | if ((checks == checks)) | |
1002 | 1019 | then { | |
1003 | 1020 | let pmt = value(i.payments[0]) | |
1004 | 1021 | let assetIn = assetIdToString(pmt.assetId) | |
1005 | - | let $ | |
1022 | + | let $t03768438078 = if ((isReverse == false)) | |
1006 | 1023 | then { | |
1007 | 1024 | let assetOut = strf(this, pa()) | |
1008 | 1025 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1009 | 1026 | $Tuple2(assetOut, poolAmountInBalance) | |
1010 | 1027 | } | |
1011 | 1028 | else { | |
1012 | 1029 | let assetOut = strf(this, aa()) | |
1013 | 1030 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1014 | 1031 | $Tuple2(assetOut, poolAmountInBalance) | |
1015 | 1032 | } | |
1016 | - | let assetOut = $ | |
1017 | - | let poolAmountInBalance = $ | |
1033 | + | let assetOut = $t03768438078._1 | |
1034 | + | let poolAmountInBalance = $t03768438078._2 | |
1018 | 1035 | let poolConfig = gpc() | |
1019 | 1036 | let amId = poolConfig[idxAmAsId] | |
1020 | 1037 | let prId = poolConfig[idxPrAsId] | |
1021 | 1038 | let xp = if ((isReverse == false)) | |
1022 | 1039 | then [(toBigInt(getAccBalance(amId)) - toBigInt(value(i.payments[0]).amount)), toBigInt(getAccBalance(prId))] | |
1023 | 1040 | else [toBigInt(getAccBalance(amId)), (toBigInt(getAccBalance(prId)) - toBigInt(value(i.payments[0]).amount))] | |
1024 | 1041 | let D = getD(xp) | |
1025 | 1042 | let y = getY(isReverse, D, toBigInt(0)) | |
1026 | 1043 | let dy = ((toBigInt(getAccBalance(assetOut)) - y) - toBigInt(1)) | |
1027 | 1044 | let totalGetRaw = max([0, toInt(dy)]) | |
1028 | 1045 | let checkMin = if ((totalGetRaw >= amountOutMin)) | |
1029 | 1046 | then true | |
1030 | 1047 | else throw("Exchange result is fewer coins than expected") | |
1031 | 1048 | if ((checkMin == checkMin)) | |
1032 | 1049 | then { | |
1033 | 1050 | let newXp = if ((isReverse == false)) | |
1034 | 1051 | then [(toBigInt(getAccBalance(amId)) + toBigInt(feePoolAmount)), (toBigInt(getAccBalance(prId)) - dy)] | |
1035 | 1052 | else [(toBigInt(getAccBalance(amId)) - dy), (toBigInt(getAccBalance(prId)) + toBigInt(feePoolAmount))] | |
1036 | 1053 | let newD = getD(newXp) | |
1037 | 1054 | let checkD = if ((newD >= D)) | |
1038 | 1055 | then true | |
1039 | 1056 | else throw("new D is fewer error") | |
1040 | 1057 | if ((checkD == checkD)) | |
1041 | 1058 | then $Tuple2([ScriptTransfer(addressFromStringValue(addressTo), totalGetRaw, parseAssetId(assetOut))], totalGetRaw) | |
1042 | 1059 | else throw("Strict value is not equal to itself.") | |
1043 | 1060 | } | |
1044 | 1061 | else throw("Strict value is not equal to itself.") | |
1045 | 1062 | } | |
1046 | 1063 | else throw("Strict value is not equal to itself.") | |
1047 | 1064 | } | |
1048 | 1065 | ||
1049 | 1066 | ||
1050 | 1067 | ||
1051 | 1068 | @Callable(i) | |
1052 | 1069 | func constructor (fc) = { | |
1053 | - | let c = | |
1070 | + | let c = mustManager(i) | |
1054 | 1071 | if ((c == c)) | |
1055 | 1072 | then [StringEntry(fc(), fc)] | |
1056 | - | else throw("Strict value is not equal to itself.") | |
1057 | - | } | |
1058 | - | ||
1059 | - | ||
1060 | - | ||
1061 | - | @Callable(i) | |
1062 | - | func setManager (pendingManagerPublicKey) = { | |
1063 | - | let c = mm(i) | |
1064 | - | if ((c == c)) | |
1065 | - | then { | |
1066 | - | let cm = fromBase58String(pendingManagerPublicKey) | |
1067 | - | if ((cm == cm)) | |
1068 | - | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
1069 | - | else throw("Strict value is not equal to itself.") | |
1070 | - | } | |
1071 | - | else throw("Strict value is not equal to itself.") | |
1072 | - | } | |
1073 | - | ||
1074 | - | ||
1075 | - | ||
1076 | - | @Callable(i) | |
1077 | - | func confirmManager () = { | |
1078 | - | let p = pm() | |
1079 | - | let hpm = if (isDefined(p)) | |
1080 | - | then true | |
1081 | - | else throw("No pending manager") | |
1082 | - | if ((hpm == hpm)) | |
1083 | - | then { | |
1084 | - | let cpm = if ((i.callerPublicKey == value(p))) | |
1085 | - | then true | |
1086 | - | else throw("You are not pending manager") | |
1087 | - | if ((cpm == cpm)) | |
1088 | - | then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())] | |
1089 | - | else throw("Strict value is not equal to itself.") | |
1090 | - | } | |
1091 | 1073 | else throw("Strict value is not equal to itself.") | |
1092 | 1074 | } | |
1093 | 1075 | ||
1094 | 1076 | ||
1095 | 1077 | ||
1096 | 1078 | @Callable(i) | |
1097 | 1079 | func put (slip,autoStake) = { | |
1098 | 1080 | let factCfg = gfc() | |
1099 | 1081 | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
1100 | 1082 | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
1101 | 1083 | if ((0 > slip)) | |
1102 | 1084 | then throw("Wrong slippage") | |
1103 | 1085 | else if ((size(i.payments) != 2)) | |
1104 | 1086 | then throw("2 pmnts expd") | |
1105 | 1087 | else { | |
1106 | 1088 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1107 | 1089 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1108 | 1090 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amAssetPmt) | |
1109 | 1091 | if ((amountAssetBalance == amountAssetBalance)) | |
1110 | 1092 | then { | |
1111 | 1093 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - prAssetPmt) | |
1112 | 1094 | if ((priceAssetBalance == priceAssetBalance)) | |
1113 | 1095 | then { | |
1114 | 1096 | let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity) | |
1115 | 1097 | if ((lpAssetEmission == lpAssetEmission)) | |
1116 | 1098 | then { | |
1117 | 1099 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1118 | 1100 | if ((currentDLp == currentDLp)) | |
1119 | 1101 | then { | |
1120 | 1102 | let e = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], slip, true, false, true, 0, "") | |
1121 | 1103 | let emitLpAmt = e._2 | |
1122 | 1104 | let lpAssetId = e._7 | |
1123 | 1105 | let state = e._9 | |
1124 | 1106 | let amDiff = e._10 | |
1125 | 1107 | let prDiff = e._11 | |
1126 | 1108 | let amId = e._12 | |
1127 | 1109 | let prId = e._13 | |
1128 | 1110 | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
1129 | 1111 | if ((r == r)) | |
1130 | 1112 | then { | |
1131 | 1113 | let el = match r { | |
1132 | 1114 | case legacy: Address => | |
1133 | 1115 | invoke(legacy, "emit", [emitLpAmt], nil) | |
1134 | 1116 | case _ => | |
1135 | 1117 | unit | |
1136 | 1118 | } | |
1137 | 1119 | if ((el == el)) | |
1138 | 1120 | then { | |
1139 | 1121 | let sa = if ((amDiff > 0)) | |
1140 | 1122 | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
1141 | 1123 | else nil | |
1142 | 1124 | if ((sa == sa)) | |
1143 | 1125 | then { | |
1144 | 1126 | let sp = if ((prDiff > 0)) | |
1145 | 1127 | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
1146 | 1128 | else nil | |
1147 | 1129 | if ((sp == sp)) | |
1148 | 1130 | then { | |
1149 | 1131 | let lpTrnsfr = if (autoStake) | |
1150 | 1132 | then { | |
1151 | 1133 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
1152 | 1134 | if ((ss == ss)) | |
1153 | 1135 | then nil | |
1154 | 1136 | else throw("Strict value is not equal to itself.") | |
1155 | 1137 | } | |
1156 | 1138 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1157 | - | let $ | |
1158 | - | let refreshDLpActions = $ | |
1159 | - | let updatedDLp = $ | |
1139 | + | let $t04222242364 = refreshDLpInternal(0, 0, 0) | |
1140 | + | let refreshDLpActions = $t04222242364._1 | |
1141 | + | let updatedDLp = $t04222242364._2 | |
1160 | 1142 | let check = if ((updatedDLp >= currentDLp)) | |
1161 | 1143 | then true | |
1162 | 1144 | else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(amDiff), toString(prDiff)], " ")) | |
1163 | 1145 | if ((check == check)) | |
1164 | 1146 | then { | |
1165 | 1147 | let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity | |
1166 | 1148 | if ((lpAssetEmissionAfter == lpAssetEmissionAfter)) | |
1167 | 1149 | then ((state ++ lpTrnsfr) ++ refreshDLpActions) | |
1168 | 1150 | else throw("Strict value is not equal to itself.") | |
1169 | 1151 | } | |
1170 | 1152 | else throw("Strict value is not equal to itself.") | |
1171 | 1153 | } | |
1172 | 1154 | else throw("Strict value is not equal to itself.") | |
1173 | 1155 | } | |
1174 | 1156 | else throw("Strict value is not equal to itself.") | |
1175 | 1157 | } | |
1176 | 1158 | else throw("Strict value is not equal to itself.") | |
1177 | 1159 | } | |
1178 | 1160 | else throw("Strict value is not equal to itself.") | |
1179 | 1161 | } | |
1180 | 1162 | else throw("Strict value is not equal to itself.") | |
1181 | 1163 | } | |
1182 | 1164 | else throw("Strict value is not equal to itself.") | |
1183 | 1165 | } | |
1184 | 1166 | else throw("Strict value is not equal to itself.") | |
1185 | 1167 | } | |
1186 | 1168 | else throw("Strict value is not equal to itself.") | |
1187 | 1169 | } | |
1188 | 1170 | } | |
1189 | 1171 | ||
1190 | 1172 | ||
1191 | 1173 | ||
1192 | 1174 | @Callable(i) | |
1193 | 1175 | func putOneTknV2 (minOutAmount,autoStake) = { | |
1194 | 1176 | let isPoolOneTokenOperationsDisabled = { | |
1195 | 1177 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1196 | 1178 | if ($isInstanceOf(@, "Boolean")) | |
1197 | 1179 | then @ | |
1198 | 1180 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1199 | 1181 | } | |
1200 | 1182 | let isPutDisabled = if (if (if (igs()) | |
1201 | 1183 | then true | |
1202 | 1184 | else (cfgPoolStatus == PoolPutDis)) | |
1203 | 1185 | then true | |
1204 | 1186 | else (cfgPoolStatus == PoolShutdown)) | |
1205 | 1187 | then true | |
1206 | 1188 | else isPoolOneTokenOperationsDisabled | |
1207 | 1189 | let checks = [if (if (!(isPutDisabled)) | |
1208 | 1190 | then true | |
1209 | 1191 | else isManager(i)) | |
1210 | 1192 | then true | |
1211 | 1193 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1212 | 1194 | then true | |
1213 | 1195 | else throwErr("exactly 1 payment are expected")] | |
1214 | 1196 | if ((checks == checks)) | |
1215 | 1197 | then { | |
1216 | 1198 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1217 | 1199 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1218 | 1200 | let lpId = cfgLpAssetId | |
1219 | 1201 | let amDecimals = cfgAmountAssetDecimals | |
1220 | 1202 | let prDecimals = cfgPriceAssetDecimals | |
1221 | 1203 | let userAddress = if ((i.caller == this)) | |
1222 | 1204 | then i.originCaller | |
1223 | 1205 | else i.caller | |
1224 | 1206 | let pmt = value(i.payments[0]) | |
1225 | 1207 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
1226 | 1208 | let pmtAmt = pmt.amount | |
1227 | 1209 | let currentDLp = if ((pmt.assetId == cfgAmountAssetId)) | |
1228 | 1210 | then calcCurrentDLp(toBigInt(pmtAmt), toBigInt(0), toBigInt(0)) | |
1229 | 1211 | else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0)) | |
1230 | 1212 | if ((currentDLp == currentDLp)) | |
1231 | 1213 | then { | |
1232 | - | let $ | |
1233 | - | if (($ | |
1214 | + | let $t04400544163 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
1215 | + | if (($t04400544163 == $t04400544163)) | |
1234 | 1216 | then { | |
1235 | - | let feeAmount = $ | |
1236 | - | let state = $ | |
1237 | - | let estimLP = $ | |
1217 | + | let feeAmount = $t04400544163._3 | |
1218 | + | let state = $t04400544163._2 | |
1219 | + | let estimLP = $t04400544163._1 | |
1238 | 1220 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
1239 | 1221 | then (minOutAmount > estimLP) | |
1240 | 1222 | else false) | |
1241 | 1223 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1242 | 1224 | else estimLP | |
1243 | 1225 | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
1244 | 1226 | if ((e == e)) | |
1245 | 1227 | then { | |
1246 | 1228 | let el = match e { | |
1247 | 1229 | case legacy: Address => | |
1248 | 1230 | invoke(legacy, "emit", [emitLpAmt], nil) | |
1249 | 1231 | case _ => | |
1250 | 1232 | unit | |
1251 | 1233 | } | |
1252 | 1234 | if ((el == el)) | |
1253 | 1235 | then { | |
1254 | 1236 | let lpTrnsfr = if (autoStake) | |
1255 | 1237 | then { | |
1256 | 1238 | let ss = invoke(stakingContract, "stakeFor", [toString(i.caller)], [AttachedPayment(lpId, emitLpAmt)]) | |
1257 | 1239 | if ((ss == ss)) | |
1258 | 1240 | then nil | |
1259 | 1241 | else throw("Strict value is not equal to itself.") | |
1260 | 1242 | } | |
1261 | 1243 | else [ScriptTransfer(i.caller, emitLpAmt, lpId)] | |
1262 | 1244 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1263 | 1245 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1264 | 1246 | else nil | |
1265 | - | let $ | |
1247 | + | let $t04504845397 = if ((this == feeCollectorAddress)) | |
1266 | 1248 | then $Tuple2(0, 0) | |
1267 | 1249 | else { | |
1268 | 1250 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1269 | 1251 | then true | |
1270 | 1252 | else false | |
1271 | 1253 | if (paymentInAmountAsset) | |
1272 | 1254 | then $Tuple2(-(feeAmount), 0) | |
1273 | 1255 | else $Tuple2(0, -(feeAmount)) | |
1274 | 1256 | } | |
1275 | - | let amountAssetBalanceDelta = $ | |
1276 | - | let priceAssetBalanceDelta = $ | |
1277 | - | let $ | |
1278 | - | let refreshDLpActions = $ | |
1279 | - | let updatedDLp = $ | |
1257 | + | let amountAssetBalanceDelta = $t04504845397._1 | |
1258 | + | let priceAssetBalanceDelta = $t04504845397._2 | |
1259 | + | let $t04540045508 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1260 | + | let refreshDLpActions = $t04540045508._1 | |
1261 | + | let updatedDLp = $t04540045508._2 | |
1280 | 1262 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1281 | 1263 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1282 | 1264 | then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1283 | 1265 | else throw("Strict value is not equal to itself.") | |
1284 | 1266 | } | |
1285 | 1267 | else throw("Strict value is not equal to itself.") | |
1286 | 1268 | } | |
1287 | 1269 | else throw("Strict value is not equal to itself.") | |
1288 | 1270 | } | |
1289 | 1271 | else throw("Strict value is not equal to itself.") | |
1290 | 1272 | } | |
1291 | 1273 | else throw("Strict value is not equal to itself.") | |
1292 | 1274 | } | |
1293 | 1275 | else throw("Strict value is not equal to itself.") | |
1294 | 1276 | } | |
1295 | 1277 | ||
1296 | 1278 | ||
1297 | 1279 | ||
1298 | 1280 | @Callable(i) | |
1299 | 1281 | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
1300 | 1282 | then throw("Wrong slpg") | |
1301 | 1283 | else if ((size(i.payments) != 2)) | |
1302 | 1284 | then throw("2 pmnts expd") | |
1303 | 1285 | else { | |
1304 | 1286 | let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, true, 0, "") | |
1305 | 1287 | let state = estPut._9 | |
1306 | 1288 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1307 | 1289 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1308 | 1290 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1309 | 1291 | if ((currentDLp == currentDLp)) | |
1310 | 1292 | then { | |
1311 | - | let $ | |
1312 | - | let refreshDLpActions = $ | |
1313 | - | let updatedDLp = $ | |
1293 | + | let $t04653846603 = refreshDLpInternal(0, 0, 0) | |
1294 | + | let refreshDLpActions = $t04653846603._1 | |
1295 | + | let updatedDLp = $t04653846603._2 | |
1314 | 1296 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1315 | 1297 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1316 | 1298 | then (state ++ refreshDLpActions) | |
1317 | 1299 | else throw("Strict value is not equal to itself.") | |
1318 | 1300 | } | |
1319 | 1301 | else throw("Strict value is not equal to itself.") | |
1320 | 1302 | } | |
1321 | 1303 | ||
1322 | 1304 | ||
1323 | 1305 | ||
1324 | 1306 | @Callable(i) | |
1325 | 1307 | func get () = { | |
1326 | 1308 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1327 | 1309 | if ((currentDLp == currentDLp)) | |
1328 | 1310 | then { | |
1329 | 1311 | let r = cg(i) | |
1330 | 1312 | let outAmtAmt = r._1 | |
1331 | 1313 | let outPrAmt = r._2 | |
1332 | 1314 | let pmtAmt = r._3 | |
1333 | 1315 | let pmtAssetId = r._4 | |
1334 | 1316 | let state = r._5 | |
1335 | 1317 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1336 | 1318 | if ((b == b)) | |
1337 | 1319 | then { | |
1338 | - | let $ | |
1339 | - | let refreshDLpActions = $ | |
1340 | - | let updatedDLp = $ | |
1320 | + | let $t04777647858 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1321 | + | let refreshDLpActions = $t04777647858._1 | |
1322 | + | let updatedDLp = $t04777647858._2 | |
1341 | 1323 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1342 | 1324 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1343 | 1325 | then (state ++ refreshDLpActions) | |
1344 | 1326 | else throw("Strict value is not equal to itself.") | |
1345 | 1327 | } | |
1346 | 1328 | else throw("Strict value is not equal to itself.") | |
1347 | 1329 | } | |
1348 | 1330 | else throw("Strict value is not equal to itself.") | |
1349 | 1331 | } | |
1350 | 1332 | ||
1351 | 1333 | ||
1352 | 1334 | ||
1353 | 1335 | @Callable(i) | |
1354 | 1336 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1355 | 1337 | let isPoolOneTokenOperationsDisabled = { | |
1356 | 1338 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1357 | 1339 | if ($isInstanceOf(@, "Boolean")) | |
1358 | 1340 | then @ | |
1359 | 1341 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1360 | 1342 | } | |
1361 | 1343 | let isGetDisabled = if (if (igs()) | |
1362 | 1344 | then true | |
1363 | 1345 | else (cfgPoolStatus == PoolShutdown)) | |
1364 | 1346 | then true | |
1365 | 1347 | else isPoolOneTokenOperationsDisabled | |
1366 | 1348 | let checks = [if (if (!(isGetDisabled)) | |
1367 | 1349 | then true | |
1368 | 1350 | else isManager(i)) | |
1369 | 1351 | then true | |
1370 | 1352 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1371 | 1353 | then true | |
1372 | 1354 | else throwErr("exactly 1 payment are expected")] | |
1373 | 1355 | if ((checks == checks)) | |
1374 | 1356 | then { | |
1375 | - | let $ | |
1376 | - | let state = $ | |
1377 | - | let totalAmount = $ | |
1357 | + | let $t04847648631 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1358 | + | let state = $t04847648631._1 | |
1359 | + | let totalAmount = $t04847648631._2 | |
1378 | 1360 | $Tuple2(state, totalAmount) | |
1379 | 1361 | } | |
1380 | 1362 | else throw("Strict value is not equal to itself.") | |
1381 | 1363 | } | |
1382 | 1364 | ||
1383 | 1365 | ||
1384 | 1366 | ||
1385 | 1367 | @Callable(i) | |
1386 | 1368 | func refreshDLp () = { | |
1387 | 1369 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0) | |
1388 | 1370 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay)) | |
1389 | 1371 | then unit | |
1390 | 1372 | else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1391 | 1373 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1392 | 1374 | then { | |
1393 | 1375 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1394 | - | let $ | |
1395 | - | let dLpUpdateActions = $ | |
1396 | - | let updatedDLp = $ | |
1376 | + | let $t04915549219 = refreshDLpInternal(0, 0, 0) | |
1377 | + | let dLpUpdateActions = $t04915549219._1 | |
1378 | + | let updatedDLp = $t04915549219._2 | |
1397 | 1379 | let actions = if ((dLp != updatedDLp)) | |
1398 | 1380 | then dLpUpdateActions | |
1399 | 1381 | else throwErr("nothing to refresh") | |
1400 | 1382 | $Tuple2(actions, toString(updatedDLp)) | |
1401 | 1383 | } | |
1402 | 1384 | else throw("Strict value is not equal to itself.") | |
1403 | 1385 | } | |
1404 | 1386 | ||
1405 | 1387 | ||
1406 | 1388 | ||
1407 | 1389 | @Callable(i) | |
1408 | 1390 | func getOneTknV2READONLY (outAssetId,lpAssetAmount) = { | |
1409 | 1391 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1410 | 1392 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1411 | 1393 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1412 | 1394 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
1413 | 1395 | let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity) | |
1414 | 1396 | let D0 = getD(xp) | |
1415 | 1397 | let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission)) | |
1416 | 1398 | let index = if ((outAssetId == amId)) | |
1417 | 1399 | then 0 | |
1418 | 1400 | else if ((outAssetId == prId)) | |
1419 | 1401 | then 1 | |
1420 | 1402 | else throw("invalid out asset id") | |
1421 | 1403 | let newY = getYD(xp, index, D1) | |
1422 | 1404 | let dy = (xp[index] - newY) | |
1423 | 1405 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1424 | - | let $ | |
1425 | - | let totalGet = $ | |
1426 | - | let feeAmount = $ | |
1406 | + | let $t05022950284 = takeFee(totalGetRaw, outFee) | |
1407 | + | let totalGet = $t05022950284._1 | |
1408 | + | let feeAmount = $t05022950284._2 | |
1427 | 1409 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1428 | 1410 | } | |
1429 | 1411 | ||
1430 | 1412 | ||
1431 | 1413 | ||
1432 | 1414 | @Callable(i) | |
1433 | 1415 | func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = { | |
1434 | 1416 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1435 | 1417 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1436 | 1418 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1437 | 1419 | let amBalance = getAccBalance(amId) | |
1438 | 1420 | let prBalance = getAccBalance(prId) | |
1439 | - | let $ | |
1421 | + | let $t05065950774 = { | |
1440 | 1422 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1441 | 1423 | if ($isInstanceOf(@, "(Int, Int)")) | |
1442 | 1424 | then @ | |
1443 | 1425 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1444 | 1426 | } | |
1445 | - | let totalGet = $ | |
1446 | - | let feeAmount = $ | |
1427 | + | let totalGet = $t05065950774._1 | |
1428 | + | let feeAmount = $t05065950774._2 | |
1447 | 1429 | let r = ego("", lpId, lpAssetAmount, this) | |
1448 | 1430 | let outAmAmt = r._1 | |
1449 | 1431 | let outPrAmt = r._2 | |
1450 | 1432 | let sumOfGetAssets = (outAmAmt + outPrAmt) | |
1451 | 1433 | let bonus = if ((sumOfGetAssets == 0)) | |
1452 | 1434 | then if ((totalGet == 0)) | |
1453 | 1435 | then 0 | |
1454 | 1436 | else throw("bonus calculation error") | |
1455 | 1437 | else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets) | |
1456 | 1438 | $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus)) | |
1457 | 1439 | } | |
1458 | 1440 | ||
1459 | 1441 | ||
1460 | 1442 | ||
1461 | 1443 | @Callable(i) | |
1462 | 1444 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1463 | 1445 | let r = cg(i) | |
1464 | 1446 | let outAmAmt = r._1 | |
1465 | 1447 | let outPrAmt = r._2 | |
1466 | 1448 | let pmtAmt = r._3 | |
1467 | 1449 | let pmtAssetId = r._4 | |
1468 | 1450 | let state = r._5 | |
1469 | 1451 | if ((noLessThenAmtAsset > outAmAmt)) | |
1470 | 1452 | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1471 | 1453 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1472 | 1454 | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1473 | 1455 | else { | |
1474 | 1456 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1475 | 1457 | if ((currentDLp == currentDLp)) | |
1476 | 1458 | then { | |
1477 | 1459 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1478 | 1460 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1479 | 1461 | then { | |
1480 | - | let $ | |
1481 | - | let refreshDLpActions = $ | |
1482 | - | let updatedDLp = $ | |
1462 | + | let $t05194052021 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1463 | + | let refreshDLpActions = $t05194052021._1 | |
1464 | + | let updatedDLp = $t05194052021._2 | |
1483 | 1465 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1484 | 1466 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1485 | 1467 | then (state ++ refreshDLpActions) | |
1486 | 1468 | else throw("Strict value is not equal to itself.") | |
1487 | 1469 | } | |
1488 | 1470 | else throw("Strict value is not equal to itself.") | |
1489 | 1471 | } | |
1490 | 1472 | else throw("Strict value is not equal to itself.") | |
1491 | 1473 | } | |
1492 | 1474 | } | |
1493 | 1475 | ||
1494 | 1476 | ||
1495 | 1477 | ||
1496 | 1478 | @Callable(i) | |
1497 | 1479 | func unstakeAndGet (amount) = { | |
1498 | 1480 | let checkPayments = if ((size(i.payments) != 0)) | |
1499 | 1481 | then throw("No pmnts expd") | |
1500 | 1482 | else true | |
1501 | 1483 | if ((checkPayments == checkPayments)) | |
1502 | 1484 | then { | |
1503 | 1485 | let factoryCfg = gfc() | |
1504 | 1486 | let lpAssetId = cfgLpAssetId | |
1505 | 1487 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1506 | 1488 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1507 | 1489 | if ((currentDLp == currentDLp)) | |
1508 | 1490 | then { | |
1509 | 1491 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1510 | 1492 | if ((unstakeInv == unstakeInv)) | |
1511 | 1493 | then { | |
1512 | 1494 | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1513 | 1495 | let outAmAmt = r._1 | |
1514 | 1496 | let outPrAmt = r._2 | |
1515 | 1497 | let sts = parseIntValue(r._9) | |
1516 | 1498 | let state = r._10 | |
1517 | 1499 | let v = if (if (igs()) | |
1518 | 1500 | then true | |
1519 | 1501 | else (sts == PoolShutdown)) | |
1520 | 1502 | then throw(("Blocked: " + toString(sts))) | |
1521 | 1503 | else true | |
1522 | 1504 | if ((v == v)) | |
1523 | 1505 | then { | |
1524 | 1506 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1525 | 1507 | if ((burnA == burnA)) | |
1526 | 1508 | then { | |
1527 | - | let $ | |
1528 | - | let refreshDLpActions = $ | |
1529 | - | let updatedDLp = $ | |
1509 | + | let $t05304853129 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1510 | + | let refreshDLpActions = $t05304853129._1 | |
1511 | + | let updatedDLp = $t05304853129._2 | |
1530 | 1512 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1531 | 1513 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1532 | 1514 | then (state ++ refreshDLpActions) | |
1533 | 1515 | else throw("Strict value is not equal to itself.") | |
1534 | 1516 | } | |
1535 | 1517 | else throw("Strict value is not equal to itself.") | |
1536 | 1518 | } | |
1537 | 1519 | else throw("Strict value is not equal to itself.") | |
1538 | 1520 | } | |
1539 | 1521 | else throw("Strict value is not equal to itself.") | |
1540 | 1522 | } | |
1541 | 1523 | else throw("Strict value is not equal to itself.") | |
1542 | 1524 | } | |
1543 | 1525 | else throw("Strict value is not equal to itself.") | |
1544 | 1526 | } | |
1545 | 1527 | ||
1546 | 1528 | ||
1547 | 1529 | ||
1548 | 1530 | @Callable(i) | |
1549 | 1531 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1550 | 1532 | let isGetDisabled = if (igs()) | |
1551 | 1533 | then true | |
1552 | 1534 | else (cfgPoolStatus == PoolShutdown) | |
1553 | 1535 | let checks = [if (!(isGetDisabled)) | |
1554 | 1536 | then true | |
1555 | 1537 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1556 | 1538 | then true | |
1557 | 1539 | else throw("no payments are expected")] | |
1558 | 1540 | if ((checks == checks)) | |
1559 | 1541 | then { | |
1560 | 1542 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1561 | 1543 | if ((currentDLp == currentDLp)) | |
1562 | 1544 | then { | |
1563 | 1545 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1564 | 1546 | if ((unstakeInv == unstakeInv)) | |
1565 | 1547 | then { | |
1566 | 1548 | let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1567 | 1549 | let outAmAmt = res._1 | |
1568 | 1550 | let outPrAmt = res._2 | |
1569 | 1551 | let state = res._10 | |
1570 | 1552 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1571 | 1553 | then true | |
1572 | 1554 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1573 | 1555 | then true | |
1574 | 1556 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1575 | 1557 | if ((checkAmounts == checkAmounts)) | |
1576 | 1558 | then { | |
1577 | 1559 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1578 | 1560 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1579 | 1561 | then { | |
1580 | - | let $ | |
1581 | - | let refreshDLpActions = $ | |
1582 | - | let updatedDLp = $ | |
1562 | + | let $t05438054461 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1563 | + | let refreshDLpActions = $t05438054461._1 | |
1564 | + | let updatedDLp = $t05438054461._2 | |
1583 | 1565 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1584 | 1566 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1585 | 1567 | then (state ++ refreshDLpActions) | |
1586 | 1568 | else throw("Strict value is not equal to itself.") | |
1587 | 1569 | } | |
1588 | 1570 | else throw("Strict value is not equal to itself.") | |
1589 | 1571 | } | |
1590 | 1572 | else throw("Strict value is not equal to itself.") | |
1591 | 1573 | } | |
1592 | 1574 | else throw("Strict value is not equal to itself.") | |
1593 | 1575 | } | |
1594 | 1576 | else throw("Strict value is not equal to itself.") | |
1595 | 1577 | } | |
1596 | 1578 | else throw("Strict value is not equal to itself.") | |
1597 | 1579 | } | |
1598 | 1580 | ||
1599 | 1581 | ||
1600 | 1582 | ||
1601 | 1583 | @Callable(i) | |
1602 | 1584 | func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = { | |
1603 | 1585 | let isPoolOneTokenOperationsDisabled = { | |
1604 | 1586 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1605 | 1587 | if ($isInstanceOf(@, "Boolean")) | |
1606 | 1588 | then @ | |
1607 | 1589 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1608 | 1590 | } | |
1609 | 1591 | let isGetDisabled = if (if (igs()) | |
1610 | 1592 | then true | |
1611 | 1593 | else (cfgPoolStatus == PoolShutdown)) | |
1612 | 1594 | then true | |
1613 | 1595 | else isPoolOneTokenOperationsDisabled | |
1614 | 1596 | let checks = [if (if (!(isGetDisabled)) | |
1615 | 1597 | then true | |
1616 | 1598 | else isManager(i)) | |
1617 | 1599 | then true | |
1618 | 1600 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1619 | 1601 | then true | |
1620 | 1602 | else throwErr("no payments are expected")] | |
1621 | 1603 | if ((checks == checks)) | |
1622 | 1604 | then { | |
1623 | 1605 | let factoryCfg = gfc() | |
1624 | 1606 | let lpAssetId = cfgLpAssetId | |
1625 | 1607 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1626 | 1608 | let userAddress = i.caller | |
1627 | 1609 | let lpAssetRecipientAddress = this | |
1628 | 1610 | let unstakeInv = invoke(staking, "unstakeINTERNAL", [lpAssetId, unstakeAmount, userAddress.bytes, lpAssetRecipientAddress.bytes], nil) | |
1629 | 1611 | if ((unstakeInv == unstakeInv)) | |
1630 | 1612 | then { | |
1631 | - | let $ | |
1632 | - | let state = $ | |
1633 | - | let totalAmount = $ | |
1613 | + | let $t05548355671 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1614 | + | let state = $t05548355671._1 | |
1615 | + | let totalAmount = $t05548355671._2 | |
1634 | 1616 | $Tuple2(state, totalAmount) | |
1635 | 1617 | } | |
1636 | 1618 | else throw("Strict value is not equal to itself.") | |
1637 | 1619 | } | |
1638 | 1620 | else throw("Strict value is not equal to itself.") | |
1639 | 1621 | } | |
1640 | 1622 | ||
1641 | 1623 | ||
1642 | 1624 | ||
1643 | 1625 | @Callable(i) | |
1644 | 1626 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1645 | - | let $ | |
1646 | - | let lpAmount = $ | |
1647 | - | let state = $ | |
1648 | - | let feeAmount = $ | |
1649 | - | let bonus = $ | |
1627 | + | let $t05579955902 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1628 | + | let lpAmount = $t05579955902._1 | |
1629 | + | let state = $t05579955902._2 | |
1630 | + | let feeAmount = $t05579955902._3 | |
1631 | + | let bonus = $t05579955902._4 | |
1650 | 1632 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1651 | 1633 | } | |
1652 | 1634 | ||
1653 | 1635 | ||
1654 | 1636 | ||
1655 | 1637 | @Callable(i) | |
1656 | 1638 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1657 | - | let $ | |
1658 | - | let lpAmount = $ | |
1659 | - | let state = $ | |
1660 | - | let feeAmount = $ | |
1661 | - | let bonus = $ | |
1639 | + | let $t05605056154 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1640 | + | let lpAmount = $t05605056154._1 | |
1641 | + | let state = $t05605056154._2 | |
1642 | + | let feeAmount = $t05605056154._3 | |
1643 | + | let bonus = $t05605056154._4 | |
1662 | 1644 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1663 | 1645 | } | |
1664 | 1646 | ||
1665 | 1647 | ||
1666 | 1648 | ||
1667 | 1649 | @Callable(i) | |
1668 | 1650 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1669 | 1651 | then throw("denied") | |
1670 | 1652 | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success") | |
1671 | 1653 | ||
1672 | 1654 | ||
1673 | 1655 | ||
1674 | 1656 | @Callable(i) | |
1675 | 1657 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
1676 | 1658 | ||
1677 | 1659 | ||
1678 | 1660 | ||
1679 | 1661 | @Callable(i) | |
1680 | 1662 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1681 | 1663 | ||
1682 | 1664 | ||
1683 | 1665 | ||
1684 | 1666 | @Callable(i) | |
1685 | 1667 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1686 | 1668 | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
1687 | 1669 | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
1688 | 1670 | } | |
1689 | 1671 | ||
1690 | 1672 | ||
1691 | 1673 | ||
1692 | 1674 | @Callable(i) | |
1693 | 1675 | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
1694 | 1676 | ||
1695 | 1677 | ||
1696 | 1678 | ||
1697 | 1679 | @Callable(i) | |
1698 | 1680 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
1699 | 1681 | ||
1700 | 1682 | ||
1701 | 1683 | ||
1702 | 1684 | @Callable(i) | |
1703 | 1685 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1704 | 1686 | ||
1705 | 1687 | ||
1706 | 1688 | ||
1707 | 1689 | @Callable(i) | |
1708 | 1690 | func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, true, false, 0, "")) | |
1709 | 1691 | ||
1710 | 1692 | ||
1711 | 1693 | ||
1712 | 1694 | @Callable(i) | |
1713 | 1695 | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
1714 | 1696 | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
1715 | 1697 | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
1716 | 1698 | } | |
1717 | 1699 | ||
1718 | 1700 | ||
1719 | 1701 | ||
1720 | 1702 | @Callable(i) | |
1721 | 1703 | func changeAmp () = { | |
1722 | 1704 | let cfg = invoke(fca, "getChangeAmpConfigREADONLY", [toString(this)], nil) | |
1723 | - | let $ | |
1705 | + | let $t05850858707 = match cfg { | |
1724 | 1706 | case list: List[Any] => | |
1725 | 1707 | $Tuple3({ | |
1726 | 1708 | let @ = list[0] | |
1727 | 1709 | if ($isInstanceOf(@, "Int")) | |
1728 | 1710 | then @ | |
1729 | 1711 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1730 | 1712 | }, { | |
1731 | 1713 | let @ = list[1] | |
1732 | 1714 | if ($isInstanceOf(@, "Int")) | |
1733 | 1715 | then @ | |
1734 | 1716 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1735 | 1717 | }, { | |
1736 | 1718 | let @ = list[2] | |
1737 | 1719 | if ($isInstanceOf(@, "Int")) | |
1738 | 1720 | then @ | |
1739 | 1721 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1740 | 1722 | }) | |
1741 | 1723 | case _ => | |
1742 | 1724 | throwErr("invalid entry type") | |
1743 | 1725 | } | |
1744 | - | let delay = $ | |
1745 | - | let delta = $ | |
1746 | - | let target = $ | |
1726 | + | let delay = $t05850858707._1 | |
1727 | + | let delta = $t05850858707._2 | |
1728 | + | let target = $t05850858707._3 | |
1747 | 1729 | let curAmp = parseIntValue(getStringValue(amp())) | |
1748 | 1730 | let newAmpRaw = (curAmp + delta) | |
1749 | 1731 | let newAmp = if ((0 > delta)) | |
1750 | 1732 | then if ((target > newAmpRaw)) | |
1751 | 1733 | then target | |
1752 | 1734 | else newAmpRaw | |
1753 | 1735 | else if ((newAmpRaw > target)) | |
1754 | 1736 | then target | |
1755 | 1737 | else newAmpRaw | |
1756 | 1738 | let lastCall = valueOrElse(getInteger(keyChangeAmpLastCall()), 0) | |
1757 | 1739 | let wait = (lastCall + delay) | |
1758 | 1740 | let checks = [if ((height > wait)) | |
1759 | 1741 | then true | |
1760 | 1742 | else throwErr("try again in few blocks"), if ((curAmp != newAmp)) | |
1761 | 1743 | then true | |
1762 | 1744 | else throwErr("already reached target")] | |
1763 | 1745 | if ((checks == checks)) | |
1764 | 1746 | then [IntegerEntry(keyChangeAmpLastCall(), height), StringEntry(amp(), toString(newAmp)), StringEntry(keyAmpHistory(height), toString(newAmp))] | |
1765 | 1747 | else throw("Strict value is not equal to itself.") | |
1766 | 1748 | } | |
1767 | 1749 | ||
1768 | 1750 | ||
1769 | 1751 | @Verifier(tx) | |
1770 | 1752 | func verify () = { | |
1771 | - | let targetPublicKey = match | |
1753 | + | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1772 | 1754 | case pk: ByteVector => | |
1773 | 1755 | pk | |
1774 | 1756 | case _: Unit => | |
1775 | 1757 | tx.senderPublicKey | |
1776 | 1758 | case _ => | |
1777 | 1759 | throw("Match error") | |
1778 | 1760 | } | |
1779 | 1761 | match tx { | |
1780 | 1762 | case order: Order => | |
1781 | 1763 | let matcherPub = mp() | |
1782 | - | let $ | |
1764 | + | let $t05964059757 = if (skipOrderValidation()) | |
1783 | 1765 | then $Tuple2(true, "") | |
1784 | 1766 | else validateMatcherOrderAllowed(order) | |
1785 | - | let orderValid = $ | |
1786 | - | let orderValidInfo = $ | |
1767 | + | let orderValid = $t05964059757._1 | |
1768 | + | let orderValidInfo = $t05964059757._2 | |
1787 | 1769 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1788 | 1770 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1789 | 1771 | if (if (if (orderValid) | |
1790 | 1772 | then senderValid | |
1791 | 1773 | else false) | |
1792 | 1774 | then matcherValid | |
1793 | 1775 | else false) | |
1794 | 1776 | then true | |
1795 | 1777 | else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid) | |
1796 | 1778 | case s: SetScriptTransaction => | |
1797 | 1779 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
1798 | 1780 | then true | |
1799 | 1781 | else { | |
1800 | 1782 | let newHash = blake2b256(value(s.script)) | |
1801 | 1783 | let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash()))) | |
1802 | 1784 | let currentHash = scriptHash(this) | |
1803 | 1785 | if ((allowedHash == newHash)) | |
1804 | 1786 | then (currentHash != newHash) | |
1805 | 1787 | else false | |
1806 | 1788 | } | |
1807 | 1789 | case _ => | |
1808 | 1790 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1809 | 1791 | } | |
1810 | 1792 | } | |
1811 | 1793 |
github/deemru/w8io/026f985 262.21 ms ◑