tx · BPJgJQP89m6exNXVof8Axz3X2iFLENLXz7WE76P5W9Mx

3MxuKn3ZoWnX58Q4ooAraNxabpcdaAtpufk:  -0.03400000 Waves

2022.06.09 14:31 [2088771] smart account 3MxuKn3ZoWnX58Q4ooAraNxabpcdaAtpufk > SELF 0.00000000 Waves

{ "type": 13, "id": "BPJgJQP89m6exNXVof8Axz3X2iFLENLXz7WE76P5W9Mx", "fee": 3400000, "feeAssetId": null, "timestamp": 1654774317830, "version": 1, "sender": "3MxuKn3ZoWnX58Q4ooAraNxabpcdaAtpufk", "senderPublicKey": "3GJt6j9wqqWrm9ontm1mnLfeW2wgWZYSqzVb9ueSKL1E", "proofs": [ "cND16tH3tygafvTgGKA6DYXCwMtdCreskCyr2cK8DaA5S2iMmkwQrPQFAsQnop2LPMyEvMGAqXuDtckhJpM89gX" ], "script": "base64:AAIFAAAAAAAAC6sIAhIECgIICBIDCgEIEgASBAoCAQQSBwoFAQEBAQQSAwoBARIAEgcKBQEBAQgBEgQKAgEBEgMKAQESBAoCCAgSBAoCCAgSBAoCCAESABIDCgEIEgUKAwEBARIECgIIARIECgIBARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCCIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiCW9uZUJpZ0ludCIKc2xpcHBhZ2U0RCIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFzSWQiDWlkeElQcmljZUFzSWQiD2lkeEZhY3RTdGFrQ250ciIQaWR4RmFjdFNsaXBwQ250ciIRaWR4RmFjdEd3eFJld0NudHIiBWRlbGF5IgJ0M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l85CAUAAAACY3YAAAADXzEwAAAAAQAAAAJlSQEAAAACZUoAAAAABAAAAAJhcQUAAAACZUkDCQAAAQAAAAIFAAAAAmFxAgAAAAVPcmRlcgQAAAACY1EFAAAAAmFxBAAAAAJlSwkBAAAAAmF6AAAAAAQAAAACYW0JAQAAAAJjUAAAAAEFAAAAAmNRBAAAAAJlTAkAAfQAAAADCAUAAAACY1EAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJjUQAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJjUQAAAA9zZW5kZXJQdWJsaWNLZXkEAAAAAmVNCQAB9AAAAAMIBQAAAAJjUQAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAmNRAAAABnByb29mcwAAAAAAAAAAAQUAAAACZUsDAwMFAAAAAmFtBQAAAAJlTAcFAAAAAmVNBwYJAQAAAAJhbAAAAAMFAAAAAmFtBQAAAAJlTAUAAAACZU0EAAAAAmVOBAAAAAJlTwkBAAAAAmRpAAAAAAMJAAABAAAAAgUAAAACZU8CAAAACkJ5dGVWZWN0b3IEAAAAAmRuBQAAAAJlTwUAAAACZG4DCQAAAQAAAAIFAAAAAmVPAgAAAARVbml0CAUAAAACZUkAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJlSQAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAmVJAAAABnByb29mcwAAAAAAAAAAAAUAAAACZU5fgHbs", "chainId": 84, "height": 2088771, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: H3W8wXrsPAv8gg4f2qRA7uVLJmuhbBBYGBJ1wuBBo1Ty Next: 6Y6TuX7Q2XWnpgFGkGbCr5CZaWwk1SKRCTDGLqb1g1JY Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# 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+
420 let SEP = "__"
521
622 let EMPTY = ""
723
24+let PoolActive = 1
25+
26+let PoolPutDis = 2
27+
28+let PoolMatcherDis = 3
29+
30+let PoolShutdown = 4
31+
832 let idxPoolAddress = 1
33+
34+let idxPoolSt = 2
935
1036 let idxLPAsId = 3
1137
1339
1440 let idxPrAsId = 5
1541
42+let idxAmtAsDcm = 6
43+
44+let idxPriceAsDcm = 7
45+
46+let idxIAmtAsId = 8
47+
48+let idxIPriceAsId = 9
49+
1650 let idxFactStakCntr = 1
51+
52+let idxFactSlippCntr = 7
53+
54+let idxFactGwxRewCntr = 10
1755
1856 let delay = "%s__delay"
1957
20-func keyFactCntr () = "%s__factoryContract"
58+func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
2159
2260
23-func keyManagerPublicKey () = "%s__managerPublicKey"
61+func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
2462
2563
26-func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
64+func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale)
2765
2866
29-func keyPoolAddr () = "%s__poolAddress"
67+func abs (val) = if ((zeroBigInt > val))
68+ then -(val)
69+ else val
3070
3171
32-func keyAmtAsset () = "%s__amountAsset"
72+func fc () = "%s__factoryContract"
3373
3474
35-func keyPriceAsset () = "%s__priceAsset"
75+func mpk () = "%s__managerPublicKey"
3676
3777
38-func keyAdminPubKeys () = "%s__adminPubKeys"
78+func pmpk () = "%s__pendingManagerPublicKey"
3979
4080
41-func keyAmp () = "%s__amp"
81+func pl () = "%s%s__price__last"
4282
4383
44-func keyAmpHistory (height) = ("%s%d__amp__" + toString(height))
84+func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP)
4585
4686
47-func lastGetOrPutOneTknCall (caller) = makeString(["%s%s__lastGetOrPutOneTknCall", caller], SEP)
87+func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId)
4888
4989
50-func keyFactoryConfig () = "%s__factoryConfig"
90+func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId)
5191
5292
53-func keyPoolConfig (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
93+func aa () = "%s__amountAsset"
5494
5595
56-func keyMappingsBaseAsset2internalId (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
96+func pa () = "%s__priceAsset"
5797
5898
59-func getStringOrFail (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
99+func amp () = "%s__amp"
60100
61101
62-func getIntOrFail (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
102+func ada () = "%s__addonAddr"
63103
64104
65-let poolContract = addressFromStringValue(getStringOrFail(this, keyPoolAddr()))
105+func lgopotc (caller) = makeString(["%s%s__lastGetOrPutOneTknCall", caller], SEP)
66106
67-let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr()))
68107
69-func getPoolConfig () = {
70- let amtAs = getStringOrFail(poolContract, keyAmtAsset())
71- let priceAs = getStringOrFail(poolContract, keyPriceAsset())
72- let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs))
73- let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs))
74- split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP)
108+func fcfg () = "%s__factoryConfig"
109+
110+
111+func mtpk () = "%s%s__matcher__publicKey"
112+
113+
114+func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
115+
116+
117+func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
118+
119+
120+func aps () = "%s__shutdown"
121+
122+
123+func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV)))
124+
125+
126+func str (val) = match val {
127+ case valStr: String =>
128+ valStr
129+ case _ =>
130+ throw("fail cast to String")
131+}
132+
133+
134+func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
135+
136+
137+func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
138+
139+
140+let fca = addressFromStringValue(strf(this, fc()))
141+
142+let A = strf(this, amp())
143+
144+func igs () = valueOrElse(getBoolean(fca, aps()), false)
145+
146+
147+func mp () = fromBase58String(strf(fca, mtpk()))
148+
149+
150+func gpc () = {
151+ let amtAs = strf(this, aa())
152+ let priceAs = strf(this, pa())
153+ let iPriceAs = intf(fca, mba(priceAs))
154+ let iAmtAs = intf(fca, mba(amtAs))
155+ split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP)
75156 }
76157
77158
78-func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
159+func gfc () = split(strf(fca, fcfg()), SEP)
79160
80161
81-func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
162+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)
163+
164+
165+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)
166+
167+
168+func getAccBalance (assetId) = if ((assetId == "WAVES"))
169+ then wavesBalance(this).available
170+ else assetBalance(this, fromBase58String(assetId))
171+
172+
173+func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
174+
175+
176+func vad (A1,A2,slippage) = {
177+ let diff = fraction((A1 - A2), scale8BigInt, A2)
178+ let pass = ((slippage - abs(diff)) > zeroBigInt)
179+ if (!(pass))
180+ then throw(("Big slpg: " + toString(diff)))
181+ else $Tuple2(pass, min([A1, A2]))
182+ }
183+
184+
185+func vd (D1,D0,slpg) = {
186+ let diff = fraction(D0, scale8BigInt, D1)
187+ let fail = (slpg > diff)
188+ if (if (fail)
189+ then true
190+ else (D0 > D1))
191+ then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg)))
192+ else fail
193+ }
194+
195+
196+func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
197+ let amtAsAmtX18 = t1(amAmt, amAssetDcm)
198+ let prAsAmtX18 = t1(prAmt, prAssetDcm)
199+ cpbi(prAsAmtX18, amtAsAmtX18)
200+ }
201+
202+
203+func calcPrices (amAmt,prAmt,lpAmt) = {
204+ let cfg = gpc()
205+ let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
206+ let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
207+ let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt)
208+ let amAmtX18 = t1(amAmt, amtAsDcm)
209+ let prAmtX18 = t1(prAmt, prAsDcm)
210+ let lpAmtX18 = t1(lpAmt, scale8)
211+ let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18)
212+ let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18)
213+[priceX18, lpPrInAmAsX18, lpPrInPrAsX18]
214+ }
215+
216+
217+func calculatePrices (amAmt,prAmt,lpAmt) = {
218+ let p = calcPrices(amAmt, prAmt, lpAmt)
219+[f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)]
220+ }
221+
222+
223+func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
224+ let cfg = gpc()
225+ let lpId = cfg[idxLPAsId]
226+ let amId = cfg[idxAmAsId]
227+ let prId = cfg[idxPrAsId]
228+ let amDcm = parseIntValue(cfg[idxAmtAsDcm])
229+ let prDcm = parseIntValue(cfg[idxPriceAsDcm])
230+ let sts = cfg[idxPoolSt]
231+ let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity
232+ if ((lpId != pmtAssetId))
233+ then throw("Wrong pmt asset")
234+ else {
235+ let amBalance = getAccBalance(amId)
236+ let amBalanceX18 = t1(amBalance, amDcm)
237+ let prBalance = getAccBalance(prId)
238+ let prBalanceX18 = t1(prBalance, prDcm)
239+ let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
240+ let curPrice = f1(curPriceX18, scale8)
241+ let pmtLpAmtX18 = t1(pmtLpAmt, scale8)
242+ let lpEmissX18 = t1(lpEmiss, scale8)
243+ let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18)
244+ let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18)
245+ let outAmAmt = f1(outAmAmtX18, amDcm)
246+ let outPrAmt = f1(outPrAmtX18, prDcm)
247+ let state = if ((txId58 == ""))
248+ then nil
249+ else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES"))
250+ then unit
251+ else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES"))
252+ then unit
253+ 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)]
254+ $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state)
255+ }
256+ }
257+
258+
259+func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,pmtAmt,pmtId) = {
260+ let cfg = gpc()
261+ let lpId = fromBase58String(cfg[idxLPAsId])
262+ let amIdStr = cfg[idxAmAsId]
263+ let prIdStr = cfg[idxPrAsId]
264+ let inAmIdStr = cfg[idxIAmtAsId]
265+ let inPrIdStr = cfg[idxIPriceAsId]
266+ let amtDcm = parseIntValue(cfg[idxAmtAsDcm])
267+ let priceDcm = parseIntValue(cfg[idxPriceAsDcm])
268+ let sts = cfg[idxPoolSt]
269+ let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity
270+ let amBalance = if (isEval)
271+ then getAccBalance(amIdStr)
272+ else if (if (isOneAsset)
273+ then (pmtId == amIdStr)
274+ else false)
275+ then (getAccBalance(amIdStr) - pmtAmt)
276+ else if (isOneAsset)
277+ then getAccBalance(amIdStr)
278+ else (getAccBalance(amIdStr) - inAmAmt)
279+ let prBalance = if (isEval)
280+ then getAccBalance(prIdStr)
281+ else if (if (isOneAsset)
282+ then (pmtId == prIdStr)
283+ else false)
284+ then (getAccBalance(prIdStr) - pmtAmt)
285+ else if (isOneAsset)
286+ then getAccBalance(prIdStr)
287+ else (getAccBalance(prIdStr) - inPrAmt)
288+ let inAmAssetAmtX18 = t1(inAmAmt, amtDcm)
289+ let inPrAssetAmtX18 = t1(inPrAmt, priceDcm)
290+ let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18)
291+ let amBalanceX18 = t1(amBalance, amtDcm)
292+ let prBalanceX18 = t1(prBalance, priceDcm)
293+ let r = if ((lpEm == 0))
294+ then {
295+ let curPriceX18 = zeroBigInt
296+ let slippageX18 = zeroBigInt
297+ let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
298+ $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
299+ }
300+ else {
301+ let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
302+ let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18)
303+ let slippageX18 = t1(slippage, scale8)
304+ if (if ((curPriceX18 != zeroBigInt))
305+ then (slippageRealX18 > slippageX18)
306+ else false)
307+ then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18)))
308+ else {
309+ let lpEmissionX18 = t1(lpEm, scale8)
310+ let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
311+ let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
312+ let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
313+ then $Tuple2(amViaPrX18, inPrAssetAmtX18)
314+ else $Tuple2(inAmAssetAmtX18, prViaAmX18)
315+ let expAmtAssetAmtX18 = expectedAmts._1
316+ let expPriceAssetAmtX18 = expectedAmts._2
317+ let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
318+ $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18)
319+ }
320+ }
321+ let calcLpAmt = r._1
322+ let calcAmAssetPmt = r._2
323+ let calcPrAssetPmt = r._3
324+ let curPrice = f1(r._4, scale8)
325+ let slippageCalc = f1(r._5, scale8)
326+ if ((0 >= calcLpAmt))
327+ then throw("LP <= 0")
328+ else {
329+ let emitLpAmt = if (!(emitLp))
330+ then 0
331+ else calcLpAmt
332+ let amDiff = (inAmAmt - calcAmAssetPmt)
333+ let prDiff = (inPrAmt - calcPrAssetPmt)
334+ let $t01543915784 = if (if (isOneAsset)
335+ then (pmtId == amIdStr)
336+ else false)
337+ then $Tuple2(pmtAmt, 0)
338+ else if (if (isOneAsset)
339+ then (pmtId == prIdStr)
340+ else false)
341+ then $Tuple2(0, pmtAmt)
342+ else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
343+ let writeAmAmt = $t01543915784._1
344+ let writePrAmt = $t01543915784._2
345+ 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))]
346+ $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
347+ }
348+ }
349+
350+
351+func moa (order) = {
352+ let cfg = gpc()
353+ let amtAsId = cfg[idxAmAsId]
354+ let prAsId = cfg[idxPrAsId]
355+ let sts = parseIntValue(cfg[idxPoolSt])
356+ let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
357+ let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
358+ let accAmtAsBalance = getAccBalance(amtAsId)
359+ let accPrAsBalance = getAccBalance(prAsId)
360+ let curPriceX18 = if ((order.orderType == Buy))
361+ then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance)
362+ else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance)
363+ let curPrice = f1(curPriceX18, scale8)
364+ if (if (if (igs())
365+ then true
366+ else (sts == PoolMatcherDis))
367+ then true
368+ else (sts == PoolShutdown))
369+ then throw("Admin blocked")
370+ else {
371+ let orAmtAsset = order.assetPair.amountAsset
372+ let orAmtAsStr = if ((orAmtAsset == unit))
373+ then "WAVES"
374+ else toBase58String(value(orAmtAsset))
375+ let orPrAsset = order.assetPair.priceAsset
376+ let orPrAsStr = if ((orPrAsset == unit))
377+ then "WAVES"
378+ else toBase58String(value(orPrAsset))
379+ if (if ((orAmtAsStr != amtAsId))
380+ then true
381+ else (orPrAsStr != prAsId))
382+ then throw("Wr assets")
383+ else {
384+ let orderPrice = order.price
385+ let priceDcm = fraction(scale8, prAsDcm, amtAsDcm)
386+ let castOrderPrice = ts(orderPrice, scale8, priceDcm)
387+ let isOrderPriceValid = if ((order.orderType == Buy))
388+ then (curPrice >= castOrderPrice)
389+ else (castOrderPrice >= curPrice)
390+ true
391+ }
392+ }
393+ }
394+
395+
396+func cg (i) = if ((size(i.payments) != 1))
397+ then throw("1 pmnt exp")
398+ else {
399+ let pmt = value(i.payments[0])
400+ let pmtAssetId = value(pmt.assetId)
401+ let pmtAmt = pmt.amount
402+ let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
403+ let outAmAmt = r._1
404+ let outPrAmt = r._2
405+ let sts = parseIntValue(r._9)
406+ let state = r._10
407+ if (if (igs())
408+ then true
409+ else (sts == PoolShutdown))
410+ then throw(("Admin blocked: " + toString(sts)))
411+ else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
412+ }
413+
414+
415+func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,pmtAmt,pmtId) = {
416+ let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, false, emitLp, isOneAsset, pmtAmt, pmtId)
417+ let sts = parseIntValue(r._8)
418+ if (if (if (igs())
419+ then true
420+ else (sts == PoolPutDis))
421+ then true
422+ else (sts == PoolShutdown))
423+ then throw(("Blocked:" + toString(sts)))
424+ else r
425+ }
426+
427+
428+func m () = match getString(mpk()) {
82429 case s: String =>
83430 fromBase58String(s)
84431 case _: Unit =>
88435 }
89436
90437
91-func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
438+func pm () = match getString(pmpk()) {
92439 case s: String =>
93440 fromBase58String(s)
94441 case _: Unit =>
98445 }
99446
100447
101-func mustManager (i) = {
102- let pd = throw("Permission denied")
103- match managerPublicKeyOrUnit() {
104- case pk: ByteVector =>
105- if ((i.callerPublicKey == pk))
106- then true
107- else pd
108- case _: Unit =>
109- if ((i.caller == this))
110- then true
111- else pd
112- case _ =>
113- throw("Match error")
114- }
115- }
448+let pd = throw("Permission denied")
116449
117-
118-func getAdmins () = match getString(keyAdminPubKeys()) {
119- case s: String =>
120- if ((size(s) == 0))
121- then nil
122- else split(s, SEP)
450+func mm (i) = match m() {
451+ case pk: ByteVector =>
452+ if ((i.callerPublicKey == pk))
453+ then true
454+ else pd
455+ case _: Unit =>
456+ if ((i.caller == this))
457+ then true
458+ else pd
123459 case _ =>
124- nil
460+ throw("Match error")
125461 }
126462
127463
128-func mustAdmin (i) = if (containsElement(getAdmins(), toBase58String(i.callerPublicKey)))
129- then true
130- else mustManager(i)
131-
132-
133-func mustPool (i) = if ((i.caller == poolContract))
134- then true
135- else throw("caller must be the pool")
136-
137-
138464 @Callable(i)
139-func constructor (poolAddress) = {
140- let checkCaller = mustManager(i)
141- if ((checkCaller == checkCaller))
142- then [StringEntry(keyPoolAddr(), poolAddress)]
465+func constructor (fc,ada) = {
466+ let c = mm(i)
467+ if ((c == c))
468+ then [StringEntry(fc(), fc), StringEntry(ada(), ada)]
143469 else throw("Strict value is not equal to itself.")
144470 }
145471
147473
148474 @Callable(i)
149475 func setManager (pendingManagerPublicKey) = {
150- let checkCaller = mustManager(i)
151- if ((checkCaller == checkCaller))
476+ let c = mm(i)
477+ if ((c == c))
152478 then {
153- let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
154- if ((checkManagerPublicKey == checkManagerPublicKey))
155- then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
479+ let cm = fromBase58String(pendingManagerPublicKey)
480+ if ((cm == cm))
481+ then [StringEntry(pmpk(), pendingManagerPublicKey)]
156482 else throw("Strict value is not equal to itself.")
157483 }
158484 else throw("Strict value is not equal to itself.")
162488
163489 @Callable(i)
164490 func confirmManager () = {
165- let pm = pendingManagerPublicKeyOrUnit()
166- let hasPM = if (isDefined(pm))
491+ let p = pm()
492+ let hpm = if (isDefined(p))
167493 then true
168494 else throw("No pending manager")
169- if ((hasPM == hasPM))
495+ if ((hpm == hpm))
170496 then {
171- let checkPM = if ((i.callerPublicKey == value(pm)))
497+ let cpm = if ((i.callerPublicKey == value(p)))
172498 then true
173499 else throw("You are not pending manager")
174- if ((checkPM == checkPM))
175- then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
500+ if ((cpm == cpm))
501+ then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())]
176502 else throw("Strict value is not equal to itself.")
177503 }
178504 else throw("Strict value is not equal to itself.")
181507
182508
183509 @Callable(i)
184-func setAdmins (adminPubKeys) = {
185- let checkCaller = mustManager(i)
186- if ((checkCaller == checkCaller))
187- then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))]
510+func put (slip,autoStake) = {
511+ let factCfg = gfc()
512+ let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr")
513+ let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr")
514+ if ((0 > slip))
515+ then throw("Wrong slippage")
516+ else if ((size(i.payments) != 2))
517+ then throw("2 pmnts expd")
518+ else {
519+ 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, "")
520+ let emitLpAmt = e._2
521+ let lpAssetId = e._7
522+ let state = e._9
523+ let amDiff = e._10
524+ let prDiff = e._11
525+ let amId = e._12
526+ let prId = e._13
527+ let r = invoke(fca, "emit", [emitLpAmt], nil)
528+ if ((r == r))
529+ then {
530+ let el = match r {
531+ case legacy: Address =>
532+ invoke(legacy, "emit", [emitLpAmt], nil)
533+ case _ =>
534+ unit
535+ }
536+ if ((el == el))
537+ then {
538+ let sa = if ((amDiff > 0))
539+ then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
540+ else nil
541+ if ((sa == sa))
542+ then {
543+ let sp = if ((prDiff > 0))
544+ then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
545+ else nil
546+ if ((sp == sp))
547+ then {
548+ let lpTrnsfr = if (autoStake)
549+ then {
550+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
551+ if ((ss == ss))
552+ then nil
553+ else throw("Strict value is not equal to itself.")
554+ }
555+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
556+ (state ++ lpTrnsfr)
557+ }
558+ else throw("Strict value is not equal to itself.")
559+ }
560+ else throw("Strict value is not equal to itself.")
561+ }
562+ else throw("Strict value is not equal to itself.")
563+ }
564+ else throw("Strict value is not equal to itself.")
565+ }
566+ }
567+
568+
569+
570+@Callable(i)
571+func putOneTkn (amAssetPart,prAssetPart,outLp,slippage,autoStake) = {
572+ let cfg = gfc()
573+ let stakingCntr = valueOrErrorMessage(addressFromString(cfg[idxFactStakCntr]), "Wr st addr")
574+ let slipCntr = valueOrErrorMessage(addressFromString(cfg[idxFactSlippCntr]), "Wr sl addr")
575+ let gwxCntr = valueOrErrorMessage(addressFromString(cfg[idxFactGwxRewCntr]), "Wr gwx addr")
576+ let poolCfg = gpc()
577+ let amId = poolCfg[idxAmAsId]
578+ let prId = poolCfg[idxPrAsId]
579+ let amDcm = parseIntValue(poolCfg[idxAmtAsDcm])
580+ let prDcm = parseIntValue(poolCfg[idxPriceAsDcm])
581+ let addon = valueOrElse(getString(this, ada()), "")
582+ let userAddress = if ((addon == toString(i.caller)))
583+ then i.originCaller
584+ else i.caller
585+ let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid")
586+ let check = reentrantInvoke(addonContract, "ensureCanGetOrPutOneTkn", [toString(userAddress)], nil)
587+ if ((check == check))
588+ then if (if (if (if ((0 >= slippage))
589+ then true
590+ else (0 >= amAssetPart))
591+ then true
592+ else (0 >= prAssetPart))
593+ then true
594+ else (0 >= outLp))
595+ then throw("Wrong params")
596+ else if ((size(i.payments) != 1))
597+ then throw("1 pmnt expd")
598+ else {
599+ let pmt = value(i.payments[0])
600+ let pmtAssetId = toBase58String(value(pmt.assetId))
601+ let pmtAmt = pmt.amount
602+ if (if (if ((amAssetPart > pmtAmt))
603+ then true
604+ else (prAssetPart > pmtAmt))
605+ then true
606+ else (10000000 > pmtAmt))
607+ then throw("Wrong pmt amt")
608+ else {
609+ let amBalance = getAccBalance(amId)
610+ let prBalance = getAccBalance(prId)
611+ let $t02480425184 = if ((pmtAssetId == amId))
612+ then $Tuple6((amBalance - pmtAmt), prBalance, (pmtAmt - amAssetPart), prAssetPart, 0, 0)
613+ else if ((pmtAssetId == prId))
614+ then $Tuple6(amBalance, (prBalance - pmtAmt), 0, 0, (pmtAmt - prAssetPart), amAssetPart)
615+ else throw("wrong pmtAssetId")
616+ let amBalanceNow = $t02480425184._1
617+ let prBalanceNow = $t02480425184._2
618+ let virtSwapInAm = $t02480425184._3
619+ let virtSwapOutPr = $t02480425184._4
620+ let virtSwapInPr = $t02480425184._5
621+ let virtSwapOutAm = $t02480425184._6
622+ let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
623+ let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil)
624+ let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
625+ if ((D0vsD1 == D0vsD1))
626+ then {
627+ let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), slippage, true, true, pmtAmt, pmtAssetId)
628+ let estimLP = estPut._2
629+ let lpAssetId = estPut._7
630+ let state = estPut._9
631+ let amDiff = estPut._10
632+ let prDiff = estPut._11
633+ let lpCalcRes = vad(toBigInt(estimLP), toBigInt(outLp), toBigInt(slippage))
634+ let emitLpAmt = toInt(lpCalcRes._2)
635+ let e = invoke(fca, "emit", [emitLpAmt], nil)
636+ if ((e == e))
637+ then {
638+ let el = match e {
639+ case legacy: Address =>
640+ invoke(legacy, "emit", [emitLpAmt], nil)
641+ case _ =>
642+ unit
643+ }
644+ if ((el == el))
645+ then {
646+ let sa = if ((amDiff > 0))
647+ then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)])
648+ else nil
649+ if ((sa == sa))
650+ then {
651+ let sp = if ((prDiff > 0))
652+ then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)])
653+ else nil
654+ if ((sp == sp))
655+ then {
656+ let lpTrnsfr = if (autoStake)
657+ then {
658+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
659+ if ((ss == ss))
660+ then nil
661+ else throw("Strict value is not equal to itself.")
662+ }
663+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
664+ (state ++ lpTrnsfr)
665+ }
666+ else throw("Strict value is not equal to itself.")
667+ }
668+ else throw("Strict value is not equal to itself.")
669+ }
670+ else throw("Strict value is not equal to itself.")
671+ }
672+ else throw("Strict value is not equal to itself.")
673+ }
674+ else throw("Strict value is not equal to itself.")
675+ }
676+ }
188677 else throw("Strict value is not equal to itself.")
189678 }
190679
191680
192681
193682 @Callable(i)
194-func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = {
683+func putForFree (maxSlpg) = if ((0 > maxSlpg))
684+ then throw("Wrong slpg")
685+ else if ((size(i.payments) != 2))
686+ then throw("2 pmnts expd")
687+ else {
688+ 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, "")
689+ estPut._9
690+ }
691+
692+
693+
694+@Callable(i)
695+func get () = {
696+ let r = cg(i)
697+ let outAmtAmt = r._1
698+ let outPrAmt = r._2
699+ let pmtAmt = r._3
700+ let pmtAssetId = r._4
701+ let state = r._5
702+ let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
703+ if ((b == b))
704+ then state
705+ else throw("Strict value is not equal to itself.")
706+ }
707+
708+
709+
710+@Callable(i)
711+func getOneTkn (exchResult,notUsed,outAmount,outAssetId,slippage) = if ((size(i.payments) != 1))
712+ then throw("1 pmnt expd")
713+ else {
714+ let cfg = gpc()
715+ let lpId = cfg[idxLPAsId]
716+ let amId = cfg[idxAmAsId]
717+ let prId = cfg[idxPrAsId]
718+ let amDcm = parseIntValue(cfg[idxAmtAsDcm])
719+ let prDcm = parseIntValue(cfg[idxPriceAsDcm])
720+ let sts = cfg[idxPoolSt]
721+ let factCfg = gfc()
722+ let gwxCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactGwxRewCntr]), "Wr sl addr")
723+ let pmt = value(i.payments[0])
724+ let addon = valueOrElse(getString(this, ada()), "")
725+ let userAddress = if ((addon == toString(i.caller)))
726+ then i.originCaller
727+ else i.caller
728+ let txId58 = toBase58String(i.transactionId)
729+ let pmtAssetId = value(pmt.assetId)
730+ let pmtAmt = pmt.amount
731+ let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid")
732+ let check = reentrantInvoke(addonContract, "ensureCanGetOrPutOneTkn", [toString(userAddress)], nil)
733+ if ((check == check))
734+ then if ((1000000000 > pmtAmt))
735+ then throw("Min pmt 10 LP")
736+ else if (if (if ((0 > slippage))
737+ then true
738+ else (0 > exchResult))
739+ then true
740+ else (0 > outAmount))
741+ then throw("Wrong params")
742+ else if ((lpId != toBase58String(pmtAssetId)))
743+ then throw("Wrong LP")
744+ else {
745+ let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
746+ let estimAmAmt = r._1
747+ let estimPrAmt = r._2
748+ let amBalance = getAccBalance(amId)
749+ let prBalance = getAccBalance(prId)
750+ let $t03022030677 = if ((outAssetId == amId))
751+ then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult))
752+ else if ((outAssetId == prId))
753+ then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult))
754+ else throw("wrong outAssetId")
755+ let amBalanceNow = $t03022030677._1
756+ let prBalanceNow = $t03022030677._2
757+ let virtSwapInAm = $t03022030677._3
758+ let virtSwapOutPr = $t03022030677._4
759+ let virtSwapInPr = $t03022030677._5
760+ let virtSwapOutAm = $t03022030677._6
761+ let totalGet = $t03022030677._7
762+ if (if ((0 > virtSwapInAm))
763+ then true
764+ else (0 > virtSwapInPr))
765+ then throw("Wrong calc")
766+ else {
767+ let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
768+ let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil)
769+ let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
770+ if ((D0vsD1 == D0vsD1))
771+ then {
772+ let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage))
773+ if ((finalRes == finalRes))
774+ then {
775+ let $t03138231486 = if ((outAssetId == amId))
776+ then $Tuple2(toInt(finalRes._2), 0)
777+ else $Tuple2(0, toInt(finalRes._2))
778+ let outAm = $t03138231486._1
779+ let outPr = $t03138231486._2
780+ let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm))
781+ let curPr = f1(curPrX18, scale8)
782+ let state = [ScriptTransfer(userAddress, (outAm + outPr), if ((outAssetId == "WAVES"))
783+ then unit
784+ 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)]
785+ if ((state == state))
786+ then {
787+ let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
788+ if ((burn == burn))
789+ then state
790+ else throw("Strict value is not equal to itself.")
791+ }
792+ else throw("Strict value is not equal to itself.")
793+ }
794+ else throw("Strict value is not equal to itself.")
795+ }
796+ else throw("Strict value is not equal to itself.")
797+ }
798+ }
799+ else throw("Strict value is not equal to itself.")
800+ }
801+
802+
803+
804+@Callable(i)
805+func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
806+ let r = cg(i)
807+ let outAmAmt = r._1
808+ let outPrAmt = r._2
809+ let pmtAmt = r._3
810+ let pmtAssetId = r._4
811+ let state = r._5
812+ if ((noLessThenAmtAsset > outAmAmt))
813+ then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
814+ else if ((noLessThenPriceAsset > outPrAmt))
815+ then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
816+ else {
817+ let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
818+ if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
819+ then state
820+ else throw("Strict value is not equal to itself.")
821+ }
822+ }
823+
824+
825+
826+@Callable(i)
827+func unstakeAndGet (amount) = {
195828 let checkPayments = if ((size(i.payments) != 0))
196829 then throw("No pmnts expd")
197830 else true
198831 if ((checkPayments == checkPayments))
199832 then {
200- let cfg = getPoolConfig()
201- let factoryCfg = getFactoryConfig()
833+ let cfg = gpc()
834+ let factoryCfg = gfc()
202835 let lpAssetId = fromBase58String(cfg[idxLPAsId])
203836 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
204837 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
205838 if ((unstakeInv == unstakeInv))
206839 then {
207- let getOneTkn = reentrantInvoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
208- if ((getOneTkn == getOneTkn))
209- then nil
840+ let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
841+ let sts = parseIntValue(r._9)
842+ let state = r._10
843+ let v = if (if (igs())
844+ then true
845+ else (sts == PoolShutdown))
846+ then throw(("Blocked: " + toString(sts)))
847+ else true
848+ if ((v == v))
849+ then {
850+ let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
851+ if ((burnA == burnA))
852+ then state
853+ else throw("Strict value is not equal to itself.")
854+ }
210855 else throw("Strict value is not equal to itself.")
211856 }
212857 else throw("Strict value is not equal to itself.")
217862
218863
219864 @Callable(i)
220-func setAmp (amp) = {
221- let checkCaller = mustAdmin(i)
222- if ((checkCaller == checkCaller))
223- then {
224- let res1 = invoke(poolContract, "setS", [keyAmp(), amp], nil)
225- let res2 = invoke(poolContract, "setS", [keyAmpHistory(height), amp], nil)
226- $Tuple2(nil, $Tuple2(res1, res2))
227- }
228- else throw("Strict value is not equal to itself.")
865+func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca)))
866+ then throw("denied")
867+ else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success")
868+
869+
870+
871+@Callable(i)
872+func setS (k,v) = if ((toString(i.caller) != strf(this, ada())))
873+ then pd
874+ else [StringEntry(k, v)]
875+
876+
877+
878+@Callable(i)
879+func setI (k,v) = if ((toString(i.caller) != strf(this, ada())))
880+ then pd
881+ else [IntegerEntry(k, v)]
882+
883+
884+
885+@Callable(i)
886+func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc())
887+
888+
889+
890+@Callable(i)
891+func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
892+
893+
894+
895+@Callable(i)
896+func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
897+ let pr = calcPrices(amAmt, prAmt, lpAmt)
898+ $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])])
229899 }
230900
231901
232902
233903 @Callable(i)
234-func ensureCanGetOrPutOneTkn (caller) = {
235- let checkCaller = mustPool(i)
236- if ((checkCaller == checkCaller))
237- then {
238- let ensureCanPut = match getInteger(poolContract, lastGetOrPutOneTknCall(caller)) {
239- case int: Int =>
240- let permittedHeight = (int + value(getInteger(poolContract, delay)))
241- let isReadyforPutOneTkn = (height >= permittedHeight)
242- let needBlocks = (permittedHeight - height)
243- if (isReadyforPutOneTkn)
244- then true
245- else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " "))
246- case _ =>
247- true
248- }
249- if ((ensureCanPut == ensureCanPut))
250- then {
251- let setI = invoke(poolContract, "setI", [lastGetOrPutOneTknCall(caller), height], nil)
252- if ((setI == setI))
253- then nil
254- else throw("Strict value is not equal to itself.")
255- }
256- else throw("Strict value is not equal to itself.")
257- }
258- else throw("Strict value is not equal to itself.")
904+func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult))
905+
906+
907+
908+@Callable(i)
909+func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult)))
910+
911+
912+
913+@Callable(i)
914+func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
915+
916+
917+
918+@Callable(i)
919+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, ""))
920+
921+
922+
923+@Callable(i)
924+func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = {
925+ let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr))
926+ $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10))
259927 }
260928
261929
262930 @Verifier(tx)
263-func verify () = {
264- let targetPublicKey = match managerPublicKeyOrUnit() {
265- case pk: ByteVector =>
266- pk
267- case _: Unit =>
268- tx.senderPublicKey
269- case _ =>
270- throw("Match error")
271- }
272- sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
273- }
931+func verify () = match tx {
932+ case order: Order =>
933+ let mtchPub = mp()
934+ let orV = moa(order)
935+ let sndrV = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
936+ let mtchV = sigVerify(order.bodyBytes, order.proofs[1], mtchPub)
937+ if (if (if (orV)
938+ then sndrV
939+ else false)
940+ then mtchV
941+ else false)
942+ then true
943+ else toe(orV, sndrV, mtchV)
944+ case _ =>
945+ let targetPublicKey = match m() {
946+ case pk: ByteVector =>
947+ pk
948+ case _: Unit =>
949+ tx.senderPublicKey
950+ case _ =>
951+ throw("Match error")
952+ }
953+ sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
954+}
274955
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# 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+
420 let SEP = "__"
521
622 let EMPTY = ""
723
24+let PoolActive = 1
25+
26+let PoolPutDis = 2
27+
28+let PoolMatcherDis = 3
29+
30+let PoolShutdown = 4
31+
832 let idxPoolAddress = 1
33+
34+let idxPoolSt = 2
935
1036 let idxLPAsId = 3
1137
1238 let idxAmAsId = 4
1339
1440 let idxPrAsId = 5
1541
42+let idxAmtAsDcm = 6
43+
44+let idxPriceAsDcm = 7
45+
46+let idxIAmtAsId = 8
47+
48+let idxIPriceAsId = 9
49+
1650 let idxFactStakCntr = 1
51+
52+let idxFactSlippCntr = 7
53+
54+let idxFactGwxRewCntr = 10
1755
1856 let delay = "%s__delay"
1957
20-func keyFactCntr () = "%s__factoryContract"
58+func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
2159
2260
23-func keyManagerPublicKey () = "%s__managerPublicKey"
61+func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
2462
2563
26-func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
64+func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale)
2765
2866
29-func keyPoolAddr () = "%s__poolAddress"
67+func abs (val) = if ((zeroBigInt > val))
68+ then -(val)
69+ else val
3070
3171
32-func keyAmtAsset () = "%s__amountAsset"
72+func fc () = "%s__factoryContract"
3373
3474
35-func keyPriceAsset () = "%s__priceAsset"
75+func mpk () = "%s__managerPublicKey"
3676
3777
38-func keyAdminPubKeys () = "%s__adminPubKeys"
78+func pmpk () = "%s__pendingManagerPublicKey"
3979
4080
41-func keyAmp () = "%s__amp"
81+func pl () = "%s%s__price__last"
4282
4383
44-func keyAmpHistory (height) = ("%s%d__amp__" + toString(height))
84+func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP)
4585
4686
47-func lastGetOrPutOneTknCall (caller) = makeString(["%s%s__lastGetOrPutOneTknCall", caller], SEP)
87+func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId)
4888
4989
50-func keyFactoryConfig () = "%s__factoryConfig"
90+func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId)
5191
5292
53-func keyPoolConfig (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
93+func aa () = "%s__amountAsset"
5494
5595
56-func keyMappingsBaseAsset2internalId (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
96+func pa () = "%s__priceAsset"
5797
5898
59-func getStringOrFail (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
99+func amp () = "%s__amp"
60100
61101
62-func getIntOrFail (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
102+func ada () = "%s__addonAddr"
63103
64104
65-let poolContract = addressFromStringValue(getStringOrFail(this, keyPoolAddr()))
105+func lgopotc (caller) = makeString(["%s%s__lastGetOrPutOneTknCall", caller], SEP)
66106
67-let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr()))
68107
69-func getPoolConfig () = {
70- let amtAs = getStringOrFail(poolContract, keyAmtAsset())
71- let priceAs = getStringOrFail(poolContract, keyPriceAsset())
72- let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs))
73- let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs))
74- split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP)
108+func fcfg () = "%s__factoryConfig"
109+
110+
111+func mtpk () = "%s%s__matcher__publicKey"
112+
113+
114+func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
115+
116+
117+func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
118+
119+
120+func aps () = "%s__shutdown"
121+
122+
123+func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV)))
124+
125+
126+func str (val) = match val {
127+ case valStr: String =>
128+ valStr
129+ case _ =>
130+ throw("fail cast to String")
131+}
132+
133+
134+func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
135+
136+
137+func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
138+
139+
140+let fca = addressFromStringValue(strf(this, fc()))
141+
142+let A = strf(this, amp())
143+
144+func igs () = valueOrElse(getBoolean(fca, aps()), false)
145+
146+
147+func mp () = fromBase58String(strf(fca, mtpk()))
148+
149+
150+func gpc () = {
151+ let amtAs = strf(this, aa())
152+ let priceAs = strf(this, pa())
153+ let iPriceAs = intf(fca, mba(priceAs))
154+ let iAmtAs = intf(fca, mba(amtAs))
155+ split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP)
75156 }
76157
77158
78-func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
159+func gfc () = split(strf(fca, fcfg()), SEP)
79160
80161
81-func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
162+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)
163+
164+
165+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)
166+
167+
168+func getAccBalance (assetId) = if ((assetId == "WAVES"))
169+ then wavesBalance(this).available
170+ else assetBalance(this, fromBase58String(assetId))
171+
172+
173+func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
174+
175+
176+func vad (A1,A2,slippage) = {
177+ let diff = fraction((A1 - A2), scale8BigInt, A2)
178+ let pass = ((slippage - abs(diff)) > zeroBigInt)
179+ if (!(pass))
180+ then throw(("Big slpg: " + toString(diff)))
181+ else $Tuple2(pass, min([A1, A2]))
182+ }
183+
184+
185+func vd (D1,D0,slpg) = {
186+ let diff = fraction(D0, scale8BigInt, D1)
187+ let fail = (slpg > diff)
188+ if (if (fail)
189+ then true
190+ else (D0 > D1))
191+ then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg)))
192+ else fail
193+ }
194+
195+
196+func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
197+ let amtAsAmtX18 = t1(amAmt, amAssetDcm)
198+ let prAsAmtX18 = t1(prAmt, prAssetDcm)
199+ cpbi(prAsAmtX18, amtAsAmtX18)
200+ }
201+
202+
203+func calcPrices (amAmt,prAmt,lpAmt) = {
204+ let cfg = gpc()
205+ let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
206+ let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
207+ let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt)
208+ let amAmtX18 = t1(amAmt, amtAsDcm)
209+ let prAmtX18 = t1(prAmt, prAsDcm)
210+ let lpAmtX18 = t1(lpAmt, scale8)
211+ let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18)
212+ let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18)
213+[priceX18, lpPrInAmAsX18, lpPrInPrAsX18]
214+ }
215+
216+
217+func calculatePrices (amAmt,prAmt,lpAmt) = {
218+ let p = calcPrices(amAmt, prAmt, lpAmt)
219+[f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)]
220+ }
221+
222+
223+func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
224+ let cfg = gpc()
225+ let lpId = cfg[idxLPAsId]
226+ let amId = cfg[idxAmAsId]
227+ let prId = cfg[idxPrAsId]
228+ let amDcm = parseIntValue(cfg[idxAmtAsDcm])
229+ let prDcm = parseIntValue(cfg[idxPriceAsDcm])
230+ let sts = cfg[idxPoolSt]
231+ let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity
232+ if ((lpId != pmtAssetId))
233+ then throw("Wrong pmt asset")
234+ else {
235+ let amBalance = getAccBalance(amId)
236+ let amBalanceX18 = t1(amBalance, amDcm)
237+ let prBalance = getAccBalance(prId)
238+ let prBalanceX18 = t1(prBalance, prDcm)
239+ let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
240+ let curPrice = f1(curPriceX18, scale8)
241+ let pmtLpAmtX18 = t1(pmtLpAmt, scale8)
242+ let lpEmissX18 = t1(lpEmiss, scale8)
243+ let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18)
244+ let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18)
245+ let outAmAmt = f1(outAmAmtX18, amDcm)
246+ let outPrAmt = f1(outPrAmtX18, prDcm)
247+ let state = if ((txId58 == ""))
248+ then nil
249+ else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES"))
250+ then unit
251+ else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES"))
252+ then unit
253+ 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)]
254+ $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state)
255+ }
256+ }
257+
258+
259+func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,pmtAmt,pmtId) = {
260+ let cfg = gpc()
261+ let lpId = fromBase58String(cfg[idxLPAsId])
262+ let amIdStr = cfg[idxAmAsId]
263+ let prIdStr = cfg[idxPrAsId]
264+ let inAmIdStr = cfg[idxIAmtAsId]
265+ let inPrIdStr = cfg[idxIPriceAsId]
266+ let amtDcm = parseIntValue(cfg[idxAmtAsDcm])
267+ let priceDcm = parseIntValue(cfg[idxPriceAsDcm])
268+ let sts = cfg[idxPoolSt]
269+ let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity
270+ let amBalance = if (isEval)
271+ then getAccBalance(amIdStr)
272+ else if (if (isOneAsset)
273+ then (pmtId == amIdStr)
274+ else false)
275+ then (getAccBalance(amIdStr) - pmtAmt)
276+ else if (isOneAsset)
277+ then getAccBalance(amIdStr)
278+ else (getAccBalance(amIdStr) - inAmAmt)
279+ let prBalance = if (isEval)
280+ then getAccBalance(prIdStr)
281+ else if (if (isOneAsset)
282+ then (pmtId == prIdStr)
283+ else false)
284+ then (getAccBalance(prIdStr) - pmtAmt)
285+ else if (isOneAsset)
286+ then getAccBalance(prIdStr)
287+ else (getAccBalance(prIdStr) - inPrAmt)
288+ let inAmAssetAmtX18 = t1(inAmAmt, amtDcm)
289+ let inPrAssetAmtX18 = t1(inPrAmt, priceDcm)
290+ let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18)
291+ let amBalanceX18 = t1(amBalance, amtDcm)
292+ let prBalanceX18 = t1(prBalance, priceDcm)
293+ let r = if ((lpEm == 0))
294+ then {
295+ let curPriceX18 = zeroBigInt
296+ let slippageX18 = zeroBigInt
297+ let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
298+ $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
299+ }
300+ else {
301+ let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
302+ let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18)
303+ let slippageX18 = t1(slippage, scale8)
304+ if (if ((curPriceX18 != zeroBigInt))
305+ then (slippageRealX18 > slippageX18)
306+ else false)
307+ then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18)))
308+ else {
309+ let lpEmissionX18 = t1(lpEm, scale8)
310+ let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
311+ let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
312+ let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
313+ then $Tuple2(amViaPrX18, inPrAssetAmtX18)
314+ else $Tuple2(inAmAssetAmtX18, prViaAmX18)
315+ let expAmtAssetAmtX18 = expectedAmts._1
316+ let expPriceAssetAmtX18 = expectedAmts._2
317+ let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
318+ $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18)
319+ }
320+ }
321+ let calcLpAmt = r._1
322+ let calcAmAssetPmt = r._2
323+ let calcPrAssetPmt = r._3
324+ let curPrice = f1(r._4, scale8)
325+ let slippageCalc = f1(r._5, scale8)
326+ if ((0 >= calcLpAmt))
327+ then throw("LP <= 0")
328+ else {
329+ let emitLpAmt = if (!(emitLp))
330+ then 0
331+ else calcLpAmt
332+ let amDiff = (inAmAmt - calcAmAssetPmt)
333+ let prDiff = (inPrAmt - calcPrAssetPmt)
334+ let $t01543915784 = if (if (isOneAsset)
335+ then (pmtId == amIdStr)
336+ else false)
337+ then $Tuple2(pmtAmt, 0)
338+ else if (if (isOneAsset)
339+ then (pmtId == prIdStr)
340+ else false)
341+ then $Tuple2(0, pmtAmt)
342+ else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
343+ let writeAmAmt = $t01543915784._1
344+ let writePrAmt = $t01543915784._2
345+ 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))]
346+ $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
347+ }
348+ }
349+
350+
351+func moa (order) = {
352+ let cfg = gpc()
353+ let amtAsId = cfg[idxAmAsId]
354+ let prAsId = cfg[idxPrAsId]
355+ let sts = parseIntValue(cfg[idxPoolSt])
356+ let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
357+ let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
358+ let accAmtAsBalance = getAccBalance(amtAsId)
359+ let accPrAsBalance = getAccBalance(prAsId)
360+ let curPriceX18 = if ((order.orderType == Buy))
361+ then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance)
362+ else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance)
363+ let curPrice = f1(curPriceX18, scale8)
364+ if (if (if (igs())
365+ then true
366+ else (sts == PoolMatcherDis))
367+ then true
368+ else (sts == PoolShutdown))
369+ then throw("Admin blocked")
370+ else {
371+ let orAmtAsset = order.assetPair.amountAsset
372+ let orAmtAsStr = if ((orAmtAsset == unit))
373+ then "WAVES"
374+ else toBase58String(value(orAmtAsset))
375+ let orPrAsset = order.assetPair.priceAsset
376+ let orPrAsStr = if ((orPrAsset == unit))
377+ then "WAVES"
378+ else toBase58String(value(orPrAsset))
379+ if (if ((orAmtAsStr != amtAsId))
380+ then true
381+ else (orPrAsStr != prAsId))
382+ then throw("Wr assets")
383+ else {
384+ let orderPrice = order.price
385+ let priceDcm = fraction(scale8, prAsDcm, amtAsDcm)
386+ let castOrderPrice = ts(orderPrice, scale8, priceDcm)
387+ let isOrderPriceValid = if ((order.orderType == Buy))
388+ then (curPrice >= castOrderPrice)
389+ else (castOrderPrice >= curPrice)
390+ true
391+ }
392+ }
393+ }
394+
395+
396+func cg (i) = if ((size(i.payments) != 1))
397+ then throw("1 pmnt exp")
398+ else {
399+ let pmt = value(i.payments[0])
400+ let pmtAssetId = value(pmt.assetId)
401+ let pmtAmt = pmt.amount
402+ let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
403+ let outAmAmt = r._1
404+ let outPrAmt = r._2
405+ let sts = parseIntValue(r._9)
406+ let state = r._10
407+ if (if (igs())
408+ then true
409+ else (sts == PoolShutdown))
410+ then throw(("Admin blocked: " + toString(sts)))
411+ else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
412+ }
413+
414+
415+func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,pmtAmt,pmtId) = {
416+ let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, false, emitLp, isOneAsset, pmtAmt, pmtId)
417+ let sts = parseIntValue(r._8)
418+ if (if (if (igs())
419+ then true
420+ else (sts == PoolPutDis))
421+ then true
422+ else (sts == PoolShutdown))
423+ then throw(("Blocked:" + toString(sts)))
424+ else r
425+ }
426+
427+
428+func m () = match getString(mpk()) {
82429 case s: String =>
83430 fromBase58String(s)
84431 case _: Unit =>
85432 unit
86433 case _ =>
87434 throw("Match error")
88435 }
89436
90437
91-func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
438+func pm () = match getString(pmpk()) {
92439 case s: String =>
93440 fromBase58String(s)
94441 case _: Unit =>
95442 unit
96443 case _ =>
97444 throw("Match error")
98445 }
99446
100447
101-func mustManager (i) = {
102- let pd = throw("Permission denied")
103- match managerPublicKeyOrUnit() {
104- case pk: ByteVector =>
105- if ((i.callerPublicKey == pk))
106- then true
107- else pd
108- case _: Unit =>
109- if ((i.caller == this))
110- then true
111- else pd
112- case _ =>
113- throw("Match error")
114- }
115- }
448+let pd = throw("Permission denied")
116449
117-
118-func getAdmins () = match getString(keyAdminPubKeys()) {
119- case s: String =>
120- if ((size(s) == 0))
121- then nil
122- else split(s, SEP)
450+func mm (i) = match m() {
451+ case pk: ByteVector =>
452+ if ((i.callerPublicKey == pk))
453+ then true
454+ else pd
455+ case _: Unit =>
456+ if ((i.caller == this))
457+ then true
458+ else pd
123459 case _ =>
124- nil
460+ throw("Match error")
125461 }
126462
127463
128-func mustAdmin (i) = if (containsElement(getAdmins(), toBase58String(i.callerPublicKey)))
129- then true
130- else mustManager(i)
131-
132-
133-func mustPool (i) = if ((i.caller == poolContract))
134- then true
135- else throw("caller must be the pool")
136-
137-
138464 @Callable(i)
139-func constructor (poolAddress) = {
140- let checkCaller = mustManager(i)
141- if ((checkCaller == checkCaller))
142- then [StringEntry(keyPoolAddr(), poolAddress)]
465+func constructor (fc,ada) = {
466+ let c = mm(i)
467+ if ((c == c))
468+ then [StringEntry(fc(), fc), StringEntry(ada(), ada)]
143469 else throw("Strict value is not equal to itself.")
144470 }
145471
146472
147473
148474 @Callable(i)
149475 func setManager (pendingManagerPublicKey) = {
150- let checkCaller = mustManager(i)
151- if ((checkCaller == checkCaller))
476+ let c = mm(i)
477+ if ((c == c))
152478 then {
153- let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
154- if ((checkManagerPublicKey == checkManagerPublicKey))
155- then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
479+ let cm = fromBase58String(pendingManagerPublicKey)
480+ if ((cm == cm))
481+ then [StringEntry(pmpk(), pendingManagerPublicKey)]
156482 else throw("Strict value is not equal to itself.")
157483 }
158484 else throw("Strict value is not equal to itself.")
159485 }
160486
161487
162488
163489 @Callable(i)
164490 func confirmManager () = {
165- let pm = pendingManagerPublicKeyOrUnit()
166- let hasPM = if (isDefined(pm))
491+ let p = pm()
492+ let hpm = if (isDefined(p))
167493 then true
168494 else throw("No pending manager")
169- if ((hasPM == hasPM))
495+ if ((hpm == hpm))
170496 then {
171- let checkPM = if ((i.callerPublicKey == value(pm)))
497+ let cpm = if ((i.callerPublicKey == value(p)))
172498 then true
173499 else throw("You are not pending manager")
174- if ((checkPM == checkPM))
175- then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
500+ if ((cpm == cpm))
501+ then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())]
176502 else throw("Strict value is not equal to itself.")
177503 }
178504 else throw("Strict value is not equal to itself.")
179505 }
180506
181507
182508
183509 @Callable(i)
184-func setAdmins (adminPubKeys) = {
185- let checkCaller = mustManager(i)
186- if ((checkCaller == checkCaller))
187- then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))]
510+func put (slip,autoStake) = {
511+ let factCfg = gfc()
512+ let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr")
513+ let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr")
514+ if ((0 > slip))
515+ then throw("Wrong slippage")
516+ else if ((size(i.payments) != 2))
517+ then throw("2 pmnts expd")
518+ else {
519+ 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, "")
520+ let emitLpAmt = e._2
521+ let lpAssetId = e._7
522+ let state = e._9
523+ let amDiff = e._10
524+ let prDiff = e._11
525+ let amId = e._12
526+ let prId = e._13
527+ let r = invoke(fca, "emit", [emitLpAmt], nil)
528+ if ((r == r))
529+ then {
530+ let el = match r {
531+ case legacy: Address =>
532+ invoke(legacy, "emit", [emitLpAmt], nil)
533+ case _ =>
534+ unit
535+ }
536+ if ((el == el))
537+ then {
538+ let sa = if ((amDiff > 0))
539+ then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
540+ else nil
541+ if ((sa == sa))
542+ then {
543+ let sp = if ((prDiff > 0))
544+ then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
545+ else nil
546+ if ((sp == sp))
547+ then {
548+ let lpTrnsfr = if (autoStake)
549+ then {
550+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
551+ if ((ss == ss))
552+ then nil
553+ else throw("Strict value is not equal to itself.")
554+ }
555+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
556+ (state ++ lpTrnsfr)
557+ }
558+ else throw("Strict value is not equal to itself.")
559+ }
560+ else throw("Strict value is not equal to itself.")
561+ }
562+ else throw("Strict value is not equal to itself.")
563+ }
564+ else throw("Strict value is not equal to itself.")
565+ }
566+ }
567+
568+
569+
570+@Callable(i)
571+func putOneTkn (amAssetPart,prAssetPart,outLp,slippage,autoStake) = {
572+ let cfg = gfc()
573+ let stakingCntr = valueOrErrorMessage(addressFromString(cfg[idxFactStakCntr]), "Wr st addr")
574+ let slipCntr = valueOrErrorMessage(addressFromString(cfg[idxFactSlippCntr]), "Wr sl addr")
575+ let gwxCntr = valueOrErrorMessage(addressFromString(cfg[idxFactGwxRewCntr]), "Wr gwx addr")
576+ let poolCfg = gpc()
577+ let amId = poolCfg[idxAmAsId]
578+ let prId = poolCfg[idxPrAsId]
579+ let amDcm = parseIntValue(poolCfg[idxAmtAsDcm])
580+ let prDcm = parseIntValue(poolCfg[idxPriceAsDcm])
581+ let addon = valueOrElse(getString(this, ada()), "")
582+ let userAddress = if ((addon == toString(i.caller)))
583+ then i.originCaller
584+ else i.caller
585+ let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid")
586+ let check = reentrantInvoke(addonContract, "ensureCanGetOrPutOneTkn", [toString(userAddress)], nil)
587+ if ((check == check))
588+ then if (if (if (if ((0 >= slippage))
589+ then true
590+ else (0 >= amAssetPart))
591+ then true
592+ else (0 >= prAssetPart))
593+ then true
594+ else (0 >= outLp))
595+ then throw("Wrong params")
596+ else if ((size(i.payments) != 1))
597+ then throw("1 pmnt expd")
598+ else {
599+ let pmt = value(i.payments[0])
600+ let pmtAssetId = toBase58String(value(pmt.assetId))
601+ let pmtAmt = pmt.amount
602+ if (if (if ((amAssetPart > pmtAmt))
603+ then true
604+ else (prAssetPart > pmtAmt))
605+ then true
606+ else (10000000 > pmtAmt))
607+ then throw("Wrong pmt amt")
608+ else {
609+ let amBalance = getAccBalance(amId)
610+ let prBalance = getAccBalance(prId)
611+ let $t02480425184 = if ((pmtAssetId == amId))
612+ then $Tuple6((amBalance - pmtAmt), prBalance, (pmtAmt - amAssetPart), prAssetPart, 0, 0)
613+ else if ((pmtAssetId == prId))
614+ then $Tuple6(amBalance, (prBalance - pmtAmt), 0, 0, (pmtAmt - prAssetPart), amAssetPart)
615+ else throw("wrong pmtAssetId")
616+ let amBalanceNow = $t02480425184._1
617+ let prBalanceNow = $t02480425184._2
618+ let virtSwapInAm = $t02480425184._3
619+ let virtSwapOutPr = $t02480425184._4
620+ let virtSwapInPr = $t02480425184._5
621+ let virtSwapOutAm = $t02480425184._6
622+ let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
623+ let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil)
624+ let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
625+ if ((D0vsD1 == D0vsD1))
626+ then {
627+ let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), slippage, true, true, pmtAmt, pmtAssetId)
628+ let estimLP = estPut._2
629+ let lpAssetId = estPut._7
630+ let state = estPut._9
631+ let amDiff = estPut._10
632+ let prDiff = estPut._11
633+ let lpCalcRes = vad(toBigInt(estimLP), toBigInt(outLp), toBigInt(slippage))
634+ let emitLpAmt = toInt(lpCalcRes._2)
635+ let e = invoke(fca, "emit", [emitLpAmt], nil)
636+ if ((e == e))
637+ then {
638+ let el = match e {
639+ case legacy: Address =>
640+ invoke(legacy, "emit", [emitLpAmt], nil)
641+ case _ =>
642+ unit
643+ }
644+ if ((el == el))
645+ then {
646+ let sa = if ((amDiff > 0))
647+ then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)])
648+ else nil
649+ if ((sa == sa))
650+ then {
651+ let sp = if ((prDiff > 0))
652+ then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)])
653+ else nil
654+ if ((sp == sp))
655+ then {
656+ let lpTrnsfr = if (autoStake)
657+ then {
658+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
659+ if ((ss == ss))
660+ then nil
661+ else throw("Strict value is not equal to itself.")
662+ }
663+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
664+ (state ++ lpTrnsfr)
665+ }
666+ else throw("Strict value is not equal to itself.")
667+ }
668+ else throw("Strict value is not equal to itself.")
669+ }
670+ else throw("Strict value is not equal to itself.")
671+ }
672+ else throw("Strict value is not equal to itself.")
673+ }
674+ else throw("Strict value is not equal to itself.")
675+ }
676+ }
188677 else throw("Strict value is not equal to itself.")
189678 }
190679
191680
192681
193682 @Callable(i)
194-func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = {
683+func putForFree (maxSlpg) = if ((0 > maxSlpg))
684+ then throw("Wrong slpg")
685+ else if ((size(i.payments) != 2))
686+ then throw("2 pmnts expd")
687+ else {
688+ 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, "")
689+ estPut._9
690+ }
691+
692+
693+
694+@Callable(i)
695+func get () = {
696+ let r = cg(i)
697+ let outAmtAmt = r._1
698+ let outPrAmt = r._2
699+ let pmtAmt = r._3
700+ let pmtAssetId = r._4
701+ let state = r._5
702+ let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
703+ if ((b == b))
704+ then state
705+ else throw("Strict value is not equal to itself.")
706+ }
707+
708+
709+
710+@Callable(i)
711+func getOneTkn (exchResult,notUsed,outAmount,outAssetId,slippage) = if ((size(i.payments) != 1))
712+ then throw("1 pmnt expd")
713+ else {
714+ let cfg = gpc()
715+ let lpId = cfg[idxLPAsId]
716+ let amId = cfg[idxAmAsId]
717+ let prId = cfg[idxPrAsId]
718+ let amDcm = parseIntValue(cfg[idxAmtAsDcm])
719+ let prDcm = parseIntValue(cfg[idxPriceAsDcm])
720+ let sts = cfg[idxPoolSt]
721+ let factCfg = gfc()
722+ let gwxCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactGwxRewCntr]), "Wr sl addr")
723+ let pmt = value(i.payments[0])
724+ let addon = valueOrElse(getString(this, ada()), "")
725+ let userAddress = if ((addon == toString(i.caller)))
726+ then i.originCaller
727+ else i.caller
728+ let txId58 = toBase58String(i.transactionId)
729+ let pmtAssetId = value(pmt.assetId)
730+ let pmtAmt = pmt.amount
731+ let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid")
732+ let check = reentrantInvoke(addonContract, "ensureCanGetOrPutOneTkn", [toString(userAddress)], nil)
733+ if ((check == check))
734+ then if ((1000000000 > pmtAmt))
735+ then throw("Min pmt 10 LP")
736+ else if (if (if ((0 > slippage))
737+ then true
738+ else (0 > exchResult))
739+ then true
740+ else (0 > outAmount))
741+ then throw("Wrong params")
742+ else if ((lpId != toBase58String(pmtAssetId)))
743+ then throw("Wrong LP")
744+ else {
745+ let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
746+ let estimAmAmt = r._1
747+ let estimPrAmt = r._2
748+ let amBalance = getAccBalance(amId)
749+ let prBalance = getAccBalance(prId)
750+ let $t03022030677 = if ((outAssetId == amId))
751+ then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult))
752+ else if ((outAssetId == prId))
753+ then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult))
754+ else throw("wrong outAssetId")
755+ let amBalanceNow = $t03022030677._1
756+ let prBalanceNow = $t03022030677._2
757+ let virtSwapInAm = $t03022030677._3
758+ let virtSwapOutPr = $t03022030677._4
759+ let virtSwapInPr = $t03022030677._5
760+ let virtSwapOutAm = $t03022030677._6
761+ let totalGet = $t03022030677._7
762+ if (if ((0 > virtSwapInAm))
763+ then true
764+ else (0 > virtSwapInPr))
765+ then throw("Wrong calc")
766+ else {
767+ let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
768+ let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil)
769+ let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
770+ if ((D0vsD1 == D0vsD1))
771+ then {
772+ let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage))
773+ if ((finalRes == finalRes))
774+ then {
775+ let $t03138231486 = if ((outAssetId == amId))
776+ then $Tuple2(toInt(finalRes._2), 0)
777+ else $Tuple2(0, toInt(finalRes._2))
778+ let outAm = $t03138231486._1
779+ let outPr = $t03138231486._2
780+ let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm))
781+ let curPr = f1(curPrX18, scale8)
782+ let state = [ScriptTransfer(userAddress, (outAm + outPr), if ((outAssetId == "WAVES"))
783+ then unit
784+ 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)]
785+ if ((state == state))
786+ then {
787+ let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
788+ if ((burn == burn))
789+ then state
790+ else throw("Strict value is not equal to itself.")
791+ }
792+ else throw("Strict value is not equal to itself.")
793+ }
794+ else throw("Strict value is not equal to itself.")
795+ }
796+ else throw("Strict value is not equal to itself.")
797+ }
798+ }
799+ else throw("Strict value is not equal to itself.")
800+ }
801+
802+
803+
804+@Callable(i)
805+func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
806+ let r = cg(i)
807+ let outAmAmt = r._1
808+ let outPrAmt = r._2
809+ let pmtAmt = r._3
810+ let pmtAssetId = r._4
811+ let state = r._5
812+ if ((noLessThenAmtAsset > outAmAmt))
813+ then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
814+ else if ((noLessThenPriceAsset > outPrAmt))
815+ then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
816+ else {
817+ let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
818+ if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
819+ then state
820+ else throw("Strict value is not equal to itself.")
821+ }
822+ }
823+
824+
825+
826+@Callable(i)
827+func unstakeAndGet (amount) = {
195828 let checkPayments = if ((size(i.payments) != 0))
196829 then throw("No pmnts expd")
197830 else true
198831 if ((checkPayments == checkPayments))
199832 then {
200- let cfg = getPoolConfig()
201- let factoryCfg = getFactoryConfig()
833+ let cfg = gpc()
834+ let factoryCfg = gfc()
202835 let lpAssetId = fromBase58String(cfg[idxLPAsId])
203836 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
204837 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
205838 if ((unstakeInv == unstakeInv))
206839 then {
207- let getOneTkn = reentrantInvoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
208- if ((getOneTkn == getOneTkn))
209- then nil
840+ let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
841+ let sts = parseIntValue(r._9)
842+ let state = r._10
843+ let v = if (if (igs())
844+ then true
845+ else (sts == PoolShutdown))
846+ then throw(("Blocked: " + toString(sts)))
847+ else true
848+ if ((v == v))
849+ then {
850+ let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
851+ if ((burnA == burnA))
852+ then state
853+ else throw("Strict value is not equal to itself.")
854+ }
210855 else throw("Strict value is not equal to itself.")
211856 }
212857 else throw("Strict value is not equal to itself.")
213858 }
214859 else throw("Strict value is not equal to itself.")
215860 }
216861
217862
218863
219864 @Callable(i)
220-func setAmp (amp) = {
221- let checkCaller = mustAdmin(i)
222- if ((checkCaller == checkCaller))
223- then {
224- let res1 = invoke(poolContract, "setS", [keyAmp(), amp], nil)
225- let res2 = invoke(poolContract, "setS", [keyAmpHistory(height), amp], nil)
226- $Tuple2(nil, $Tuple2(res1, res2))
227- }
228- else throw("Strict value is not equal to itself.")
865+func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca)))
866+ then throw("denied")
867+ else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success")
868+
869+
870+
871+@Callable(i)
872+func setS (k,v) = if ((toString(i.caller) != strf(this, ada())))
873+ then pd
874+ else [StringEntry(k, v)]
875+
876+
877+
878+@Callable(i)
879+func setI (k,v) = if ((toString(i.caller) != strf(this, ada())))
880+ then pd
881+ else [IntegerEntry(k, v)]
882+
883+
884+
885+@Callable(i)
886+func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc())
887+
888+
889+
890+@Callable(i)
891+func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
892+
893+
894+
895+@Callable(i)
896+func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
897+ let pr = calcPrices(amAmt, prAmt, lpAmt)
898+ $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])])
229899 }
230900
231901
232902
233903 @Callable(i)
234-func ensureCanGetOrPutOneTkn (caller) = {
235- let checkCaller = mustPool(i)
236- if ((checkCaller == checkCaller))
237- then {
238- let ensureCanPut = match getInteger(poolContract, lastGetOrPutOneTknCall(caller)) {
239- case int: Int =>
240- let permittedHeight = (int + value(getInteger(poolContract, delay)))
241- let isReadyforPutOneTkn = (height >= permittedHeight)
242- let needBlocks = (permittedHeight - height)
243- if (isReadyforPutOneTkn)
244- then true
245- else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " "))
246- case _ =>
247- true
248- }
249- if ((ensureCanPut == ensureCanPut))
250- then {
251- let setI = invoke(poolContract, "setI", [lastGetOrPutOneTknCall(caller), height], nil)
252- if ((setI == setI))
253- then nil
254- else throw("Strict value is not equal to itself.")
255- }
256- else throw("Strict value is not equal to itself.")
257- }
258- else throw("Strict value is not equal to itself.")
904+func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult))
905+
906+
907+
908+@Callable(i)
909+func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult)))
910+
911+
912+
913+@Callable(i)
914+func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
915+
916+
917+
918+@Callable(i)
919+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, ""))
920+
921+
922+
923+@Callable(i)
924+func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = {
925+ let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr))
926+ $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10))
259927 }
260928
261929
262930 @Verifier(tx)
263-func verify () = {
264- let targetPublicKey = match managerPublicKeyOrUnit() {
265- case pk: ByteVector =>
266- pk
267- case _: Unit =>
268- tx.senderPublicKey
269- case _ =>
270- throw("Match error")
271- }
272- sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
273- }
931+func verify () = match tx {
932+ case order: Order =>
933+ let mtchPub = mp()
934+ let orV = moa(order)
935+ let sndrV = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
936+ let mtchV = sigVerify(order.bodyBytes, order.proofs[1], mtchPub)
937+ if (if (if (orV)
938+ then sndrV
939+ else false)
940+ then mtchV
941+ else false)
942+ then true
943+ else toe(orV, sndrV, mtchV)
944+ case _ =>
945+ let targetPublicKey = match m() {
946+ case pk: ByteVector =>
947+ pk
948+ case _: Unit =>
949+ tx.senderPublicKey
950+ case _ =>
951+ throw("Match error")
952+ }
953+ sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
954+}
274955

github/deemru/w8io/026f985 
87.56 ms