tx · 94cDfvk46xEqWd5CGo2hNantdXi1bqTZN72tfdwtmCE3 3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA: -0.03100000 Waves 2022.09.28 14:20 [2248902] smart account 3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA > SELF 0.00000000 Waves
{ "type": 13, "id": "94cDfvk46xEqWd5CGo2hNantdXi1bqTZN72tfdwtmCE3", "fee": 3100000, "feeAssetId": null, "timestamp": 1664364093968, "version": 1, "sender": "3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA", "senderPublicKey": "35yd3qw1gxKDxKwGAykHN9fANbXNWwseaUwbWDj24o3x", "proofs": [ "3vFaY7gN4grgebxeq7SHKKqn1o75jyLVDpDnsqH97gp1hjnJxnmWEb1x5N3TtTAFSoE7Rs5mHg1Qe5v9fXQB3dYY" ], "script": "base64:BgL8HggCEgMKAQgSAwoBCBIAEgQKAgEEEgcKBQEBAQEEEgQKAgEEEgQKAgEIEgQKAgEIEgMKAQESABIHCgUBAQEIARIECgIIARIECgIIARIECgIIARIECgIBARIDCgEBEgUKAwEIARIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IglvbmVCaWdJbnQiCnNsaXBwYWdlNEQiBUFtdWx0IgVEY29udiIDU0VQIgVFTVBUWSIKUG9vbEFjdGl2ZSIKUG9vbFB1dERpcyIOUG9vbE1hdGNoZXJEaXMiDFBvb2xTaHV0ZG93biIOaWR4UG9vbEFkZHJlc3MiCWlkeFBvb2xTdCIJaWR4TFBBc0lkIglpZHhBbUFzSWQiCWlkeFByQXNJZCILaWR4QW10QXNEY20iDWlkeFByaWNlQXNEY20iC2lkeElBbXRBc0lkIg1pZHhJUHJpY2VBc0lkIg9pZHhGYWN0U3Rha0NudHIiEGlkeEZhY3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x3wZuQU1Tu8mSuGx4eAd7zg9svLDY9YmV25XQW9f Next: HD5zP6fGy7RVoFaYbUxmuWf3VnPWmzzisQ6ERT9XT8F9 Diff:
Old | New | Differences | |
---|---|---|---|
1104 | 1104 | let $t04216442213 = takeFee(totalGetRaw) | |
1105 | 1105 | let totalGet = $t04216442213._1 | |
1106 | 1106 | let feeAmount = $t04216442213._2 | |
1107 | - | if (true) | |
1108 | - | then throw(makeString([toString(totalGet), toString(feeAmount), toString(estimAmAmt), toString(estimPrAmt), toString(amountToSwap), toString(exchResult)], " ")) | |
1109 | - | else $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1107 | + | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1110 | 1108 | } | |
1111 | 1109 | ||
1112 | 1110 | ||
1119 | 1117 | let lpId = poolConfig[idxLPAsId] | |
1120 | 1118 | let amBalance = getAccBalance(amId) | |
1121 | 1119 | let prBalance = getAccBalance(prId) | |
1122 | - | let $ | |
1120 | + | let $t04255742672 = { | |
1123 | 1121 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1124 | 1122 | if ($isInstanceOf(@, "(Int, Int)")) | |
1125 | 1123 | then @ | |
1126 | 1124 | else throw(($getType(invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)) + " couldn't be cast to (Int, Int)")) | |
1127 | 1125 | } | |
1128 | - | let totalGet = $ | |
1129 | - | let feeAmount = $ | |
1126 | + | let totalGet = $t04255742672._1 | |
1127 | + | let feeAmount = $t04255742672._2 | |
1130 | 1128 | let r = ego("", lpId, lpAssetAmount, this) | |
1131 | 1129 | let outAmAmt = r._1 | |
1132 | 1130 | let outPrAmt = r._2 | |
1211 | 1209 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1212 | 1210 | if ((unstakeInv == unstakeInv)) | |
1213 | 1211 | then { | |
1214 | - | let $ | |
1215 | - | let state = $ | |
1216 | - | let totalAmount = $ | |
1212 | + | let $t04497745165 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1213 | + | let state = $t04497745165._1 | |
1214 | + | let totalAmount = $t04497745165._2 | |
1217 | 1215 | $Tuple2(state, totalAmount) | |
1218 | 1216 | } | |
1219 | 1217 | 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 r = estimatePutOneTknV2(paymentAmount, paymentAssetId, "", "") | |
922 | 922 | let estimLP = r._2 | |
923 | 923 | let curPrice = r._3 | |
924 | 924 | let lpAssetEmission = r._6 | |
925 | 925 | let lpAssetId = r._7 | |
926 | 926 | let amBalance = getAccBalance(amId) | |
927 | 927 | let prBalance = getAccBalance(prId) | |
928 | 928 | let poolProportion = fraction(prBalance, scale8, amBalance) | |
929 | 929 | let amountAssetPart = fraction(paymentAmount, scale8, (poolProportion + scale8)) | |
930 | 930 | let priceAssetPart = (paymentAmount - amountAssetPart) | |
931 | 931 | let lpAmtBoth = fraction(lpAssetEmission, priceAssetPart, prBalance) | |
932 | 932 | let bonus = fraction((estimLP - lpAmtBoth), scale8, lpAmtBoth) | |
933 | 933 | let feeAmount = takeFee(paymentAmount)._2 | |
934 | 934 | $Tuple2(nil, $Tuple3(estimLP, feeAmount, bonus)) | |
935 | 935 | } | |
936 | 936 | ||
937 | 937 | ||
938 | 938 | ||
939 | 939 | @Callable(i) | |
940 | 940 | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
941 | 941 | then throw("Wrong slpg") | |
942 | 942 | else if ((size(i.payments) != 2)) | |
943 | 943 | then throw("2 pmnts expd") | |
944 | 944 | else { | |
945 | 945 | 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, "") | |
946 | 946 | estPut._9 | |
947 | 947 | } | |
948 | 948 | ||
949 | 949 | ||
950 | 950 | ||
951 | 951 | @Callable(i) | |
952 | 952 | func get () = { | |
953 | 953 | let r = cg(i) | |
954 | 954 | let outAmtAmt = r._1 | |
955 | 955 | let outPrAmt = r._2 | |
956 | 956 | let pmtAmt = r._3 | |
957 | 957 | let pmtAssetId = r._4 | |
958 | 958 | let state = r._5 | |
959 | 959 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
960 | 960 | if ((b == b)) | |
961 | 961 | then state | |
962 | 962 | else throw("Strict value is not equal to itself.") | |
963 | 963 | } | |
964 | 964 | ||
965 | 965 | ||
966 | 966 | ||
967 | 967 | @Callable(i) | |
968 | 968 | func getOneTkn (exchResult,notUsed,outAmount,outAssetId,slippage) = if ((size(i.payments) != 1)) | |
969 | 969 | then throw("1 pmnt expd") | |
970 | 970 | else { | |
971 | 971 | let cfg = gpc() | |
972 | 972 | let lpId = cfg[idxLPAsId] | |
973 | 973 | let amId = cfg[idxAmAsId] | |
974 | 974 | let prId = cfg[idxPrAsId] | |
975 | 975 | let amDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
976 | 976 | let prDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
977 | 977 | let sts = cfg[idxPoolSt] | |
978 | 978 | let factCfg = gfc() | |
979 | 979 | let gwxCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactGwxRewCntr]), "Wr sl addr") | |
980 | 980 | let pmt = value(i.payments[0]) | |
981 | 981 | let addon = valueOrElse(getString(this, ada()), "") | |
982 | 982 | let userAddress = if ((addon == toString(i.caller))) | |
983 | 983 | then i.originCaller | |
984 | 984 | else i.caller | |
985 | 985 | let txId58 = toBase58String(i.transactionId) | |
986 | 986 | let pmtAssetId = value(pmt.assetId) | |
987 | 987 | let pmtAmt = pmt.amount | |
988 | 988 | if ((1000000000 > pmtAmt)) | |
989 | 989 | then throw("Min pmt 10 LP") | |
990 | 990 | else if (if (if ((0 > slippage)) | |
991 | 991 | then true | |
992 | 992 | else (0 > exchResult)) | |
993 | 993 | then true | |
994 | 994 | else (0 > outAmount)) | |
995 | 995 | then throw("Wrong params") | |
996 | 996 | else if ((lpId != toBase58String(pmtAssetId))) | |
997 | 997 | then throw("Wrong LP") | |
998 | 998 | else { | |
999 | 999 | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
1000 | 1000 | let estimAmAmt = r._1 | |
1001 | 1001 | let estimPrAmt = r._2 | |
1002 | 1002 | let amBalance = getAccBalance(amId) | |
1003 | 1003 | let prBalance = getAccBalance(prId) | |
1004 | 1004 | let $t03832738787 = if ((outAssetId == amId)) | |
1005 | 1005 | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult)) | |
1006 | 1006 | else if ((outAssetId == prId)) | |
1007 | 1007 | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult)) | |
1008 | 1008 | else throw("wrong outAssetId") | |
1009 | 1009 | let amBalanceNow = $t03832738787._1 | |
1010 | 1010 | let prBalanceNow = $t03832738787._2 | |
1011 | 1011 | let virtSwapInAm = $t03832738787._3 | |
1012 | 1012 | let virtSwapOutPr = $t03832738787._4 | |
1013 | 1013 | let virtSwapInPr = $t03832738787._5 | |
1014 | 1014 | let virtSwapOutAm = $t03832738787._6 | |
1015 | 1015 | let totalGetRaw = $t03832738787._7 | |
1016 | 1016 | if (if ((0 > virtSwapInAm)) | |
1017 | 1017 | then true | |
1018 | 1018 | else (0 > virtSwapInPr)) | |
1019 | 1019 | then throw("Wrong calc") | |
1020 | 1020 | else { | |
1021 | 1021 | let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil) | |
1022 | 1022 | let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil) | |
1023 | 1023 | let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D) | |
1024 | 1024 | if ((D0vsD1 == D0vsD1)) | |
1025 | 1025 | then { | |
1026 | 1026 | let totalGet = takeFee(totalGetRaw)._1 | |
1027 | 1027 | let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage)) | |
1028 | 1028 | if ((finalRes == finalRes)) | |
1029 | 1029 | then { | |
1030 | 1030 | let $t03953439638 = if ((outAssetId == amId)) | |
1031 | 1031 | then $Tuple2(toInt(finalRes._2), 0) | |
1032 | 1032 | else $Tuple2(0, toInt(finalRes._2)) | |
1033 | 1033 | let outAm = $t03953439638._1 | |
1034 | 1034 | let outPr = $t03953439638._2 | |
1035 | 1035 | let totalAmount = (outAm + outPr) | |
1036 | 1036 | let feeAmount = (totalGetRaw - totalGet) | |
1037 | 1037 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
1038 | 1038 | then unit | |
1039 | 1039 | else fromBase58String(outAssetId) | |
1040 | 1040 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1041 | 1041 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
1042 | 1042 | else nil | |
1043 | 1043 | let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm)) | |
1044 | 1044 | let curPr = f1(curPrX18, scale8) | |
1045 | 1045 | 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)] | |
1046 | 1046 | if ((state == state)) | |
1047 | 1047 | then { | |
1048 | 1048 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1049 | 1049 | if ((burn == burn)) | |
1050 | 1050 | then (state ++ sendFeeToMatcher) | |
1051 | 1051 | else throw("Strict value is not equal to itself.") | |
1052 | 1052 | } | |
1053 | 1053 | else throw("Strict value is not equal to itself.") | |
1054 | 1054 | } | |
1055 | 1055 | else throw("Strict value is not equal to itself.") | |
1056 | 1056 | } | |
1057 | 1057 | else throw("Strict value is not equal to itself.") | |
1058 | 1058 | } | |
1059 | 1059 | } | |
1060 | 1060 | } | |
1061 | 1061 | ||
1062 | 1062 | ||
1063 | 1063 | ||
1064 | 1064 | @Callable(i) | |
1065 | 1065 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1066 | 1066 | let $t04066340818 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1067 | 1067 | let state = $t04066340818._1 | |
1068 | 1068 | let totalAmount = $t04066340818._2 | |
1069 | 1069 | $Tuple2(state, totalAmount) | |
1070 | 1070 | } | |
1071 | 1071 | ||
1072 | 1072 | ||
1073 | 1073 | ||
1074 | 1074 | @Callable(i) | |
1075 | 1075 | func getOneTknV2READONLY (outAssetId,lpAssetAmount) = { | |
1076 | 1076 | let poolConfig = gpc() | |
1077 | 1077 | let lpId = poolConfig[idxLPAsId] | |
1078 | 1078 | let amId = poolConfig[idxAmAsId] | |
1079 | 1079 | let prId = poolConfig[idxPrAsId] | |
1080 | 1080 | let r = ego("", lpId, lpAssetAmount, this) | |
1081 | 1081 | let estimAmAmt = r._1 | |
1082 | 1082 | let estimPrAmt = r._2 | |
1083 | 1083 | let amBalance = getAccBalance(amId) | |
1084 | 1084 | let prBalance = getAccBalance(prId) | |
1085 | 1085 | let amBalanceNow = (amBalance - estimAmAmt) | |
1086 | 1086 | let prBalanceNow = (prBalance - estimPrAmt) | |
1087 | 1087 | let $t04132841636 = if ((outAssetId == amId)) | |
1088 | 1088 | then $Tuple4(prBalanceNow, amBalanceNow, estimPrAmt, estimAmAmt) | |
1089 | 1089 | else if ((outAssetId == prId)) | |
1090 | 1090 | then $Tuple4(amBalanceNow, prBalanceNow, estimAmAmt, estimPrAmt) | |
1091 | 1091 | else throw("wrong outAssetId") | |
1092 | 1092 | let amountBalanceForSwap = $t04132841636._1 | |
1093 | 1093 | let priceBalanceForSwap = $t04132841636._2 | |
1094 | 1094 | let amountToSwap = $t04132841636._3 | |
1095 | 1095 | let amountToAdd = $t04132841636._4 | |
1096 | 1096 | let yPrecision = 1 | |
1097 | 1097 | let exchResult = { | |
1098 | 1098 | let @ = invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil) | |
1099 | 1099 | if ($isInstanceOf(@, "Int")) | |
1100 | 1100 | then @ | |
1101 | 1101 | else throw(($getType(invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil)) + " couldn't be cast to Int")) | |
1102 | 1102 | } | |
1103 | 1103 | let totalGetRaw = (exchResult + amountToAdd) | |
1104 | 1104 | let $t04216442213 = takeFee(totalGetRaw) | |
1105 | 1105 | let totalGet = $t04216442213._1 | |
1106 | 1106 | let feeAmount = $t04216442213._2 | |
1107 | - | if (true) | |
1108 | - | then throw(makeString([toString(totalGet), toString(feeAmount), toString(estimAmAmt), toString(estimPrAmt), toString(amountToSwap), toString(exchResult)], " ")) | |
1109 | - | else $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1107 | + | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1110 | 1108 | } | |
1111 | 1109 | ||
1112 | 1110 | ||
1113 | 1111 | ||
1114 | 1112 | @Callable(i) | |
1115 | 1113 | func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = { | |
1116 | 1114 | let poolConfig = gpc() | |
1117 | 1115 | let amId = poolConfig[idxAmAsId] | |
1118 | 1116 | let prId = poolConfig[idxPrAsId] | |
1119 | 1117 | let lpId = poolConfig[idxLPAsId] | |
1120 | 1118 | let amBalance = getAccBalance(amId) | |
1121 | 1119 | let prBalance = getAccBalance(prId) | |
1122 | - | let $ | |
1120 | + | let $t04255742672 = { | |
1123 | 1121 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1124 | 1122 | if ($isInstanceOf(@, "(Int, Int)")) | |
1125 | 1123 | then @ | |
1126 | 1124 | else throw(($getType(invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)) + " couldn't be cast to (Int, Int)")) | |
1127 | 1125 | } | |
1128 | - | let totalGet = $ | |
1129 | - | let feeAmount = $ | |
1126 | + | let totalGet = $t04255742672._1 | |
1127 | + | let feeAmount = $t04255742672._2 | |
1130 | 1128 | let r = ego("", lpId, lpAssetAmount, this) | |
1131 | 1129 | let outAmAmt = r._1 | |
1132 | 1130 | let outPrAmt = r._2 | |
1133 | 1131 | let sumOfGetAssets = (outAmAmt + outPrAmt) | |
1134 | 1132 | let bonus = fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets) | |
1135 | 1133 | $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus)) | |
1136 | 1134 | } | |
1137 | 1135 | ||
1138 | 1136 | ||
1139 | 1137 | ||
1140 | 1138 | @Callable(i) | |
1141 | 1139 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1142 | 1140 | let r = cg(i) | |
1143 | 1141 | let outAmAmt = r._1 | |
1144 | 1142 | let outPrAmt = r._2 | |
1145 | 1143 | let pmtAmt = r._3 | |
1146 | 1144 | let pmtAssetId = r._4 | |
1147 | 1145 | let state = r._5 | |
1148 | 1146 | if ((noLessThenAmtAsset > outAmAmt)) | |
1149 | 1147 | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1150 | 1148 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1151 | 1149 | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1152 | 1150 | else { | |
1153 | 1151 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1154 | 1152 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1155 | 1153 | then state | |
1156 | 1154 | else throw("Strict value is not equal to itself.") | |
1157 | 1155 | } | |
1158 | 1156 | } | |
1159 | 1157 | ||
1160 | 1158 | ||
1161 | 1159 | ||
1162 | 1160 | @Callable(i) | |
1163 | 1161 | func unstakeAndGet (amount) = { | |
1164 | 1162 | let checkPayments = if ((size(i.payments) != 0)) | |
1165 | 1163 | then throw("No pmnts expd") | |
1166 | 1164 | else true | |
1167 | 1165 | if ((checkPayments == checkPayments)) | |
1168 | 1166 | then { | |
1169 | 1167 | let cfg = gpc() | |
1170 | 1168 | let factoryCfg = gfc() | |
1171 | 1169 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1172 | 1170 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1173 | 1171 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1174 | 1172 | if ((unstakeInv == unstakeInv)) | |
1175 | 1173 | then { | |
1176 | 1174 | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1177 | 1175 | let sts = parseIntValue(r._9) | |
1178 | 1176 | let state = r._10 | |
1179 | 1177 | let v = if (if (igs()) | |
1180 | 1178 | then true | |
1181 | 1179 | else (sts == PoolShutdown)) | |
1182 | 1180 | then throw(("Blocked: " + toString(sts))) | |
1183 | 1181 | else true | |
1184 | 1182 | if ((v == v)) | |
1185 | 1183 | then { | |
1186 | 1184 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1187 | 1185 | if ((burnA == burnA)) | |
1188 | 1186 | then state | |
1189 | 1187 | else throw("Strict value is not equal to itself.") | |
1190 | 1188 | } | |
1191 | 1189 | else throw("Strict value is not equal to itself.") | |
1192 | 1190 | } | |
1193 | 1191 | else throw("Strict value is not equal to itself.") | |
1194 | 1192 | } | |
1195 | 1193 | else throw("Strict value is not equal to itself.") | |
1196 | 1194 | } | |
1197 | 1195 | ||
1198 | 1196 | ||
1199 | 1197 | ||
1200 | 1198 | @Callable(i) | |
1201 | 1199 | func unstakeAndGetOneTkn (unstakeAmount,outAssetId,minOutAmount) = { | |
1202 | 1200 | let checkPayments = if ((size(i.payments) != 0)) | |
1203 | 1201 | then throw("No pmnts expd") | |
1204 | 1202 | else true | |
1205 | 1203 | if ((checkPayments == checkPayments)) | |
1206 | 1204 | then { | |
1207 | 1205 | let cfg = gpc() | |
1208 | 1206 | let factoryCfg = gfc() | |
1209 | 1207 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1210 | 1208 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1211 | 1209 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1212 | 1210 | if ((unstakeInv == unstakeInv)) | |
1213 | 1211 | then { | |
1214 | - | let $ | |
1215 | - | let state = $ | |
1216 | - | let totalAmount = $ | |
1212 | + | let $t04497745165 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1213 | + | let state = $t04497745165._1 | |
1214 | + | let totalAmount = $t04497745165._2 | |
1217 | 1215 | $Tuple2(state, totalAmount) | |
1218 | 1216 | } | |
1219 | 1217 | else throw("Strict value is not equal to itself.") | |
1220 | 1218 | } | |
1221 | 1219 | else throw("Strict value is not equal to itself.") | |
1222 | 1220 | } | |
1223 | 1221 | ||
1224 | 1222 | ||
1225 | 1223 | ||
1226 | 1224 | @Callable(i) | |
1227 | 1225 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1228 | 1226 | then throw("denied") | |
1229 | 1227 | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success") | |
1230 | 1228 | ||
1231 | 1229 | ||
1232 | 1230 | ||
1233 | 1231 | @Callable(i) | |
1234 | 1232 | func setS (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1235 | 1233 | then pd | |
1236 | 1234 | else [StringEntry(k, v)] | |
1237 | 1235 | ||
1238 | 1236 | ||
1239 | 1237 | ||
1240 | 1238 | @Callable(i) | |
1241 | 1239 | func setI (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1242 | 1240 | then pd | |
1243 | 1241 | else [IntegerEntry(k, v)] | |
1244 | 1242 | ||
1245 | 1243 | ||
1246 | 1244 | ||
1247 | 1245 | @Callable(i) | |
1248 | 1246 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
1249 | 1247 | ||
1250 | 1248 | ||
1251 | 1249 | ||
1252 | 1250 | @Callable(i) | |
1253 | 1251 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1254 | 1252 | ||
1255 | 1253 | ||
1256 | 1254 | ||
1257 | 1255 | @Callable(i) | |
1258 | 1256 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1259 | 1257 | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
1260 | 1258 | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
1261 | 1259 | } | |
1262 | 1260 | ||
1263 | 1261 | ||
1264 | 1262 | ||
1265 | 1263 | @Callable(i) | |
1266 | 1264 | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
1267 | 1265 | ||
1268 | 1266 | ||
1269 | 1267 | ||
1270 | 1268 | @Callable(i) | |
1271 | 1269 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
1272 | 1270 | ||
1273 | 1271 | ||
1274 | 1272 | ||
1275 | 1273 | @Callable(i) | |
1276 | 1274 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1277 | 1275 | ||
1278 | 1276 | ||
1279 | 1277 | ||
1280 | 1278 | @Callable(i) | |
1281 | 1279 | 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, "")) | |
1282 | 1280 | ||
1283 | 1281 | ||
1284 | 1282 | ||
1285 | 1283 | @Callable(i) | |
1286 | 1284 | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
1287 | 1285 | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
1288 | 1286 | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
1289 | 1287 | } | |
1290 | 1288 | ||
1291 | 1289 | ||
1292 | 1290 | ||
1293 | 1291 | @Callable(i) | |
1294 | 1292 | func getFeeREADONLY () = $Tuple2(nil, fee) | |
1295 | 1293 | ||
1296 | 1294 | ||
1297 | 1295 | @Verifier(tx) | |
1298 | 1296 | func verify () = { | |
1299 | 1297 | let targetPublicKey = match m() { | |
1300 | 1298 | case pk: ByteVector => | |
1301 | 1299 | pk | |
1302 | 1300 | case _: Unit => | |
1303 | 1301 | tx.senderPublicKey | |
1304 | 1302 | case _ => | |
1305 | 1303 | throw("Match error") | |
1306 | 1304 | } | |
1307 | 1305 | match tx { | |
1308 | 1306 | case order: Order => | |
1309 | 1307 | let matcherPub = mp() | |
1310 | 1308 | let orderValid = moa(order) | |
1311 | 1309 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1312 | 1310 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1313 | 1311 | if (if (if (orderValid) | |
1314 | 1312 | then senderValid | |
1315 | 1313 | else false) | |
1316 | 1314 | then matcherValid | |
1317 | 1315 | else false) | |
1318 | 1316 | then true | |
1319 | 1317 | else toe(orderValid, senderValid, matcherValid) | |
1320 | 1318 | case s: SetScriptTransaction => | |
1321 | 1319 | let newHash = blake2b256(value(s.script)) | |
1322 | 1320 | let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash()))) | |
1323 | 1321 | let currentHash = scriptHash(this) | |
1324 | 1322 | if (if ((allowedHash == newHash)) | |
1325 | 1323 | then (currentHash != newHash) | |
1326 | 1324 | else false) | |
1327 | 1325 | then true | |
1328 | 1326 | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1329 | 1327 | case _ => | |
1330 | 1328 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1331 | 1329 | } | |
1332 | 1330 | } | |
1333 | 1331 |
github/deemru/w8io/026f985 139.75 ms ◑