tx · joRik8nf36KjzFSPH8PgFpwiBSwScZH4gAyJ1SBaRhr 3Mu71f1EmazQMM1VWVvuC774griRcq9swnq: -0.03500000 Waves 2022.06.02 16:47 [2078793] smart account 3Mu71f1EmazQMM1VWVvuC774griRcq9swnq > SELF 0.00000000 Waves
{ "type": 13, "id": "joRik8nf36KjzFSPH8PgFpwiBSwScZH4gAyJ1SBaRhr", "fee": 3500000, "feeAssetId": null, "timestamp": 1654177638366, "version": 1, "sender": "3Mu71f1EmazQMM1VWVvuC774griRcq9swnq", "senderPublicKey": "FLRzDQsRMqsdSC8iXdqnko1r7hCfZaFiga7ukmAxWjP8", "proofs": [ "eE6vkTtXEMhanieYa9qX1Y7XxGBigKYxsDTCFGkRwLF3Yr81vUNAui1P8EFU3zZSNRkCTS96VJjv1eGAp9UeZWx" ], "script": "base64:AAIFAAAAAAAAEo8IAhIDCgEIEgMKAQgSABIECgIBBBIHCgUBAQEBBBIDCgEBEgASBwoFAQEBCAESBAoCAQESAwoBARIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIGgoKAUESBWRlbGF5GgcKAUISAnQxGgwKAUMSB29yaWdWYWwaEgoBRBINb3JpZ1NjYWxlTXVsdBoHCgFFEgJmMRoICgFGEgN2YWwaFAoBRxIPcmVzdWx0U2NhbGVNdWx0GgcKAUgSAnRzGggKAUkSA2FtdBoNCgFKEghyZXNTY2FsZRoNCgFLEghjdXJTY2FsZRoICgFMEgNhYnMaBwoBTRICZmMaCAoBThIDbXBrGgkKAU8SBHBtcGsaBwoBUBICcGwaBwoBURICcGgaBgoBUhIBaBoGCgFTEgF0GggKAVQSA3BhdRoHCgFVEgJ1YRoJCgFWEgR0eElkGggKAVcSA2dhdRoHCgFYEgJhYRoHCgFZEgJwYRoICgFaEgNhbXAaCwoBYRIGc2NhbGU4GggKAmFBEgJtcBoJCgJhQhIDZ3BjGgsKAmFDEgVhbXR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nByb29mcwAAAAAAAAAAAAUAAAACZU+rIlEa", "chainId": 84, "height": 2078793, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: D5iqDiFMJSLPk4aEWimU8PfFXQrfQquHsQWZomdN8BwK Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let scale8 = 100000000 | |
5 | + | ||
6 | + | let scale8BigInt = toBigInt(100000000) | |
7 | + | ||
8 | + | let scale18 = toBigInt(1000000000000000000) | |
9 | + | ||
10 | + | let zeroBigInt = toBigInt(0) | |
11 | + | ||
12 | + | let oneBigInt = toBigInt(1) | |
13 | + | ||
14 | + | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
15 | + | ||
16 | + | let Amult = "100" | |
17 | + | ||
18 | + | let Dconv = "1" | |
19 | + | ||
4 | 20 | let SEP = "__" | |
5 | 21 | ||
6 | 22 | let EMPTY = "" | |
7 | 23 | ||
24 | + | let PoolActive = 1 | |
25 | + | ||
26 | + | let PoolPutDis = 2 | |
27 | + | ||
28 | + | let PoolMatcherDis = 3 | |
29 | + | ||
30 | + | let PoolShutdown = 4 | |
31 | + | ||
8 | 32 | let idxPoolAddress = 1 | |
33 | + | ||
34 | + | let idxPoolSt = 2 | |
9 | 35 | ||
10 | 36 | let idxLPAsId = 3 | |
11 | 37 | ||
13 | 39 | ||
14 | 40 | let idxPrAsId = 5 | |
15 | 41 | ||
42 | + | let idxAmtAsDcm = 6 | |
43 | + | ||
44 | + | let idxPriceAsDcm = 7 | |
45 | + | ||
46 | + | let idxIAmtAsId = 8 | |
47 | + | ||
48 | + | let idxIPriceAsId = 9 | |
49 | + | ||
16 | 50 | let idxFactStakCntr = 1 | |
51 | + | ||
52 | + | let idxFactSlippCntr = 7 | |
53 | + | ||
54 | + | let idxFactGwxRewCntr = 10 | |
17 | 55 | ||
18 | 56 | let delay = "%s__delay" | |
19 | 57 | ||
20 | - | func | |
58 | + | func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
21 | 59 | ||
22 | 60 | ||
23 | - | func | |
61 | + | func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
24 | 62 | ||
25 | 63 | ||
26 | - | func | |
64 | + | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
27 | 65 | ||
28 | 66 | ||
29 | - | func keyPoolAddr () = "%s__poolAddress" | |
67 | + | func abs (val) = if ((zeroBigInt > val)) | |
68 | + | then -(val) | |
69 | + | else val | |
30 | 70 | ||
31 | 71 | ||
32 | - | func | |
72 | + | func fc () = "%s__factoryContract" | |
33 | 73 | ||
34 | 74 | ||
35 | - | func | |
75 | + | func mpk () = "%s__managerPublicKey" | |
36 | 76 | ||
37 | 77 | ||
38 | - | func | |
78 | + | func pmpk () = "%s__pendingManagerPublicKey" | |
39 | 79 | ||
40 | 80 | ||
41 | - | func | |
81 | + | func pl () = "%s%s__price__last" | |
42 | 82 | ||
43 | 83 | ||
44 | - | func | |
84 | + | func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP) | |
45 | 85 | ||
46 | 86 | ||
47 | - | func | |
87 | + | func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId) | |
48 | 88 | ||
49 | 89 | ||
50 | - | func | |
90 | + | func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId) | |
51 | 91 | ||
52 | 92 | ||
53 | - | func | |
93 | + | func aa () = "%s__amountAsset" | |
54 | 94 | ||
55 | 95 | ||
56 | - | func | |
96 | + | func pa () = "%s__priceAsset" | |
57 | 97 | ||
58 | 98 | ||
59 | - | func | |
99 | + | func amp () = "%s__amp" | |
60 | 100 | ||
61 | 101 | ||
62 | - | func | |
102 | + | func ada () = "%s__addonAddr" | |
63 | 103 | ||
64 | 104 | ||
65 | - | func | |
105 | + | func lgotc (caller) = makeString(["%s%s__lastGetOneTknCall", caller], SEP) | |
66 | 106 | ||
67 | 107 | ||
68 | - | ||
108 | + | func lsotc (caller) = makeString(["%s%s__lastPutOneTknCall", caller], SEP) | |
69 | 109 | ||
70 | - | let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr())) | |
71 | 110 | ||
72 | - | func getPoolConfig () = { | |
73 | - | let amtAs = getStringOrFail(poolContract, keyAmtAsset()) | |
74 | - | let priceAs = getStringOrFail(poolContract, keyPriceAsset()) | |
75 | - | let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs)) | |
76 | - | let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs)) | |
77 | - | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP) | |
111 | + | func fcfg () = "%s__factoryConfig" | |
112 | + | ||
113 | + | ||
114 | + | func mtpk () = "%s%s__matcher__publicKey" | |
115 | + | ||
116 | + | ||
117 | + | func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
118 | + | ||
119 | + | ||
120 | + | func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
121 | + | ||
122 | + | ||
123 | + | func aps () = "%s__shutdown" | |
124 | + | ||
125 | + | ||
126 | + | func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV))) | |
127 | + | ||
128 | + | ||
129 | + | func str (val) = match val { | |
130 | + | case valStr: String => | |
131 | + | valStr | |
132 | + | case _ => | |
133 | + | throw("fail cast to String") | |
134 | + | } | |
135 | + | ||
136 | + | ||
137 | + | func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
138 | + | ||
139 | + | ||
140 | + | func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
141 | + | ||
142 | + | ||
143 | + | let fca = addressFromStringValue(strf(this, fc())) | |
144 | + | ||
145 | + | let A = strf(this, amp()) | |
146 | + | ||
147 | + | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
148 | + | ||
149 | + | ||
150 | + | func mp () = fromBase58String(strf(fca, mtpk())) | |
151 | + | ||
152 | + | ||
153 | + | func gpc () = { | |
154 | + | let amtAs = strf(this, aa()) | |
155 | + | let priceAs = strf(this, pa()) | |
156 | + | let iPriceAs = intf(fca, mba(priceAs)) | |
157 | + | let iAmtAs = intf(fca, mba(amtAs)) | |
158 | + | split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP) | |
78 | 159 | } | |
79 | 160 | ||
80 | 161 | ||
81 | - | func | |
162 | + | func gfc () = split(strf(fca, fcfg()), SEP) | |
82 | 163 | ||
83 | 164 | ||
84 | - | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
165 | + | 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) | |
166 | + | ||
167 | + | ||
168 | + | 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) | |
169 | + | ||
170 | + | ||
171 | + | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
172 | + | then wavesBalance(this).available | |
173 | + | else assetBalance(this, fromBase58String(assetId)) | |
174 | + | ||
175 | + | ||
176 | + | func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
177 | + | ||
178 | + | ||
179 | + | func vad (A1,A2,slippage) = { | |
180 | + | let diff = fraction((A1 - A2), scale8BigInt, A2) | |
181 | + | let pass = ((slippage - abs(diff)) > zeroBigInt) | |
182 | + | if (!(pass)) | |
183 | + | then throw(("Big slpg: " + toString(diff))) | |
184 | + | else $Tuple2(pass, min([A1, A2])) | |
185 | + | } | |
186 | + | ||
187 | + | ||
188 | + | func vd (D1,D0,slpg) = { | |
189 | + | let diff = fraction(D0, scale8BigInt, D1) | |
190 | + | let fail = (slpg > diff) | |
191 | + | if (if (fail) | |
192 | + | then true | |
193 | + | else (D0 > D1)) | |
194 | + | then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg))) | |
195 | + | else fail | |
196 | + | } | |
197 | + | ||
198 | + | ||
199 | + | func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
200 | + | let amtAsAmtX18 = t1(amAmt, amAssetDcm) | |
201 | + | let prAsAmtX18 = t1(prAmt, prAssetDcm) | |
202 | + | cpbi(prAsAmtX18, amtAsAmtX18) | |
203 | + | } | |
204 | + | ||
205 | + | ||
206 | + | func calcPrices (amAmt,prAmt,lpAmt) = { | |
207 | + | let cfg = gpc() | |
208 | + | let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
209 | + | let prAsDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
210 | + | let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt) | |
211 | + | let amAmtX18 = t1(amAmt, amtAsDcm) | |
212 | + | let prAmtX18 = t1(prAmt, prAsDcm) | |
213 | + | let lpAmtX18 = t1(lpAmt, scale8) | |
214 | + | let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18) | |
215 | + | let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18) | |
216 | + | [priceX18, lpPrInAmAsX18, lpPrInPrAsX18] | |
217 | + | } | |
218 | + | ||
219 | + | ||
220 | + | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
221 | + | let p = calcPrices(amAmt, prAmt, lpAmt) | |
222 | + | [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)] | |
223 | + | } | |
224 | + | ||
225 | + | ||
226 | + | func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
227 | + | let cfg = gpc() | |
228 | + | let lpId = cfg[idxLPAsId] | |
229 | + | let amId = cfg[idxAmAsId] | |
230 | + | let prId = cfg[idxPrAsId] | |
231 | + | let amDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
232 | + | let prDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
233 | + | let sts = cfg[idxPoolSt] | |
234 | + | let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity | |
235 | + | if ((lpId != pmtAssetId)) | |
236 | + | then throw("Wrong pmt asset") | |
237 | + | else { | |
238 | + | let amBalance = getAccBalance(amId) | |
239 | + | let amBalanceX18 = t1(amBalance, amDcm) | |
240 | + | let prBalance = getAccBalance(prId) | |
241 | + | let prBalanceX18 = t1(prBalance, prDcm) | |
242 | + | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
243 | + | let curPrice = f1(curPriceX18, scale8) | |
244 | + | let pmtLpAmtX18 = t1(pmtLpAmt, scale8) | |
245 | + | let lpEmissX18 = t1(lpEmiss, scale8) | |
246 | + | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18) | |
247 | + | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18) | |
248 | + | let outAmAmt = f1(outAmAmtX18, amDcm) | |
249 | + | let outPrAmt = f1(outPrAmtX18, prDcm) | |
250 | + | let state = if ((txId58 == "")) | |
251 | + | then nil | |
252 | + | else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES")) | |
253 | + | then unit | |
254 | + | else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES")) | |
255 | + | then unit | |
256 | + | 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)] | |
257 | + | $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state) | |
258 | + | } | |
259 | + | } | |
260 | + | ||
261 | + | ||
262 | + | func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,pmtAmt,pmtId) = { | |
263 | + | let cfg = gpc() | |
264 | + | let lpId = fromBase58String(cfg[idxLPAsId]) | |
265 | + | let amIdStr = cfg[idxAmAsId] | |
266 | + | let prIdStr = cfg[idxPrAsId] | |
267 | + | let inAmIdStr = cfg[idxIAmtAsId] | |
268 | + | let inPrIdStr = cfg[idxIPriceAsId] | |
269 | + | let amtDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
270 | + | let priceDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
271 | + | let sts = cfg[idxPoolSt] | |
272 | + | let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity | |
273 | + | let amBalance = if (isEval) | |
274 | + | then getAccBalance(amIdStr) | |
275 | + | else if (if (isOneAsset) | |
276 | + | then (pmtId == amIdStr) | |
277 | + | else false) | |
278 | + | then (getAccBalance(amIdStr) - pmtAmt) | |
279 | + | else if (isOneAsset) | |
280 | + | then getAccBalance(amIdStr) | |
281 | + | else (getAccBalance(amIdStr) - inAmAmt) | |
282 | + | let prBalance = if (isEval) | |
283 | + | then getAccBalance(prIdStr) | |
284 | + | else if (if (isOneAsset) | |
285 | + | then (pmtId == prIdStr) | |
286 | + | else false) | |
287 | + | then (getAccBalance(prIdStr) - pmtAmt) | |
288 | + | else if (isOneAsset) | |
289 | + | then getAccBalance(prIdStr) | |
290 | + | else (getAccBalance(prIdStr) - inPrAmt) | |
291 | + | let inAmAssetAmtX18 = t1(inAmAmt, amtDcm) | |
292 | + | let inPrAssetAmtX18 = t1(inPrAmt, priceDcm) | |
293 | + | let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18) | |
294 | + | let amBalanceX18 = t1(amBalance, amtDcm) | |
295 | + | let prBalanceX18 = t1(prBalance, priceDcm) | |
296 | + | let r = if ((lpEm == 0)) | |
297 | + | then { | |
298 | + | let curPriceX18 = zeroBigInt | |
299 | + | let slippageX18 = zeroBigInt | |
300 | + | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
301 | + | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
302 | + | } | |
303 | + | else { | |
304 | + | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
305 | + | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
306 | + | let slippageX18 = t1(slippage, scale8) | |
307 | + | if (if ((curPriceX18 != zeroBigInt)) | |
308 | + | then (slippageRealX18 > slippageX18) | |
309 | + | else false) | |
310 | + | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
311 | + | else { | |
312 | + | let lpEmissionX18 = t1(lpEm, scale8) | |
313 | + | let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
314 | + | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
315 | + | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
316 | + | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
317 | + | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
318 | + | let expAmtAssetAmtX18 = expectedAmts._1 | |
319 | + | let expPriceAssetAmtX18 = expectedAmts._2 | |
320 | + | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18) | |
321 | + | $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18) | |
322 | + | } | |
323 | + | } | |
324 | + | let calcLpAmt = r._1 | |
325 | + | let calcAmAssetPmt = r._2 | |
326 | + | let calcPrAssetPmt = r._3 | |
327 | + | let curPrice = f1(r._4, scale8) | |
328 | + | let slippageCalc = f1(r._5, scale8) | |
329 | + | if ((0 >= calcLpAmt)) | |
330 | + | then throw("LP <= 0") | |
331 | + | else { | |
332 | + | let emitLpAmt = if (!(emitLp)) | |
333 | + | then 0 | |
334 | + | else calcLpAmt | |
335 | + | let amDiff = (inAmAmt - calcAmAssetPmt) | |
336 | + | let prDiff = (inPrAmt - calcPrAssetPmt) | |
337 | + | let $t01553115876 = if (if (isOneAsset) | |
338 | + | then (pmtId == amIdStr) | |
339 | + | else false) | |
340 | + | then $Tuple2(pmtAmt, 0) | |
341 | + | else if (if (isOneAsset) | |
342 | + | then (pmtId == prIdStr) | |
343 | + | else false) | |
344 | + | then $Tuple2(0, pmtAmt) | |
345 | + | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
346 | + | let writeAmAmt = $t01553115876._1 | |
347 | + | let writePrAmt = $t01553115876._2 | |
348 | + | 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))] | |
349 | + | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
350 | + | } | |
351 | + | } | |
352 | + | ||
353 | + | ||
354 | + | func moa (order) = { | |
355 | + | let cfg = gpc() | |
356 | + | let amtAsId = cfg[idxAmAsId] | |
357 | + | let prAsId = cfg[idxPrAsId] | |
358 | + | let sts = parseIntValue(cfg[idxPoolSt]) | |
359 | + | let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
360 | + | let prAsDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
361 | + | let accAmtAsBalance = getAccBalance(amtAsId) | |
362 | + | let accPrAsBalance = getAccBalance(prAsId) | |
363 | + | let curPriceX18 = if ((order.orderType == Buy)) | |
364 | + | then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance) | |
365 | + | else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance) | |
366 | + | let curPrice = f1(curPriceX18, scale8) | |
367 | + | if (if (if (igs()) | |
368 | + | then true | |
369 | + | else (sts == PoolMatcherDis)) | |
370 | + | then true | |
371 | + | else (sts == PoolShutdown)) | |
372 | + | then throw("Admin blocked") | |
373 | + | else { | |
374 | + | let orAmtAsset = order.assetPair.amountAsset | |
375 | + | let orAmtAsStr = if ((orAmtAsset == unit)) | |
376 | + | then "WAVES" | |
377 | + | else toBase58String(value(orAmtAsset)) | |
378 | + | let orPrAsset = order.assetPair.priceAsset | |
379 | + | let orPrAsStr = if ((orPrAsset == unit)) | |
380 | + | then "WAVES" | |
381 | + | else toBase58String(value(orPrAsset)) | |
382 | + | if (if ((orAmtAsStr != amtAsId)) | |
383 | + | then true | |
384 | + | else (orPrAsStr != prAsId)) | |
385 | + | then throw("Wr assets") | |
386 | + | else { | |
387 | + | let orderPrice = order.price | |
388 | + | let priceDcm = fraction(scale8, prAsDcm, amtAsDcm) | |
389 | + | let castOrderPrice = ts(orderPrice, scale8, priceDcm) | |
390 | + | let isOrderPriceValid = if ((order.orderType == Buy)) | |
391 | + | then (curPrice >= castOrderPrice) | |
392 | + | else (castOrderPrice >= curPrice) | |
393 | + | true | |
394 | + | } | |
395 | + | } | |
396 | + | } | |
397 | + | ||
398 | + | ||
399 | + | func cg (i) = if ((size(i.payments) != 1)) | |
400 | + | then throw("1 pmnt exp") | |
401 | + | else { | |
402 | + | let pmt = value(i.payments[0]) | |
403 | + | let pmtAssetId = value(pmt.assetId) | |
404 | + | let pmtAmt = pmt.amount | |
405 | + | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
406 | + | let outAmAmt = r._1 | |
407 | + | let outPrAmt = r._2 | |
408 | + | let sts = parseIntValue(r._9) | |
409 | + | let state = r._10 | |
410 | + | if (if (igs()) | |
411 | + | then true | |
412 | + | else (sts == PoolShutdown)) | |
413 | + | then throw(("Admin blocked: " + toString(sts))) | |
414 | + | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
415 | + | } | |
416 | + | ||
417 | + | ||
418 | + | func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,pmtAmt,pmtId) = { | |
419 | + | let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, false, emitLp, isOneAsset, pmtAmt, pmtId) | |
420 | + | let sts = parseIntValue(r._8) | |
421 | + | if (if (if (igs()) | |
422 | + | then true | |
423 | + | else (sts == PoolPutDis)) | |
424 | + | then true | |
425 | + | else (sts == PoolShutdown)) | |
426 | + | then throw(("Blocked:" + toString(sts))) | |
427 | + | else r | |
428 | + | } | |
429 | + | ||
430 | + | ||
431 | + | func m () = match getString(mpk()) { | |
85 | 432 | case s: String => | |
86 | 433 | fromBase58String(s) | |
87 | 434 | case _: Unit => | |
91 | 438 | } | |
92 | 439 | ||
93 | 440 | ||
94 | - | func | |
441 | + | func pm () = match getString(pmpk()) { | |
95 | 442 | case s: String => | |
96 | 443 | fromBase58String(s) | |
97 | 444 | case _: Unit => | |
101 | 448 | } | |
102 | 449 | ||
103 | 450 | ||
104 | - | func mustManager (i) = { | |
105 | - | let pd = throw("Permission denied") | |
106 | - | match managerPublicKeyOrUnit() { | |
107 | - | case pk: ByteVector => | |
108 | - | if ((i.callerPublicKey == pk)) | |
109 | - | then true | |
110 | - | else pd | |
111 | - | case _: Unit => | |
112 | - | if ((i.caller == this)) | |
113 | - | then true | |
114 | - | else pd | |
115 | - | case _ => | |
116 | - | throw("Match error") | |
117 | - | } | |
118 | - | } | |
451 | + | let pd = throw("Permission denied") | |
119 | 452 | ||
120 | - | ||
121 | - | func getAdmins () = match getString(keyAdminPubKeys()) { | |
122 | - | case s: String => | |
123 | - | if ((size(s) == 0)) | |
124 | - | then nil | |
125 | - | else split(s, SEP) | |
453 | + | func mm (i) = match m() { | |
454 | + | case pk: ByteVector => | |
455 | + | if ((i.callerPublicKey == pk)) | |
456 | + | then true | |
457 | + | else pd | |
458 | + | case _: Unit => | |
459 | + | if ((i.caller == this)) | |
460 | + | then true | |
461 | + | else pd | |
126 | 462 | case _ => | |
127 | - | | |
463 | + | throw("Match error") | |
128 | 464 | } | |
129 | 465 | ||
130 | 466 | ||
131 | - | func mustAdmin (i) = if (containsElement(getAdmins(), toBase58String(i.callerPublicKey))) | |
132 | - | then true | |
133 | - | else mustManager(i) | |
134 | - | ||
135 | - | ||
136 | - | func mustPool (i) = if ((i.caller == poolContract)) | |
137 | - | then true | |
138 | - | else throw("caller must be the pool") | |
139 | - | ||
140 | - | ||
141 | 467 | @Callable(i) | |
142 | - | func constructor ( | |
143 | - | let | |
144 | - | if (( | |
145 | - | then [StringEntry( | |
468 | + | func constructor (fc) = { | |
469 | + | let c = mm(i) | |
470 | + | if ((c == c)) | |
471 | + | then [StringEntry(fc(), fc)] | |
146 | 472 | else throw("Strict value is not equal to itself.") | |
147 | 473 | } | |
148 | 474 | ||
150 | 476 | ||
151 | 477 | @Callable(i) | |
152 | 478 | func setManager (pendingManagerPublicKey) = { | |
153 | - | let | |
154 | - | if (( | |
479 | + | let c = mm(i) | |
480 | + | if ((c == c)) | |
155 | 481 | then { | |
156 | - | let | |
157 | - | if (( | |
158 | - | then [StringEntry( | |
482 | + | let cm = fromBase58String(pendingManagerPublicKey) | |
483 | + | if ((cm == cm)) | |
484 | + | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
159 | 485 | else throw("Strict value is not equal to itself.") | |
160 | 486 | } | |
161 | 487 | else throw("Strict value is not equal to itself.") | |
165 | 491 | ||
166 | 492 | @Callable(i) | |
167 | 493 | func confirmManager () = { | |
168 | - | let | |
169 | - | let | |
494 | + | let p = pm() | |
495 | + | let hpm = if (isDefined(p)) | |
170 | 496 | then true | |
171 | 497 | else throw("No pending manager") | |
172 | - | if (( | |
498 | + | if ((hpm == hpm)) | |
173 | 499 | then { | |
174 | - | let | |
500 | + | let cpm = if ((i.callerPublicKey == value(p))) | |
175 | 501 | then true | |
176 | 502 | else throw("You are not pending manager") | |
177 | - | if (( | |
178 | - | then [StringEntry( | |
503 | + | if ((cpm == cpm)) | |
504 | + | then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())] | |
179 | 505 | else throw("Strict value is not equal to itself.") | |
180 | 506 | } | |
181 | 507 | else throw("Strict value is not equal to itself.") | |
184 | 510 | ||
185 | 511 | ||
186 | 512 | @Callable(i) | |
187 | - | func setAdmins (adminPubKeys) = { | |
188 | - | let checkCaller = mustManager(i) | |
189 | - | if ((checkCaller == checkCaller)) | |
190 | - | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
513 | + | func put (slip,autoStake) = { | |
514 | + | let factCfg = gfc() | |
515 | + | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
516 | + | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
517 | + | if ((0 > slip)) | |
518 | + | then throw("Wrong slippage") | |
519 | + | else if ((size(i.payments) != 2)) | |
520 | + | then throw("2 pmnts expd") | |
521 | + | else { | |
522 | + | 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, 0, "") | |
523 | + | let emitLpAmt = e._2 | |
524 | + | let lpAssetId = e._7 | |
525 | + | let state = e._9 | |
526 | + | let amDiff = e._10 | |
527 | + | let prDiff = e._11 | |
528 | + | let amId = e._12 | |
529 | + | let prId = e._13 | |
530 | + | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
531 | + | if ((r == r)) | |
532 | + | then { | |
533 | + | let el = match r { | |
534 | + | case legacy: Address => | |
535 | + | invoke(legacy, "emit", [emitLpAmt], nil) | |
536 | + | case _ => | |
537 | + | unit | |
538 | + | } | |
539 | + | if ((el == el)) | |
540 | + | then { | |
541 | + | let sa = if ((amDiff > 0)) | |
542 | + | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
543 | + | else nil | |
544 | + | if ((sa == sa)) | |
545 | + | then { | |
546 | + | let sp = if ((prDiff > 0)) | |
547 | + | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
548 | + | else nil | |
549 | + | if ((sp == sp)) | |
550 | + | then { | |
551 | + | let lpTrnsfr = if (autoStake) | |
552 | + | then { | |
553 | + | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
554 | + | if ((ss == ss)) | |
555 | + | then nil | |
556 | + | else throw("Strict value is not equal to itself.") | |
557 | + | } | |
558 | + | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
559 | + | (state ++ lpTrnsfr) | |
560 | + | } | |
561 | + | else throw("Strict value is not equal to itself.") | |
562 | + | } | |
563 | + | else throw("Strict value is not equal to itself.") | |
564 | + | } | |
565 | + | else throw("Strict value is not equal to itself.") | |
566 | + | } | |
567 | + | else throw("Strict value is not equal to itself.") | |
568 | + | } | |
569 | + | } | |
570 | + | ||
571 | + | ||
572 | + | ||
573 | + | @Callable(i) | |
574 | + | func putOneTkn (amAssetPart,prAssetPart,outLp,slippage,autoStake) = { | |
575 | + | let cfg = gfc() | |
576 | + | let stakingCntr = valueOrErrorMessage(addressFromString(cfg[idxFactStakCntr]), "Wr st addr") | |
577 | + | let slipCntr = valueOrErrorMessage(addressFromString(cfg[idxFactSlippCntr]), "Wr sl addr") | |
578 | + | let gwxCntr = valueOrErrorMessage(addressFromString(cfg[idxFactGwxRewCntr]), "Wr gwx addr") | |
579 | + | let poolCfg = gpc() | |
580 | + | let amId = poolCfg[idxAmAsId] | |
581 | + | let prId = poolCfg[idxPrAsId] | |
582 | + | let amDcm = parseIntValue(poolCfg[idxAmtAsDcm]) | |
583 | + | let prDcm = parseIntValue(poolCfg[idxPriceAsDcm]) | |
584 | + | let addon = valueOrElse(getString(this, ada()), "") | |
585 | + | let userAddress = if ((addon == toString(i.caller))) | |
586 | + | then i.originCaller | |
587 | + | else i.caller | |
588 | + | let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid") | |
589 | + | let check = reentrantInvoke(addonContract, "ensureCanPutOneTkn", [toString(userAddress)], nil) | |
590 | + | if ((check == check)) | |
591 | + | then if (if (if (if ((0 >= slippage)) | |
592 | + | then true | |
593 | + | else (0 >= amAssetPart)) | |
594 | + | then true | |
595 | + | else (0 >= prAssetPart)) | |
596 | + | then true | |
597 | + | else (0 >= outLp)) | |
598 | + | then throw("Wrong params") | |
599 | + | else if ((size(i.payments) != 1)) | |
600 | + | then throw("1 pmnt expd") | |
601 | + | else { | |
602 | + | let pmt = value(i.payments[0]) | |
603 | + | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
604 | + | let pmtAmt = pmt.amount | |
605 | + | if (if (if ((amAssetPart > pmtAmt)) | |
606 | + | then true | |
607 | + | else (prAssetPart > pmtAmt)) | |
608 | + | then true | |
609 | + | else (10000000 > pmtAmt)) | |
610 | + | then throw("Wrong pmt amt") | |
611 | + | else { | |
612 | + | let amBalance = getAccBalance(amId) | |
613 | + | let prBalance = getAccBalance(prId) | |
614 | + | let $t02483225212 = if ((pmtAssetId == amId)) | |
615 | + | then $Tuple6((amBalance - pmtAmt), prBalance, (pmtAmt - amAssetPart), prAssetPart, 0, 0) | |
616 | + | else if ((pmtAssetId == prId)) | |
617 | + | then $Tuple6(amBalance, (prBalance - pmtAmt), 0, 0, (pmtAmt - prAssetPart), amAssetPart) | |
618 | + | else throw("wrong pmtAssetId") | |
619 | + | let amBalanceNow = $t02483225212._1 | |
620 | + | let prBalanceNow = $t02483225212._2 | |
621 | + | let virtSwapInAm = $t02483225212._3 | |
622 | + | let virtSwapOutPr = $t02483225212._4 | |
623 | + | let virtSwapInPr = $t02483225212._5 | |
624 | + | let virtSwapOutAm = $t02483225212._6 | |
625 | + | let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil) | |
626 | + | let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil) | |
627 | + | let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D) | |
628 | + | if ((D0vsD1 == D0vsD1)) | |
629 | + | then { | |
630 | + | let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), slippage, true, true, pmtAmt, pmtAssetId) | |
631 | + | let estimLP = estPut._2 | |
632 | + | let lpAssetId = estPut._7 | |
633 | + | let state = estPut._9 | |
634 | + | let amDiff = estPut._10 | |
635 | + | let prDiff = estPut._11 | |
636 | + | let lpCalcRes = vad(toBigInt(estimLP), toBigInt(outLp), toBigInt(slippage)) | |
637 | + | let emitLpAmt = toInt(lpCalcRes._2) | |
638 | + | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
639 | + | if ((e == e)) | |
640 | + | then { | |
641 | + | let el = match e { | |
642 | + | case legacy: Address => | |
643 | + | invoke(legacy, "emit", [emitLpAmt], nil) | |
644 | + | case _ => | |
645 | + | unit | |
646 | + | } | |
647 | + | if ((el == el)) | |
648 | + | then { | |
649 | + | let sa = if ((amDiff > 0)) | |
650 | + | then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)]) | |
651 | + | else nil | |
652 | + | if ((sa == sa)) | |
653 | + | then { | |
654 | + | let sp = if ((prDiff > 0)) | |
655 | + | then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)]) | |
656 | + | else nil | |
657 | + | if ((sp == sp)) | |
658 | + | then { | |
659 | + | let lpTrnsfr = if (autoStake) | |
660 | + | then { | |
661 | + | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
662 | + | if ((ss == ss)) | |
663 | + | then nil | |
664 | + | else throw("Strict value is not equal to itself.") | |
665 | + | } | |
666 | + | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
667 | + | (state ++ lpTrnsfr) | |
668 | + | } | |
669 | + | else throw("Strict value is not equal to itself.") | |
670 | + | } | |
671 | + | else throw("Strict value is not equal to itself.") | |
672 | + | } | |
673 | + | else throw("Strict value is not equal to itself.") | |
674 | + | } | |
675 | + | else throw("Strict value is not equal to itself.") | |
676 | + | } | |
677 | + | else throw("Strict value is not equal to itself.") | |
678 | + | } | |
679 | + | } | |
191 | 680 | else throw("Strict value is not equal to itself.") | |
192 | 681 | } | |
193 | 682 | ||
194 | 683 | ||
195 | 684 | ||
196 | 685 | @Callable(i) | |
197 | - | func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = { | |
198 | - | let checkPayments = if ((size(i.payments) != 0)) | |
199 | - | then throw("No pmnts expd") | |
200 | - | else true | |
201 | - | if ((checkPayments == checkPayments)) | |
202 | - | then { | |
203 | - | let cfg = getPoolConfig() | |
204 | - | let factoryCfg = getFactoryConfig() | |
205 | - | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
206 | - | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
207 | - | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
208 | - | if ((unstakeInv == unstakeInv)) | |
209 | - | then { | |
210 | - | let getOneTkn = invoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)]) | |
211 | - | if ((getOneTkn == getOneTkn)) | |
212 | - | then nil | |
213 | - | else throw("Strict value is not equal to itself.") | |
214 | - | } | |
215 | - | else throw("Strict value is not equal to itself.") | |
686 | + | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
687 | + | then throw("Wrong slpg") | |
688 | + | else if ((size(i.payments) != 2)) | |
689 | + | then throw("2 pmnts expd") | |
690 | + | else { | |
691 | + | 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, 0, "") | |
692 | + | estPut._9 | |
216 | 693 | } | |
694 | + | ||
695 | + | ||
696 | + | ||
697 | + | @Callable(i) | |
698 | + | func get () = { | |
699 | + | let r = cg(i) | |
700 | + | let outAmtAmt = r._1 | |
701 | + | let outPrAmt = r._2 | |
702 | + | let pmtAmt = r._3 | |
703 | + | let pmtAssetId = r._4 | |
704 | + | let state = r._5 | |
705 | + | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
706 | + | if ((b == b)) | |
707 | + | then state | |
217 | 708 | else throw("Strict value is not equal to itself.") | |
218 | 709 | } | |
219 | 710 | ||
220 | 711 | ||
221 | 712 | ||
222 | 713 | @Callable(i) | |
223 | - | func setAmp (amp) = { | |
224 | - | let checkCaller = mustAdmin(i) | |
225 | - | if ((checkCaller == checkCaller)) | |
226 | - | then { | |
227 | - | let res1 = invoke(poolContract, "setS", [keyAmp(), amp], nil) | |
228 | - | let res2 = invoke(poolContract, "setS", [keyAmpHistory(height), amp], nil) | |
229 | - | $Tuple2(nil, $Tuple2(res1, res2)) | |
230 | - | } | |
231 | - | else throw("Strict value is not equal to itself.") | |
714 | + | func getOneTkn (exchResult,notUsed,outAmount,outAssetId,slippage) = if ((size(i.payments) != 1)) | |
715 | + | then throw("1 pmnt expd") | |
716 | + | else { | |
717 | + | let cfg = gpc() | |
718 | + | let lpId = cfg[idxLPAsId] | |
719 | + | let amId = cfg[idxAmAsId] | |
720 | + | let prId = cfg[idxPrAsId] | |
721 | + | let amDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
722 | + | let prDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
723 | + | let sts = cfg[idxPoolSt] | |
724 | + | let factCfg = gfc() | |
725 | + | let gwxCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactGwxRewCntr]), "Wr sl addr") | |
726 | + | let pmt = value(i.payments[0]) | |
727 | + | let addon = valueOrElse(getString(this, ada()), "") | |
728 | + | let userAddress = if ((addon == toString(i.caller))) | |
729 | + | then i.originCaller | |
730 | + | else i.caller | |
731 | + | let txId58 = toBase58String(i.transactionId) | |
732 | + | let pmtAssetId = value(pmt.assetId) | |
733 | + | let pmtAmt = pmt.amount | |
734 | + | let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid") | |
735 | + | let check = reentrantInvoke(addonContract, "ensureCanGetOneTkn", [toString(userAddress)], nil) | |
736 | + | if ((check == check)) | |
737 | + | then if ((1000000000 > pmtAmt)) | |
738 | + | then throw("Min pmt 10 LP") | |
739 | + | else if (if (if ((0 > slippage)) | |
740 | + | then true | |
741 | + | else (0 > exchResult)) | |
742 | + | then true | |
743 | + | else (0 > outAmount)) | |
744 | + | then throw("Wrong params") | |
745 | + | else if ((lpId != toBase58String(pmtAssetId))) | |
746 | + | then throw("Wrong LP") | |
747 | + | else { | |
748 | + | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
749 | + | let estimAmAmt = r._1 | |
750 | + | let estimPrAmt = r._2 | |
751 | + | let amBalance = getAccBalance(amId) | |
752 | + | let prBalance = getAccBalance(prId) | |
753 | + | let $t03024330700 = if ((outAssetId == amId)) | |
754 | + | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult)) | |
755 | + | else if ((outAssetId == prId)) | |
756 | + | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult)) | |
757 | + | else throw("wrong outAssetId") | |
758 | + | let amBalanceNow = $t03024330700._1 | |
759 | + | let prBalanceNow = $t03024330700._2 | |
760 | + | let virtSwapInAm = $t03024330700._3 | |
761 | + | let virtSwapOutPr = $t03024330700._4 | |
762 | + | let virtSwapInPr = $t03024330700._5 | |
763 | + | let virtSwapOutAm = $t03024330700._6 | |
764 | + | let totalGet = $t03024330700._7 | |
765 | + | if (if ((0 > virtSwapInAm)) | |
766 | + | then true | |
767 | + | else (0 > virtSwapInPr)) | |
768 | + | then throw("Wrong calc") | |
769 | + | else { | |
770 | + | let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil) | |
771 | + | let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil) | |
772 | + | let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D) | |
773 | + | if ((D0vsD1 == D0vsD1)) | |
774 | + | then { | |
775 | + | let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage)) | |
776 | + | if ((finalRes == finalRes)) | |
777 | + | then { | |
778 | + | let $t03140531509 = if ((outAssetId == amId)) | |
779 | + | then $Tuple2(toInt(finalRes._2), 0) | |
780 | + | else $Tuple2(0, toInt(finalRes._2)) | |
781 | + | let outAm = $t03140531509._1 | |
782 | + | let outPr = $t03140531509._2 | |
783 | + | let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm)) | |
784 | + | let curPr = f1(curPrX18, scale8) | |
785 | + | let state = [ScriptTransfer(userAddress, (outAm + outPr), if ((outAssetId == "WAVES")) | |
786 | + | then unit | |
787 | + | else fromBase58String(outAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] | |
788 | + | if ((state == state)) | |
789 | + | then { | |
790 | + | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
791 | + | if ((burn == burn)) | |
792 | + | then state | |
793 | + | else throw("Strict value is not equal to itself.") | |
794 | + | } | |
795 | + | else throw("Strict value is not equal to itself.") | |
796 | + | } | |
797 | + | else throw("Strict value is not equal to itself.") | |
798 | + | } | |
799 | + | else throw("Strict value is not equal to itself.") | |
800 | + | } | |
801 | + | } | |
802 | + | else throw("Strict value is not equal to itself.") | |
803 | + | } | |
804 | + | ||
805 | + | ||
806 | + | ||
807 | + | @Callable(i) | |
808 | + | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
809 | + | let r = cg(i) | |
810 | + | let outAmAmt = r._1 | |
811 | + | let outPrAmt = r._2 | |
812 | + | let pmtAmt = r._3 | |
813 | + | let pmtAssetId = r._4 | |
814 | + | let state = r._5 | |
815 | + | if ((noLessThenAmtAsset > outAmAmt)) | |
816 | + | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
817 | + | else if ((noLessThenPriceAsset > outPrAmt)) | |
818 | + | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
819 | + | else { | |
820 | + | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
821 | + | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
822 | + | then state | |
823 | + | else throw("Strict value is not equal to itself.") | |
824 | + | } | |
232 | 825 | } | |
233 | 826 | ||
234 | 827 | ||
235 | 828 | ||
236 | 829 | @Callable(i) | |
237 | - | func ensureCanGetOneTkn (caller) = { | |
238 | - | let checkCaller = mustPool(i) | |
239 | - | if ((checkCaller == checkCaller)) | |
830 | + | func unstakeAndGet (amount) = { | |
831 | + | let checkPayments = if ((size(i.payments) != 0)) | |
832 | + | then throw("No pmnts expd") | |
833 | + | else true | |
834 | + | if ((checkPayments == checkPayments)) | |
240 | 835 | then { | |
241 | - | let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) { | |
242 | - | case int: Int => | |
243 | - | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
244 | - | let isReadyforPutOneTkn = (height >= permittedHeight) | |
245 | - | let needBlocks = (permittedHeight - height) | |
246 | - | if (isReadyforPutOneTkn) | |
836 | + | let cfg = gpc() | |
837 | + | let factoryCfg = gfc() | |
838 | + | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
839 | + | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
840 | + | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
841 | + | if ((unstakeInv == unstakeInv)) | |
842 | + | then { | |
843 | + | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
844 | + | let sts = parseIntValue(r._9) | |
845 | + | let state = r._10 | |
846 | + | let v = if (if (igs()) | |
247 | 847 | then true | |
248 | - | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
249 | - | case _ => | |
250 | - | true | |
251 | - | } | |
252 | - | if ((ensureCanPut == ensureCanPut)) | |
253 | - | then { | |
254 | - | let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) { | |
255 | - | case int: Int => | |
256 | - | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
257 | - | let isReadyforGetOneTkn = (height >= permittedHeight) | |
258 | - | let needBlocks = (permittedHeight - height) | |
259 | - | if (isReadyforGetOneTkn) | |
260 | - | then true | |
261 | - | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
262 | - | case _ => | |
263 | - | true | |
264 | - | } | |
265 | - | if ((ensureCanGet == ensureCanGet)) | |
848 | + | else (sts == PoolShutdown)) | |
849 | + | then throw(("Blocked: " + toString(sts))) | |
850 | + | else true | |
851 | + | if ((v == v)) | |
266 | 852 | then { | |
267 | - | let | |
268 | - | if (( | |
269 | - | then | |
853 | + | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
854 | + | if ((burnA == burnA)) | |
855 | + | then state | |
270 | 856 | else throw("Strict value is not equal to itself.") | |
271 | 857 | } | |
272 | 858 | else throw("Strict value is not equal to itself.") | |
279 | 865 | ||
280 | 866 | ||
281 | 867 | @Callable(i) | |
282 | - | func ensureCanPutOneTkn (caller) = { | |
283 | - | let checkCaller = mustPool(i) | |
284 | - | if ((checkCaller == checkCaller)) | |
285 | - | then { | |
286 | - | let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) { | |
287 | - | case int: Int => | |
288 | - | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
289 | - | let isReadyforPutOneTkn = (height >= permittedHeight) | |
290 | - | let needBlocks = (permittedHeight - height) | |
291 | - | if (isReadyforPutOneTkn) | |
292 | - | then true | |
293 | - | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
294 | - | case _ => | |
295 | - | true | |
296 | - | } | |
297 | - | if ((ensureCanPut == ensureCanPut)) | |
298 | - | then { | |
299 | - | let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) { | |
300 | - | case int: Int => | |
301 | - | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
302 | - | let isReadyforGetOneTkn = (height >= permittedHeight) | |
303 | - | let needBlocks = (permittedHeight - height) | |
304 | - | if (isReadyforGetOneTkn) | |
305 | - | then true | |
306 | - | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
307 | - | case _ => | |
308 | - | true | |
309 | - | } | |
310 | - | if ((ensureCanGet == ensureCanGet)) | |
311 | - | then { | |
312 | - | let setI = invoke(poolContract, "setI", [lastPutOneTknCall(caller), height], nil) | |
313 | - | if ((setI == setI)) | |
314 | - | then nil | |
315 | - | else throw("Strict value is not equal to itself.") | |
316 | - | } | |
317 | - | else throw("Strict value is not equal to itself.") | |
318 | - | } | |
319 | - | else throw("Strict value is not equal to itself.") | |
320 | - | } | |
321 | - | else throw("Strict value is not equal to itself.") | |
868 | + | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
869 | + | then throw("denied") | |
870 | + | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success") | |
871 | + | ||
872 | + | ||
873 | + | ||
874 | + | @Callable(i) | |
875 | + | func setS (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
876 | + | then pd | |
877 | + | else [StringEntry(k, v)] | |
878 | + | ||
879 | + | ||
880 | + | ||
881 | + | @Callable(i) | |
882 | + | func setI (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
883 | + | then pd | |
884 | + | else [IntegerEntry(k, v)] | |
885 | + | ||
886 | + | ||
887 | + | ||
888 | + | @Callable(i) | |
889 | + | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
890 | + | ||
891 | + | ||
892 | + | ||
893 | + | @Callable(i) | |
894 | + | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
895 | + | ||
896 | + | ||
897 | + | ||
898 | + | @Callable(i) | |
899 | + | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
900 | + | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
901 | + | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
902 | + | } | |
903 | + | ||
904 | + | ||
905 | + | ||
906 | + | @Callable(i) | |
907 | + | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
908 | + | ||
909 | + | ||
910 | + | ||
911 | + | @Callable(i) | |
912 | + | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
913 | + | ||
914 | + | ||
915 | + | ||
916 | + | @Callable(i) | |
917 | + | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
918 | + | ||
919 | + | ||
920 | + | ||
921 | + | @Callable(i) | |
922 | + | func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, false, 0, "")) | |
923 | + | ||
924 | + | ||
925 | + | ||
926 | + | @Callable(i) | |
927 | + | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
928 | + | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
929 | + | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
322 | 930 | } | |
323 | 931 | ||
324 | 932 | ||
325 | 933 | @Verifier(tx) | |
326 | - | func verify () = { | |
327 | - | let targetPublicKey = match managerPublicKeyOrUnit() { | |
328 | - | case pk: ByteVector => | |
329 | - | pk | |
330 | - | case _: Unit => | |
331 | - | tx.senderPublicKey | |
332 | - | case _ => | |
333 | - | throw("Match error") | |
334 | - | } | |
335 | - | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
336 | - | } | |
934 | + | func verify () = match tx { | |
935 | + | case order: Order => | |
936 | + | let mtchPub = mp() | |
937 | + | let orV = moa(order) | |
938 | + | let sndrV = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
939 | + | let mtchV = sigVerify(order.bodyBytes, order.proofs[1], mtchPub) | |
940 | + | if (if (if (orV) | |
941 | + | then sndrV | |
942 | + | else false) | |
943 | + | then mtchV | |
944 | + | else false) | |
945 | + | then true | |
946 | + | else toe(orV, sndrV, mtchV) | |
947 | + | case _ => | |
948 | + | let targetPublicKey = match m() { | |
949 | + | case pk: ByteVector => | |
950 | + | pk | |
951 | + | case _: Unit => | |
952 | + | tx.senderPublicKey | |
953 | + | case _ => | |
954 | + | throw("Match error") | |
955 | + | } | |
956 | + | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
957 | + | } | |
337 | 958 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let scale8 = 100000000 | |
5 | + | ||
6 | + | let scale8BigInt = toBigInt(100000000) | |
7 | + | ||
8 | + | let scale18 = toBigInt(1000000000000000000) | |
9 | + | ||
10 | + | let zeroBigInt = toBigInt(0) | |
11 | + | ||
12 | + | let oneBigInt = toBigInt(1) | |
13 | + | ||
14 | + | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
15 | + | ||
16 | + | let Amult = "100" | |
17 | + | ||
18 | + | let Dconv = "1" | |
19 | + | ||
4 | 20 | let SEP = "__" | |
5 | 21 | ||
6 | 22 | let EMPTY = "" | |
7 | 23 | ||
24 | + | let PoolActive = 1 | |
25 | + | ||
26 | + | let PoolPutDis = 2 | |
27 | + | ||
28 | + | let PoolMatcherDis = 3 | |
29 | + | ||
30 | + | let PoolShutdown = 4 | |
31 | + | ||
8 | 32 | let idxPoolAddress = 1 | |
33 | + | ||
34 | + | let idxPoolSt = 2 | |
9 | 35 | ||
10 | 36 | let idxLPAsId = 3 | |
11 | 37 | ||
12 | 38 | let idxAmAsId = 4 | |
13 | 39 | ||
14 | 40 | let idxPrAsId = 5 | |
15 | 41 | ||
42 | + | let idxAmtAsDcm = 6 | |
43 | + | ||
44 | + | let idxPriceAsDcm = 7 | |
45 | + | ||
46 | + | let idxIAmtAsId = 8 | |
47 | + | ||
48 | + | let idxIPriceAsId = 9 | |
49 | + | ||
16 | 50 | let idxFactStakCntr = 1 | |
51 | + | ||
52 | + | let idxFactSlippCntr = 7 | |
53 | + | ||
54 | + | let idxFactGwxRewCntr = 10 | |
17 | 55 | ||
18 | 56 | let delay = "%s__delay" | |
19 | 57 | ||
20 | - | func | |
58 | + | func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
21 | 59 | ||
22 | 60 | ||
23 | - | func | |
61 | + | func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
24 | 62 | ||
25 | 63 | ||
26 | - | func | |
64 | + | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
27 | 65 | ||
28 | 66 | ||
29 | - | func keyPoolAddr () = "%s__poolAddress" | |
67 | + | func abs (val) = if ((zeroBigInt > val)) | |
68 | + | then -(val) | |
69 | + | else val | |
30 | 70 | ||
31 | 71 | ||
32 | - | func | |
72 | + | func fc () = "%s__factoryContract" | |
33 | 73 | ||
34 | 74 | ||
35 | - | func | |
75 | + | func mpk () = "%s__managerPublicKey" | |
36 | 76 | ||
37 | 77 | ||
38 | - | func | |
78 | + | func pmpk () = "%s__pendingManagerPublicKey" | |
39 | 79 | ||
40 | 80 | ||
41 | - | func | |
81 | + | func pl () = "%s%s__price__last" | |
42 | 82 | ||
43 | 83 | ||
44 | - | func | |
84 | + | func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP) | |
45 | 85 | ||
46 | 86 | ||
47 | - | func | |
87 | + | func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId) | |
48 | 88 | ||
49 | 89 | ||
50 | - | func | |
90 | + | func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId) | |
51 | 91 | ||
52 | 92 | ||
53 | - | func | |
93 | + | func aa () = "%s__amountAsset" | |
54 | 94 | ||
55 | 95 | ||
56 | - | func | |
96 | + | func pa () = "%s__priceAsset" | |
57 | 97 | ||
58 | 98 | ||
59 | - | func | |
99 | + | func amp () = "%s__amp" | |
60 | 100 | ||
61 | 101 | ||
62 | - | func | |
102 | + | func ada () = "%s__addonAddr" | |
63 | 103 | ||
64 | 104 | ||
65 | - | func | |
105 | + | func lgotc (caller) = makeString(["%s%s__lastGetOneTknCall", caller], SEP) | |
66 | 106 | ||
67 | 107 | ||
68 | - | ||
108 | + | func lsotc (caller) = makeString(["%s%s__lastPutOneTknCall", caller], SEP) | |
69 | 109 | ||
70 | - | let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr())) | |
71 | 110 | ||
72 | - | func getPoolConfig () = { | |
73 | - | let amtAs = getStringOrFail(poolContract, keyAmtAsset()) | |
74 | - | let priceAs = getStringOrFail(poolContract, keyPriceAsset()) | |
75 | - | let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs)) | |
76 | - | let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs)) | |
77 | - | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP) | |
111 | + | func fcfg () = "%s__factoryConfig" | |
112 | + | ||
113 | + | ||
114 | + | func mtpk () = "%s%s__matcher__publicKey" | |
115 | + | ||
116 | + | ||
117 | + | func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
118 | + | ||
119 | + | ||
120 | + | func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
121 | + | ||
122 | + | ||
123 | + | func aps () = "%s__shutdown" | |
124 | + | ||
125 | + | ||
126 | + | func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV))) | |
127 | + | ||
128 | + | ||
129 | + | func str (val) = match val { | |
130 | + | case valStr: String => | |
131 | + | valStr | |
132 | + | case _ => | |
133 | + | throw("fail cast to String") | |
134 | + | } | |
135 | + | ||
136 | + | ||
137 | + | func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
138 | + | ||
139 | + | ||
140 | + | func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
141 | + | ||
142 | + | ||
143 | + | let fca = addressFromStringValue(strf(this, fc())) | |
144 | + | ||
145 | + | let A = strf(this, amp()) | |
146 | + | ||
147 | + | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
148 | + | ||
149 | + | ||
150 | + | func mp () = fromBase58String(strf(fca, mtpk())) | |
151 | + | ||
152 | + | ||
153 | + | func gpc () = { | |
154 | + | let amtAs = strf(this, aa()) | |
155 | + | let priceAs = strf(this, pa()) | |
156 | + | let iPriceAs = intf(fca, mba(priceAs)) | |
157 | + | let iAmtAs = intf(fca, mba(amtAs)) | |
158 | + | split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP) | |
78 | 159 | } | |
79 | 160 | ||
80 | 161 | ||
81 | - | func | |
162 | + | func gfc () = split(strf(fca, fcfg()), SEP) | |
82 | 163 | ||
83 | 164 | ||
84 | - | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
165 | + | 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) | |
166 | + | ||
167 | + | ||
168 | + | 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) | |
169 | + | ||
170 | + | ||
171 | + | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
172 | + | then wavesBalance(this).available | |
173 | + | else assetBalance(this, fromBase58String(assetId)) | |
174 | + | ||
175 | + | ||
176 | + | func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
177 | + | ||
178 | + | ||
179 | + | func vad (A1,A2,slippage) = { | |
180 | + | let diff = fraction((A1 - A2), scale8BigInt, A2) | |
181 | + | let pass = ((slippage - abs(diff)) > zeroBigInt) | |
182 | + | if (!(pass)) | |
183 | + | then throw(("Big slpg: " + toString(diff))) | |
184 | + | else $Tuple2(pass, min([A1, A2])) | |
185 | + | } | |
186 | + | ||
187 | + | ||
188 | + | func vd (D1,D0,slpg) = { | |
189 | + | let diff = fraction(D0, scale8BigInt, D1) | |
190 | + | let fail = (slpg > diff) | |
191 | + | if (if (fail) | |
192 | + | then true | |
193 | + | else (D0 > D1)) | |
194 | + | then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg))) | |
195 | + | else fail | |
196 | + | } | |
197 | + | ||
198 | + | ||
199 | + | func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
200 | + | let amtAsAmtX18 = t1(amAmt, amAssetDcm) | |
201 | + | let prAsAmtX18 = t1(prAmt, prAssetDcm) | |
202 | + | cpbi(prAsAmtX18, amtAsAmtX18) | |
203 | + | } | |
204 | + | ||
205 | + | ||
206 | + | func calcPrices (amAmt,prAmt,lpAmt) = { | |
207 | + | let cfg = gpc() | |
208 | + | let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
209 | + | let prAsDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
210 | + | let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt) | |
211 | + | let amAmtX18 = t1(amAmt, amtAsDcm) | |
212 | + | let prAmtX18 = t1(prAmt, prAsDcm) | |
213 | + | let lpAmtX18 = t1(lpAmt, scale8) | |
214 | + | let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18) | |
215 | + | let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18) | |
216 | + | [priceX18, lpPrInAmAsX18, lpPrInPrAsX18] | |
217 | + | } | |
218 | + | ||
219 | + | ||
220 | + | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
221 | + | let p = calcPrices(amAmt, prAmt, lpAmt) | |
222 | + | [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)] | |
223 | + | } | |
224 | + | ||
225 | + | ||
226 | + | func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
227 | + | let cfg = gpc() | |
228 | + | let lpId = cfg[idxLPAsId] | |
229 | + | let amId = cfg[idxAmAsId] | |
230 | + | let prId = cfg[idxPrAsId] | |
231 | + | let amDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
232 | + | let prDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
233 | + | let sts = cfg[idxPoolSt] | |
234 | + | let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity | |
235 | + | if ((lpId != pmtAssetId)) | |
236 | + | then throw("Wrong pmt asset") | |
237 | + | else { | |
238 | + | let amBalance = getAccBalance(amId) | |
239 | + | let amBalanceX18 = t1(amBalance, amDcm) | |
240 | + | let prBalance = getAccBalance(prId) | |
241 | + | let prBalanceX18 = t1(prBalance, prDcm) | |
242 | + | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
243 | + | let curPrice = f1(curPriceX18, scale8) | |
244 | + | let pmtLpAmtX18 = t1(pmtLpAmt, scale8) | |
245 | + | let lpEmissX18 = t1(lpEmiss, scale8) | |
246 | + | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18) | |
247 | + | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18) | |
248 | + | let outAmAmt = f1(outAmAmtX18, amDcm) | |
249 | + | let outPrAmt = f1(outPrAmtX18, prDcm) | |
250 | + | let state = if ((txId58 == "")) | |
251 | + | then nil | |
252 | + | else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES")) | |
253 | + | then unit | |
254 | + | else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES")) | |
255 | + | then unit | |
256 | + | 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)] | |
257 | + | $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state) | |
258 | + | } | |
259 | + | } | |
260 | + | ||
261 | + | ||
262 | + | func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,pmtAmt,pmtId) = { | |
263 | + | let cfg = gpc() | |
264 | + | let lpId = fromBase58String(cfg[idxLPAsId]) | |
265 | + | let amIdStr = cfg[idxAmAsId] | |
266 | + | let prIdStr = cfg[idxPrAsId] | |
267 | + | let inAmIdStr = cfg[idxIAmtAsId] | |
268 | + | let inPrIdStr = cfg[idxIPriceAsId] | |
269 | + | let amtDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
270 | + | let priceDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
271 | + | let sts = cfg[idxPoolSt] | |
272 | + | let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity | |
273 | + | let amBalance = if (isEval) | |
274 | + | then getAccBalance(amIdStr) | |
275 | + | else if (if (isOneAsset) | |
276 | + | then (pmtId == amIdStr) | |
277 | + | else false) | |
278 | + | then (getAccBalance(amIdStr) - pmtAmt) | |
279 | + | else if (isOneAsset) | |
280 | + | then getAccBalance(amIdStr) | |
281 | + | else (getAccBalance(amIdStr) - inAmAmt) | |
282 | + | let prBalance = if (isEval) | |
283 | + | then getAccBalance(prIdStr) | |
284 | + | else if (if (isOneAsset) | |
285 | + | then (pmtId == prIdStr) | |
286 | + | else false) | |
287 | + | then (getAccBalance(prIdStr) - pmtAmt) | |
288 | + | else if (isOneAsset) | |
289 | + | then getAccBalance(prIdStr) | |
290 | + | else (getAccBalance(prIdStr) - inPrAmt) | |
291 | + | let inAmAssetAmtX18 = t1(inAmAmt, amtDcm) | |
292 | + | let inPrAssetAmtX18 = t1(inPrAmt, priceDcm) | |
293 | + | let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18) | |
294 | + | let amBalanceX18 = t1(amBalance, amtDcm) | |
295 | + | let prBalanceX18 = t1(prBalance, priceDcm) | |
296 | + | let r = if ((lpEm == 0)) | |
297 | + | then { | |
298 | + | let curPriceX18 = zeroBigInt | |
299 | + | let slippageX18 = zeroBigInt | |
300 | + | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
301 | + | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
302 | + | } | |
303 | + | else { | |
304 | + | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
305 | + | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
306 | + | let slippageX18 = t1(slippage, scale8) | |
307 | + | if (if ((curPriceX18 != zeroBigInt)) | |
308 | + | then (slippageRealX18 > slippageX18) | |
309 | + | else false) | |
310 | + | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
311 | + | else { | |
312 | + | let lpEmissionX18 = t1(lpEm, scale8) | |
313 | + | let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
314 | + | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
315 | + | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
316 | + | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
317 | + | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
318 | + | let expAmtAssetAmtX18 = expectedAmts._1 | |
319 | + | let expPriceAssetAmtX18 = expectedAmts._2 | |
320 | + | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18) | |
321 | + | $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18) | |
322 | + | } | |
323 | + | } | |
324 | + | let calcLpAmt = r._1 | |
325 | + | let calcAmAssetPmt = r._2 | |
326 | + | let calcPrAssetPmt = r._3 | |
327 | + | let curPrice = f1(r._4, scale8) | |
328 | + | let slippageCalc = f1(r._5, scale8) | |
329 | + | if ((0 >= calcLpAmt)) | |
330 | + | then throw("LP <= 0") | |
331 | + | else { | |
332 | + | let emitLpAmt = if (!(emitLp)) | |
333 | + | then 0 | |
334 | + | else calcLpAmt | |
335 | + | let amDiff = (inAmAmt - calcAmAssetPmt) | |
336 | + | let prDiff = (inPrAmt - calcPrAssetPmt) | |
337 | + | let $t01553115876 = if (if (isOneAsset) | |
338 | + | then (pmtId == amIdStr) | |
339 | + | else false) | |
340 | + | then $Tuple2(pmtAmt, 0) | |
341 | + | else if (if (isOneAsset) | |
342 | + | then (pmtId == prIdStr) | |
343 | + | else false) | |
344 | + | then $Tuple2(0, pmtAmt) | |
345 | + | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
346 | + | let writeAmAmt = $t01553115876._1 | |
347 | + | let writePrAmt = $t01553115876._2 | |
348 | + | 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))] | |
349 | + | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
350 | + | } | |
351 | + | } | |
352 | + | ||
353 | + | ||
354 | + | func moa (order) = { | |
355 | + | let cfg = gpc() | |
356 | + | let amtAsId = cfg[idxAmAsId] | |
357 | + | let prAsId = cfg[idxPrAsId] | |
358 | + | let sts = parseIntValue(cfg[idxPoolSt]) | |
359 | + | let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
360 | + | let prAsDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
361 | + | let accAmtAsBalance = getAccBalance(amtAsId) | |
362 | + | let accPrAsBalance = getAccBalance(prAsId) | |
363 | + | let curPriceX18 = if ((order.orderType == Buy)) | |
364 | + | then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance) | |
365 | + | else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance) | |
366 | + | let curPrice = f1(curPriceX18, scale8) | |
367 | + | if (if (if (igs()) | |
368 | + | then true | |
369 | + | else (sts == PoolMatcherDis)) | |
370 | + | then true | |
371 | + | else (sts == PoolShutdown)) | |
372 | + | then throw("Admin blocked") | |
373 | + | else { | |
374 | + | let orAmtAsset = order.assetPair.amountAsset | |
375 | + | let orAmtAsStr = if ((orAmtAsset == unit)) | |
376 | + | then "WAVES" | |
377 | + | else toBase58String(value(orAmtAsset)) | |
378 | + | let orPrAsset = order.assetPair.priceAsset | |
379 | + | let orPrAsStr = if ((orPrAsset == unit)) | |
380 | + | then "WAVES" | |
381 | + | else toBase58String(value(orPrAsset)) | |
382 | + | if (if ((orAmtAsStr != amtAsId)) | |
383 | + | then true | |
384 | + | else (orPrAsStr != prAsId)) | |
385 | + | then throw("Wr assets") | |
386 | + | else { | |
387 | + | let orderPrice = order.price | |
388 | + | let priceDcm = fraction(scale8, prAsDcm, amtAsDcm) | |
389 | + | let castOrderPrice = ts(orderPrice, scale8, priceDcm) | |
390 | + | let isOrderPriceValid = if ((order.orderType == Buy)) | |
391 | + | then (curPrice >= castOrderPrice) | |
392 | + | else (castOrderPrice >= curPrice) | |
393 | + | true | |
394 | + | } | |
395 | + | } | |
396 | + | } | |
397 | + | ||
398 | + | ||
399 | + | func cg (i) = if ((size(i.payments) != 1)) | |
400 | + | then throw("1 pmnt exp") | |
401 | + | else { | |
402 | + | let pmt = value(i.payments[0]) | |
403 | + | let pmtAssetId = value(pmt.assetId) | |
404 | + | let pmtAmt = pmt.amount | |
405 | + | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
406 | + | let outAmAmt = r._1 | |
407 | + | let outPrAmt = r._2 | |
408 | + | let sts = parseIntValue(r._9) | |
409 | + | let state = r._10 | |
410 | + | if (if (igs()) | |
411 | + | then true | |
412 | + | else (sts == PoolShutdown)) | |
413 | + | then throw(("Admin blocked: " + toString(sts))) | |
414 | + | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
415 | + | } | |
416 | + | ||
417 | + | ||
418 | + | func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,pmtAmt,pmtId) = { | |
419 | + | let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, false, emitLp, isOneAsset, pmtAmt, pmtId) | |
420 | + | let sts = parseIntValue(r._8) | |
421 | + | if (if (if (igs()) | |
422 | + | then true | |
423 | + | else (sts == PoolPutDis)) | |
424 | + | then true | |
425 | + | else (sts == PoolShutdown)) | |
426 | + | then throw(("Blocked:" + toString(sts))) | |
427 | + | else r | |
428 | + | } | |
429 | + | ||
430 | + | ||
431 | + | func m () = match getString(mpk()) { | |
85 | 432 | case s: String => | |
86 | 433 | fromBase58String(s) | |
87 | 434 | case _: Unit => | |
88 | 435 | unit | |
89 | 436 | case _ => | |
90 | 437 | throw("Match error") | |
91 | 438 | } | |
92 | 439 | ||
93 | 440 | ||
94 | - | func | |
441 | + | func pm () = match getString(pmpk()) { | |
95 | 442 | case s: String => | |
96 | 443 | fromBase58String(s) | |
97 | 444 | case _: Unit => | |
98 | 445 | unit | |
99 | 446 | case _ => | |
100 | 447 | throw("Match error") | |
101 | 448 | } | |
102 | 449 | ||
103 | 450 | ||
104 | - | func mustManager (i) = { | |
105 | - | let pd = throw("Permission denied") | |
106 | - | match managerPublicKeyOrUnit() { | |
107 | - | case pk: ByteVector => | |
108 | - | if ((i.callerPublicKey == pk)) | |
109 | - | then true | |
110 | - | else pd | |
111 | - | case _: Unit => | |
112 | - | if ((i.caller == this)) | |
113 | - | then true | |
114 | - | else pd | |
115 | - | case _ => | |
116 | - | throw("Match error") | |
117 | - | } | |
118 | - | } | |
451 | + | let pd = throw("Permission denied") | |
119 | 452 | ||
120 | - | ||
121 | - | func getAdmins () = match getString(keyAdminPubKeys()) { | |
122 | - | case s: String => | |
123 | - | if ((size(s) == 0)) | |
124 | - | then nil | |
125 | - | else split(s, SEP) | |
453 | + | func mm (i) = match m() { | |
454 | + | case pk: ByteVector => | |
455 | + | if ((i.callerPublicKey == pk)) | |
456 | + | then true | |
457 | + | else pd | |
458 | + | case _: Unit => | |
459 | + | if ((i.caller == this)) | |
460 | + | then true | |
461 | + | else pd | |
126 | 462 | case _ => | |
127 | - | | |
463 | + | throw("Match error") | |
128 | 464 | } | |
129 | 465 | ||
130 | 466 | ||
131 | - | func mustAdmin (i) = if (containsElement(getAdmins(), toBase58String(i.callerPublicKey))) | |
132 | - | then true | |
133 | - | else mustManager(i) | |
134 | - | ||
135 | - | ||
136 | - | func mustPool (i) = if ((i.caller == poolContract)) | |
137 | - | then true | |
138 | - | else throw("caller must be the pool") | |
139 | - | ||
140 | - | ||
141 | 467 | @Callable(i) | |
142 | - | func constructor ( | |
143 | - | let | |
144 | - | if (( | |
145 | - | then [StringEntry( | |
468 | + | func constructor (fc) = { | |
469 | + | let c = mm(i) | |
470 | + | if ((c == c)) | |
471 | + | then [StringEntry(fc(), fc)] | |
146 | 472 | else throw("Strict value is not equal to itself.") | |
147 | 473 | } | |
148 | 474 | ||
149 | 475 | ||
150 | 476 | ||
151 | 477 | @Callable(i) | |
152 | 478 | func setManager (pendingManagerPublicKey) = { | |
153 | - | let | |
154 | - | if (( | |
479 | + | let c = mm(i) | |
480 | + | if ((c == c)) | |
155 | 481 | then { | |
156 | - | let | |
157 | - | if (( | |
158 | - | then [StringEntry( | |
482 | + | let cm = fromBase58String(pendingManagerPublicKey) | |
483 | + | if ((cm == cm)) | |
484 | + | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
159 | 485 | else throw("Strict value is not equal to itself.") | |
160 | 486 | } | |
161 | 487 | else throw("Strict value is not equal to itself.") | |
162 | 488 | } | |
163 | 489 | ||
164 | 490 | ||
165 | 491 | ||
166 | 492 | @Callable(i) | |
167 | 493 | func confirmManager () = { | |
168 | - | let | |
169 | - | let | |
494 | + | let p = pm() | |
495 | + | let hpm = if (isDefined(p)) | |
170 | 496 | then true | |
171 | 497 | else throw("No pending manager") | |
172 | - | if (( | |
498 | + | if ((hpm == hpm)) | |
173 | 499 | then { | |
174 | - | let | |
500 | + | let cpm = if ((i.callerPublicKey == value(p))) | |
175 | 501 | then true | |
176 | 502 | else throw("You are not pending manager") | |
177 | - | if (( | |
178 | - | then [StringEntry( | |
503 | + | if ((cpm == cpm)) | |
504 | + | then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())] | |
179 | 505 | else throw("Strict value is not equal to itself.") | |
180 | 506 | } | |
181 | 507 | else throw("Strict value is not equal to itself.") | |
182 | 508 | } | |
183 | 509 | ||
184 | 510 | ||
185 | 511 | ||
186 | 512 | @Callable(i) | |
187 | - | func setAdmins (adminPubKeys) = { | |
188 | - | let checkCaller = mustManager(i) | |
189 | - | if ((checkCaller == checkCaller)) | |
190 | - | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
513 | + | func put (slip,autoStake) = { | |
514 | + | let factCfg = gfc() | |
515 | + | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
516 | + | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
517 | + | if ((0 > slip)) | |
518 | + | then throw("Wrong slippage") | |
519 | + | else if ((size(i.payments) != 2)) | |
520 | + | then throw("2 pmnts expd") | |
521 | + | else { | |
522 | + | 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, 0, "") | |
523 | + | let emitLpAmt = e._2 | |
524 | + | let lpAssetId = e._7 | |
525 | + | let state = e._9 | |
526 | + | let amDiff = e._10 | |
527 | + | let prDiff = e._11 | |
528 | + | let amId = e._12 | |
529 | + | let prId = e._13 | |
530 | + | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
531 | + | if ((r == r)) | |
532 | + | then { | |
533 | + | let el = match r { | |
534 | + | case legacy: Address => | |
535 | + | invoke(legacy, "emit", [emitLpAmt], nil) | |
536 | + | case _ => | |
537 | + | unit | |
538 | + | } | |
539 | + | if ((el == el)) | |
540 | + | then { | |
541 | + | let sa = if ((amDiff > 0)) | |
542 | + | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
543 | + | else nil | |
544 | + | if ((sa == sa)) | |
545 | + | then { | |
546 | + | let sp = if ((prDiff > 0)) | |
547 | + | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
548 | + | else nil | |
549 | + | if ((sp == sp)) | |
550 | + | then { | |
551 | + | let lpTrnsfr = if (autoStake) | |
552 | + | then { | |
553 | + | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
554 | + | if ((ss == ss)) | |
555 | + | then nil | |
556 | + | else throw("Strict value is not equal to itself.") | |
557 | + | } | |
558 | + | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
559 | + | (state ++ lpTrnsfr) | |
560 | + | } | |
561 | + | else throw("Strict value is not equal to itself.") | |
562 | + | } | |
563 | + | else throw("Strict value is not equal to itself.") | |
564 | + | } | |
565 | + | else throw("Strict value is not equal to itself.") | |
566 | + | } | |
567 | + | else throw("Strict value is not equal to itself.") | |
568 | + | } | |
569 | + | } | |
570 | + | ||
571 | + | ||
572 | + | ||
573 | + | @Callable(i) | |
574 | + | func putOneTkn (amAssetPart,prAssetPart,outLp,slippage,autoStake) = { | |
575 | + | let cfg = gfc() | |
576 | + | let stakingCntr = valueOrErrorMessage(addressFromString(cfg[idxFactStakCntr]), "Wr st addr") | |
577 | + | let slipCntr = valueOrErrorMessage(addressFromString(cfg[idxFactSlippCntr]), "Wr sl addr") | |
578 | + | let gwxCntr = valueOrErrorMessage(addressFromString(cfg[idxFactGwxRewCntr]), "Wr gwx addr") | |
579 | + | let poolCfg = gpc() | |
580 | + | let amId = poolCfg[idxAmAsId] | |
581 | + | let prId = poolCfg[idxPrAsId] | |
582 | + | let amDcm = parseIntValue(poolCfg[idxAmtAsDcm]) | |
583 | + | let prDcm = parseIntValue(poolCfg[idxPriceAsDcm]) | |
584 | + | let addon = valueOrElse(getString(this, ada()), "") | |
585 | + | let userAddress = if ((addon == toString(i.caller))) | |
586 | + | then i.originCaller | |
587 | + | else i.caller | |
588 | + | let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid") | |
589 | + | let check = reentrantInvoke(addonContract, "ensureCanPutOneTkn", [toString(userAddress)], nil) | |
590 | + | if ((check == check)) | |
591 | + | then if (if (if (if ((0 >= slippage)) | |
592 | + | then true | |
593 | + | else (0 >= amAssetPart)) | |
594 | + | then true | |
595 | + | else (0 >= prAssetPart)) | |
596 | + | then true | |
597 | + | else (0 >= outLp)) | |
598 | + | then throw("Wrong params") | |
599 | + | else if ((size(i.payments) != 1)) | |
600 | + | then throw("1 pmnt expd") | |
601 | + | else { | |
602 | + | let pmt = value(i.payments[0]) | |
603 | + | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
604 | + | let pmtAmt = pmt.amount | |
605 | + | if (if (if ((amAssetPart > pmtAmt)) | |
606 | + | then true | |
607 | + | else (prAssetPart > pmtAmt)) | |
608 | + | then true | |
609 | + | else (10000000 > pmtAmt)) | |
610 | + | then throw("Wrong pmt amt") | |
611 | + | else { | |
612 | + | let amBalance = getAccBalance(amId) | |
613 | + | let prBalance = getAccBalance(prId) | |
614 | + | let $t02483225212 = if ((pmtAssetId == amId)) | |
615 | + | then $Tuple6((amBalance - pmtAmt), prBalance, (pmtAmt - amAssetPart), prAssetPart, 0, 0) | |
616 | + | else if ((pmtAssetId == prId)) | |
617 | + | then $Tuple6(amBalance, (prBalance - pmtAmt), 0, 0, (pmtAmt - prAssetPart), amAssetPart) | |
618 | + | else throw("wrong pmtAssetId") | |
619 | + | let amBalanceNow = $t02483225212._1 | |
620 | + | let prBalanceNow = $t02483225212._2 | |
621 | + | let virtSwapInAm = $t02483225212._3 | |
622 | + | let virtSwapOutPr = $t02483225212._4 | |
623 | + | let virtSwapInPr = $t02483225212._5 | |
624 | + | let virtSwapOutAm = $t02483225212._6 | |
625 | + | let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil) | |
626 | + | let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil) | |
627 | + | let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D) | |
628 | + | if ((D0vsD1 == D0vsD1)) | |
629 | + | then { | |
630 | + | let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), slippage, true, true, pmtAmt, pmtAssetId) | |
631 | + | let estimLP = estPut._2 | |
632 | + | let lpAssetId = estPut._7 | |
633 | + | let state = estPut._9 | |
634 | + | let amDiff = estPut._10 | |
635 | + | let prDiff = estPut._11 | |
636 | + | let lpCalcRes = vad(toBigInt(estimLP), toBigInt(outLp), toBigInt(slippage)) | |
637 | + | let emitLpAmt = toInt(lpCalcRes._2) | |
638 | + | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
639 | + | if ((e == e)) | |
640 | + | then { | |
641 | + | let el = match e { | |
642 | + | case legacy: Address => | |
643 | + | invoke(legacy, "emit", [emitLpAmt], nil) | |
644 | + | case _ => | |
645 | + | unit | |
646 | + | } | |
647 | + | if ((el == el)) | |
648 | + | then { | |
649 | + | let sa = if ((amDiff > 0)) | |
650 | + | then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)]) | |
651 | + | else nil | |
652 | + | if ((sa == sa)) | |
653 | + | then { | |
654 | + | let sp = if ((prDiff > 0)) | |
655 | + | then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)]) | |
656 | + | else nil | |
657 | + | if ((sp == sp)) | |
658 | + | then { | |
659 | + | let lpTrnsfr = if (autoStake) | |
660 | + | then { | |
661 | + | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
662 | + | if ((ss == ss)) | |
663 | + | then nil | |
664 | + | else throw("Strict value is not equal to itself.") | |
665 | + | } | |
666 | + | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
667 | + | (state ++ lpTrnsfr) | |
668 | + | } | |
669 | + | else throw("Strict value is not equal to itself.") | |
670 | + | } | |
671 | + | else throw("Strict value is not equal to itself.") | |
672 | + | } | |
673 | + | else throw("Strict value is not equal to itself.") | |
674 | + | } | |
675 | + | else throw("Strict value is not equal to itself.") | |
676 | + | } | |
677 | + | else throw("Strict value is not equal to itself.") | |
678 | + | } | |
679 | + | } | |
191 | 680 | else throw("Strict value is not equal to itself.") | |
192 | 681 | } | |
193 | 682 | ||
194 | 683 | ||
195 | 684 | ||
196 | 685 | @Callable(i) | |
197 | - | func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = { | |
198 | - | let checkPayments = if ((size(i.payments) != 0)) | |
199 | - | then throw("No pmnts expd") | |
200 | - | else true | |
201 | - | if ((checkPayments == checkPayments)) | |
202 | - | then { | |
203 | - | let cfg = getPoolConfig() | |
204 | - | let factoryCfg = getFactoryConfig() | |
205 | - | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
206 | - | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
207 | - | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
208 | - | if ((unstakeInv == unstakeInv)) | |
209 | - | then { | |
210 | - | let getOneTkn = invoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)]) | |
211 | - | if ((getOneTkn == getOneTkn)) | |
212 | - | then nil | |
213 | - | else throw("Strict value is not equal to itself.") | |
214 | - | } | |
215 | - | else throw("Strict value is not equal to itself.") | |
686 | + | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
687 | + | then throw("Wrong slpg") | |
688 | + | else if ((size(i.payments) != 2)) | |
689 | + | then throw("2 pmnts expd") | |
690 | + | else { | |
691 | + | 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, 0, "") | |
692 | + | estPut._9 | |
216 | 693 | } | |
694 | + | ||
695 | + | ||
696 | + | ||
697 | + | @Callable(i) | |
698 | + | func get () = { | |
699 | + | let r = cg(i) | |
700 | + | let outAmtAmt = r._1 | |
701 | + | let outPrAmt = r._2 | |
702 | + | let pmtAmt = r._3 | |
703 | + | let pmtAssetId = r._4 | |
704 | + | let state = r._5 | |
705 | + | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
706 | + | if ((b == b)) | |
707 | + | then state | |
217 | 708 | else throw("Strict value is not equal to itself.") | |
218 | 709 | } | |
219 | 710 | ||
220 | 711 | ||
221 | 712 | ||
222 | 713 | @Callable(i) | |
223 | - | func setAmp (amp) = { | |
224 | - | let checkCaller = mustAdmin(i) | |
225 | - | if ((checkCaller == checkCaller)) | |
226 | - | then { | |
227 | - | let res1 = invoke(poolContract, "setS", [keyAmp(), amp], nil) | |
228 | - | let res2 = invoke(poolContract, "setS", [keyAmpHistory(height), amp], nil) | |
229 | - | $Tuple2(nil, $Tuple2(res1, res2)) | |
230 | - | } | |
231 | - | else throw("Strict value is not equal to itself.") | |
714 | + | func getOneTkn (exchResult,notUsed,outAmount,outAssetId,slippage) = if ((size(i.payments) != 1)) | |
715 | + | then throw("1 pmnt expd") | |
716 | + | else { | |
717 | + | let cfg = gpc() | |
718 | + | let lpId = cfg[idxLPAsId] | |
719 | + | let amId = cfg[idxAmAsId] | |
720 | + | let prId = cfg[idxPrAsId] | |
721 | + | let amDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
722 | + | let prDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
723 | + | let sts = cfg[idxPoolSt] | |
724 | + | let factCfg = gfc() | |
725 | + | let gwxCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactGwxRewCntr]), "Wr sl addr") | |
726 | + | let pmt = value(i.payments[0]) | |
727 | + | let addon = valueOrElse(getString(this, ada()), "") | |
728 | + | let userAddress = if ((addon == toString(i.caller))) | |
729 | + | then i.originCaller | |
730 | + | else i.caller | |
731 | + | let txId58 = toBase58String(i.transactionId) | |
732 | + | let pmtAssetId = value(pmt.assetId) | |
733 | + | let pmtAmt = pmt.amount | |
734 | + | let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid") | |
735 | + | let check = reentrantInvoke(addonContract, "ensureCanGetOneTkn", [toString(userAddress)], nil) | |
736 | + | if ((check == check)) | |
737 | + | then if ((1000000000 > pmtAmt)) | |
738 | + | then throw("Min pmt 10 LP") | |
739 | + | else if (if (if ((0 > slippage)) | |
740 | + | then true | |
741 | + | else (0 > exchResult)) | |
742 | + | then true | |
743 | + | else (0 > outAmount)) | |
744 | + | then throw("Wrong params") | |
745 | + | else if ((lpId != toBase58String(pmtAssetId))) | |
746 | + | then throw("Wrong LP") | |
747 | + | else { | |
748 | + | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
749 | + | let estimAmAmt = r._1 | |
750 | + | let estimPrAmt = r._2 | |
751 | + | let amBalance = getAccBalance(amId) | |
752 | + | let prBalance = getAccBalance(prId) | |
753 | + | let $t03024330700 = if ((outAssetId == amId)) | |
754 | + | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult)) | |
755 | + | else if ((outAssetId == prId)) | |
756 | + | then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult)) | |
757 | + | else throw("wrong outAssetId") | |
758 | + | let amBalanceNow = $t03024330700._1 | |
759 | + | let prBalanceNow = $t03024330700._2 | |
760 | + | let virtSwapInAm = $t03024330700._3 | |
761 | + | let virtSwapOutPr = $t03024330700._4 | |
762 | + | let virtSwapInPr = $t03024330700._5 | |
763 | + | let virtSwapOutAm = $t03024330700._6 | |
764 | + | let totalGet = $t03024330700._7 | |
765 | + | if (if ((0 > virtSwapInAm)) | |
766 | + | then true | |
767 | + | else (0 > virtSwapInPr)) | |
768 | + | then throw("Wrong calc") | |
769 | + | else { | |
770 | + | let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil) | |
771 | + | let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil) | |
772 | + | let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D) | |
773 | + | if ((D0vsD1 == D0vsD1)) | |
774 | + | then { | |
775 | + | let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage)) | |
776 | + | if ((finalRes == finalRes)) | |
777 | + | then { | |
778 | + | let $t03140531509 = if ((outAssetId == amId)) | |
779 | + | then $Tuple2(toInt(finalRes._2), 0) | |
780 | + | else $Tuple2(0, toInt(finalRes._2)) | |
781 | + | let outAm = $t03140531509._1 | |
782 | + | let outPr = $t03140531509._2 | |
783 | + | let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm)) | |
784 | + | let curPr = f1(curPrX18, scale8) | |
785 | + | let state = [ScriptTransfer(userAddress, (outAm + outPr), if ((outAssetId == "WAVES")) | |
786 | + | then unit | |
787 | + | else fromBase58String(outAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] | |
788 | + | if ((state == state)) | |
789 | + | then { | |
790 | + | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
791 | + | if ((burn == burn)) | |
792 | + | then state | |
793 | + | else throw("Strict value is not equal to itself.") | |
794 | + | } | |
795 | + | else throw("Strict value is not equal to itself.") | |
796 | + | } | |
797 | + | else throw("Strict value is not equal to itself.") | |
798 | + | } | |
799 | + | else throw("Strict value is not equal to itself.") | |
800 | + | } | |
801 | + | } | |
802 | + | else throw("Strict value is not equal to itself.") | |
803 | + | } | |
804 | + | ||
805 | + | ||
806 | + | ||
807 | + | @Callable(i) | |
808 | + | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
809 | + | let r = cg(i) | |
810 | + | let outAmAmt = r._1 | |
811 | + | let outPrAmt = r._2 | |
812 | + | let pmtAmt = r._3 | |
813 | + | let pmtAssetId = r._4 | |
814 | + | let state = r._5 | |
815 | + | if ((noLessThenAmtAsset > outAmAmt)) | |
816 | + | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
817 | + | else if ((noLessThenPriceAsset > outPrAmt)) | |
818 | + | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
819 | + | else { | |
820 | + | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
821 | + | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
822 | + | then state | |
823 | + | else throw("Strict value is not equal to itself.") | |
824 | + | } | |
232 | 825 | } | |
233 | 826 | ||
234 | 827 | ||
235 | 828 | ||
236 | 829 | @Callable(i) | |
237 | - | func ensureCanGetOneTkn (caller) = { | |
238 | - | let checkCaller = mustPool(i) | |
239 | - | if ((checkCaller == checkCaller)) | |
830 | + | func unstakeAndGet (amount) = { | |
831 | + | let checkPayments = if ((size(i.payments) != 0)) | |
832 | + | then throw("No pmnts expd") | |
833 | + | else true | |
834 | + | if ((checkPayments == checkPayments)) | |
240 | 835 | then { | |
241 | - | let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) { | |
242 | - | case int: Int => | |
243 | - | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
244 | - | let isReadyforPutOneTkn = (height >= permittedHeight) | |
245 | - | let needBlocks = (permittedHeight - height) | |
246 | - | if (isReadyforPutOneTkn) | |
836 | + | let cfg = gpc() | |
837 | + | let factoryCfg = gfc() | |
838 | + | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
839 | + | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
840 | + | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
841 | + | if ((unstakeInv == unstakeInv)) | |
842 | + | then { | |
843 | + | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
844 | + | let sts = parseIntValue(r._9) | |
845 | + | let state = r._10 | |
846 | + | let v = if (if (igs()) | |
247 | 847 | then true | |
248 | - | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
249 | - | case _ => | |
250 | - | true | |
251 | - | } | |
252 | - | if ((ensureCanPut == ensureCanPut)) | |
253 | - | then { | |
254 | - | let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) { | |
255 | - | case int: Int => | |
256 | - | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
257 | - | let isReadyforGetOneTkn = (height >= permittedHeight) | |
258 | - | let needBlocks = (permittedHeight - height) | |
259 | - | if (isReadyforGetOneTkn) | |
260 | - | then true | |
261 | - | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
262 | - | case _ => | |
263 | - | true | |
264 | - | } | |
265 | - | if ((ensureCanGet == ensureCanGet)) | |
848 | + | else (sts == PoolShutdown)) | |
849 | + | then throw(("Blocked: " + toString(sts))) | |
850 | + | else true | |
851 | + | if ((v == v)) | |
266 | 852 | then { | |
267 | - | let | |
268 | - | if (( | |
269 | - | then | |
853 | + | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
854 | + | if ((burnA == burnA)) | |
855 | + | then state | |
270 | 856 | else throw("Strict value is not equal to itself.") | |
271 | 857 | } | |
272 | 858 | else throw("Strict value is not equal to itself.") | |
273 | 859 | } | |
274 | 860 | else throw("Strict value is not equal to itself.") | |
275 | 861 | } | |
276 | 862 | else throw("Strict value is not equal to itself.") | |
277 | 863 | } | |
278 | 864 | ||
279 | 865 | ||
280 | 866 | ||
281 | 867 | @Callable(i) | |
282 | - | func ensureCanPutOneTkn (caller) = { | |
283 | - | let checkCaller = mustPool(i) | |
284 | - | if ((checkCaller == checkCaller)) | |
285 | - | then { | |
286 | - | let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) { | |
287 | - | case int: Int => | |
288 | - | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
289 | - | let isReadyforPutOneTkn = (height >= permittedHeight) | |
290 | - | let needBlocks = (permittedHeight - height) | |
291 | - | if (isReadyforPutOneTkn) | |
292 | - | then true | |
293 | - | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
294 | - | case _ => | |
295 | - | true | |
296 | - | } | |
297 | - | if ((ensureCanPut == ensureCanPut)) | |
298 | - | then { | |
299 | - | let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) { | |
300 | - | case int: Int => | |
301 | - | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
302 | - | let isReadyforGetOneTkn = (height >= permittedHeight) | |
303 | - | let needBlocks = (permittedHeight - height) | |
304 | - | if (isReadyforGetOneTkn) | |
305 | - | then true | |
306 | - | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
307 | - | case _ => | |
308 | - | true | |
309 | - | } | |
310 | - | if ((ensureCanGet == ensureCanGet)) | |
311 | - | then { | |
312 | - | let setI = invoke(poolContract, "setI", [lastPutOneTknCall(caller), height], nil) | |
313 | - | if ((setI == setI)) | |
314 | - | then nil | |
315 | - | else throw("Strict value is not equal to itself.") | |
316 | - | } | |
317 | - | else throw("Strict value is not equal to itself.") | |
318 | - | } | |
319 | - | else throw("Strict value is not equal to itself.") | |
320 | - | } | |
321 | - | else throw("Strict value is not equal to itself.") | |
868 | + | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
869 | + | then throw("denied") | |
870 | + | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success") | |
871 | + | ||
872 | + | ||
873 | + | ||
874 | + | @Callable(i) | |
875 | + | func setS (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
876 | + | then pd | |
877 | + | else [StringEntry(k, v)] | |
878 | + | ||
879 | + | ||
880 | + | ||
881 | + | @Callable(i) | |
882 | + | func setI (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
883 | + | then pd | |
884 | + | else [IntegerEntry(k, v)] | |
885 | + | ||
886 | + | ||
887 | + | ||
888 | + | @Callable(i) | |
889 | + | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
890 | + | ||
891 | + | ||
892 | + | ||
893 | + | @Callable(i) | |
894 | + | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
895 | + | ||
896 | + | ||
897 | + | ||
898 | + | @Callable(i) | |
899 | + | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
900 | + | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
901 | + | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
902 | + | } | |
903 | + | ||
904 | + | ||
905 | + | ||
906 | + | @Callable(i) | |
907 | + | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
908 | + | ||
909 | + | ||
910 | + | ||
911 | + | @Callable(i) | |
912 | + | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
913 | + | ||
914 | + | ||
915 | + | ||
916 | + | @Callable(i) | |
917 | + | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
918 | + | ||
919 | + | ||
920 | + | ||
921 | + | @Callable(i) | |
922 | + | func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, false, 0, "")) | |
923 | + | ||
924 | + | ||
925 | + | ||
926 | + | @Callable(i) | |
927 | + | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
928 | + | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
929 | + | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
322 | 930 | } | |
323 | 931 | ||
324 | 932 | ||
325 | 933 | @Verifier(tx) | |
326 | - | func verify () = { | |
327 | - | let targetPublicKey = match managerPublicKeyOrUnit() { | |
328 | - | case pk: ByteVector => | |
329 | - | pk | |
330 | - | case _: Unit => | |
331 | - | tx.senderPublicKey | |
332 | - | case _ => | |
333 | - | throw("Match error") | |
334 | - | } | |
335 | - | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
336 | - | } | |
934 | + | func verify () = match tx { | |
935 | + | case order: Order => | |
936 | + | let mtchPub = mp() | |
937 | + | let orV = moa(order) | |
938 | + | let sndrV = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
939 | + | let mtchV = sigVerify(order.bodyBytes, order.proofs[1], mtchPub) | |
940 | + | if (if (if (orV) | |
941 | + | then sndrV | |
942 | + | else false) | |
943 | + | then mtchV | |
944 | + | else false) | |
945 | + | then true | |
946 | + | else toe(orV, sndrV, mtchV) | |
947 | + | case _ => | |
948 | + | let targetPublicKey = match m() { | |
949 | + | case pk: ByteVector => | |
950 | + | pk | |
951 | + | case _: Unit => | |
952 | + | tx.senderPublicKey | |
953 | + | case _ => | |
954 | + | throw("Match error") | |
955 | + | } | |
956 | + | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
957 | + | } | |
337 | 958 |
github/deemru/w8io/169f3d6 113.43 ms ◑