tx · 984XrwirZcLsRC5yGkY1jsauYM5totQnv5pL153FWfGi 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT: -0.03100000 Waves 2022.09.26 15:22 [2246098] smart account 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT > SELF 0.00000000 Waves
{ "type": 13, "id": "984XrwirZcLsRC5yGkY1jsauYM5totQnv5pL153FWfGi", "fee": 3100000, "feeAssetId": null, "timestamp": 1664194968220, "version": 1, "sender": "3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT", "senderPublicKey": "D1BL65meykxFZTCuq7jq9HSGLLnWvQamQPUNrguW5w39", "proofs": [ "3tUZaxGmYd2XghbTeoPnjYQ564oaCjwoTzosEQLJ9z94tvQ94d3VZayCpUqFdhJ7KLTLZWxXM7fHoxE6rLTXjeXK" ], "script": "base64:BgKFHwgCEgMKAQgSAwoBCBIAEgQKAgEEEgcKBQEBAQEEEgQKAgEEEgQKAgEIEgQKAgEIEgMKAQESABIHCgUBAQEIARIECgIIARIECgIIARIECgIIARIECgIBARIDCgEBEgUKAwEIARIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IglvbmVCaWdJbnQiCnNsaXBwYWdlNEQiBUFtdWx0IgVEY29udiIDU0VQIgVFTVBUWSIKUG9vbEFjdGl2ZSIKUG9vbFB1dERpcyIOUG9vbE1hdGNoZXJEaXMiDFBvb2xTaHV0ZG93biIOaWR4UG9vbEFkZHJlc3MiCWlkeFBvb2xTdCIJaWR4TFBBc0lkIglpZHhBbUFzSWQiCWlkeFByQXNJZCILaWR4QW10QXNEY20iDWlkeFByaWNlQXNEY20iC2lkeElBbXRBc0lkIg1pZHhJUHJpY2VBc0lkIg9pZHhGYWN0U3Rha0NudHIiEGlkeEZhY3RTbGlwcENudHIiE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GVzCQCRAwIIBQJmTwZwcm9vZnMAAAUCZlEJAPQDAwgFAmZPCWJvZHlCeXRlcwkAkQMCCAUCZk8GcHJvb2ZzAAAFAmZRtU1VWg==", "chainId": 84, "height": 2246098, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Crm7EBEVVuPas1FrwqcRvfgTVQira7hbXhpydbKVSVxH Next: 5LLFZNvs6hPAjp9J1UPDMZGAWL13XJSdLXdZNBLH7CXR Diff:
Old | New | Differences | |
---|---|---|---|
941 | 941 | then fraction(amountAssetAmount, scale8, estimLP) | |
942 | 942 | else fraction(priceAssetAmount, scale8, estimLP) | |
943 | 943 | let lpAssetPriceBoth = fraction((priceAssetAmount + amountAssetAmount), scale8, lpAmtBoth) | |
944 | - | let bonus = fraction(( | |
944 | + | let bonus = fraction((estimLP - lpAmtBoth), scale8, lpAmtBoth) | |
945 | 945 | let feeAmount = takeFee(paymentAmount)._2 | |
946 | 946 | $Tuple2(nil, $Tuple3(estimLP, feeAmount, bonus)) | |
947 | 947 | } | |
1013 | 1013 | let estimPrAmt = r._2 | |
1014 | 1014 | let amBalance = getAccBalance(amId) | |
1015 | 1015 | let prBalance = getAccBalance(prId) | |
1016 | - | let $ | |
1016 | + | let $t03875039210 = if ((outAssetId == amId)) | |
1017 | 1017 | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult)) | |
1018 | 1018 | else if ((outAssetId == prId)) | |
1019 | 1019 | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult)) | |
1020 | 1020 | else throw("wrong outAssetId") | |
1021 | - | let amBalanceNow = $ | |
1022 | - | let prBalanceNow = $ | |
1023 | - | let virtSwapInAm = $ | |
1024 | - | let virtSwapOutPr = $ | |
1025 | - | let virtSwapInPr = $ | |
1026 | - | let virtSwapOutAm = $ | |
1027 | - | let totalGetRaw = $ | |
1021 | + | let amBalanceNow = $t03875039210._1 | |
1022 | + | let prBalanceNow = $t03875039210._2 | |
1023 | + | let virtSwapInAm = $t03875039210._3 | |
1024 | + | let virtSwapOutPr = $t03875039210._4 | |
1025 | + | let virtSwapInPr = $t03875039210._5 | |
1026 | + | let virtSwapOutAm = $t03875039210._6 | |
1027 | + | let totalGetRaw = $t03875039210._7 | |
1028 | 1028 | if (if ((0 > virtSwapInAm)) | |
1029 | 1029 | then true | |
1030 | 1030 | else (0 > virtSwapInPr)) | |
1039 | 1039 | let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage)) | |
1040 | 1040 | if ((finalRes == finalRes)) | |
1041 | 1041 | then { | |
1042 | - | let $ | |
1042 | + | let $t03995740061 = if ((outAssetId == amId)) | |
1043 | 1043 | then $Tuple2(toInt(finalRes._2), 0) | |
1044 | 1044 | else $Tuple2(0, toInt(finalRes._2)) | |
1045 | - | let outAm = $ | |
1046 | - | let outPr = $ | |
1045 | + | let outAm = $t03995740061._1 | |
1046 | + | let outPr = $t03995740061._2 | |
1047 | 1047 | let totalAmount = (outAm + outPr) | |
1048 | 1048 | let feeAmount = (totalGetRaw - totalGet) | |
1049 | 1049 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
1075 | 1075 | ||
1076 | 1076 | @Callable(i) | |
1077 | 1077 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1078 | - | let $ | |
1079 | - | let state = $ | |
1080 | - | let totalAmount = $ | |
1078 | + | let $t04108641241 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1079 | + | let state = $t04108641241._1 | |
1080 | + | let totalAmount = $t04108641241._2 | |
1081 | 1081 | $Tuple2(state, totalAmount) | |
1082 | 1082 | } | |
1083 | 1083 | ||
1096 | 1096 | let prBalance = getAccBalance(prId) | |
1097 | 1097 | let amBalanceNow = (amBalance - estimAmAmt) | |
1098 | 1098 | let prBalanceNow = (prBalance - estimPrAmt) | |
1099 | - | let $ | |
1099 | + | let $t04175142022 = if ((outAssetId == amId)) | |
1100 | 1100 | then $Tuple3(prBalanceNow, amBalanceNow, estimPrAmt) | |
1101 | 1101 | else if ((outAssetId == prId)) | |
1102 | 1102 | then $Tuple3(amBalanceNow, prBalanceNow, estimAmAmt) | |
1103 | 1103 | else throw("wrong outAssetId") | |
1104 | - | let amountBalanceForSwap = $ | |
1105 | - | let priceBalanceForSwap = $ | |
1106 | - | let amountToSwap = $ | |
1104 | + | let amountBalanceForSwap = $t04175142022._1 | |
1105 | + | let priceBalanceForSwap = $t04175142022._2 | |
1106 | + | let amountToSwap = $t04175142022._3 | |
1107 | 1107 | let yPrecision = 1 | |
1108 | 1108 | let exchResult = { | |
1109 | 1109 | let @ = invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil) | |
1114 | 1114 | let totalGetRaw = (exchResult + (if ((outAssetId == amId)) | |
1115 | 1115 | then estimAmAmt | |
1116 | 1116 | else estimPrAmt)) | |
1117 | - | let $ | |
1118 | - | let totalGet = $ | |
1119 | - | let feeAmount = $ | |
1117 | + | let $t04259442643 = takeFee(totalGetRaw) | |
1118 | + | let totalGet = $t04259442643._1 | |
1119 | + | let feeAmount = $t04259442643._2 | |
1120 | 1120 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1121 | 1121 | } | |
1122 | 1122 | ||
1130 | 1130 | let lpId = poolConfig[idxLPAsId] | |
1131 | 1131 | let amBalance = getAccBalance(amId) | |
1132 | 1132 | let prBalance = getAccBalance(prId) | |
1133 | - | let $ | |
1133 | + | let $t04298743102 = { | |
1134 | 1134 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1135 | 1135 | if ($isInstanceOf(@, "(Int, Int)")) | |
1136 | 1136 | then @ | |
1137 | 1137 | else throw(($getType(invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)) + " couldn't be cast to (Int, Int)")) | |
1138 | 1138 | } | |
1139 | - | let totalGet = $ | |
1140 | - | let feeAmount = $ | |
1139 | + | let totalGet = $t04298743102._1 | |
1140 | + | let feeAmount = $t04298743102._2 | |
1141 | 1141 | let r = ego("", lpId, lpAssetAmount, this) | |
1142 | 1142 | let outAmAmt = r._1 | |
1143 | 1143 | let outPrAmt = r._2 | |
1223 | 1223 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1224 | 1224 | if ((unstakeInv == unstakeInv)) | |
1225 | 1225 | then { | |
1226 | - | let $ | |
1227 | - | let state = $ | |
1228 | - | let totalAmount = $ | |
1226 | + | let $t04552245710 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1227 | + | let state = $t04552245710._1 | |
1228 | + | let totalAmount = $t04552245710._2 | |
1229 | 1229 | $Tuple2(state, totalAmount) | |
1230 | 1230 | } | |
1231 | 1231 | 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 | 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 | 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 | 533 | let totalGet = $t02347623584._1 | |
534 | 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 | 540 | let $t02377123858 = if ((outAssetId == amId)) | |
541 | 541 | then $Tuple2(totalAmount, 0) | |
542 | 542 | else $Tuple2(0, totalAmount) | |
543 | 543 | let outAm = $t02377123858._1 | |
544 | 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 outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
548 | 548 | then unit | |
549 | 549 | else fromBase58String(outAssetId) | |
550 | 550 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
551 | 551 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
552 | 552 | else nil | |
553 | 553 | 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) | |
554 | 554 | if ((state == state)) | |
555 | 555 | then { | |
556 | 556 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
557 | 557 | if ((burn == burn)) | |
558 | 558 | then $Tuple2(state, totalAmount) | |
559 | 559 | else throw("Strict value is not equal to itself.") | |
560 | 560 | } | |
561 | 561 | else throw("Strict value is not equal to itself.") | |
562 | 562 | } | |
563 | 563 | } | |
564 | 564 | } | |
565 | 565 | ||
566 | 566 | ||
567 | 567 | func m () = match getString(mpk()) { | |
568 | 568 | case s: String => | |
569 | 569 | fromBase58String(s) | |
570 | 570 | case _: Unit => | |
571 | 571 | unit | |
572 | 572 | case _ => | |
573 | 573 | throw("Match error") | |
574 | 574 | } | |
575 | 575 | ||
576 | 576 | ||
577 | 577 | func pm () = match getString(pmpk()) { | |
578 | 578 | case s: String => | |
579 | 579 | fromBase58String(s) | |
580 | 580 | case _: Unit => | |
581 | 581 | unit | |
582 | 582 | case _ => | |
583 | 583 | throw("Match error") | |
584 | 584 | } | |
585 | 585 | ||
586 | 586 | ||
587 | 587 | let pd = throw("Permission denied") | |
588 | 588 | ||
589 | 589 | func mm (i) = match m() { | |
590 | 590 | case pk: ByteVector => | |
591 | 591 | if ((i.callerPublicKey == pk)) | |
592 | 592 | then true | |
593 | 593 | else pd | |
594 | 594 | case _: Unit => | |
595 | 595 | if ((i.caller == this)) | |
596 | 596 | then true | |
597 | 597 | else pd | |
598 | 598 | case _ => | |
599 | 599 | throw("Match error") | |
600 | 600 | } | |
601 | 601 | ||
602 | 602 | ||
603 | 603 | @Callable(i) | |
604 | 604 | func constructor (fc) = { | |
605 | 605 | let c = mm(i) | |
606 | 606 | if ((c == c)) | |
607 | 607 | then [StringEntry(fc(), fc)] | |
608 | 608 | else throw("Strict value is not equal to itself.") | |
609 | 609 | } | |
610 | 610 | ||
611 | 611 | ||
612 | 612 | ||
613 | 613 | @Callable(i) | |
614 | 614 | func setManager (pendingManagerPublicKey) = { | |
615 | 615 | let c = mm(i) | |
616 | 616 | if ((c == c)) | |
617 | 617 | then { | |
618 | 618 | let cm = fromBase58String(pendingManagerPublicKey) | |
619 | 619 | if ((cm == cm)) | |
620 | 620 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
621 | 621 | else throw("Strict value is not equal to itself.") | |
622 | 622 | } | |
623 | 623 | else throw("Strict value is not equal to itself.") | |
624 | 624 | } | |
625 | 625 | ||
626 | 626 | ||
627 | 627 | ||
628 | 628 | @Callable(i) | |
629 | 629 | func confirmManager () = { | |
630 | 630 | let p = pm() | |
631 | 631 | let hpm = if (isDefined(p)) | |
632 | 632 | then true | |
633 | 633 | else throw("No pending manager") | |
634 | 634 | if ((hpm == hpm)) | |
635 | 635 | then { | |
636 | 636 | let cpm = if ((i.callerPublicKey == value(p))) | |
637 | 637 | then true | |
638 | 638 | else throw("You are not pending manager") | |
639 | 639 | if ((cpm == cpm)) | |
640 | 640 | then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())] | |
641 | 641 | else throw("Strict value is not equal to itself.") | |
642 | 642 | } | |
643 | 643 | else throw("Strict value is not equal to itself.") | |
644 | 644 | } | |
645 | 645 | ||
646 | 646 | ||
647 | 647 | ||
648 | 648 | @Callable(i) | |
649 | 649 | func put (slip,autoStake) = { | |
650 | 650 | let factCfg = gfc() | |
651 | 651 | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
652 | 652 | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
653 | 653 | if ((0 > slip)) | |
654 | 654 | then throw("Wrong slippage") | |
655 | 655 | else if ((size(i.payments) != 2)) | |
656 | 656 | then throw("2 pmnts expd") | |
657 | 657 | else { | |
658 | 658 | 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, "") | |
659 | 659 | let emitLpAmt = e._2 | |
660 | 660 | let lpAssetId = e._7 | |
661 | 661 | let state = e._9 | |
662 | 662 | let amDiff = e._10 | |
663 | 663 | let prDiff = e._11 | |
664 | 664 | let amId = e._12 | |
665 | 665 | let prId = e._13 | |
666 | 666 | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
667 | 667 | if ((r == r)) | |
668 | 668 | then { | |
669 | 669 | let el = match r { | |
670 | 670 | case legacy: Address => | |
671 | 671 | invoke(legacy, "emit", [emitLpAmt], nil) | |
672 | 672 | case _ => | |
673 | 673 | unit | |
674 | 674 | } | |
675 | 675 | if ((el == el)) | |
676 | 676 | then { | |
677 | 677 | let sa = if ((amDiff > 0)) | |
678 | 678 | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
679 | 679 | else nil | |
680 | 680 | if ((sa == sa)) | |
681 | 681 | then { | |
682 | 682 | let sp = if ((prDiff > 0)) | |
683 | 683 | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
684 | 684 | else nil | |
685 | 685 | if ((sp == sp)) | |
686 | 686 | then { | |
687 | 687 | let lpTrnsfr = if (autoStake) | |
688 | 688 | then { | |
689 | 689 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
690 | 690 | if ((ss == ss)) | |
691 | 691 | then nil | |
692 | 692 | else throw("Strict value is not equal to itself.") | |
693 | 693 | } | |
694 | 694 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
695 | 695 | (state ++ lpTrnsfr) | |
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 | else throw("Strict value is not equal to itself.") | |
702 | 702 | } | |
703 | 703 | else throw("Strict value is not equal to itself.") | |
704 | 704 | } | |
705 | 705 | } | |
706 | 706 | ||
707 | 707 | ||
708 | 708 | ||
709 | 709 | @Callable(i) | |
710 | 710 | func putOneTkn (amAssetPart,prAssetPart,outLp,slippage,autoStake) = { | |
711 | 711 | let cfg = gfc() | |
712 | 712 | let stakingCntr = valueOrErrorMessage(addressFromString(cfg[idxFactStakCntr]), "Wr st addr") | |
713 | 713 | let slipCntr = valueOrErrorMessage(addressFromString(cfg[idxFactSlippCntr]), "Wr sl addr") | |
714 | 714 | let gwxCntr = valueOrErrorMessage(addressFromString(cfg[idxFactGwxRewCntr]), "Wr gwx addr") | |
715 | 715 | let poolCfg = gpc() | |
716 | 716 | let amId = poolCfg[idxAmAsId] | |
717 | 717 | let prId = poolCfg[idxPrAsId] | |
718 | 718 | let amDcm = parseIntValue(poolCfg[idxAmtAsDcm]) | |
719 | 719 | let prDcm = parseIntValue(poolCfg[idxPriceAsDcm]) | |
720 | 720 | let addon = valueOrElse(getString(this, ada()), "") | |
721 | 721 | let userAddress = if ((addon == toString(i.caller))) | |
722 | 722 | then i.originCaller | |
723 | 723 | else i.caller | |
724 | 724 | if (if (if (if ((0 >= slippage)) | |
725 | 725 | then true | |
726 | 726 | else (0 >= amAssetPart)) | |
727 | 727 | then true | |
728 | 728 | else (0 >= prAssetPart)) | |
729 | 729 | then true | |
730 | 730 | else (0 >= outLp)) | |
731 | 731 | then throw("Wrong params") | |
732 | 732 | else if ((size(i.payments) != 1)) | |
733 | 733 | then throw("1 pmnt expd") | |
734 | 734 | else { | |
735 | 735 | let pmt = value(i.payments[0]) | |
736 | 736 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
737 | 737 | let paymentAmountRaw = pmt.amount | |
738 | 738 | let $t02924429296 = takeFee(paymentAmountRaw) | |
739 | 739 | let pmtAmt = $t02924429296._1 | |
740 | 740 | let feeAmount = $t02924429296._2 | |
741 | 741 | if ((10000000 > paymentAmountRaw)) | |
742 | 742 | then throw("Wrong pmt amt") | |
743 | 743 | else { | |
744 | 744 | let amBalance = getAccBalance(amId) | |
745 | 745 | let prBalance = getAccBalance(prId) | |
746 | 746 | let $t02945630072 = if ((pmtAssetId == amId)) | |
747 | 747 | then if (if ((paymentAmountRaw > amBalance)) | |
748 | 748 | then true | |
749 | 749 | else (amAssetPart > pmtAmt)) | |
750 | 750 | then throw("invalid payment amount") | |
751 | 751 | else $Tuple6((amBalance - paymentAmountRaw), prBalance, (pmtAmt - amAssetPart), prAssetPart, 0, 0) | |
752 | 752 | else if ((pmtAssetId == prId)) | |
753 | 753 | then if (if ((paymentAmountRaw > prBalance)) | |
754 | 754 | then true | |
755 | 755 | else (prAssetPart > pmtAmt)) | |
756 | 756 | then throw("invalid payment amount") | |
757 | 757 | else $Tuple6(amBalance, (prBalance - paymentAmountRaw), 0, 0, (pmtAmt - prAssetPart), amAssetPart) | |
758 | 758 | else throw("wrong pmtAssetId") | |
759 | 759 | let amBalanceNow = $t02945630072._1 | |
760 | 760 | let prBalanceNow = $t02945630072._2 | |
761 | 761 | let virtSwapInAm = $t02945630072._3 | |
762 | 762 | let virtSwapOutPr = $t02945630072._4 | |
763 | 763 | let virtSwapInPr = $t02945630072._5 | |
764 | 764 | let virtSwapOutAm = $t02945630072._6 | |
765 | 765 | let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil) | |
766 | 766 | let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil) | |
767 | 767 | let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D) | |
768 | 768 | if ((D0vsD1 == D0vsD1)) | |
769 | 769 | then { | |
770 | 770 | let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), slippage, true, true, true, pmtAmt, pmtAssetId) | |
771 | 771 | let estimLP = estPut._2 | |
772 | 772 | let lpAssetId = estPut._7 | |
773 | 773 | let state = estPut._9 | |
774 | 774 | let amDiff = estPut._10 | |
775 | 775 | let prDiff = estPut._11 | |
776 | 776 | let lpCalcRes = vad(toBigInt(estimLP), toBigInt(outLp), toBigInt(slippage)) | |
777 | 777 | let emitLpAmt = toInt(lpCalcRes._2) | |
778 | 778 | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
779 | 779 | if ((e == e)) | |
780 | 780 | then { | |
781 | 781 | let el = match e { | |
782 | 782 | case legacy: Address => | |
783 | 783 | invoke(legacy, "emit", [emitLpAmt], nil) | |
784 | 784 | case _ => | |
785 | 785 | unit | |
786 | 786 | } | |
787 | 787 | if ((el == el)) | |
788 | 788 | then { | |
789 | 789 | let sa = if ((amDiff > 0)) | |
790 | 790 | then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)]) | |
791 | 791 | else nil | |
792 | 792 | if ((sa == sa)) | |
793 | 793 | then { | |
794 | 794 | let sp = if ((prDiff > 0)) | |
795 | 795 | then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)]) | |
796 | 796 | else nil | |
797 | 797 | if ((sp == sp)) | |
798 | 798 | then { | |
799 | 799 | let lpTrnsfr = if (autoStake) | |
800 | 800 | then { | |
801 | 801 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
802 | 802 | if ((ss == ss)) | |
803 | 803 | then nil | |
804 | 804 | else throw("Strict value is not equal to itself.") | |
805 | 805 | } | |
806 | 806 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
807 | 807 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
808 | 808 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
809 | 809 | else nil | |
810 | 810 | ((state ++ lpTrnsfr) ++ sendFeeToMatcher) | |
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 | else throw("Strict value is not equal to itself.") | |
819 | 819 | } | |
820 | 820 | else throw("Strict value is not equal to itself.") | |
821 | 821 | } | |
822 | 822 | } | |
823 | 823 | } | |
824 | 824 | ||
825 | 825 | ||
826 | 826 | ||
827 | 827 | @Callable(i) | |
828 | 828 | func putOneTknV2 (minOutAmount,autoStake) = if ((size(i.payments) != 1)) | |
829 | 829 | then throw("1 pmnt expd") | |
830 | 830 | else { | |
831 | 831 | let poolConfig = gpc() | |
832 | 832 | let amId = poolConfig[idxAmAsId] | |
833 | 833 | let prId = poolConfig[idxPrAsId] | |
834 | 834 | let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm]) | |
835 | 835 | let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm]) | |
836 | 836 | let userAddress = if ((i.caller == this)) | |
837 | 837 | then i.originCaller | |
838 | 838 | else i.caller | |
839 | 839 | let pmt = value(i.payments[0]) | |
840 | 840 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
841 | 841 | let pmtAmt = pmt.amount | |
842 | 842 | if ((10000000 > pmtAmt)) | |
843 | 843 | then throw("Wrong pmt amt") | |
844 | 844 | else { | |
845 | 845 | let r = estimatePutOneTknV2(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId)) | |
846 | 846 | let estimLP = r._2 | |
847 | 847 | let lpAssetId = r._7 | |
848 | 848 | let state = r._9 | |
849 | 849 | let amDiff = r._10 | |
850 | 850 | let prDiff = r._11 | |
851 | 851 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
852 | 852 | then (minOutAmount > estimLP) | |
853 | 853 | else false) | |
854 | 854 | then throw(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
855 | 855 | else estimLP | |
856 | 856 | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
857 | 857 | if ((e == e)) | |
858 | 858 | then { | |
859 | 859 | let el = match e { | |
860 | 860 | case legacy: Address => | |
861 | 861 | invoke(legacy, "emit", [emitLpAmt], nil) | |
862 | 862 | case _ => | |
863 | 863 | unit | |
864 | 864 | } | |
865 | 865 | if ((el == el)) | |
866 | 866 | then { | |
867 | 867 | let sa = if ((amDiff > 0)) | |
868 | 868 | then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)]) | |
869 | 869 | else nil | |
870 | 870 | if ((sa == sa)) | |
871 | 871 | then { | |
872 | 872 | let sp = if ((prDiff > 0)) | |
873 | 873 | then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)]) | |
874 | 874 | else nil | |
875 | 875 | if ((sp == sp)) | |
876 | 876 | then { | |
877 | 877 | let lpTrnsfr = if (autoStake) | |
878 | 878 | then { | |
879 | 879 | let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
880 | 880 | if ((ss == ss)) | |
881 | 881 | then nil | |
882 | 882 | else throw("Strict value is not equal to itself.") | |
883 | 883 | } | |
884 | 884 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
885 | 885 | let feeAmount = takeFee(pmtAmt)._2 | |
886 | 886 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
887 | 887 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
888 | 888 | else nil | |
889 | 889 | $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt) | |
890 | 890 | } | |
891 | 891 | else throw("Strict value is not equal to itself.") | |
892 | 892 | } | |
893 | 893 | else throw("Strict value is not equal to itself.") | |
894 | 894 | } | |
895 | 895 | else throw("Strict value is not equal to itself.") | |
896 | 896 | } | |
897 | 897 | else throw("Strict value is not equal to itself.") | |
898 | 898 | } | |
899 | 899 | } | |
900 | 900 | ||
901 | 901 | ||
902 | 902 | ||
903 | 903 | @Callable(i) | |
904 | 904 | func putOneTknV2READONLY (paymentAmount,paymentAssetId) = { | |
905 | 905 | let r = estimatePutOneTknV2(paymentAmount, paymentAssetId, "", "") | |
906 | 906 | let estimLP = r._2 | |
907 | 907 | let lpAssetId = r._7 | |
908 | 908 | let state = r._9 | |
909 | 909 | let amDiff = r._10 | |
910 | 910 | let prDiff = r._11 | |
911 | 911 | $Tuple2(nil, estimLP) | |
912 | 912 | } | |
913 | 913 | ||
914 | 914 | ||
915 | 915 | ||
916 | 916 | @Callable(i) | |
917 | 917 | func putOneTknV2WithBonusREADONLY (paymentAmount,paymentAssetId) = { | |
918 | 918 | let poolConfig = gpc() | |
919 | 919 | let amId = poolConfig[idxAmAsId] | |
920 | 920 | let prId = poolConfig[idxPrAsId] | |
921 | 921 | let amBalance = getAccBalance(amId) | |
922 | 922 | let prBalance = getAccBalance(prId) | |
923 | 923 | let r = estimatePutOneTknV2(paymentAmount, paymentAssetId, "", "") | |
924 | 924 | let estimLP = r._2 | |
925 | 925 | let curPrice = r._3 | |
926 | 926 | let lpAssetEmission = r._6 | |
927 | 927 | let lpAssetId = r._7 | |
928 | 928 | let $t03509535404 = if ((paymentAssetId == amId)) | |
929 | 929 | then { | |
930 | 930 | let priceAssetAmount = fraction(paymentAmount, curPrice, scale8) | |
931 | 931 | $Tuple2(paymentAmount, priceAssetAmount) | |
932 | 932 | } | |
933 | 933 | else { | |
934 | 934 | let amountAssetAmount = fraction(paymentAmount, scale8, curPrice) | |
935 | 935 | $Tuple2(amountAssetAmount, paymentAmount) | |
936 | 936 | } | |
937 | 937 | let amountAssetAmount = $t03509535404._1 | |
938 | 938 | let priceAssetAmount = $t03509535404._2 | |
939 | 939 | let lpAmtBoth = fraction(lpAssetEmission, priceAssetAmount, prBalance) | |
940 | 940 | let lpAssetPriceOne = if ((paymentAssetId == amId)) | |
941 | 941 | then fraction(amountAssetAmount, scale8, estimLP) | |
942 | 942 | else fraction(priceAssetAmount, scale8, estimLP) | |
943 | 943 | let lpAssetPriceBoth = fraction((priceAssetAmount + amountAssetAmount), scale8, lpAmtBoth) | |
944 | - | let bonus = fraction(( | |
944 | + | let bonus = fraction((estimLP - lpAmtBoth), scale8, lpAmtBoth) | |
945 | 945 | let feeAmount = takeFee(paymentAmount)._2 | |
946 | 946 | $Tuple2(nil, $Tuple3(estimLP, feeAmount, bonus)) | |
947 | 947 | } | |
948 | 948 | ||
949 | 949 | ||
950 | 950 | ||
951 | 951 | @Callable(i) | |
952 | 952 | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
953 | 953 | then throw("Wrong slpg") | |
954 | 954 | else if ((size(i.payments) != 2)) | |
955 | 955 | then throw("2 pmnts expd") | |
956 | 956 | else { | |
957 | 957 | 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, "") | |
958 | 958 | estPut._9 | |
959 | 959 | } | |
960 | 960 | ||
961 | 961 | ||
962 | 962 | ||
963 | 963 | @Callable(i) | |
964 | 964 | func get () = { | |
965 | 965 | let r = cg(i) | |
966 | 966 | let outAmtAmt = r._1 | |
967 | 967 | let outPrAmt = r._2 | |
968 | 968 | let pmtAmt = r._3 | |
969 | 969 | let pmtAssetId = r._4 | |
970 | 970 | let state = r._5 | |
971 | 971 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
972 | 972 | if ((b == b)) | |
973 | 973 | then state | |
974 | 974 | else throw("Strict value is not equal to itself.") | |
975 | 975 | } | |
976 | 976 | ||
977 | 977 | ||
978 | 978 | ||
979 | 979 | @Callable(i) | |
980 | 980 | func getOneTkn (exchResult,notUsed,outAmount,outAssetId,slippage) = if ((size(i.payments) != 1)) | |
981 | 981 | then throw("1 pmnt expd") | |
982 | 982 | else { | |
983 | 983 | let cfg = gpc() | |
984 | 984 | let lpId = cfg[idxLPAsId] | |
985 | 985 | let amId = cfg[idxAmAsId] | |
986 | 986 | let prId = cfg[idxPrAsId] | |
987 | 987 | let amDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
988 | 988 | let prDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
989 | 989 | let sts = cfg[idxPoolSt] | |
990 | 990 | let factCfg = gfc() | |
991 | 991 | let gwxCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactGwxRewCntr]), "Wr sl addr") | |
992 | 992 | let pmt = value(i.payments[0]) | |
993 | 993 | let addon = valueOrElse(getString(this, ada()), "") | |
994 | 994 | let userAddress = if ((addon == toString(i.caller))) | |
995 | 995 | then i.originCaller | |
996 | 996 | else i.caller | |
997 | 997 | let txId58 = toBase58String(i.transactionId) | |
998 | 998 | let pmtAssetId = value(pmt.assetId) | |
999 | 999 | let pmtAmt = pmt.amount | |
1000 | 1000 | if ((1000000000 > pmtAmt)) | |
1001 | 1001 | then throw("Min pmt 10 LP") | |
1002 | 1002 | else if (if (if ((0 > slippage)) | |
1003 | 1003 | then true | |
1004 | 1004 | else (0 > exchResult)) | |
1005 | 1005 | then true | |
1006 | 1006 | else (0 > outAmount)) | |
1007 | 1007 | then throw("Wrong params") | |
1008 | 1008 | else if ((lpId != toBase58String(pmtAssetId))) | |
1009 | 1009 | then throw("Wrong LP") | |
1010 | 1010 | else { | |
1011 | 1011 | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
1012 | 1012 | let estimAmAmt = r._1 | |
1013 | 1013 | let estimPrAmt = r._2 | |
1014 | 1014 | let amBalance = getAccBalance(amId) | |
1015 | 1015 | let prBalance = getAccBalance(prId) | |
1016 | - | let $ | |
1016 | + | let $t03875039210 = if ((outAssetId == amId)) | |
1017 | 1017 | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult)) | |
1018 | 1018 | else if ((outAssetId == prId)) | |
1019 | 1019 | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult)) | |
1020 | 1020 | else throw("wrong outAssetId") | |
1021 | - | let amBalanceNow = $ | |
1022 | - | let prBalanceNow = $ | |
1023 | - | let virtSwapInAm = $ | |
1024 | - | let virtSwapOutPr = $ | |
1025 | - | let virtSwapInPr = $ | |
1026 | - | let virtSwapOutAm = $ | |
1027 | - | let totalGetRaw = $ | |
1021 | + | let amBalanceNow = $t03875039210._1 | |
1022 | + | let prBalanceNow = $t03875039210._2 | |
1023 | + | let virtSwapInAm = $t03875039210._3 | |
1024 | + | let virtSwapOutPr = $t03875039210._4 | |
1025 | + | let virtSwapInPr = $t03875039210._5 | |
1026 | + | let virtSwapOutAm = $t03875039210._6 | |
1027 | + | let totalGetRaw = $t03875039210._7 | |
1028 | 1028 | if (if ((0 > virtSwapInAm)) | |
1029 | 1029 | then true | |
1030 | 1030 | else (0 > virtSwapInPr)) | |
1031 | 1031 | then throw("Wrong calc") | |
1032 | 1032 | else { | |
1033 | 1033 | let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil) | |
1034 | 1034 | let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil) | |
1035 | 1035 | let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D) | |
1036 | 1036 | if ((D0vsD1 == D0vsD1)) | |
1037 | 1037 | then { | |
1038 | 1038 | let totalGet = takeFee(totalGetRaw)._1 | |
1039 | 1039 | let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage)) | |
1040 | 1040 | if ((finalRes == finalRes)) | |
1041 | 1041 | then { | |
1042 | - | let $ | |
1042 | + | let $t03995740061 = if ((outAssetId == amId)) | |
1043 | 1043 | then $Tuple2(toInt(finalRes._2), 0) | |
1044 | 1044 | else $Tuple2(0, toInt(finalRes._2)) | |
1045 | - | let outAm = $ | |
1046 | - | let outPr = $ | |
1045 | + | let outAm = $t03995740061._1 | |
1046 | + | let outPr = $t03995740061._2 | |
1047 | 1047 | let totalAmount = (outAm + outPr) | |
1048 | 1048 | let feeAmount = (totalGetRaw - totalGet) | |
1049 | 1049 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
1050 | 1050 | then unit | |
1051 | 1051 | else fromBase58String(outAssetId) | |
1052 | 1052 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1053 | 1053 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
1054 | 1054 | else nil | |
1055 | 1055 | let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm)) | |
1056 | 1056 | let curPr = f1(curPrX18, scale8) | |
1057 | 1057 | 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)] | |
1058 | 1058 | if ((state == state)) | |
1059 | 1059 | then { | |
1060 | 1060 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1061 | 1061 | if ((burn == burn)) | |
1062 | 1062 | then (state ++ sendFeeToMatcher) | |
1063 | 1063 | else throw("Strict value is not equal to itself.") | |
1064 | 1064 | } | |
1065 | 1065 | else throw("Strict value is not equal to itself.") | |
1066 | 1066 | } | |
1067 | 1067 | else throw("Strict value is not equal to itself.") | |
1068 | 1068 | } | |
1069 | 1069 | else throw("Strict value is not equal to itself.") | |
1070 | 1070 | } | |
1071 | 1071 | } | |
1072 | 1072 | } | |
1073 | 1073 | ||
1074 | 1074 | ||
1075 | 1075 | ||
1076 | 1076 | @Callable(i) | |
1077 | 1077 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1078 | - | let $ | |
1079 | - | let state = $ | |
1080 | - | let totalAmount = $ | |
1078 | + | let $t04108641241 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1079 | + | let state = $t04108641241._1 | |
1080 | + | let totalAmount = $t04108641241._2 | |
1081 | 1081 | $Tuple2(state, totalAmount) | |
1082 | 1082 | } | |
1083 | 1083 | ||
1084 | 1084 | ||
1085 | 1085 | ||
1086 | 1086 | @Callable(i) | |
1087 | 1087 | func getOneTknV2READONLY (outAssetId,lpAssetAmount) = { | |
1088 | 1088 | let poolConfig = gpc() | |
1089 | 1089 | let lpId = poolConfig[idxLPAsId] | |
1090 | 1090 | let amId = poolConfig[idxAmAsId] | |
1091 | 1091 | let prId = poolConfig[idxPrAsId] | |
1092 | 1092 | let r = ego("", lpId, lpAssetAmount, this) | |
1093 | 1093 | let estimAmAmt = r._1 | |
1094 | 1094 | let estimPrAmt = r._2 | |
1095 | 1095 | let amBalance = getAccBalance(amId) | |
1096 | 1096 | let prBalance = getAccBalance(prId) | |
1097 | 1097 | let amBalanceNow = (amBalance - estimAmAmt) | |
1098 | 1098 | let prBalanceNow = (prBalance - estimPrAmt) | |
1099 | - | let $ | |
1099 | + | let $t04175142022 = if ((outAssetId == amId)) | |
1100 | 1100 | then $Tuple3(prBalanceNow, amBalanceNow, estimPrAmt) | |
1101 | 1101 | else if ((outAssetId == prId)) | |
1102 | 1102 | then $Tuple3(amBalanceNow, prBalanceNow, estimAmAmt) | |
1103 | 1103 | else throw("wrong outAssetId") | |
1104 | - | let amountBalanceForSwap = $ | |
1105 | - | let priceBalanceForSwap = $ | |
1106 | - | let amountToSwap = $ | |
1104 | + | let amountBalanceForSwap = $t04175142022._1 | |
1105 | + | let priceBalanceForSwap = $t04175142022._2 | |
1106 | + | let amountToSwap = $t04175142022._3 | |
1107 | 1107 | let yPrecision = 1 | |
1108 | 1108 | let exchResult = { | |
1109 | 1109 | let @ = invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil) | |
1110 | 1110 | if ($isInstanceOf(@, "Int")) | |
1111 | 1111 | then @ | |
1112 | 1112 | else throw(($getType(invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil)) + " couldn't be cast to Int")) | |
1113 | 1113 | } | |
1114 | 1114 | let totalGetRaw = (exchResult + (if ((outAssetId == amId)) | |
1115 | 1115 | then estimAmAmt | |
1116 | 1116 | else estimPrAmt)) | |
1117 | - | let $ | |
1118 | - | let totalGet = $ | |
1119 | - | let feeAmount = $ | |
1117 | + | let $t04259442643 = takeFee(totalGetRaw) | |
1118 | + | let totalGet = $t04259442643._1 | |
1119 | + | let feeAmount = $t04259442643._2 | |
1120 | 1120 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1121 | 1121 | } | |
1122 | 1122 | ||
1123 | 1123 | ||
1124 | 1124 | ||
1125 | 1125 | @Callable(i) | |
1126 | 1126 | func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = { | |
1127 | 1127 | let poolConfig = gpc() | |
1128 | 1128 | let amId = poolConfig[idxAmAsId] | |
1129 | 1129 | let prId = poolConfig[idxPrAsId] | |
1130 | 1130 | let lpId = poolConfig[idxLPAsId] | |
1131 | 1131 | let amBalance = getAccBalance(amId) | |
1132 | 1132 | let prBalance = getAccBalance(prId) | |
1133 | - | let $ | |
1133 | + | let $t04298743102 = { | |
1134 | 1134 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1135 | 1135 | if ($isInstanceOf(@, "(Int, Int)")) | |
1136 | 1136 | then @ | |
1137 | 1137 | else throw(($getType(invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)) + " couldn't be cast to (Int, Int)")) | |
1138 | 1138 | } | |
1139 | - | let totalGet = $ | |
1140 | - | let feeAmount = $ | |
1139 | + | let totalGet = $t04298743102._1 | |
1140 | + | let feeAmount = $t04298743102._2 | |
1141 | 1141 | let r = ego("", lpId, lpAssetAmount, this) | |
1142 | 1142 | let outAmAmt = r._1 | |
1143 | 1143 | let outPrAmt = r._2 | |
1144 | 1144 | let lpAssetPriceOne = fraction(totalGet, scale8, lpAssetAmount) | |
1145 | 1145 | let lpAssetPriceBoth = fraction((outAmAmt + outPrAmt), scale8, lpAssetAmount) | |
1146 | 1146 | let bonus = fraction((lpAssetPriceOne - lpAssetPriceBoth), scale8, lpAssetPriceBoth) | |
1147 | 1147 | $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus)) | |
1148 | 1148 | } | |
1149 | 1149 | ||
1150 | 1150 | ||
1151 | 1151 | ||
1152 | 1152 | @Callable(i) | |
1153 | 1153 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1154 | 1154 | let r = cg(i) | |
1155 | 1155 | let outAmAmt = r._1 | |
1156 | 1156 | let outPrAmt = r._2 | |
1157 | 1157 | let pmtAmt = r._3 | |
1158 | 1158 | let pmtAssetId = r._4 | |
1159 | 1159 | let state = r._5 | |
1160 | 1160 | if ((noLessThenAmtAsset > outAmAmt)) | |
1161 | 1161 | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1162 | 1162 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1163 | 1163 | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1164 | 1164 | else { | |
1165 | 1165 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1166 | 1166 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1167 | 1167 | then state | |
1168 | 1168 | else throw("Strict value is not equal to itself.") | |
1169 | 1169 | } | |
1170 | 1170 | } | |
1171 | 1171 | ||
1172 | 1172 | ||
1173 | 1173 | ||
1174 | 1174 | @Callable(i) | |
1175 | 1175 | func unstakeAndGet (amount) = { | |
1176 | 1176 | let checkPayments = if ((size(i.payments) != 0)) | |
1177 | 1177 | then throw("No pmnts expd") | |
1178 | 1178 | else true | |
1179 | 1179 | if ((checkPayments == checkPayments)) | |
1180 | 1180 | then { | |
1181 | 1181 | let cfg = gpc() | |
1182 | 1182 | let factoryCfg = gfc() | |
1183 | 1183 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1184 | 1184 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1185 | 1185 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1186 | 1186 | if ((unstakeInv == unstakeInv)) | |
1187 | 1187 | then { | |
1188 | 1188 | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1189 | 1189 | let sts = parseIntValue(r._9) | |
1190 | 1190 | let state = r._10 | |
1191 | 1191 | let v = if (if (igs()) | |
1192 | 1192 | then true | |
1193 | 1193 | else (sts == PoolShutdown)) | |
1194 | 1194 | then throw(("Blocked: " + toString(sts))) | |
1195 | 1195 | else true | |
1196 | 1196 | if ((v == v)) | |
1197 | 1197 | then { | |
1198 | 1198 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1199 | 1199 | if ((burnA == burnA)) | |
1200 | 1200 | then state | |
1201 | 1201 | else throw("Strict value is not equal to itself.") | |
1202 | 1202 | } | |
1203 | 1203 | else throw("Strict value is not equal to itself.") | |
1204 | 1204 | } | |
1205 | 1205 | else throw("Strict value is not equal to itself.") | |
1206 | 1206 | } | |
1207 | 1207 | else throw("Strict value is not equal to itself.") | |
1208 | 1208 | } | |
1209 | 1209 | ||
1210 | 1210 | ||
1211 | 1211 | ||
1212 | 1212 | @Callable(i) | |
1213 | 1213 | func unstakeAndGetOneTkn (unstakeAmount,outAssetId,minOutAmount) = { | |
1214 | 1214 | let checkPayments = if ((size(i.payments) != 0)) | |
1215 | 1215 | then throw("No pmnts expd") | |
1216 | 1216 | else true | |
1217 | 1217 | if ((checkPayments == checkPayments)) | |
1218 | 1218 | then { | |
1219 | 1219 | let cfg = gpc() | |
1220 | 1220 | let factoryCfg = gfc() | |
1221 | 1221 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1222 | 1222 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1223 | 1223 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1224 | 1224 | if ((unstakeInv == unstakeInv)) | |
1225 | 1225 | then { | |
1226 | - | let $ | |
1227 | - | let state = $ | |
1228 | - | let totalAmount = $ | |
1226 | + | let $t04552245710 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1227 | + | let state = $t04552245710._1 | |
1228 | + | let totalAmount = $t04552245710._2 | |
1229 | 1229 | $Tuple2(state, totalAmount) | |
1230 | 1230 | } | |
1231 | 1231 | else throw("Strict value is not equal to itself.") | |
1232 | 1232 | } | |
1233 | 1233 | else throw("Strict value is not equal to itself.") | |
1234 | 1234 | } | |
1235 | 1235 | ||
1236 | 1236 | ||
1237 | 1237 | ||
1238 | 1238 | @Callable(i) | |
1239 | 1239 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1240 | 1240 | then throw("denied") | |
1241 | 1241 | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success") | |
1242 | 1242 | ||
1243 | 1243 | ||
1244 | 1244 | ||
1245 | 1245 | @Callable(i) | |
1246 | 1246 | func setS (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1247 | 1247 | then pd | |
1248 | 1248 | else [StringEntry(k, v)] | |
1249 | 1249 | ||
1250 | 1250 | ||
1251 | 1251 | ||
1252 | 1252 | @Callable(i) | |
1253 | 1253 | func setI (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1254 | 1254 | then pd | |
1255 | 1255 | else [IntegerEntry(k, v)] | |
1256 | 1256 | ||
1257 | 1257 | ||
1258 | 1258 | ||
1259 | 1259 | @Callable(i) | |
1260 | 1260 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
1261 | 1261 | ||
1262 | 1262 | ||
1263 | 1263 | ||
1264 | 1264 | @Callable(i) | |
1265 | 1265 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1266 | 1266 | ||
1267 | 1267 | ||
1268 | 1268 | ||
1269 | 1269 | @Callable(i) | |
1270 | 1270 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1271 | 1271 | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
1272 | 1272 | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
1273 | 1273 | } | |
1274 | 1274 | ||
1275 | 1275 | ||
1276 | 1276 | ||
1277 | 1277 | @Callable(i) | |
1278 | 1278 | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
1279 | 1279 | ||
1280 | 1280 | ||
1281 | 1281 | ||
1282 | 1282 | @Callable(i) | |
1283 | 1283 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
1284 | 1284 | ||
1285 | 1285 | ||
1286 | 1286 | ||
1287 | 1287 | @Callable(i) | |
1288 | 1288 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1289 | 1289 | ||
1290 | 1290 | ||
1291 | 1291 | ||
1292 | 1292 | @Callable(i) | |
1293 | 1293 | 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, "")) | |
1294 | 1294 | ||
1295 | 1295 | ||
1296 | 1296 | ||
1297 | 1297 | @Callable(i) | |
1298 | 1298 | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
1299 | 1299 | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
1300 | 1300 | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
1301 | 1301 | } | |
1302 | 1302 | ||
1303 | 1303 | ||
1304 | 1304 | ||
1305 | 1305 | @Callable(i) | |
1306 | 1306 | func getFeeREADONLY () = $Tuple2(nil, fee) | |
1307 | 1307 | ||
1308 | 1308 | ||
1309 | 1309 | @Verifier(tx) | |
1310 | 1310 | func verify () = { | |
1311 | 1311 | let targetPublicKey = match m() { | |
1312 | 1312 | case pk: ByteVector => | |
1313 | 1313 | pk | |
1314 | 1314 | case _: Unit => | |
1315 | 1315 | tx.senderPublicKey | |
1316 | 1316 | case _ => | |
1317 | 1317 | throw("Match error") | |
1318 | 1318 | } | |
1319 | 1319 | match tx { | |
1320 | 1320 | case order: Order => | |
1321 | 1321 | let matcherPub = mp() | |
1322 | 1322 | let orderValid = moa(order) | |
1323 | 1323 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1324 | 1324 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1325 | 1325 | if (if (if (orderValid) | |
1326 | 1326 | then senderValid | |
1327 | 1327 | else false) | |
1328 | 1328 | then matcherValid | |
1329 | 1329 | else false) | |
1330 | 1330 | then true | |
1331 | 1331 | else toe(orderValid, senderValid, matcherValid) | |
1332 | 1332 | case s: SetScriptTransaction => | |
1333 | 1333 | let newHash = blake2b256(value(s.script)) | |
1334 | 1334 | let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash()))) | |
1335 | 1335 | let currentHash = scriptHash(this) | |
1336 | 1336 | if (if ((allowedHash == newHash)) | |
1337 | 1337 | then (currentHash != newHash) | |
1338 | 1338 | else false) | |
1339 | 1339 | then true | |
1340 | 1340 | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1341 | 1341 | case _ => | |
1342 | 1342 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1343 | 1343 | } | |
1344 | 1344 | } | |
1345 | 1345 |
github/deemru/w8io/026f985 202.91 ms ◑