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