tx · 79r159Vj6vScnC2Zi83FsiqJX9xVLb2hWe4FW1tnA8j 3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA: -0.03100000 Waves 2022.09.21 17:55 [2239042] smart account 3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA > SELF 0.00000000 Waves
{ "type": 13, "id": "79r159Vj6vScnC2Zi83FsiqJX9xVLb2hWe4FW1tnA8j", "fee": 3100000, "feeAssetId": null, "timestamp": 1663772206672, "version": 1, "sender": "3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA", "senderPublicKey": "35yd3qw1gxKDxKwGAykHN9fANbXNWwseaUwbWDj24o3x", "proofs": [ "3RyBG92w2C52bEipghS3gCqWTZer3gSQkd6QFtgHUZ9EDo7TWoe7rXoeeukLe4gu5BnZfypgQavVhPNyP7cMRD5H" ], "script": "base64:BgKFHwgCEgMKAQgSAwoBCBIAEgQKAgEEEgcKBQEBAQEEEgQKAgEEEgQKAgEIEgQKAgEIEgMKAQESABIHCgUBAQEIARIECgIIARIECgIIARIECgIIARIECgIBARIDCgEBEgUKAwEIARIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IglvbmVCaWdJbnQiCnNsaXBwYWdlNEQiBUFtdWx0IgVEY29udiIDU0VQIgVFTVBUWSIKUG9vbEFjdGl2ZSIKUG9vbFB1dERpcyIOUG9vbE1hdGNoZXJEaXMiDFBvb2xTaHV0ZG93biIOaWR4UG9vbEFkZHJlc3MiCWlkeFBvb2xTdCIJaWR4TFBBc0lkIglpZHhBbUFzSWQiCWlkeFByQXNJZCILaWR4QW10QXNEY20iDWlkeFByaWNlQXNEY20iC2lkeElBbXRBc0lkIg1pZHhJUHJpY2VBc0lkIg9pZHhGYWN0U3Rha0NudHIiEGlkeEZhY3RT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nXyJ48Fwaf4 Next: 4CshcCKzqXFScuBciyM8QXSJH9ZNUtUqsXm7bcpZj4aW Diff:
Old | New | Differences | |
---|---|---|---|
489 | 489 | else $Tuple2(result._2, result._1) | |
490 | 490 | let amAssetPart = $t02202522121._1 | |
491 | 491 | let prAssetPart = $t02202522121._2 | |
492 | - | let estPut = cp(userAddress, txId, AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), 0, true, true, false, | |
492 | + | let estPut = cp(userAddress, txId, AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), 0, true, true, false, pmtAmtRaw, pmtAssetId) | |
493 | 493 | let estimLP = estPut._2 | |
494 | 494 | let lpAssetId = estPut._7 | |
495 | 495 | let state = estPut._9 | |
524 | 524 | else { | |
525 | 525 | let amBalance = getAccBalance(amId) | |
526 | 526 | let prBalance = getAccBalance(prId) | |
527 | - | let $ | |
527 | + | let $t02347623584 = { | |
528 | 528 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
529 | 529 | if ($isInstanceOf(@, "(Int, Int)")) | |
530 | 530 | then @ | |
531 | 531 | else throw(($getType(invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)) + " couldn't be cast to (Int, Int)")) | |
532 | 532 | } | |
533 | - | let totalGet = $ | |
534 | - | let feeAmount = $ | |
533 | + | let totalGet = $t02347623584._1 | |
534 | + | let feeAmount = $t02347623584._2 | |
535 | 535 | let totalAmount = if (if ((minOutAmount > 0)) | |
536 | 536 | then (minOutAmount > totalGet) | |
537 | 537 | else false) | |
538 | 538 | then throw(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
539 | 539 | else totalGet | |
540 | - | let $ | |
540 | + | let $t02377123858 = if ((outAssetId == amId)) | |
541 | 541 | then $Tuple2(totalAmount, 0) | |
542 | 542 | else $Tuple2(0, totalAmount) | |
543 | - | let outAm = $ | |
544 | - | let outPr = $ | |
543 | + | let outAm = $t02377123858._1 | |
544 | + | let outPr = $t02377123858._2 | |
545 | 545 | let curPrX18 = cpbi(t1(prBalance, prDecimals), t1(amBalance, amDecimals)) | |
546 | 546 | let curPr = f1(curPrX18, scale8) | |
547 | 547 | let state = [ScriptTransfer(userAddress, totalAmount, if ((outAssetId == "WAVES")) | |
731 | 731 | let pmt = value(i.payments[0]) | |
732 | 732 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
733 | 733 | let paymentAmountRaw = pmt.amount | |
734 | - | let $ | |
735 | - | let pmtAmt = $ | |
736 | - | let feeAmount = $ | |
734 | + | let $t02905429106 = takeFee(paymentAmountRaw) | |
735 | + | let pmtAmt = $t02905429106._1 | |
736 | + | let feeAmount = $t02905429106._2 | |
737 | 737 | if ((10000000 > paymentAmountRaw)) | |
738 | 738 | then throw("Wrong pmt amt") | |
739 | 739 | else { | |
740 | 740 | let amBalance = getAccBalance(amId) | |
741 | 741 | let prBalance = getAccBalance(prId) | |
742 | - | let $ | |
742 | + | let $t02926629882 = if ((pmtAssetId == amId)) | |
743 | 743 | then if (if ((paymentAmountRaw > amBalance)) | |
744 | 744 | then true | |
745 | 745 | else (amAssetPart > pmtAmt)) | |
752 | 752 | then throw("invalid payment amount") | |
753 | 753 | else $Tuple6(amBalance, (prBalance - paymentAmountRaw), 0, 0, (pmtAmt - prAssetPart), amAssetPart) | |
754 | 754 | else throw("wrong pmtAssetId") | |
755 | - | let amBalanceNow = $ | |
756 | - | let prBalanceNow = $ | |
757 | - | let virtSwapInAm = $ | |
758 | - | let virtSwapOutPr = $ | |
759 | - | let virtSwapInPr = $ | |
760 | - | let virtSwapOutAm = $ | |
755 | + | let amBalanceNow = $t02926629882._1 | |
756 | + | let prBalanceNow = $t02926629882._2 | |
757 | + | let virtSwapInAm = $t02926629882._3 | |
758 | + | let virtSwapOutPr = $t02926629882._4 | |
759 | + | let virtSwapInPr = $t02926629882._5 | |
760 | + | let virtSwapOutAm = $t02926629882._6 | |
761 | 761 | let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil) | |
762 | 762 | let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil) | |
763 | 763 | let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D) | |
917 | 917 | let curPrice = r._3 | |
918 | 918 | let lpAssetEmission = r._6 | |
919 | 919 | let lpAssetId = r._7 | |
920 | - | let $ | |
920 | + | let $t03470935018 = if ((paymentAssetId == amId)) | |
921 | 921 | then { | |
922 | 922 | let priceAssetAmount = fraction(paymentAmount, curPrice, scale8) | |
923 | 923 | $Tuple2(paymentAmount, priceAssetAmount) | |
926 | 926 | let amountAssetAmount = fraction(paymentAmount, scale8, curPrice) | |
927 | 927 | $Tuple2(amountAssetAmount, paymentAmount) | |
928 | 928 | } | |
929 | - | let amountAssetAmount = $ | |
930 | - | let priceAssetAmount = $ | |
929 | + | let amountAssetAmount = $t03470935018._1 | |
930 | + | let priceAssetAmount = $t03470935018._2 | |
931 | 931 | let lpAmtBoth = fraction(lpAssetEmission, priceAssetAmount, prBalance) | |
932 | 932 | let lpAssetPriceOne = if ((paymentAssetId == amId)) | |
933 | 933 | then fraction(amountAssetAmount, scale8, estimLP) | |
1005 | 1005 | let estimPrAmt = r._2 | |
1006 | 1006 | let amBalance = getAccBalance(amId) | |
1007 | 1007 | let prBalance = getAccBalance(prId) | |
1008 | - | let $ | |
1008 | + | let $t03829938759 = if ((outAssetId == amId)) | |
1009 | 1009 | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult)) | |
1010 | 1010 | else if ((outAssetId == prId)) | |
1011 | 1011 | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult)) | |
1012 | 1012 | else throw("wrong outAssetId") | |
1013 | - | let amBalanceNow = $ | |
1014 | - | let prBalanceNow = $ | |
1015 | - | let virtSwapInAm = $ | |
1016 | - | let virtSwapOutPr = $ | |
1017 | - | let virtSwapInPr = $ | |
1018 | - | let virtSwapOutAm = $ | |
1019 | - | let totalGetRaw = $ | |
1013 | + | let amBalanceNow = $t03829938759._1 | |
1014 | + | let prBalanceNow = $t03829938759._2 | |
1015 | + | let virtSwapInAm = $t03829938759._3 | |
1016 | + | let virtSwapOutPr = $t03829938759._4 | |
1017 | + | let virtSwapInPr = $t03829938759._5 | |
1018 | + | let virtSwapOutAm = $t03829938759._6 | |
1019 | + | let totalGetRaw = $t03829938759._7 | |
1020 | 1020 | if (if ((0 > virtSwapInAm)) | |
1021 | 1021 | then true | |
1022 | 1022 | else (0 > virtSwapInPr)) | |
1031 | 1031 | let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage)) | |
1032 | 1032 | if ((finalRes == finalRes)) | |
1033 | 1033 | then { | |
1034 | - | let $ | |
1034 | + | let $t03950639610 = if ((outAssetId == amId)) | |
1035 | 1035 | then $Tuple2(toInt(finalRes._2), 0) | |
1036 | 1036 | else $Tuple2(0, toInt(finalRes._2)) | |
1037 | - | let outAm = $ | |
1038 | - | let outPr = $ | |
1037 | + | let outAm = $t03950639610._1 | |
1038 | + | let outPr = $t03950639610._2 | |
1039 | 1039 | let totalAmount = (outAm + outPr) | |
1040 | 1040 | let feeAmount = (totalGetRaw - totalGet) | |
1041 | 1041 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
1067 | 1067 | ||
1068 | 1068 | @Callable(i) | |
1069 | 1069 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1070 | - | let $ | |
1071 | - | let state = $ | |
1072 | - | let totalAmount = $ | |
1070 | + | let $t04063540790 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1071 | + | let state = $t04063540790._1 | |
1072 | + | let totalAmount = $t04063540790._2 | |
1073 | 1073 | $Tuple2(state, totalAmount) | |
1074 | 1074 | } | |
1075 | 1075 | ||
1088 | 1088 | let prBalance = getAccBalance(prId) | |
1089 | 1089 | let amBalanceNow = (amBalance - estimAmAmt) | |
1090 | 1090 | let prBalanceNow = (prBalance - estimPrAmt) | |
1091 | - | let $ | |
1091 | + | let $t04130041571 = if ((outAssetId == amId)) | |
1092 | 1092 | then $Tuple3(prBalanceNow, amBalanceNow, estimPrAmt) | |
1093 | 1093 | else if ((outAssetId == prId)) | |
1094 | 1094 | then $Tuple3(amBalanceNow, prBalanceNow, estimAmAmt) | |
1095 | 1095 | else throw("wrong outAssetId") | |
1096 | - | let amountBalanceForSwap = $ | |
1097 | - | let priceBalanceForSwap = $ | |
1098 | - | let amountToSwap = $ | |
1096 | + | let amountBalanceForSwap = $t04130041571._1 | |
1097 | + | let priceBalanceForSwap = $t04130041571._2 | |
1098 | + | let amountToSwap = $t04130041571._3 | |
1099 | 1099 | let yPrecision = 1 | |
1100 | 1100 | let exchResult = { | |
1101 | 1101 | let @ = invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil) | |
1106 | 1106 | let totalGetRaw = (exchResult + (if ((outAssetId == amId)) | |
1107 | 1107 | then estimAmAmt | |
1108 | 1108 | else estimPrAmt)) | |
1109 | - | let $ | |
1110 | - | let totalGet = $ | |
1111 | - | let feeAmount = $ | |
1109 | + | let $t04214342192 = takeFee(totalGetRaw) | |
1110 | + | let totalGet = $t04214342192._1 | |
1111 | + | let feeAmount = $t04214342192._2 | |
1112 | 1112 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1113 | 1113 | } | |
1114 | 1114 | ||
1122 | 1122 | let lpId = poolConfig[idxLPAsId] | |
1123 | 1123 | let amBalance = getAccBalance(amId) | |
1124 | 1124 | let prBalance = getAccBalance(prId) | |
1125 | - | let $ | |
1125 | + | let $t04253642651 = { | |
1126 | 1126 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1127 | 1127 | if ($isInstanceOf(@, "(Int, Int)")) | |
1128 | 1128 | then @ | |
1129 | 1129 | else throw(($getType(invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)) + " couldn't be cast to (Int, Int)")) | |
1130 | 1130 | } | |
1131 | - | let totalGet = $ | |
1132 | - | let feeAmount = $ | |
1131 | + | let totalGet = $t04253642651._1 | |
1132 | + | let feeAmount = $t04253642651._2 | |
1133 | 1133 | let r = ego("", lpId, lpAssetAmount, this) | |
1134 | 1134 | let outAmAmt = r._1 | |
1135 | 1135 | let outPrAmt = r._2 | |
1215 | 1215 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1216 | 1216 | if ((unstakeInv == unstakeInv)) | |
1217 | 1217 | then { | |
1218 | - | let $ | |
1219 | - | let state = $ | |
1220 | - | let totalAmount = $ | |
1218 | + | let $t04507145259 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1219 | + | let state = $t04507145259._1 | |
1220 | + | let totalAmount = $t04507145259._2 | |
1221 | 1221 | $Tuple2(state, totalAmount) | |
1222 | 1222 | } | |
1223 | 1223 | else throw("Strict value is not equal to itself.") |
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 oneBigInt = toBigInt(1) | |
13 | 13 | ||
14 | 14 | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
15 | 15 | ||
16 | 16 | let Amult = "100" | |
17 | 17 | ||
18 | 18 | let Dconv = "1" | |
19 | 19 | ||
20 | 20 | let SEP = "__" | |
21 | 21 | ||
22 | 22 | let EMPTY = "" | |
23 | 23 | ||
24 | 24 | let PoolActive = 1 | |
25 | 25 | ||
26 | 26 | let PoolPutDis = 2 | |
27 | 27 | ||
28 | 28 | let PoolMatcherDis = 3 | |
29 | 29 | ||
30 | 30 | let PoolShutdown = 4 | |
31 | 31 | ||
32 | 32 | let idxPoolAddress = 1 | |
33 | 33 | ||
34 | 34 | let idxPoolSt = 2 | |
35 | 35 | ||
36 | 36 | let idxLPAsId = 3 | |
37 | 37 | ||
38 | 38 | let idxAmAsId = 4 | |
39 | 39 | ||
40 | 40 | let idxPrAsId = 5 | |
41 | 41 | ||
42 | 42 | let idxAmtAsDcm = 6 | |
43 | 43 | ||
44 | 44 | let idxPriceAsDcm = 7 | |
45 | 45 | ||
46 | 46 | let idxIAmtAsId = 8 | |
47 | 47 | ||
48 | 48 | let idxIPriceAsId = 9 | |
49 | 49 | ||
50 | 50 | let idxFactStakCntr = 1 | |
51 | 51 | ||
52 | 52 | let idxFactSlippCntr = 7 | |
53 | 53 | ||
54 | 54 | let idxFactGwxRewCntr = 10 | |
55 | 55 | ||
56 | 56 | let feeDefault = fraction(5, scale8, 10000) | |
57 | 57 | ||
58 | 58 | func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func abs (val) = if ((zeroBigInt > val)) | |
68 | 68 | then -(val) | |
69 | 69 | else val | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func fc () = "%s__factoryContract" | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func mpk () = "%s__managerPublicKey" | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func pmpk () = "%s__pendingManagerPublicKey" | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func pl () = "%s%s__price__last" | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId) | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func aa () = "%s__amountAsset" | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func pa () = "%s__priceAsset" | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func amp () = "%s__amp" | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func ada () = "%s__addonAddr" | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | let keyFee = "%s__fee" | |
106 | 106 | ||
107 | 107 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
108 | 108 | ||
109 | 109 | func fcfg () = "%s__factoryConfig" | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func mtpk () = "%s%s__matcher__publicKey" | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func aps () = "%s__shutdown" | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash" | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func keyFeeCollectorAddress () = "%s__feeCollectorAddress" | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV))) | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func str (val) = match val { | |
134 | 134 | case valStr: String => | |
135 | 135 | valStr | |
136 | 136 | case _ => | |
137 | 137 | throw("fail cast to String") | |
138 | 138 | } | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | let fca = addressFromStringValue(strf(this, fc())) | |
148 | 148 | ||
149 | 149 | let A = strf(this, amp()) | |
150 | 150 | ||
151 | 151 | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func mp () = fromBase58String(strf(fca, mtpk())) | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress())) | |
158 | 158 | ||
159 | 159 | func gpc () = { | |
160 | 160 | let amtAs = strf(this, aa()) | |
161 | 161 | let priceAs = strf(this, pa()) | |
162 | 162 | let iPriceAs = intf(fca, mba(priceAs)) | |
163 | 163 | let iAmtAs = intf(fca, mba(amtAs)) | |
164 | 164 | split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP) | |
165 | 165 | } | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func gfc () = split(strf(fca, fcfg()), SEP) | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | let factoryConfig = gfc() | |
172 | 172 | ||
173 | 173 | let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address") | |
174 | 174 | ||
175 | 175 | let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address") | |
176 | 176 | ||
177 | 177 | let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address") | |
178 | 178 | ||
179 | 179 | 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) | |
180 | 180 | ||
181 | 181 | ||
182 | 182 | 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) | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
186 | 186 | then wavesBalance(this).available | |
187 | 187 | else assetBalance(this, fromBase58String(assetId)) | |
188 | 188 | ||
189 | 189 | ||
190 | 190 | func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
191 | 191 | ||
192 | 192 | ||
193 | 193 | func vad (A1,A2,slippage) = { | |
194 | 194 | let diff = fraction((A1 - A2), scale8BigInt, A2) | |
195 | 195 | let pass = ((slippage - abs(diff)) > zeroBigInt) | |
196 | 196 | if (!(pass)) | |
197 | 197 | then throw(("Big slpg: " + toString(diff))) | |
198 | 198 | else $Tuple2(pass, min([A1, A2])) | |
199 | 199 | } | |
200 | 200 | ||
201 | 201 | ||
202 | 202 | func vd (D1,D0,slpg) = { | |
203 | 203 | let diff = fraction(D0, scale8BigInt, D1) | |
204 | 204 | let fail = (slpg > diff) | |
205 | 205 | if (if (fail) | |
206 | 206 | then true | |
207 | 207 | else (D0 > D1)) | |
208 | 208 | then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg))) | |
209 | 209 | else fail | |
210 | 210 | } | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
214 | 214 | let amtAsAmtX18 = t1(amAmt, amAssetDcm) | |
215 | 215 | let prAsAmtX18 = t1(prAmt, prAssetDcm) | |
216 | 216 | cpbi(prAsAmtX18, amtAsAmtX18) | |
217 | 217 | } | |
218 | 218 | ||
219 | 219 | ||
220 | 220 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
221 | 221 | let cfg = gpc() | |
222 | 222 | let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
223 | 223 | let prAsDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
224 | 224 | let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt) | |
225 | 225 | let amAmtX18 = t1(amAmt, amtAsDcm) | |
226 | 226 | let prAmtX18 = t1(prAmt, prAsDcm) | |
227 | 227 | let lpAmtX18 = t1(lpAmt, scale8) | |
228 | 228 | let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18) | |
229 | 229 | let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18) | |
230 | 230 | [priceX18, lpPrInAmAsX18, lpPrInPrAsX18] | |
231 | 231 | } | |
232 | 232 | ||
233 | 233 | ||
234 | 234 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
235 | 235 | let p = calcPrices(amAmt, prAmt, lpAmt) | |
236 | 236 | [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)] | |
237 | 237 | } | |
238 | 238 | ||
239 | 239 | ||
240 | 240 | func takeFee (amount) = { | |
241 | 241 | let feeAmount = fraction(amount, fee, scale8) | |
242 | 242 | $Tuple2((amount - feeAmount), feeAmount) | |
243 | 243 | } | |
244 | 244 | ||
245 | 245 | ||
246 | 246 | func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
247 | 247 | let cfg = gpc() | |
248 | 248 | let lpId = cfg[idxLPAsId] | |
249 | 249 | let amId = cfg[idxAmAsId] | |
250 | 250 | let prId = cfg[idxPrAsId] | |
251 | 251 | let amDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
252 | 252 | let prDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
253 | 253 | let sts = cfg[idxPoolSt] | |
254 | 254 | let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity | |
255 | 255 | if ((lpId != pmtAssetId)) | |
256 | 256 | then throw("Wrong pmt asset") | |
257 | 257 | else { | |
258 | 258 | let amBalance = getAccBalance(amId) | |
259 | 259 | let amBalanceX18 = t1(amBalance, amDcm) | |
260 | 260 | let prBalance = getAccBalance(prId) | |
261 | 261 | let prBalanceX18 = t1(prBalance, prDcm) | |
262 | 262 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
263 | 263 | let curPrice = f1(curPriceX18, scale8) | |
264 | 264 | let pmtLpAmtX18 = t1(pmtLpAmt, scale8) | |
265 | 265 | let lpEmissX18 = t1(lpEmiss, scale8) | |
266 | 266 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18) | |
267 | 267 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18) | |
268 | 268 | let outAmAmt = f1(outAmAmtX18, amDcm) | |
269 | 269 | let outPrAmt = f1(outPrAmtX18, prDcm) | |
270 | 270 | let state = if ((txId58 == "")) | |
271 | 271 | then nil | |
272 | 272 | else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES")) | |
273 | 273 | then unit | |
274 | 274 | else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES")) | |
275 | 275 | then unit | |
276 | 276 | 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)] | |
277 | 277 | $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state) | |
278 | 278 | } | |
279 | 279 | } | |
280 | 280 | ||
281 | 281 | ||
282 | 282 | func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
283 | 283 | let cfg = gpc() | |
284 | 284 | let lpId = fromBase58String(cfg[idxLPAsId]) | |
285 | 285 | let amIdStr = cfg[idxAmAsId] | |
286 | 286 | let prIdStr = cfg[idxPrAsId] | |
287 | 287 | let inAmIdStr = cfg[idxIAmtAsId] | |
288 | 288 | let inPrIdStr = cfg[idxIPriceAsId] | |
289 | 289 | let amtDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
290 | 290 | let priceDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
291 | 291 | let sts = cfg[idxPoolSt] | |
292 | 292 | let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity | |
293 | 293 | let amBalance = if (isEval) | |
294 | 294 | then getAccBalance(amIdStr) | |
295 | 295 | else if (if (isOneAsset) | |
296 | 296 | then (pmtId == amIdStr) | |
297 | 297 | else false) | |
298 | 298 | then (getAccBalance(amIdStr) - pmtAmt) | |
299 | 299 | else if (isOneAsset) | |
300 | 300 | then getAccBalance(amIdStr) | |
301 | 301 | else (getAccBalance(amIdStr) - inAmAmt) | |
302 | 302 | let prBalance = if (isEval) | |
303 | 303 | then getAccBalance(prIdStr) | |
304 | 304 | else if (if (isOneAsset) | |
305 | 305 | then (pmtId == prIdStr) | |
306 | 306 | else false) | |
307 | 307 | then (getAccBalance(prIdStr) - pmtAmt) | |
308 | 308 | else if (isOneAsset) | |
309 | 309 | then getAccBalance(prIdStr) | |
310 | 310 | else (getAccBalance(prIdStr) - inPrAmt) | |
311 | 311 | let inAmAssetAmtX18 = t1(inAmAmt, amtDcm) | |
312 | 312 | let inPrAssetAmtX18 = t1(inPrAmt, priceDcm) | |
313 | 313 | let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18) | |
314 | 314 | let amBalanceX18 = t1(amBalance, amtDcm) | |
315 | 315 | let prBalanceX18 = t1(prBalance, priceDcm) | |
316 | 316 | let r = if ((lpEm == 0)) | |
317 | 317 | then { | |
318 | 318 | let curPriceX18 = zeroBigInt | |
319 | 319 | let slippageX18 = zeroBigInt | |
320 | 320 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
321 | 321 | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
322 | 322 | } | |
323 | 323 | else { | |
324 | 324 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
325 | 325 | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
326 | 326 | let slippageX18 = t1(slippage, scale8) | |
327 | 327 | if (if (if (validateSlippage) | |
328 | 328 | then (curPriceX18 != zeroBigInt) | |
329 | 329 | else false) | |
330 | 330 | then (slippageRealX18 > slippageX18) | |
331 | 331 | else false) | |
332 | 332 | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
333 | 333 | else { | |
334 | 334 | let lpEmissionX18 = t1(lpEm, scale8) | |
335 | 335 | let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
336 | 336 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
337 | 337 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
338 | 338 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
339 | 339 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
340 | 340 | let expAmtAssetAmtX18 = expectedAmts._1 | |
341 | 341 | let expPriceAssetAmtX18 = expectedAmts._2 | |
342 | 342 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18) | |
343 | 343 | $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18) | |
344 | 344 | } | |
345 | 345 | } | |
346 | 346 | let calcLpAmt = r._1 | |
347 | 347 | let calcAmAssetPmt = r._2 | |
348 | 348 | let calcPrAssetPmt = r._3 | |
349 | 349 | let curPrice = f1(r._4, scale8) | |
350 | 350 | let slippageCalc = f1(r._5, scale8) | |
351 | 351 | if ((0 >= calcLpAmt)) | |
352 | 352 | then throw("LP <= 0") | |
353 | 353 | else { | |
354 | 354 | let emitLpAmt = if (!(emitLp)) | |
355 | 355 | then 0 | |
356 | 356 | else calcLpAmt | |
357 | 357 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
358 | 358 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
359 | 359 | let $t01623716582 = if (if (isOneAsset) | |
360 | 360 | then (pmtId == amIdStr) | |
361 | 361 | else false) | |
362 | 362 | then $Tuple2(pmtAmt, 0) | |
363 | 363 | else if (if (isOneAsset) | |
364 | 364 | then (pmtId == prIdStr) | |
365 | 365 | else false) | |
366 | 366 | then $Tuple2(0, pmtAmt) | |
367 | 367 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
368 | 368 | let writeAmAmt = $t01623716582._1 | |
369 | 369 | let writePrAmt = $t01623716582._2 | |
370 | 370 | 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))] | |
371 | 371 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
372 | 372 | } | |
373 | 373 | } | |
374 | 374 | ||
375 | 375 | ||
376 | 376 | func moa (order) = { | |
377 | 377 | let cfg = gpc() | |
378 | 378 | let amtAsId = cfg[idxAmAsId] | |
379 | 379 | let prAsId = cfg[idxPrAsId] | |
380 | 380 | let sts = parseIntValue(cfg[idxPoolSt]) | |
381 | 381 | let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
382 | 382 | let prAsDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
383 | 383 | let accAmtAsBalance = getAccBalance(amtAsId) | |
384 | 384 | let accPrAsBalance = getAccBalance(prAsId) | |
385 | 385 | let curPriceX18 = if ((order.orderType == Buy)) | |
386 | 386 | then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance) | |
387 | 387 | else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance) | |
388 | 388 | let curPrice = f1(curPriceX18, scale8) | |
389 | 389 | if (if (if (igs()) | |
390 | 390 | then true | |
391 | 391 | else (sts == PoolMatcherDis)) | |
392 | 392 | then true | |
393 | 393 | else (sts == PoolShutdown)) | |
394 | 394 | then throw("Admin blocked") | |
395 | 395 | else { | |
396 | 396 | let orAmtAsset = order.assetPair.amountAsset | |
397 | 397 | let orAmtAsStr = if ((orAmtAsset == unit)) | |
398 | 398 | then "WAVES" | |
399 | 399 | else toBase58String(value(orAmtAsset)) | |
400 | 400 | let orPrAsset = order.assetPair.priceAsset | |
401 | 401 | let orPrAsStr = if ((orPrAsset == unit)) | |
402 | 402 | then "WAVES" | |
403 | 403 | else toBase58String(value(orPrAsset)) | |
404 | 404 | if (if ((orAmtAsStr != amtAsId)) | |
405 | 405 | then true | |
406 | 406 | else (orPrAsStr != prAsId)) | |
407 | 407 | then throw("Wr assets") | |
408 | 408 | else { | |
409 | 409 | let orderPrice = order.price | |
410 | 410 | let priceDcm = fraction(scale8, prAsDcm, amtAsDcm) | |
411 | 411 | let castOrderPrice = ts(orderPrice, scale8, priceDcm) | |
412 | 412 | let isOrderPriceValid = if ((order.orderType == Buy)) | |
413 | 413 | then (curPrice >= castOrderPrice) | |
414 | 414 | else (castOrderPrice >= curPrice) | |
415 | 415 | true | |
416 | 416 | } | |
417 | 417 | } | |
418 | 418 | } | |
419 | 419 | ||
420 | 420 | ||
421 | 421 | func cg (i) = if ((size(i.payments) != 1)) | |
422 | 422 | then throw("1 pmnt exp") | |
423 | 423 | else { | |
424 | 424 | let pmt = value(i.payments[0]) | |
425 | 425 | let pmtAssetId = value(pmt.assetId) | |
426 | 426 | let pmtAmt = pmt.amount | |
427 | 427 | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
428 | 428 | let outAmAmt = r._1 | |
429 | 429 | let outPrAmt = r._2 | |
430 | 430 | let sts = parseIntValue(r._9) | |
431 | 431 | let state = r._10 | |
432 | 432 | if (if (igs()) | |
433 | 433 | then true | |
434 | 434 | else (sts == PoolShutdown)) | |
435 | 435 | then throw(("Admin blocked: " + toString(sts))) | |
436 | 436 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
437 | 437 | } | |
438 | 438 | ||
439 | 439 | ||
440 | 440 | func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
441 | 441 | let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, false, emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId) | |
442 | 442 | let sts = parseIntValue(r._8) | |
443 | 443 | if (if (if (igs()) | |
444 | 444 | then true | |
445 | 445 | else (sts == PoolPutDis)) | |
446 | 446 | then true | |
447 | 447 | else (sts == PoolShutdown)) | |
448 | 448 | then throw(("Blocked:" + toString(sts))) | |
449 | 449 | else r | |
450 | 450 | } | |
451 | 451 | ||
452 | 452 | ||
453 | 453 | func estimatePutOneTknV2 (pmtAmtRaw,pmtAssetId,userAddress,txId) = { | |
454 | 454 | let poolConfig = gpc() | |
455 | 455 | let amId = poolConfig[idxAmAsId] | |
456 | 456 | let prId = poolConfig[idxPrAsId] | |
457 | 457 | let amBalance = getAccBalance(amId) | |
458 | 458 | let prBalance = getAccBalance(prId) | |
459 | 459 | let $t02090820953 = takeFee(pmtAmtRaw) | |
460 | 460 | let pmtAmt = $t02090820953._1 | |
461 | 461 | let feeAmount = $t02090820953._2 | |
462 | 462 | let $t02095721418 = if ((txId == "")) | |
463 | 463 | then $Tuple2(amBalance, prBalance) | |
464 | 464 | else if ((pmtAssetId == amId)) | |
465 | 465 | then if ((pmtAmtRaw > amBalance)) | |
466 | 466 | then throw("invalid payment amount") | |
467 | 467 | else $Tuple2((amBalance - pmtAmtRaw), prBalance) | |
468 | 468 | else if ((pmtAssetId == prId)) | |
469 | 469 | then if ((pmtAmtRaw > prBalance)) | |
470 | 470 | then throw("invalid payment amount") | |
471 | 471 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
472 | 472 | else throw("wrong pmtAssetId") | |
473 | 473 | let amBalanceNow = $t02095721418._1 | |
474 | 474 | let prBalanceNow = $t02095721418._2 | |
475 | 475 | let $t02142221556 = if ((pmtAssetId == amId)) | |
476 | 476 | then $Tuple2(amBalanceNow, prBalanceNow) | |
477 | 477 | else $Tuple2(prBalanceNow, amBalanceNow) | |
478 | 478 | let amBalanceForCalc = $t02142221556._1 | |
479 | 479 | let prBalanceForCalc = $t02142221556._2 | |
480 | 480 | let xPrecision = 1 | |
481 | 481 | let result = { | |
482 | 482 | let @ = invoke(gwxContract, "calcPutXOnly", [toString(pmtAmt), toString(amBalanceForCalc), toString(prBalanceForCalc), "", A, Amult, toString(xPrecision), Dconv], nil) | |
483 | 483 | if ($isInstanceOf(@, "(Int, Int)")) | |
484 | 484 | then @ | |
485 | 485 | else throw(($getType(invoke(gwxContract, "calcPutXOnly", [toString(pmtAmt), toString(amBalanceForCalc), toString(prBalanceForCalc), "", A, Amult, toString(xPrecision), Dconv], nil)) + " couldn't be cast to (Int, Int)")) | |
486 | 486 | } | |
487 | 487 | let $t02202522121 = if ((pmtAssetId == amId)) | |
488 | 488 | then result | |
489 | 489 | else $Tuple2(result._2, result._1) | |
490 | 490 | let amAssetPart = $t02202522121._1 | |
491 | 491 | let prAssetPart = $t02202522121._2 | |
492 | - | let estPut = cp(userAddress, txId, AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), 0, true, true, false, | |
492 | + | let estPut = cp(userAddress, txId, AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), 0, true, true, false, pmtAmtRaw, pmtAssetId) | |
493 | 493 | let estimLP = estPut._2 | |
494 | 494 | let lpAssetId = estPut._7 | |
495 | 495 | let state = estPut._9 | |
496 | 496 | let amDiff = estPut._10 | |
497 | 497 | let prDiff = estPut._11 | |
498 | 498 | estPut | |
499 | 499 | } | |
500 | 500 | ||
501 | 501 | ||
502 | 502 | func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = if ((size(payments) != 1)) | |
503 | 503 | then throw("1 pmnt expd") | |
504 | 504 | else { | |
505 | 505 | let poolConfig = gpc() | |
506 | 506 | let lpId = poolConfig[idxLPAsId] | |
507 | 507 | let amId = poolConfig[idxAmAsId] | |
508 | 508 | let prId = poolConfig[idxPrAsId] | |
509 | 509 | let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm]) | |
510 | 510 | let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm]) | |
511 | 511 | let poolStatus = poolConfig[idxPoolSt] | |
512 | 512 | let userAddress = if ((caller == this)) | |
513 | 513 | then originCaller | |
514 | 514 | else caller | |
515 | 515 | let pmt = value(payments[0]) | |
516 | 516 | let pmtAssetId = value(pmt.assetId) | |
517 | 517 | let pmtAmt = pmt.amount | |
518 | 518 | if ((1000000000 > pmtAmt)) | |
519 | 519 | then throw("Min pmt 10 LP") | |
520 | 520 | else { | |
521 | 521 | let txId58 = toBase58String(transactionId) | |
522 | 522 | if ((lpId != toBase58String(pmtAssetId))) | |
523 | 523 | then throw("Wrong LP") | |
524 | 524 | else { | |
525 | 525 | let amBalance = getAccBalance(amId) | |
526 | 526 | let prBalance = getAccBalance(prId) | |
527 | - | let $ | |
527 | + | let $t02347623584 = { | |
528 | 528 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
529 | 529 | if ($isInstanceOf(@, "(Int, Int)")) | |
530 | 530 | then @ | |
531 | 531 | else throw(($getType(invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)) + " couldn't be cast to (Int, Int)")) | |
532 | 532 | } | |
533 | - | let totalGet = $ | |
534 | - | let feeAmount = $ | |
533 | + | let totalGet = $t02347623584._1 | |
534 | + | let feeAmount = $t02347623584._2 | |
535 | 535 | let totalAmount = if (if ((minOutAmount > 0)) | |
536 | 536 | then (minOutAmount > totalGet) | |
537 | 537 | else false) | |
538 | 538 | then throw(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
539 | 539 | else totalGet | |
540 | - | let $ | |
540 | + | let $t02377123858 = if ((outAssetId == amId)) | |
541 | 541 | then $Tuple2(totalAmount, 0) | |
542 | 542 | else $Tuple2(0, totalAmount) | |
543 | - | let outAm = $ | |
544 | - | let outPr = $ | |
543 | + | let outAm = $t02377123858._1 | |
544 | + | let outPr = $t02377123858._2 | |
545 | 545 | let curPrX18 = cpbi(t1(prBalance, prDecimals), t1(amBalance, amDecimals)) | |
546 | 546 | let curPr = f1(curPrX18, scale8) | |
547 | 547 | let state = [ScriptTransfer(userAddress, totalAmount, if ((outAssetId == "WAVES")) | |
548 | 548 | then unit | |
549 | 549 | else fromBase58String(outAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] | |
550 | 550 | if ((state == state)) | |
551 | 551 | then { | |
552 | 552 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
553 | 553 | if ((burn == burn)) | |
554 | 554 | then $Tuple2(state, totalAmount) | |
555 | 555 | else throw("Strict value is not equal to itself.") | |
556 | 556 | } | |
557 | 557 | else throw("Strict value is not equal to itself.") | |
558 | 558 | } | |
559 | 559 | } | |
560 | 560 | } | |
561 | 561 | ||
562 | 562 | ||
563 | 563 | func m () = match getString(mpk()) { | |
564 | 564 | case s: String => | |
565 | 565 | fromBase58String(s) | |
566 | 566 | case _: Unit => | |
567 | 567 | unit | |
568 | 568 | case _ => | |
569 | 569 | throw("Match error") | |
570 | 570 | } | |
571 | 571 | ||
572 | 572 | ||
573 | 573 | func pm () = match getString(pmpk()) { | |
574 | 574 | case s: String => | |
575 | 575 | fromBase58String(s) | |
576 | 576 | case _: Unit => | |
577 | 577 | unit | |
578 | 578 | case _ => | |
579 | 579 | throw("Match error") | |
580 | 580 | } | |
581 | 581 | ||
582 | 582 | ||
583 | 583 | let pd = throw("Permission denied") | |
584 | 584 | ||
585 | 585 | func mm (i) = match m() { | |
586 | 586 | case pk: ByteVector => | |
587 | 587 | if ((i.callerPublicKey == pk)) | |
588 | 588 | then true | |
589 | 589 | else pd | |
590 | 590 | case _: Unit => | |
591 | 591 | if ((i.caller == this)) | |
592 | 592 | then true | |
593 | 593 | else pd | |
594 | 594 | case _ => | |
595 | 595 | throw("Match error") | |
596 | 596 | } | |
597 | 597 | ||
598 | 598 | ||
599 | 599 | @Callable(i) | |
600 | 600 | func constructor (fc) = { | |
601 | 601 | let c = mm(i) | |
602 | 602 | if ((c == c)) | |
603 | 603 | then [StringEntry(fc(), fc)] | |
604 | 604 | else throw("Strict value is not equal to itself.") | |
605 | 605 | } | |
606 | 606 | ||
607 | 607 | ||
608 | 608 | ||
609 | 609 | @Callable(i) | |
610 | 610 | func setManager (pendingManagerPublicKey) = { | |
611 | 611 | let c = mm(i) | |
612 | 612 | if ((c == c)) | |
613 | 613 | then { | |
614 | 614 | let cm = fromBase58String(pendingManagerPublicKey) | |
615 | 615 | if ((cm == cm)) | |
616 | 616 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
617 | 617 | else throw("Strict value is not equal to itself.") | |
618 | 618 | } | |
619 | 619 | else throw("Strict value is not equal to itself.") | |
620 | 620 | } | |
621 | 621 | ||
622 | 622 | ||
623 | 623 | ||
624 | 624 | @Callable(i) | |
625 | 625 | func confirmManager () = { | |
626 | 626 | let p = pm() | |
627 | 627 | let hpm = if (isDefined(p)) | |
628 | 628 | then true | |
629 | 629 | else throw("No pending manager") | |
630 | 630 | if ((hpm == hpm)) | |
631 | 631 | then { | |
632 | 632 | let cpm = if ((i.callerPublicKey == value(p))) | |
633 | 633 | then true | |
634 | 634 | else throw("You are not pending manager") | |
635 | 635 | if ((cpm == cpm)) | |
636 | 636 | then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())] | |
637 | 637 | else throw("Strict value is not equal to itself.") | |
638 | 638 | } | |
639 | 639 | else throw("Strict value is not equal to itself.") | |
640 | 640 | } | |
641 | 641 | ||
642 | 642 | ||
643 | 643 | ||
644 | 644 | @Callable(i) | |
645 | 645 | func put (slip,autoStake) = { | |
646 | 646 | let factCfg = gfc() | |
647 | 647 | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
648 | 648 | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
649 | 649 | if ((0 > slip)) | |
650 | 650 | then throw("Wrong slippage") | |
651 | 651 | else if ((size(i.payments) != 2)) | |
652 | 652 | then throw("2 pmnts expd") | |
653 | 653 | else { | |
654 | 654 | 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, "") | |
655 | 655 | let emitLpAmt = e._2 | |
656 | 656 | let lpAssetId = e._7 | |
657 | 657 | let state = e._9 | |
658 | 658 | let amDiff = e._10 | |
659 | 659 | let prDiff = e._11 | |
660 | 660 | let amId = e._12 | |
661 | 661 | let prId = e._13 | |
662 | 662 | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
663 | 663 | if ((r == r)) | |
664 | 664 | then { | |
665 | 665 | let el = match r { | |
666 | 666 | case legacy: Address => | |
667 | 667 | invoke(legacy, "emit", [emitLpAmt], nil) | |
668 | 668 | case _ => | |
669 | 669 | unit | |
670 | 670 | } | |
671 | 671 | if ((el == el)) | |
672 | 672 | then { | |
673 | 673 | let sa = if ((amDiff > 0)) | |
674 | 674 | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
675 | 675 | else nil | |
676 | 676 | if ((sa == sa)) | |
677 | 677 | then { | |
678 | 678 | let sp = if ((prDiff > 0)) | |
679 | 679 | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
680 | 680 | else nil | |
681 | 681 | if ((sp == sp)) | |
682 | 682 | then { | |
683 | 683 | let lpTrnsfr = if (autoStake) | |
684 | 684 | then { | |
685 | 685 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
686 | 686 | if ((ss == ss)) | |
687 | 687 | then nil | |
688 | 688 | else throw("Strict value is not equal to itself.") | |
689 | 689 | } | |
690 | 690 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
691 | 691 | (state ++ lpTrnsfr) | |
692 | 692 | } | |
693 | 693 | else throw("Strict value is not equal to itself.") | |
694 | 694 | } | |
695 | 695 | else throw("Strict value is not equal to itself.") | |
696 | 696 | } | |
697 | 697 | else throw("Strict value is not equal to itself.") | |
698 | 698 | } | |
699 | 699 | else throw("Strict value is not equal to itself.") | |
700 | 700 | } | |
701 | 701 | } | |
702 | 702 | ||
703 | 703 | ||
704 | 704 | ||
705 | 705 | @Callable(i) | |
706 | 706 | func putOneTkn (amAssetPart,prAssetPart,outLp,slippage,autoStake) = { | |
707 | 707 | let cfg = gfc() | |
708 | 708 | let stakingCntr = valueOrErrorMessage(addressFromString(cfg[idxFactStakCntr]), "Wr st addr") | |
709 | 709 | let slipCntr = valueOrErrorMessage(addressFromString(cfg[idxFactSlippCntr]), "Wr sl addr") | |
710 | 710 | let gwxCntr = valueOrErrorMessage(addressFromString(cfg[idxFactGwxRewCntr]), "Wr gwx addr") | |
711 | 711 | let poolCfg = gpc() | |
712 | 712 | let amId = poolCfg[idxAmAsId] | |
713 | 713 | let prId = poolCfg[idxPrAsId] | |
714 | 714 | let amDcm = parseIntValue(poolCfg[idxAmtAsDcm]) | |
715 | 715 | let prDcm = parseIntValue(poolCfg[idxPriceAsDcm]) | |
716 | 716 | let addon = valueOrElse(getString(this, ada()), "") | |
717 | 717 | let userAddress = if ((addon == toString(i.caller))) | |
718 | 718 | then i.originCaller | |
719 | 719 | else i.caller | |
720 | 720 | if (if (if (if ((0 >= slippage)) | |
721 | 721 | then true | |
722 | 722 | else (0 >= amAssetPart)) | |
723 | 723 | then true | |
724 | 724 | else (0 >= prAssetPart)) | |
725 | 725 | then true | |
726 | 726 | else (0 >= outLp)) | |
727 | 727 | then throw("Wrong params") | |
728 | 728 | else if ((size(i.payments) != 1)) | |
729 | 729 | then throw("1 pmnt expd") | |
730 | 730 | else { | |
731 | 731 | let pmt = value(i.payments[0]) | |
732 | 732 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
733 | 733 | let paymentAmountRaw = pmt.amount | |
734 | - | let $ | |
735 | - | let pmtAmt = $ | |
736 | - | let feeAmount = $ | |
734 | + | let $t02905429106 = takeFee(paymentAmountRaw) | |
735 | + | let pmtAmt = $t02905429106._1 | |
736 | + | let feeAmount = $t02905429106._2 | |
737 | 737 | if ((10000000 > paymentAmountRaw)) | |
738 | 738 | then throw("Wrong pmt amt") | |
739 | 739 | else { | |
740 | 740 | let amBalance = getAccBalance(amId) | |
741 | 741 | let prBalance = getAccBalance(prId) | |
742 | - | let $ | |
742 | + | let $t02926629882 = if ((pmtAssetId == amId)) | |
743 | 743 | then if (if ((paymentAmountRaw > amBalance)) | |
744 | 744 | then true | |
745 | 745 | else (amAssetPart > pmtAmt)) | |
746 | 746 | then throw("invalid payment amount") | |
747 | 747 | else $Tuple6((amBalance - paymentAmountRaw), prBalance, (pmtAmt - amAssetPart), prAssetPart, 0, 0) | |
748 | 748 | else if ((pmtAssetId == prId)) | |
749 | 749 | then if (if ((paymentAmountRaw > prBalance)) | |
750 | 750 | then true | |
751 | 751 | else (prAssetPart > pmtAmt)) | |
752 | 752 | then throw("invalid payment amount") | |
753 | 753 | else $Tuple6(amBalance, (prBalance - paymentAmountRaw), 0, 0, (pmtAmt - prAssetPart), amAssetPart) | |
754 | 754 | else throw("wrong pmtAssetId") | |
755 | - | let amBalanceNow = $ | |
756 | - | let prBalanceNow = $ | |
757 | - | let virtSwapInAm = $ | |
758 | - | let virtSwapOutPr = $ | |
759 | - | let virtSwapInPr = $ | |
760 | - | let virtSwapOutAm = $ | |
755 | + | let amBalanceNow = $t02926629882._1 | |
756 | + | let prBalanceNow = $t02926629882._2 | |
757 | + | let virtSwapInAm = $t02926629882._3 | |
758 | + | let virtSwapOutPr = $t02926629882._4 | |
759 | + | let virtSwapInPr = $t02926629882._5 | |
760 | + | let virtSwapOutAm = $t02926629882._6 | |
761 | 761 | let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil) | |
762 | 762 | let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil) | |
763 | 763 | let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D) | |
764 | 764 | if ((D0vsD1 == D0vsD1)) | |
765 | 765 | then { | |
766 | 766 | let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), slippage, true, true, true, pmtAmt, pmtAssetId) | |
767 | 767 | let estimLP = estPut._2 | |
768 | 768 | let lpAssetId = estPut._7 | |
769 | 769 | let state = estPut._9 | |
770 | 770 | let amDiff = estPut._10 | |
771 | 771 | let prDiff = estPut._11 | |
772 | 772 | let lpCalcRes = vad(toBigInt(estimLP), toBigInt(outLp), toBigInt(slippage)) | |
773 | 773 | let emitLpAmt = toInt(lpCalcRes._2) | |
774 | 774 | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
775 | 775 | if ((e == e)) | |
776 | 776 | then { | |
777 | 777 | let el = match e { | |
778 | 778 | case legacy: Address => | |
779 | 779 | invoke(legacy, "emit", [emitLpAmt], nil) | |
780 | 780 | case _ => | |
781 | 781 | unit | |
782 | 782 | } | |
783 | 783 | if ((el == el)) | |
784 | 784 | then { | |
785 | 785 | let sa = if ((amDiff > 0)) | |
786 | 786 | then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)]) | |
787 | 787 | else nil | |
788 | 788 | if ((sa == sa)) | |
789 | 789 | then { | |
790 | 790 | let sp = if ((prDiff > 0)) | |
791 | 791 | then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)]) | |
792 | 792 | else nil | |
793 | 793 | if ((sp == sp)) | |
794 | 794 | then { | |
795 | 795 | let lpTrnsfr = if (autoStake) | |
796 | 796 | then { | |
797 | 797 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
798 | 798 | if ((ss == ss)) | |
799 | 799 | then nil | |
800 | 800 | else throw("Strict value is not equal to itself.") | |
801 | 801 | } | |
802 | 802 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
803 | 803 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
804 | 804 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
805 | 805 | else nil | |
806 | 806 | ((state ++ lpTrnsfr) ++ sendFeeToMatcher) | |
807 | 807 | } | |
808 | 808 | else throw("Strict value is not equal to itself.") | |
809 | 809 | } | |
810 | 810 | else throw("Strict value is not equal to itself.") | |
811 | 811 | } | |
812 | 812 | else throw("Strict value is not equal to itself.") | |
813 | 813 | } | |
814 | 814 | else throw("Strict value is not equal to itself.") | |
815 | 815 | } | |
816 | 816 | else throw("Strict value is not equal to itself.") | |
817 | 817 | } | |
818 | 818 | } | |
819 | 819 | } | |
820 | 820 | ||
821 | 821 | ||
822 | 822 | ||
823 | 823 | @Callable(i) | |
824 | 824 | func putOneTknV2 (minOutAmount,autoStake) = if ((size(i.payments) != 1)) | |
825 | 825 | then throw("1 pmnt expd") | |
826 | 826 | else { | |
827 | 827 | let poolConfig = gpc() | |
828 | 828 | let amId = poolConfig[idxAmAsId] | |
829 | 829 | let prId = poolConfig[idxPrAsId] | |
830 | 830 | let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm]) | |
831 | 831 | let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm]) | |
832 | 832 | let userAddress = if ((i.caller == this)) | |
833 | 833 | then i.originCaller | |
834 | 834 | else i.caller | |
835 | 835 | let pmt = value(i.payments[0]) | |
836 | 836 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
837 | 837 | let pmtAmt = pmt.amount | |
838 | 838 | if ((10000000 > pmtAmt)) | |
839 | 839 | then throw("Wrong pmt amt") | |
840 | 840 | else { | |
841 | 841 | let r = estimatePutOneTknV2(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId)) | |
842 | 842 | let estimLP = r._2 | |
843 | 843 | let lpAssetId = r._7 | |
844 | 844 | let state = r._9 | |
845 | 845 | let amDiff = r._10 | |
846 | 846 | let prDiff = r._11 | |
847 | 847 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
848 | 848 | then (minOutAmount > estimLP) | |
849 | 849 | else false) | |
850 | 850 | then throw(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
851 | 851 | else estimLP | |
852 | 852 | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
853 | 853 | if ((e == e)) | |
854 | 854 | then { | |
855 | 855 | let el = match e { | |
856 | 856 | case legacy: Address => | |
857 | 857 | invoke(legacy, "emit", [emitLpAmt], nil) | |
858 | 858 | case _ => | |
859 | 859 | unit | |
860 | 860 | } | |
861 | 861 | if ((el == el)) | |
862 | 862 | then { | |
863 | 863 | let sa = if ((amDiff > 0)) | |
864 | 864 | then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)]) | |
865 | 865 | else nil | |
866 | 866 | if ((sa == sa)) | |
867 | 867 | then { | |
868 | 868 | let sp = if ((prDiff > 0)) | |
869 | 869 | then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)]) | |
870 | 870 | else nil | |
871 | 871 | if ((sp == sp)) | |
872 | 872 | then { | |
873 | 873 | let lpTrnsfr = if (autoStake) | |
874 | 874 | then { | |
875 | 875 | let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
876 | 876 | if ((ss == ss)) | |
877 | 877 | then nil | |
878 | 878 | else throw("Strict value is not equal to itself.") | |
879 | 879 | } | |
880 | 880 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
881 | 881 | $Tuple2((state ++ lpTrnsfr), emitLpAmt) | |
882 | 882 | } | |
883 | 883 | else throw("Strict value is not equal to itself.") | |
884 | 884 | } | |
885 | 885 | else throw("Strict value is not equal to itself.") | |
886 | 886 | } | |
887 | 887 | else throw("Strict value is not equal to itself.") | |
888 | 888 | } | |
889 | 889 | else throw("Strict value is not equal to itself.") | |
890 | 890 | } | |
891 | 891 | } | |
892 | 892 | ||
893 | 893 | ||
894 | 894 | ||
895 | 895 | @Callable(i) | |
896 | 896 | func putOneTknV2READONLY (paymentAmount,paymentAssetId) = { | |
897 | 897 | let r = estimatePutOneTknV2(paymentAmount, paymentAssetId, "", "") | |
898 | 898 | let estimLP = r._2 | |
899 | 899 | let lpAssetId = r._7 | |
900 | 900 | let state = r._9 | |
901 | 901 | let amDiff = r._10 | |
902 | 902 | let prDiff = r._11 | |
903 | 903 | $Tuple2(nil, estimLP) | |
904 | 904 | } | |
905 | 905 | ||
906 | 906 | ||
907 | 907 | ||
908 | 908 | @Callable(i) | |
909 | 909 | func putOneTknV2WithBonusREADONLY (paymentAmount,paymentAssetId) = { | |
910 | 910 | let poolConfig = gpc() | |
911 | 911 | let amId = poolConfig[idxAmAsId] | |
912 | 912 | let prId = poolConfig[idxPrAsId] | |
913 | 913 | let amBalance = getAccBalance(amId) | |
914 | 914 | let prBalance = getAccBalance(prId) | |
915 | 915 | let r = estimatePutOneTknV2(paymentAmount, paymentAssetId, "", "") | |
916 | 916 | let estimLP = r._2 | |
917 | 917 | let curPrice = r._3 | |
918 | 918 | let lpAssetEmission = r._6 | |
919 | 919 | let lpAssetId = r._7 | |
920 | - | let $ | |
920 | + | let $t03470935018 = if ((paymentAssetId == amId)) | |
921 | 921 | then { | |
922 | 922 | let priceAssetAmount = fraction(paymentAmount, curPrice, scale8) | |
923 | 923 | $Tuple2(paymentAmount, priceAssetAmount) | |
924 | 924 | } | |
925 | 925 | else { | |
926 | 926 | let amountAssetAmount = fraction(paymentAmount, scale8, curPrice) | |
927 | 927 | $Tuple2(amountAssetAmount, paymentAmount) | |
928 | 928 | } | |
929 | - | let amountAssetAmount = $ | |
930 | - | let priceAssetAmount = $ | |
929 | + | let amountAssetAmount = $t03470935018._1 | |
930 | + | let priceAssetAmount = $t03470935018._2 | |
931 | 931 | let lpAmtBoth = fraction(lpAssetEmission, priceAssetAmount, prBalance) | |
932 | 932 | let lpAssetPriceOne = if ((paymentAssetId == amId)) | |
933 | 933 | then fraction(amountAssetAmount, scale8, estimLP) | |
934 | 934 | else fraction(priceAssetAmount, scale8, estimLP) | |
935 | 935 | let lpAssetPriceBoth = fraction((priceAssetAmount + amountAssetAmount), scale8, lpAmtBoth) | |
936 | 936 | let bonus = fraction((lpAssetPriceBoth - lpAssetPriceOne), scale8, lpAssetPriceOne) | |
937 | 937 | let feeAmount = takeFee(paymentAmount)._2 | |
938 | 938 | $Tuple2(nil, $Tuple3(estimLP, feeAmount, bonus)) | |
939 | 939 | } | |
940 | 940 | ||
941 | 941 | ||
942 | 942 | ||
943 | 943 | @Callable(i) | |
944 | 944 | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
945 | 945 | then throw("Wrong slpg") | |
946 | 946 | else if ((size(i.payments) != 2)) | |
947 | 947 | then throw("2 pmnts expd") | |
948 | 948 | else { | |
949 | 949 | 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, "") | |
950 | 950 | estPut._9 | |
951 | 951 | } | |
952 | 952 | ||
953 | 953 | ||
954 | 954 | ||
955 | 955 | @Callable(i) | |
956 | 956 | func get () = { | |
957 | 957 | let r = cg(i) | |
958 | 958 | let outAmtAmt = r._1 | |
959 | 959 | let outPrAmt = r._2 | |
960 | 960 | let pmtAmt = r._3 | |
961 | 961 | let pmtAssetId = r._4 | |
962 | 962 | let state = r._5 | |
963 | 963 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
964 | 964 | if ((b == b)) | |
965 | 965 | then state | |
966 | 966 | else throw("Strict value is not equal to itself.") | |
967 | 967 | } | |
968 | 968 | ||
969 | 969 | ||
970 | 970 | ||
971 | 971 | @Callable(i) | |
972 | 972 | func getOneTkn (exchResult,notUsed,outAmount,outAssetId,slippage) = if ((size(i.payments) != 1)) | |
973 | 973 | then throw("1 pmnt expd") | |
974 | 974 | else { | |
975 | 975 | let cfg = gpc() | |
976 | 976 | let lpId = cfg[idxLPAsId] | |
977 | 977 | let amId = cfg[idxAmAsId] | |
978 | 978 | let prId = cfg[idxPrAsId] | |
979 | 979 | let amDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
980 | 980 | let prDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
981 | 981 | let sts = cfg[idxPoolSt] | |
982 | 982 | let factCfg = gfc() | |
983 | 983 | let gwxCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactGwxRewCntr]), "Wr sl addr") | |
984 | 984 | let pmt = value(i.payments[0]) | |
985 | 985 | let addon = valueOrElse(getString(this, ada()), "") | |
986 | 986 | let userAddress = if ((addon == toString(i.caller))) | |
987 | 987 | then i.originCaller | |
988 | 988 | else i.caller | |
989 | 989 | let txId58 = toBase58String(i.transactionId) | |
990 | 990 | let pmtAssetId = value(pmt.assetId) | |
991 | 991 | let pmtAmt = pmt.amount | |
992 | 992 | if ((1000000000 > pmtAmt)) | |
993 | 993 | then throw("Min pmt 10 LP") | |
994 | 994 | else if (if (if ((0 > slippage)) | |
995 | 995 | then true | |
996 | 996 | else (0 > exchResult)) | |
997 | 997 | then true | |
998 | 998 | else (0 > outAmount)) | |
999 | 999 | then throw("Wrong params") | |
1000 | 1000 | else if ((lpId != toBase58String(pmtAssetId))) | |
1001 | 1001 | then throw("Wrong LP") | |
1002 | 1002 | else { | |
1003 | 1003 | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
1004 | 1004 | let estimAmAmt = r._1 | |
1005 | 1005 | let estimPrAmt = r._2 | |
1006 | 1006 | let amBalance = getAccBalance(amId) | |
1007 | 1007 | let prBalance = getAccBalance(prId) | |
1008 | - | let $ | |
1008 | + | let $t03829938759 = if ((outAssetId == amId)) | |
1009 | 1009 | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult)) | |
1010 | 1010 | else if ((outAssetId == prId)) | |
1011 | 1011 | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult)) | |
1012 | 1012 | else throw("wrong outAssetId") | |
1013 | - | let amBalanceNow = $ | |
1014 | - | let prBalanceNow = $ | |
1015 | - | let virtSwapInAm = $ | |
1016 | - | let virtSwapOutPr = $ | |
1017 | - | let virtSwapInPr = $ | |
1018 | - | let virtSwapOutAm = $ | |
1019 | - | let totalGetRaw = $ | |
1013 | + | let amBalanceNow = $t03829938759._1 | |
1014 | + | let prBalanceNow = $t03829938759._2 | |
1015 | + | let virtSwapInAm = $t03829938759._3 | |
1016 | + | let virtSwapOutPr = $t03829938759._4 | |
1017 | + | let virtSwapInPr = $t03829938759._5 | |
1018 | + | let virtSwapOutAm = $t03829938759._6 | |
1019 | + | let totalGetRaw = $t03829938759._7 | |
1020 | 1020 | if (if ((0 > virtSwapInAm)) | |
1021 | 1021 | then true | |
1022 | 1022 | else (0 > virtSwapInPr)) | |
1023 | 1023 | then throw("Wrong calc") | |
1024 | 1024 | else { | |
1025 | 1025 | let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil) | |
1026 | 1026 | let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil) | |
1027 | 1027 | let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D) | |
1028 | 1028 | if ((D0vsD1 == D0vsD1)) | |
1029 | 1029 | then { | |
1030 | 1030 | let totalGet = takeFee(totalGetRaw)._1 | |
1031 | 1031 | let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage)) | |
1032 | 1032 | if ((finalRes == finalRes)) | |
1033 | 1033 | then { | |
1034 | - | let $ | |
1034 | + | let $t03950639610 = if ((outAssetId == amId)) | |
1035 | 1035 | then $Tuple2(toInt(finalRes._2), 0) | |
1036 | 1036 | else $Tuple2(0, toInt(finalRes._2)) | |
1037 | - | let outAm = $ | |
1038 | - | let outPr = $ | |
1037 | + | let outAm = $t03950639610._1 | |
1038 | + | let outPr = $t03950639610._2 | |
1039 | 1039 | let totalAmount = (outAm + outPr) | |
1040 | 1040 | let feeAmount = (totalGetRaw - totalGet) | |
1041 | 1041 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
1042 | 1042 | then unit | |
1043 | 1043 | else fromBase58String(outAssetId) | |
1044 | 1044 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1045 | 1045 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
1046 | 1046 | else nil | |
1047 | 1047 | let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm)) | |
1048 | 1048 | let curPr = f1(curPrX18, scale8) | |
1049 | 1049 | 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)] | |
1050 | 1050 | if ((state == state)) | |
1051 | 1051 | then { | |
1052 | 1052 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1053 | 1053 | if ((burn == burn)) | |
1054 | 1054 | then (state ++ sendFeeToMatcher) | |
1055 | 1055 | else throw("Strict value is not equal to itself.") | |
1056 | 1056 | } | |
1057 | 1057 | else throw("Strict value is not equal to itself.") | |
1058 | 1058 | } | |
1059 | 1059 | else throw("Strict value is not equal to itself.") | |
1060 | 1060 | } | |
1061 | 1061 | else throw("Strict value is not equal to itself.") | |
1062 | 1062 | } | |
1063 | 1063 | } | |
1064 | 1064 | } | |
1065 | 1065 | ||
1066 | 1066 | ||
1067 | 1067 | ||
1068 | 1068 | @Callable(i) | |
1069 | 1069 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1070 | - | let $ | |
1071 | - | let state = $ | |
1072 | - | let totalAmount = $ | |
1070 | + | let $t04063540790 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1071 | + | let state = $t04063540790._1 | |
1072 | + | let totalAmount = $t04063540790._2 | |
1073 | 1073 | $Tuple2(state, totalAmount) | |
1074 | 1074 | } | |
1075 | 1075 | ||
1076 | 1076 | ||
1077 | 1077 | ||
1078 | 1078 | @Callable(i) | |
1079 | 1079 | func getOneTknV2READONLY (outAssetId,lpAssetAmount) = { | |
1080 | 1080 | let poolConfig = gpc() | |
1081 | 1081 | let lpId = poolConfig[idxLPAsId] | |
1082 | 1082 | let amId = poolConfig[idxAmAsId] | |
1083 | 1083 | let prId = poolConfig[idxPrAsId] | |
1084 | 1084 | let r = ego("", lpId, lpAssetAmount, this) | |
1085 | 1085 | let estimAmAmt = r._1 | |
1086 | 1086 | let estimPrAmt = r._2 | |
1087 | 1087 | let amBalance = getAccBalance(amId) | |
1088 | 1088 | let prBalance = getAccBalance(prId) | |
1089 | 1089 | let amBalanceNow = (amBalance - estimAmAmt) | |
1090 | 1090 | let prBalanceNow = (prBalance - estimPrAmt) | |
1091 | - | let $ | |
1091 | + | let $t04130041571 = if ((outAssetId == amId)) | |
1092 | 1092 | then $Tuple3(prBalanceNow, amBalanceNow, estimPrAmt) | |
1093 | 1093 | else if ((outAssetId == prId)) | |
1094 | 1094 | then $Tuple3(amBalanceNow, prBalanceNow, estimAmAmt) | |
1095 | 1095 | else throw("wrong outAssetId") | |
1096 | - | let amountBalanceForSwap = $ | |
1097 | - | let priceBalanceForSwap = $ | |
1098 | - | let amountToSwap = $ | |
1096 | + | let amountBalanceForSwap = $t04130041571._1 | |
1097 | + | let priceBalanceForSwap = $t04130041571._2 | |
1098 | + | let amountToSwap = $t04130041571._3 | |
1099 | 1099 | let yPrecision = 1 | |
1100 | 1100 | let exchResult = { | |
1101 | 1101 | let @ = invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil) | |
1102 | 1102 | if ($isInstanceOf(@, "Int")) | |
1103 | 1103 | then @ | |
1104 | 1104 | else throw(($getType(invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil)) + " couldn't be cast to Int")) | |
1105 | 1105 | } | |
1106 | 1106 | let totalGetRaw = (exchResult + (if ((outAssetId == amId)) | |
1107 | 1107 | then estimAmAmt | |
1108 | 1108 | else estimPrAmt)) | |
1109 | - | let $ | |
1110 | - | let totalGet = $ | |
1111 | - | let feeAmount = $ | |
1109 | + | let $t04214342192 = takeFee(totalGetRaw) | |
1110 | + | let totalGet = $t04214342192._1 | |
1111 | + | let feeAmount = $t04214342192._2 | |
1112 | 1112 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1113 | 1113 | } | |
1114 | 1114 | ||
1115 | 1115 | ||
1116 | 1116 | ||
1117 | 1117 | @Callable(i) | |
1118 | 1118 | func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = { | |
1119 | 1119 | let poolConfig = gpc() | |
1120 | 1120 | let amId = poolConfig[idxAmAsId] | |
1121 | 1121 | let prId = poolConfig[idxPrAsId] | |
1122 | 1122 | let lpId = poolConfig[idxLPAsId] | |
1123 | 1123 | let amBalance = getAccBalance(amId) | |
1124 | 1124 | let prBalance = getAccBalance(prId) | |
1125 | - | let $ | |
1125 | + | let $t04253642651 = { | |
1126 | 1126 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1127 | 1127 | if ($isInstanceOf(@, "(Int, Int)")) | |
1128 | 1128 | then @ | |
1129 | 1129 | else throw(($getType(invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)) + " couldn't be cast to (Int, Int)")) | |
1130 | 1130 | } | |
1131 | - | let totalGet = $ | |
1132 | - | let feeAmount = $ | |
1131 | + | let totalGet = $t04253642651._1 | |
1132 | + | let feeAmount = $t04253642651._2 | |
1133 | 1133 | let r = ego("", lpId, lpAssetAmount, this) | |
1134 | 1134 | let outAmAmt = r._1 | |
1135 | 1135 | let outPrAmt = r._2 | |
1136 | 1136 | let lpAssetPriceOne = fraction(totalGet, scale8, lpAssetAmount) | |
1137 | 1137 | let lpAssetPriceBoth = fraction((outAmAmt + outPrAmt), scale8, lpAssetAmount) | |
1138 | 1138 | let bonus = fraction((lpAssetPriceOne - lpAssetPriceBoth), scale8, lpAssetPriceBoth) | |
1139 | 1139 | $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus)) | |
1140 | 1140 | } | |
1141 | 1141 | ||
1142 | 1142 | ||
1143 | 1143 | ||
1144 | 1144 | @Callable(i) | |
1145 | 1145 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1146 | 1146 | let r = cg(i) | |
1147 | 1147 | let outAmAmt = r._1 | |
1148 | 1148 | let outPrAmt = r._2 | |
1149 | 1149 | let pmtAmt = r._3 | |
1150 | 1150 | let pmtAssetId = r._4 | |
1151 | 1151 | let state = r._5 | |
1152 | 1152 | if ((noLessThenAmtAsset > outAmAmt)) | |
1153 | 1153 | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1154 | 1154 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1155 | 1155 | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1156 | 1156 | else { | |
1157 | 1157 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1158 | 1158 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1159 | 1159 | then state | |
1160 | 1160 | else throw("Strict value is not equal to itself.") | |
1161 | 1161 | } | |
1162 | 1162 | } | |
1163 | 1163 | ||
1164 | 1164 | ||
1165 | 1165 | ||
1166 | 1166 | @Callable(i) | |
1167 | 1167 | func unstakeAndGet (amount) = { | |
1168 | 1168 | let checkPayments = if ((size(i.payments) != 0)) | |
1169 | 1169 | then throw("No pmnts expd") | |
1170 | 1170 | else true | |
1171 | 1171 | if ((checkPayments == checkPayments)) | |
1172 | 1172 | then { | |
1173 | 1173 | let cfg = gpc() | |
1174 | 1174 | let factoryCfg = gfc() | |
1175 | 1175 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1176 | 1176 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1177 | 1177 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1178 | 1178 | if ((unstakeInv == unstakeInv)) | |
1179 | 1179 | then { | |
1180 | 1180 | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1181 | 1181 | let sts = parseIntValue(r._9) | |
1182 | 1182 | let state = r._10 | |
1183 | 1183 | let v = if (if (igs()) | |
1184 | 1184 | then true | |
1185 | 1185 | else (sts == PoolShutdown)) | |
1186 | 1186 | then throw(("Blocked: " + toString(sts))) | |
1187 | 1187 | else true | |
1188 | 1188 | if ((v == v)) | |
1189 | 1189 | then { | |
1190 | 1190 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1191 | 1191 | if ((burnA == burnA)) | |
1192 | 1192 | then state | |
1193 | 1193 | else throw("Strict value is not equal to itself.") | |
1194 | 1194 | } | |
1195 | 1195 | else throw("Strict value is not equal to itself.") | |
1196 | 1196 | } | |
1197 | 1197 | else throw("Strict value is not equal to itself.") | |
1198 | 1198 | } | |
1199 | 1199 | else throw("Strict value is not equal to itself.") | |
1200 | 1200 | } | |
1201 | 1201 | ||
1202 | 1202 | ||
1203 | 1203 | ||
1204 | 1204 | @Callable(i) | |
1205 | 1205 | func unstakeAndGetOneTkn (unstakeAmount,outAssetId,minOutAmount) = { | |
1206 | 1206 | let checkPayments = if ((size(i.payments) != 0)) | |
1207 | 1207 | then throw("No pmnts expd") | |
1208 | 1208 | else true | |
1209 | 1209 | if ((checkPayments == checkPayments)) | |
1210 | 1210 | then { | |
1211 | 1211 | let cfg = gpc() | |
1212 | 1212 | let factoryCfg = gfc() | |
1213 | 1213 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1214 | 1214 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1215 | 1215 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1216 | 1216 | if ((unstakeInv == unstakeInv)) | |
1217 | 1217 | then { | |
1218 | - | let $ | |
1219 | - | let state = $ | |
1220 | - | let totalAmount = $ | |
1218 | + | let $t04507145259 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1219 | + | let state = $t04507145259._1 | |
1220 | + | let totalAmount = $t04507145259._2 | |
1221 | 1221 | $Tuple2(state, totalAmount) | |
1222 | 1222 | } | |
1223 | 1223 | else throw("Strict value is not equal to itself.") | |
1224 | 1224 | } | |
1225 | 1225 | else throw("Strict value is not equal to itself.") | |
1226 | 1226 | } | |
1227 | 1227 | ||
1228 | 1228 | ||
1229 | 1229 | ||
1230 | 1230 | @Callable(i) | |
1231 | 1231 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1232 | 1232 | then throw("denied") | |
1233 | 1233 | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success") | |
1234 | 1234 | ||
1235 | 1235 | ||
1236 | 1236 | ||
1237 | 1237 | @Callable(i) | |
1238 | 1238 | func setS (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1239 | 1239 | then pd | |
1240 | 1240 | else [StringEntry(k, v)] | |
1241 | 1241 | ||
1242 | 1242 | ||
1243 | 1243 | ||
1244 | 1244 | @Callable(i) | |
1245 | 1245 | func setI (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1246 | 1246 | then pd | |
1247 | 1247 | else [IntegerEntry(k, v)] | |
1248 | 1248 | ||
1249 | 1249 | ||
1250 | 1250 | ||
1251 | 1251 | @Callable(i) | |
1252 | 1252 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
1253 | 1253 | ||
1254 | 1254 | ||
1255 | 1255 | ||
1256 | 1256 | @Callable(i) | |
1257 | 1257 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1258 | 1258 | ||
1259 | 1259 | ||
1260 | 1260 | ||
1261 | 1261 | @Callable(i) | |
1262 | 1262 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1263 | 1263 | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
1264 | 1264 | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
1265 | 1265 | } | |
1266 | 1266 | ||
1267 | 1267 | ||
1268 | 1268 | ||
1269 | 1269 | @Callable(i) | |
1270 | 1270 | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
1271 | 1271 | ||
1272 | 1272 | ||
1273 | 1273 | ||
1274 | 1274 | @Callable(i) | |
1275 | 1275 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
1276 | 1276 | ||
1277 | 1277 | ||
1278 | 1278 | ||
1279 | 1279 | @Callable(i) | |
1280 | 1280 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1281 | 1281 | ||
1282 | 1282 | ||
1283 | 1283 | ||
1284 | 1284 | @Callable(i) | |
1285 | 1285 | 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, "")) | |
1286 | 1286 | ||
1287 | 1287 | ||
1288 | 1288 | ||
1289 | 1289 | @Callable(i) | |
1290 | 1290 | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
1291 | 1291 | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
1292 | 1292 | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
1293 | 1293 | } | |
1294 | 1294 | ||
1295 | 1295 | ||
1296 | 1296 | ||
1297 | 1297 | @Callable(i) | |
1298 | 1298 | func getFeeREADONLY () = $Tuple2(nil, fee) | |
1299 | 1299 | ||
1300 | 1300 | ||
1301 | 1301 | @Verifier(tx) | |
1302 | 1302 | func verify () = { | |
1303 | 1303 | let targetPublicKey = match m() { | |
1304 | 1304 | case pk: ByteVector => | |
1305 | 1305 | pk | |
1306 | 1306 | case _: Unit => | |
1307 | 1307 | tx.senderPublicKey | |
1308 | 1308 | case _ => | |
1309 | 1309 | throw("Match error") | |
1310 | 1310 | } | |
1311 | 1311 | match tx { | |
1312 | 1312 | case order: Order => | |
1313 | 1313 | let matcherPub = mp() | |
1314 | 1314 | let orderValid = moa(order) | |
1315 | 1315 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1316 | 1316 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1317 | 1317 | if (if (if (orderValid) | |
1318 | 1318 | then senderValid | |
1319 | 1319 | else false) | |
1320 | 1320 | then matcherValid | |
1321 | 1321 | else false) | |
1322 | 1322 | then true | |
1323 | 1323 | else toe(orderValid, senderValid, matcherValid) | |
1324 | 1324 | case s: SetScriptTransaction => | |
1325 | 1325 | let newHash = blake2b256(value(s.script)) | |
1326 | 1326 | let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash()))) | |
1327 | 1327 | let currentHash = scriptHash(this) | |
1328 | 1328 | if (if ((allowedHash == newHash)) | |
1329 | 1329 | then (currentHash != newHash) | |
1330 | 1330 | else false) | |
1331 | 1331 | then true | |
1332 | 1332 | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1333 | 1333 | case _ => | |
1334 | 1334 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1335 | 1335 | } | |
1336 | 1336 | } | |
1337 | 1337 |
github/deemru/w8io/169f3d6 179.61 ms ◑