tx · GpbGy7r5XDVv6REPioMPBDcSD5GroZk7zNzdVPwz2dBB

3N4vUDe3oc1YPNwMyQi2h8f2tmGoA7wBZp2:  -0.03100000 Waves

2022.11.28 11:53 [2336737] smart account 3N4vUDe3oc1YPNwMyQi2h8f2tmGoA7wBZp2 > SELF 0.00000000 Waves

{ "type": 13, "id": "GpbGy7r5XDVv6REPioMPBDcSD5GroZk7zNzdVPwz2dBB", "fee": 3100000, "feeAssetId": null, "timestamp": 1669625665760, "version": 1, "sender": "3N4vUDe3oc1YPNwMyQi2h8f2tmGoA7wBZp2", "senderPublicKey": "6MuWw1pkme7UgQX2hZh8yTZyoWVkz8A4rmHZ1acrsrVm", "proofs": [ "aN7fkqSwEP9GB3KkMhjeQy65K2gnDsZ2wezRzEQw232UvhgVeGMuU33RDoSRjn9FvBFbFufCvAqc2mfiKceM9jE" ], "script": "base64:BgLIKQgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlkeEx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FNjcmlwdFRyYW5zYWN0aW9uBAJlSQUCZHcEAmdiCQD2AwEJAQV2YWx1ZQEIBQJlSQZzY3JpcHQEAmdjCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYUoJAQJhdwAEAmdkCQDxBwEFBHRoaXMDAwkAAAIFAmdjBQJnYgkBAiE9AgUCZ2QFAmdiBwYJAPQDAwgFAmZYCWJvZHlCeXRlcwkAkQMCCAUCZlgGcHJvb2ZzAAAFAmZaCQD0AwMIBQJmWAlib2R5Qnl0ZXMJAJEDAggFAmZYBnByb29mcwAABQJmWj2Y7YM=", "chainId": 84, "height": 2336737, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6MJCcFapRru93MqZZUgakYKFX8zfKobsQC5cQUf4hwkG Next: Hw2DmZjsHGmqMCQj2kxAAi8k9FEExrDX1QvER7PcHPKJ Diff:
OldNewDifferences
111111
112112 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
113113
114-let keyKLp = makeString(["%s", "keyKlp"], SEP)
114+let keyKLp = makeString(["%s", "kLp"], SEP)
115115
116-let keyLastKLpRefreshed = makeString(["%s", "keyLastKLpRefreshed"], SEP)
116+let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
117117
118-let keyRefreshKLpDelay = makeString(["%s", "keyRefreshKLpDelay"], SEP)
118+let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
119+
120+let kLpRefreshDelayDefault = 30
121+
122+let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
119123
120124 func keyFactoryConfig () = "%s__factoryConfig"
121125
158162 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
159163
160164
161-func asInt (val) = match val {
162- case valInt: Int =>
163- valInt
164- case _ =>
165- throw("fail to cast into Int")
166-}
167-
168-
169165 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
170166
171167 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
200196
201197 let poolConfigParsed = parsePoolConfig(getPoolConfig())
202198
203-let $t079168082 = poolConfigParsed
199+let $t079158081 = poolConfigParsed
204200
205-let cfgPoolAddress = $t079168082._1
201+let cfgPoolAddress = $t079158081._1
206202
207-let cfgPoolStatus = $t079168082._2
203+let cfgPoolStatus = $t079158081._2
208204
209-let cfgLpAssetId = $t079168082._3
205+let cfgLpAssetId = $t079158081._3
210206
211-let cfgAmountAssetId = $t079168082._4
207+let cfgAmountAssetId = $t079158081._4
212208
213-let cfgPriceAssetId = $t079168082._5
209+let cfgPriceAssetId = $t079158081._5
214210
215-let cfgAmountAssetDecimals = $t079168082._6
211+let cfgAmountAssetDecimals = $t079158081._6
216212
217-let cfgPriceAssetDecimals = $t079168082._7
213+let cfgPriceAssetDecimals = $t079158081._7
218214
219215 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
220216
491487 else if ((paymentAssetId == cfgPriceAssetId))
492488 then false
493489 else throwErr("invalid asset")
494- let $t02294323236 = if (isEval)
490+ let $t02294223235 = if (isEval)
495491 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
496492 else if (paymentInAmountAsset)
497493 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
498494 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
499- let amountBalanceOld = $t02294323236._1
500- let priceBalanceOld = $t02294323236._2
501- let $t02324023389 = if (paymentInAmountAsset)
495+ let amountBalanceOld = $t02294223235._1
496+ let priceBalanceOld = $t02294223235._2
497+ let $t02323923388 = if (paymentInAmountAsset)
502498 then $Tuple2(paymentAmountRaw, 0)
503499 else $Tuple2(0, paymentAmountRaw)
504- let amountAssetAmountRaw = $t02324023389._1
505- let priceAssetAmountRaw = $t02324023389._2
500+ let amountAssetAmountRaw = $t02323923388._1
501+ let priceAssetAmountRaw = $t02323923388._2
506502 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
507503 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
508- let $t02351123570 = takeFee(paymentAmountRaw)
509- let paymentAmount = $t02351123570._1
510- let feeAmount = $t02351123570._2
504+ let $t02351023569 = takeFee(paymentAmountRaw)
505+ let paymentAmount = $t02351023569._1
506+ let feeAmount = $t02351023569._2
511507 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
512508 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
513509 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
530526 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
531527 let priceOld = fromX18(priceOldX18, scale8)
532528 let loss = {
533- let $t02504725214 = if (paymentInAmountAsset)
529+ let $t02504625213 = if (paymentInAmountAsset)
534530 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
535531 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
536- let amount = $t02504725214._1
537- let balance = $t02504725214._2
532+ let amount = $t02504625213._1
533+ let balance = $t02504625213._2
538534 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
539535 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
540536 }
568564 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
569565 let redeemedBigInt = toBigInt(paymentAmount)
570566 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
571- let $t02679426844 = takeFee(amountRaw)
572- let totalAmount = $t02679426844._1
573- let feeAmount = $t02679426844._2
574- let $t02684827074 = if (outInAmountAsset)
567+ let $t02679326843 = takeFee(amountRaw)
568+ let totalAmount = $t02679326843._1
569+ let feeAmount = $t02679326843._2
570+ let $t02684727073 = if (outInAmountAsset)
575571 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
576572 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
577- let outAmAmount = $t02684827074._1
578- let outPrAmount = $t02684827074._2
579- let amBalanceNew = $t02684827074._3
580- let prBalanceNew = $t02684827074._4
573+ let outAmAmount = $t02684727073._1
574+ let outPrAmount = $t02684727073._2
575+ let amBalanceNew = $t02684727073._3
576+ let prBalanceNew = $t02684727073._4
581577 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
582578 let priceNew = fromX18(priceNewX18, scale8)
583579 let commonState = if (isEval)
602598
603599
604600 func refreshKLpInternal () = {
605- let cfg = getPoolConfig()
606- let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
607- let amountAssetId = cfg[idxAmtAssetId]
608- let priceAssetId = cfg[idxPriceAssetId]
609- let amountAssetBalance = getAccBalance(amountAssetId)
610- let priceAssetBalance = getAccBalance(priceAssetId)
611- let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
601+ let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
602+ let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
603+ let lpEmission = valueOrErrorMessage(assetInfo(cfgLpAssetId), fmtErr(makeString(["Asset ", toBase58String(cfgLpAssetId), " doesn't exist"], ""))).quantity
612604 let updatedKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpEmission)
613605 updatedKLp
614606 }
789781 let paymentAmountRaw = payment.amount
790782 let userAddress = i.caller
791783 let txId = i.transactionId
792- let $t03269232819 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
793- let emitAmountEstimated = $t03269232819._1
794- let commonState = $t03269232819._2
795- let feeAmount = $t03269232819._3
796- let bonus = $t03269232819._4
784+ let $t03260132728 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
785+ let emitAmountEstimated = $t03260132728._1
786+ let commonState = $t03260132728._2
787+ let feeAmount = $t03260132728._3
788+ let bonus = $t03260132728._4
797789 let emitAmount = if (if ((minOutAmount > 0))
798790 then (minOutAmount > emitAmountEstimated)
799791 else false)
824816
825817 @Callable(i)
826818 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
827- let $t03354833683 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
828- let emitAmountEstimated = $t03354833683._1
829- let commonState = $t03354833683._2
830- let feeAmount = $t03354833683._3
831- let bonus = $t03354833683._4
819+ let $t03345733592 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
820+ let emitAmountEstimated = $t03345733592._1
821+ let commonState = $t03345733592._2
822+ let feeAmount = $t03345733592._3
823+ let bonus = $t03345733592._4
832824 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
833825 }
834826
862854 let paymentAmount = payment.amount
863855 let userAddress = i.caller
864856 let txId = i.transactionId
865- let $t03448834620 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
866- let amountEstimated = $t03448834620._1
867- let commonState = $t03448834620._2
868- let feeAmount = $t03448834620._3
869- let bonus = $t03448834620._4
857+ let $t03439734529 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
858+ let amountEstimated = $t03439734529._1
859+ let commonState = $t03439734529._2
860+ let feeAmount = $t03439734529._3
861+ let bonus = $t03439734529._4
870862 let amount = if (if ((minOutAmount > 0))
871863 then (minOutAmount > amountEstimated)
872864 else false)
890882
891883 @Callable(i)
892884 func getOneTknREADONLY (outAssetId,paymentAmount) = {
893- let $t03525535393 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
894- let amountEstimated = $t03525535393._1
895- let commonState = $t03525535393._2
896- let feeAmount = $t03525535393._3
897- let bonus = $t03525535393._4
885+ let $t03516435302 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
886+ let amountEstimated = $t03516435302._1
887+ let commonState = $t03516435302._2
888+ let feeAmount = $t03516435302._3
889+ let bonus = $t03516435302._4
898890 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
899891 }
900892
928920 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
929921 if ((unstakeInv == unstakeInv))
930922 then {
931- let $t03621836348 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
932- let amountEstimated = $t03621836348._1
933- let commonState = $t03621836348._2
934- let feeAmount = $t03621836348._3
935- let bonus = $t03621836348._4
923+ let $t03612736257 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
924+ let amountEstimated = $t03612736257._1
925+ let commonState = $t03612736257._2
926+ let feeAmount = $t03612736257._3
927+ let bonus = $t03612736257._4
936928 let amount = if (if ((minOutAmount > 0))
937929 then (minOutAmount > amountEstimated)
938930 else false)
10791071
10801072 @Callable(i)
10811073 func refreshKLp () = {
1082- let lastRefreshedBlockHeight = valueOrElse(getInteger(keyLastKLpRefreshed), 0)
1083- let delayNotReachedErrorMessage = throwErr(makeString([value(getString(keyRefreshKLpDelay)), "blocks have not passed since the previous call"], " "))
1084- let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= 30))
1085- then true
1086- else delayNotReachedErrorMessage
1074+ let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
1075+ let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
1076+ then unit
1077+ else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
10871078 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
10881079 then {
1089- let updatedKLp = asInt(refreshKLpInternal())
1090-[IntegerEntry(keyLastKLpRefreshed, height), IntegerEntry(keyKLp, updatedKLp)]
1080+ let updatedKLp = refreshKLpInternal()
1081+[IntegerEntry(keyKLpRefreshedHeight, height), IntegerEntry(keyKLp, updatedKLp)]
10911082 }
10921083 else throw("Strict value is not equal to itself.")
10931084 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lPdecimals = 8
55
66 let scale8 = 100000000
77
88 let scale8BigInt = toBigInt(100000000)
99
1010 let scale18 = toBigInt(1000000000000000000)
1111
1212 let zeroBigInt = toBigInt(0)
1313
1414 let big0 = toBigInt(0)
1515
1616 let big1 = toBigInt(1)
1717
1818 let big2 = toBigInt(2)
1919
2020 let wavesString = "WAVES"
2121
2222 let SEP = "__"
2323
2424 let PoolActive = 1
2525
2626 let PoolPutDisabled = 2
2727
2828 let PoolMatcherDisabled = 3
2929
3030 let PoolShutdown = 4
3131
3232 let idxPoolAddress = 1
3333
3434 let idxPoolStatus = 2
3535
3636 let idxPoolLPAssetId = 3
3737
3838 let idxAmtAssetId = 4
3939
4040 let idxPriceAssetId = 5
4141
4242 let idxAmtAssetDcm = 6
4343
4444 let idxPriceAssetDcm = 7
4545
4646 let idxIAmtAssetId = 8
4747
4848 let idxIPriceAssetId = 9
4949
5050 let idxLPAssetDcm = 10
5151
5252 let idxPoolAmtAssetAmt = 1
5353
5454 let idxPoolPriceAssetAmt = 2
5555
5656 let idxPoolLPAssetAmt = 3
5757
5858 let idxFactoryStakingContract = 1
5959
6060 let idxFactorySlippageContract = 7
6161
6262 func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6363
6464
6565 func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
6666
6767
6868 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
6969
7070
7171 func abs (val) = if ((0 > val))
7272 then -(val)
7373 else val
7474
7575
7676 func absBigInt (val) = if ((zeroBigInt > val))
7777 then -(val)
7878 else val
7979
8080
8181 func fc () = "%s__factoryContract"
8282
8383
8484 func mpk () = "%s__managerPublicKey"
8585
8686
8787 func pmpk () = "%s__pendingManagerPublicKey"
8888
8989
9090 func pl () = "%s%s__price__last"
9191
9292
9393 func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
9494
9595
9696 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
9797
9898
9999 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
100100
101101
102102 func aa () = "%s__amountAsset"
103103
104104
105105 func pa () = "%s__priceAsset"
106106
107107
108108 let keyFee = "%s__fee"
109109
110110 let feeDefault = fraction(10, scale8, 10000)
111111
112112 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
113113
114-let keyKLp = makeString(["%s", "keyKlp"], SEP)
114+let keyKLp = makeString(["%s", "kLp"], SEP)
115115
116-let keyLastKLpRefreshed = makeString(["%s", "keyLastKLpRefreshed"], SEP)
116+let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
117117
118-let keyRefreshKLpDelay = makeString(["%s", "keyRefreshKLpDelay"], SEP)
118+let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
119+
120+let kLpRefreshDelayDefault = 30
121+
122+let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
119123
120124 func keyFactoryConfig () = "%s__factoryConfig"
121125
122126
123127 func keyMatcherPub () = "%s%s__matcher__publicKey"
124128
125129
126130 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
127131
128132
129133 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
130134
131135
132136 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
133137
134138
135139 func keyAllPoolsShutdown () = "%s__shutdown"
136140
137141
138142 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
139143
140144
141145 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
142146
143147
144148 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
145149
146150 func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
147151
148152
149153 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
150154
151155
152156 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
153157
154158
155159 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
156160
157161
158162 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
159163
160164
161-func asInt (val) = match val {
162- case valInt: Int =>
163- valInt
164- case _ =>
165- throw("fail to cast into Int")
166-}
167-
168-
169165 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
170166
171167 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
172168
173169 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
174170
175171
176172 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
177173
178174
179175 func getPoolConfig () = {
180176 let amtAsset = getStringOrFail(this, aa())
181177 let priceAsset = getStringOrFail(this, pa())
182178 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
183179 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
184180 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
185181 }
186182
187183
188184 func parseAssetId (input) = if ((input == wavesString))
189185 then unit
190186 else fromBase58String(input)
191187
192188
193189 func assetIdToString (input) = if ((input == unit))
194190 then wavesString
195191 else toBase58String(value(input))
196192
197193
198194 func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolStatus]), fromBase58String(poolConfig[idxPoolLPAssetId]), parseAssetId(poolConfig[idxAmtAssetId]), parseAssetId(poolConfig[idxPriceAssetId]), parseIntValue(poolConfig[idxAmtAssetDcm]), parseIntValue(poolConfig[idxPriceAssetDcm]))
199195
200196
201197 let poolConfigParsed = parsePoolConfig(getPoolConfig())
202198
203-let $t079168082 = poolConfigParsed
199+let $t079158081 = poolConfigParsed
204200
205-let cfgPoolAddress = $t079168082._1
201+let cfgPoolAddress = $t079158081._1
206202
207-let cfgPoolStatus = $t079168082._2
203+let cfgPoolStatus = $t079158081._2
208204
209-let cfgLpAssetId = $t079168082._3
205+let cfgLpAssetId = $t079158081._3
210206
211-let cfgAmountAssetId = $t079168082._4
207+let cfgAmountAssetId = $t079158081._4
212208
213-let cfgPriceAssetId = $t079168082._5
209+let cfgPriceAssetId = $t079158081._5
214210
215-let cfgAmountAssetDecimals = $t079168082._6
211+let cfgAmountAssetDecimals = $t079158081._6
216212
217-let cfgPriceAssetDecimals = $t079168082._7
213+let cfgPriceAssetDecimals = $t079158081._7
218214
219215 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
220216
221217
222218 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
223219
224220 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
225221
226222 func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,slippageToleranceReal,txHeight,txTimestamp,slipageAmtAssetAmt,slipagePriceAssetAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(slippageToleranceReal), toString(txHeight), toString(txTimestamp), toString(slipageAmtAssetAmt), toString(slipagePriceAssetAmt)], SEP)
227223
228224
229225 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)
230226
231227
232228 func getAccBalance (assetId) = if ((assetId == "WAVES"))
233229 then wavesBalance(this).available
234230 else assetBalance(this, fromBase58String(assetId))
235231
236232
237233 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
238234
239235
240236 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
241237 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
242238 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
243239 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
244240 }
245241
246242
247243 func calcPrices (amAmt,prAmt,lpAmt) = {
248244 let cfg = getPoolConfig()
249245 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
250246 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
251247 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
252248 let amAmtX18 = toX18(amAmt, amtAssetDcm)
253249 let prAmtX18 = toX18(prAmt, priceAssetDcm)
254250 let lpAmtX18 = toX18(lpAmt, scale8)
255251 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
256252 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
257253 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
258254 }
259255
260256
261257 func calculatePrices (amAmt,prAmt,lpAmt) = {
262258 let prices = calcPrices(amAmt, prAmt, lpAmt)
263259 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
264260 }
265261
266262
267263 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
268264 let cfg = getPoolConfig()
269265 let lpAssetId = cfg[idxPoolLPAssetId]
270266 let amAssetId = cfg[idxAmtAssetId]
271267 let prAssetId = cfg[idxPriceAssetId]
272268 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
273269 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
274270 let poolStatus = cfg[idxPoolStatus]
275271 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
276272 if ((lpAssetId != pmtAssetId))
277273 then throw("Invalid asset passed.")
278274 else {
279275 let amBalance = getAccBalance(amAssetId)
280276 let amBalanceX18 = toX18(amBalance, amAssetDcm)
281277 let prBalance = getAccBalance(prAssetId)
282278 let prBalanceX18 = toX18(prBalance, prAssetDcm)
283279 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
284280 let curPrice = fromX18(curPriceX18, scale8)
285281 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
286282 let lpEmissionX18 = toX18(lpEmission, scale8)
287283 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
288284 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
289285 let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
290286 let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
291287 let state = if ((txId58 == ""))
292288 then nil
293289 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
294290 then unit
295291 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
296292 then unit
297293 else fromBase58String(prAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)]
298294 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
299295 }
300296 }
301297
302298
303299 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
304300 let cfg = getPoolConfig()
305301 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
306302 let amAssetIdStr = cfg[idxAmtAssetId]
307303 let prAssetIdStr = cfg[idxPriceAssetId]
308304 let iAmtAssetId = cfg[idxIAmtAssetId]
309305 let iPriceAssetId = cfg[idxIPriceAssetId]
310306 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
311307 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
312308 let poolStatus = cfg[idxPoolStatus]
313309 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
314310 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
315311 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
316312 if (if ((amAssetIdStr != inAmAssetIdStr))
317313 then true
318314 else (prAssetIdStr != inPrAssetIdStr))
319315 then throw("Invalid amt or price asset passed.")
320316 else {
321317 let amBalance = if (isEvaluate)
322318 then getAccBalance(amAssetIdStr)
323319 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
324320 let prBalance = if (isEvaluate)
325321 then getAccBalance(prAssetIdStr)
326322 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
327323 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
328324 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
329325 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
330326 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
331327 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
332328 let res = if ((lpEmission == 0))
333329 then {
334330 let curPriceX18 = zeroBigInt
335331 let slippageX18 = zeroBigInt
336332 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
337333 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
338334 }
339335 else {
340336 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
341337 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
342338 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
343339 if (if ((curPriceX18 != zeroBigInt))
344340 then (slippageX18 > slippageToleranceX18)
345341 else false)
346342 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
347343 else {
348344 let lpEmissionX18 = toX18(lpEmission, scale8)
349345 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
350346 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
351347 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
352348 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
353349 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
354350 let expAmtAssetAmtX18 = expectedAmts._1
355351 let expPriceAssetAmtX18 = expectedAmts._2
356352 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
357353 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18)
358354 }
359355 }
360356 let calcLpAmt = res._1
361357 let calcAmAssetPmt = res._2
362358 let calcPrAssetPmt = res._3
363359 let curPrice = fromX18(res._4, scale8)
364360 let slippageCalc = fromX18(res._5, scale8)
365361 if ((0 >= calcLpAmt))
366362 then throw("Invalid calculations. LP calculated is less than zero.")
367363 else {
368364 let emitLpAmt = if (!(emitLp))
369365 then 0
370366 else calcLpAmt
371367 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
372368 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
373369 let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(calcAmAssetPmt, calcPrAssetPmt, emitLpAmt, curPrice, slippageTolerance, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))]
374370 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
375371 }
376372 }
377373 }
378374
379375
380376 func validateMatcherOrderAllowed (order) = {
381377 let cfg = getPoolConfig()
382378 let amtAssetId = cfg[idxAmtAssetId]
383379 let priceAssetId = cfg[idxPriceAssetId]
384380 let poolStatus = parseIntValue(cfg[idxPoolStatus])
385381 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
386382 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
387383 let accAmtAssetBalance = getAccBalance(amtAssetId)
388384 let accPriceAssetBalance = getAccBalance(priceAssetId)
389385 let curPriceX18 = if ((order.orderType == Buy))
390386 then privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance + order.amount), accPriceAssetBalance)
391387 else privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance - order.amount), accPriceAssetBalance)
392388 let curPrice = fromX18(curPriceX18, scale8)
393389 if (if (if (isGlobalShutdown())
394390 then true
395391 else (poolStatus == PoolMatcherDisabled))
396392 then true
397393 else (poolStatus == PoolShutdown))
398394 then throw("Exchange operations disabled")
399395 else {
400396 let orderAmtAsset = order.assetPair.amountAsset
401397 let orderAmtAssetStr = if ((orderAmtAsset == unit))
402398 then "WAVES"
403399 else toBase58String(value(orderAmtAsset))
404400 let orderPriceAsset = order.assetPair.priceAsset
405401 let orderPriceAssetStr = if ((orderPriceAsset == unit))
406402 then "WAVES"
407403 else toBase58String(value(orderPriceAsset))
408404 if (if ((orderAmtAssetStr != amtAssetId))
409405 then true
410406 else (orderPriceAssetStr != priceAssetId))
411407 then throw("Wrong order assets.")
412408 else {
413409 let orderPrice = order.price
414410 let priceDcm = fraction(scale8, priceAssetDcm, amtAssetDcm)
415411 let castedOrderPrice = toScale(orderPrice, scale8, priceDcm)
416412 let isOrderPriceValid = if ((order.orderType == Buy))
417413 then (curPrice >= castedOrderPrice)
418414 else (castedOrderPrice >= curPrice)
419415 true
420416 }
421417 }
422418 }
423419
424420
425421 func commonGet (i) = if ((size(i.payments) != 1))
426422 then throw("exactly 1 payment is expected")
427423 else {
428424 let pmt = value(i.payments[0])
429425 let pmtAssetId = value(pmt.assetId)
430426 let pmtAmt = pmt.amount
431427 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
432428 let outAmAmt = res._1
433429 let outPrAmt = res._2
434430 let poolStatus = parseIntValue(res._9)
435431 let state = res._10
436432 if (if (isGlobalShutdown())
437433 then true
438434 else (poolStatus == PoolShutdown))
439435 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
440436 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
441437 }
442438
443439
444440 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
445441 then throw("exactly 2 payments are expected")
446442 else {
447443 let amAssetPmt = value(i.payments[0])
448444 let prAssetPmt = value(i.payments[1])
449445 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
450446 let poolStatus = parseIntValue(estPut._8)
451447 if (if (if (isGlobalShutdown())
452448 then true
453449 else (poolStatus == PoolPutDisabled))
454450 then true
455451 else (poolStatus == PoolShutdown))
456452 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
457453 else estPut
458454 }
459455
460456
461457 func emit (amount) = {
462458 let emitInv = invoke(factoryContract, "emit", [amount], nil)
463459 if ((emitInv == emitInv))
464460 then {
465461 let emitInvLegacy = match emitInv {
466462 case legacyFactoryContract: Address =>
467463 invoke(legacyFactoryContract, "emit", [amount], nil)
468464 case _ =>
469465 unit
470466 }
471467 if ((emitInvLegacy == emitInvLegacy))
472468 then amount
473469 else throw("Strict value is not equal to itself.")
474470 }
475471 else throw("Strict value is not equal to itself.")
476472 }
477473
478474
479475 func takeFee (amount) = {
480476 let feeAmount = fraction(amount, fee, scale8)
481477 $Tuple2((amount - feeAmount), feeAmount)
482478 }
483479
484480
485481 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
486482 let isEval = (txId == unit)
487483 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
488484 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
489485 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
490486 then true
491487 else if ((paymentAssetId == cfgPriceAssetId))
492488 then false
493489 else throwErr("invalid asset")
494- let $t02294323236 = if (isEval)
490+ let $t02294223235 = if (isEval)
495491 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
496492 else if (paymentInAmountAsset)
497493 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
498494 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
499- let amountBalanceOld = $t02294323236._1
500- let priceBalanceOld = $t02294323236._2
501- let $t02324023389 = if (paymentInAmountAsset)
495+ let amountBalanceOld = $t02294223235._1
496+ let priceBalanceOld = $t02294223235._2
497+ let $t02323923388 = if (paymentInAmountAsset)
502498 then $Tuple2(paymentAmountRaw, 0)
503499 else $Tuple2(0, paymentAmountRaw)
504- let amountAssetAmountRaw = $t02324023389._1
505- let priceAssetAmountRaw = $t02324023389._2
500+ let amountAssetAmountRaw = $t02323923388._1
501+ let priceAssetAmountRaw = $t02323923388._2
506502 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
507503 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
508- let $t02351123570 = takeFee(paymentAmountRaw)
509- let paymentAmount = $t02351123570._1
510- let feeAmount = $t02351123570._2
504+ let $t02351023569 = takeFee(paymentAmountRaw)
505+ let paymentAmount = $t02351023569._1
506+ let feeAmount = $t02351023569._2
511507 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
512508 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
513509 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
514510 let priceNew = fromX18(priceNewX18, scale8)
515511 let paymentBalance = if (paymentInAmountAsset)
516512 then amountBalanceOld
517513 else priceBalanceOld
518514 let paymentBalanceBigInt = toBigInt(paymentBalance)
519515 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
520516 let chechSupply = if ((supplyBigInt > big0))
521517 then true
522518 else throwErr("initial deposit requires all coins")
523519 if ((chechSupply == chechSupply))
524520 then {
525521 let depositBigInt = toBigInt(paymentAmount)
526522 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
527523 let commonState = if (isEval)
528524 then nil
529525 else [IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew), StringEntry(pau(toString(value(userAddress)), toBase58String(value(txId))), dataPutActionInfo(amountAssetAmountRaw, priceAssetAmountRaw, issueAmount, priceNew, 0, 0, height, lastBlock.timestamp, 0, 0))]
530526 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
531527 let priceOld = fromX18(priceOldX18, scale8)
532528 let loss = {
533- let $t02504725214 = if (paymentInAmountAsset)
529+ let $t02504625213 = if (paymentInAmountAsset)
534530 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
535531 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
536- let amount = $t02504725214._1
537- let balance = $t02504725214._2
532+ let amount = $t02504625213._1
533+ let balance = $t02504625213._2
538534 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
539535 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
540536 }
541537 $Tuple4(issueAmount, commonState, feeAmount, loss)
542538 }
543539 else throw("Strict value is not equal to itself.")
544540 }
545541
546542
547543 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
548544 let isEval = (txId == unit)
549545 let checks = [if ((paymentAssetId == cfgLpAssetId))
550546 then true
551547 else throwErr("invalid lp asset")]
552548 if ((checks == checks))
553549 then {
554550 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
555551 then true
556552 else if ((outAssetId == cfgPriceAssetId))
557553 then false
558554 else throwErr("invalid asset")
559555 let balanceBigInt = if (outInAmountAsset)
560556 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
561557 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
562558 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
563559 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
564560 let outBalance = if (outInAmountAsset)
565561 then amBalanceOld
566562 else prBalanceOld
567563 let outBalanceBigInt = toBigInt(outBalance)
568564 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
569565 let redeemedBigInt = toBigInt(paymentAmount)
570566 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
571- let $t02679426844 = takeFee(amountRaw)
572- let totalAmount = $t02679426844._1
573- let feeAmount = $t02679426844._2
574- let $t02684827074 = if (outInAmountAsset)
567+ let $t02679326843 = takeFee(amountRaw)
568+ let totalAmount = $t02679326843._1
569+ let feeAmount = $t02679326843._2
570+ let $t02684727073 = if (outInAmountAsset)
575571 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
576572 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
577- let outAmAmount = $t02684827074._1
578- let outPrAmount = $t02684827074._2
579- let amBalanceNew = $t02684827074._3
580- let prBalanceNew = $t02684827074._4
573+ let outAmAmount = $t02684727073._1
574+ let outPrAmount = $t02684727073._2
575+ let amBalanceNew = $t02684727073._3
576+ let prBalanceNew = $t02684727073._4
581577 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
582578 let priceNew = fromX18(priceNewX18, scale8)
583579 let commonState = if (isEval)
584580 then nil
585581 else [StringEntry(gau(toString(value(userAddress)), toBase58String(value(txId))), dataGetActionInfo(outAmAmount, outPrAmount, paymentAmount, priceNew, height, lastBlock.timestamp)), IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew)]
586582 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
587583 let priceOld = fromX18(priceOldX18, scale8)
588584 let loss = {
589585 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
590586 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
591587 }
592588 $Tuple4(totalAmount, commonState, feeAmount, loss)
593589 }
594590 else throw("Strict value is not equal to itself.")
595591 }
596592
597593
598594 func calcKLp (amountBalance,priceBalance,lpEmission) = {
599595 let updatedKLp = (pow((amountBalance * priceBalance), 0, 5, 1, 0, DOWN) / lpEmission)
600596 updatedKLp
601597 }
602598
603599
604600 func refreshKLpInternal () = {
605- let cfg = getPoolConfig()
606- let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
607- let amountAssetId = cfg[idxAmtAssetId]
608- let priceAssetId = cfg[idxPriceAssetId]
609- let amountAssetBalance = getAccBalance(amountAssetId)
610- let priceAssetBalance = getAccBalance(priceAssetId)
611- let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
601+ let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
602+ let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
603+ let lpEmission = valueOrErrorMessage(assetInfo(cfgLpAssetId), fmtErr(makeString(["Asset ", toBase58String(cfgLpAssetId), " doesn't exist"], ""))).quantity
612604 let updatedKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpEmission)
613605 updatedKLp
614606 }
615607
616608
617609 func managerPublicKeyOrUnit () = match getString(mpk()) {
618610 case s: String =>
619611 fromBase58String(s)
620612 case _: Unit =>
621613 unit
622614 case _ =>
623615 throw("Match error")
624616 }
625617
626618
627619 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
628620 case s: String =>
629621 fromBase58String(s)
630622 case _: Unit =>
631623 unit
632624 case _ =>
633625 throw("Match error")
634626 }
635627
636628
637629 func isManager (i) = match managerPublicKeyOrUnit() {
638630 case pk: ByteVector =>
639631 (i.callerPublicKey == pk)
640632 case _: Unit =>
641633 (i.caller == this)
642634 case _ =>
643635 throw("Match error")
644636 }
645637
646638
647639 func mustManager (i) = {
648640 let pd = throw("Permission denied")
649641 match managerPublicKeyOrUnit() {
650642 case pk: ByteVector =>
651643 if ((i.callerPublicKey == pk))
652644 then true
653645 else pd
654646 case _: Unit =>
655647 if ((i.caller == this))
656648 then true
657649 else pd
658650 case _ =>
659651 throw("Match error")
660652 }
661653 }
662654
663655
664656 @Callable(i)
665657 func setManager (pendingManagerPublicKey) = {
666658 let checkCaller = mustManager(i)
667659 if ((checkCaller == checkCaller))
668660 then {
669661 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
670662 if ((checkManagerPublicKey == checkManagerPublicKey))
671663 then [StringEntry(pmpk(), pendingManagerPublicKey)]
672664 else throw("Strict value is not equal to itself.")
673665 }
674666 else throw("Strict value is not equal to itself.")
675667 }
676668
677669
678670
679671 @Callable(i)
680672 func confirmManager () = {
681673 let pm = pendingManagerPublicKeyOrUnit()
682674 let hasPM = if (isDefined(pm))
683675 then true
684676 else throw("No pending manager")
685677 if ((hasPM == hasPM))
686678 then {
687679 let checkPM = if ((i.callerPublicKey == value(pm)))
688680 then true
689681 else throw("You are not pending manager")
690682 if ((checkPM == checkPM))
691683 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
692684 else throw("Strict value is not equal to itself.")
693685 }
694686 else throw("Strict value is not equal to itself.")
695687 }
696688
697689
698690
699691 @Callable(i)
700692 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
701693 then throw("Invalid slippageTolerance passed")
702694 else {
703695 let estPut = commonPut(i, slippageTolerance, true)
704696 let emitLpAmt = estPut._2
705697 let lpAssetId = estPut._7
706698 let state = estPut._9
707699 let amDiff = estPut._10
708700 let prDiff = estPut._11
709701 let amId = estPut._12
710702 let prId = estPut._13
711703 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
712704 if ((emitInv == emitInv))
713705 then {
714706 let emitInvLegacy = match emitInv {
715707 case legacyFactoryContract: Address =>
716708 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
717709 case _ =>
718710 unit
719711 }
720712 if ((emitInvLegacy == emitInvLegacy))
721713 then {
722714 let slippageAInv = if ((amDiff > 0))
723715 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
724716 else nil
725717 if ((slippageAInv == slippageAInv))
726718 then {
727719 let slippagePInv = if ((prDiff > 0))
728720 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
729721 else nil
730722 if ((slippagePInv == slippagePInv))
731723 then {
732724 let lpTransfer = if (shouldAutoStake)
733725 then {
734726 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
735727 if ((slpStakeInv == slpStakeInv))
736728 then nil
737729 else throw("Strict value is not equal to itself.")
738730 }
739731 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
740732 (state ++ lpTransfer)
741733 }
742734 else throw("Strict value is not equal to itself.")
743735 }
744736 else throw("Strict value is not equal to itself.")
745737 }
746738 else throw("Strict value is not equal to itself.")
747739 }
748740 else throw("Strict value is not equal to itself.")
749741 }
750742
751743
752744
753745 @Callable(i)
754746 func putForFree (maxSlippage) = if ((0 > maxSlippage))
755747 then throw("Invalid value passed")
756748 else {
757749 let estPut = commonPut(i, maxSlippage, false)
758750 estPut._9
759751 }
760752
761753
762754
763755 @Callable(i)
764756 func putOneTkn (minOutAmount,autoStake) = {
765757 let isPoolOneTokenOperationsDisabled = {
766758 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
767759 if ($isInstanceOf(@, "Boolean"))
768760 then @
769761 else throw(($getType(@) + " couldn't be cast to Boolean"))
770762 }
771763 let isPutDisabled = if (if (if (isGlobalShutdown())
772764 then true
773765 else (cfgPoolStatus == PoolPutDisabled))
774766 then true
775767 else (cfgPoolStatus == PoolShutdown))
776768 then true
777769 else isPoolOneTokenOperationsDisabled
778770 let checks = [if (if (!(isPutDisabled))
779771 then true
780772 else isManager(i))
781773 then true
782774 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
783775 then true
784776 else throwErr("exactly 1 payment are expected")]
785777 if ((checks == checks))
786778 then {
787779 let payment = i.payments[0]
788780 let paymentAssetId = payment.assetId
789781 let paymentAmountRaw = payment.amount
790782 let userAddress = i.caller
791783 let txId = i.transactionId
792- let $t03269232819 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
793- let emitAmountEstimated = $t03269232819._1
794- let commonState = $t03269232819._2
795- let feeAmount = $t03269232819._3
796- let bonus = $t03269232819._4
784+ let $t03260132728 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
785+ let emitAmountEstimated = $t03260132728._1
786+ let commonState = $t03260132728._2
787+ let feeAmount = $t03260132728._3
788+ let bonus = $t03260132728._4
797789 let emitAmount = if (if ((minOutAmount > 0))
798790 then (minOutAmount > emitAmountEstimated)
799791 else false)
800792 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
801793 else emitAmountEstimated
802794 let emitInv = emit(emitAmount)
803795 if ((emitInv == emitInv))
804796 then {
805797 let lpTransfer = if (autoStake)
806798 then {
807799 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
808800 if ((stakeInv == stakeInv))
809801 then nil
810802 else throw("Strict value is not equal to itself.")
811803 }
812804 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
813805 let sendFee = if ((feeAmount > 0))
814806 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
815807 else nil
816808 $Tuple2(((commonState ++ lpTransfer) ++ sendFee), emitAmount)
817809 }
818810 else throw("Strict value is not equal to itself.")
819811 }
820812 else throw("Strict value is not equal to itself.")
821813 }
822814
823815
824816
825817 @Callable(i)
826818 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
827- let $t03354833683 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
828- let emitAmountEstimated = $t03354833683._1
829- let commonState = $t03354833683._2
830- let feeAmount = $t03354833683._3
831- let bonus = $t03354833683._4
819+ let $t03345733592 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
820+ let emitAmountEstimated = $t03345733592._1
821+ let commonState = $t03345733592._2
822+ let feeAmount = $t03345733592._3
823+ let bonus = $t03345733592._4
832824 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
833825 }
834826
835827
836828
837829 @Callable(i)
838830 func getOneTkn (outAssetIdStr,minOutAmount) = {
839831 let isPoolOneTokenOperationsDisabled = {
840832 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
841833 if ($isInstanceOf(@, "Boolean"))
842834 then @
843835 else throw(($getType(@) + " couldn't be cast to Boolean"))
844836 }
845837 let isGetDisabled = if (if (isGlobalShutdown())
846838 then true
847839 else (cfgPoolStatus == PoolShutdown))
848840 then true
849841 else isPoolOneTokenOperationsDisabled
850842 let checks = [if (if (!(isGetDisabled))
851843 then true
852844 else isManager(i))
853845 then true
854846 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
855847 then true
856848 else throwErr("exactly 1 payment are expected")]
857849 if ((checks == checks))
858850 then {
859851 let outAssetId = parseAssetId(outAssetIdStr)
860852 let payment = i.payments[0]
861853 let paymentAssetId = payment.assetId
862854 let paymentAmount = payment.amount
863855 let userAddress = i.caller
864856 let txId = i.transactionId
865- let $t03448834620 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
866- let amountEstimated = $t03448834620._1
867- let commonState = $t03448834620._2
868- let feeAmount = $t03448834620._3
869- let bonus = $t03448834620._4
857+ let $t03439734529 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
858+ let amountEstimated = $t03439734529._1
859+ let commonState = $t03439734529._2
860+ let feeAmount = $t03439734529._3
861+ let bonus = $t03439734529._4
870862 let amount = if (if ((minOutAmount > 0))
871863 then (minOutAmount > amountEstimated)
872864 else false)
873865 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
874866 else amountEstimated
875867 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
876868 if ((burnInv == burnInv))
877869 then {
878870 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
879871 let sendFee = if ((feeAmount > 0))
880872 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
881873 else nil
882874 $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
883875 }
884876 else throw("Strict value is not equal to itself.")
885877 }
886878 else throw("Strict value is not equal to itself.")
887879 }
888880
889881
890882
891883 @Callable(i)
892884 func getOneTknREADONLY (outAssetId,paymentAmount) = {
893- let $t03525535393 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
894- let amountEstimated = $t03525535393._1
895- let commonState = $t03525535393._2
896- let feeAmount = $t03525535393._3
897- let bonus = $t03525535393._4
885+ let $t03516435302 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
886+ let amountEstimated = $t03516435302._1
887+ let commonState = $t03516435302._2
888+ let feeAmount = $t03516435302._3
889+ let bonus = $t03516435302._4
898890 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
899891 }
900892
901893
902894
903895 @Callable(i)
904896 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
905897 let isPoolOneTokenOperationsDisabled = {
906898 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
907899 if ($isInstanceOf(@, "Boolean"))
908900 then @
909901 else throw(($getType(@) + " couldn't be cast to Boolean"))
910902 }
911903 let isGetDisabled = if (if (isGlobalShutdown())
912904 then true
913905 else (cfgPoolStatus == PoolShutdown))
914906 then true
915907 else isPoolOneTokenOperationsDisabled
916908 let checks = [if (if (!(isGetDisabled))
917909 then true
918910 else isManager(i))
919911 then true
920912 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
921913 then true
922914 else throwErr("no payments are expected")]
923915 if ((checks == checks))
924916 then {
925917 let outAssetId = parseAssetId(outAssetIdStr)
926918 let userAddress = i.caller
927919 let txId = i.transactionId
928920 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
929921 if ((unstakeInv == unstakeInv))
930922 then {
931- let $t03621836348 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
932- let amountEstimated = $t03621836348._1
933- let commonState = $t03621836348._2
934- let feeAmount = $t03621836348._3
935- let bonus = $t03621836348._4
923+ let $t03612736257 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
924+ let amountEstimated = $t03612736257._1
925+ let commonState = $t03612736257._2
926+ let feeAmount = $t03612736257._3
927+ let bonus = $t03612736257._4
936928 let amount = if (if ((minOutAmount > 0))
937929 then (minOutAmount > amountEstimated)
938930 else false)
939931 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
940932 else amountEstimated
941933 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
942934 if ((burnInv == burnInv))
943935 then {
944936 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
945937 let sendFee = if ((feeAmount > 0))
946938 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
947939 else nil
948940 $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
949941 }
950942 else throw("Strict value is not equal to itself.")
951943 }
952944 else throw("Strict value is not equal to itself.")
953945 }
954946 else throw("Strict value is not equal to itself.")
955947 }
956948
957949
958950
959951 @Callable(i)
960952 func get () = {
961953 let res = commonGet(i)
962954 let outAmtAmt = res._1
963955 let outPrAmt = res._2
964956 let pmtAmt = res._3
965957 let pmtAssetId = res._4
966958 let state = res._5
967959 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
968960 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
969961 then state
970962 else throw("Strict value is not equal to itself.")
971963 }
972964
973965
974966
975967 @Callable(i)
976968 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
977969 let res = commonGet(i)
978970 let outAmAmt = res._1
979971 let outPrAmt = res._2
980972 let pmtAmt = res._3
981973 let pmtAssetId = res._4
982974 let state = res._5
983975 if ((noLessThenAmtAsset > outAmAmt))
984976 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
985977 else if ((noLessThenPriceAsset > outPrAmt))
986978 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
987979 else {
988980 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
989981 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
990982 then state
991983 else throw("Strict value is not equal to itself.")
992984 }
993985 }
994986
995987
996988
997989 @Callable(i)
998990 func unstakeAndGet (amount) = {
999991 let checkPayments = if ((size(i.payments) != 0))
1000992 then throw("No payments are expected")
1001993 else true
1002994 if ((checkPayments == checkPayments))
1003995 then {
1004996 let cfg = getPoolConfig()
1005997 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
1006998 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
1007999 if ((unstakeInv == unstakeInv))
10081000 then {
10091001 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
10101002 let poolStatus = parseIntValue(res._9)
10111003 let state = res._10
10121004 let checkPoolStatus = if (if (isGlobalShutdown())
10131005 then true
10141006 else (poolStatus == PoolShutdown))
10151007 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
10161008 else true
10171009 if ((checkPoolStatus == checkPoolStatus))
10181010 then {
10191011 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
10201012 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10211013 then state
10221014 else throw("Strict value is not equal to itself.")
10231015 }
10241016 else throw("Strict value is not equal to itself.")
10251017 }
10261018 else throw("Strict value is not equal to itself.")
10271019 }
10281020 else throw("Strict value is not equal to itself.")
10291021 }
10301022
10311023
10321024
10331025 @Callable(i)
10341026 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
10351027 let isGetDisabled = if (isGlobalShutdown())
10361028 then true
10371029 else (cfgPoolStatus == PoolShutdown)
10381030 let checks = [if (!(isGetDisabled))
10391031 then true
10401032 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
10411033 then true
10421034 else throw("no payments are expected")]
10431035 if ((checks == checks))
10441036 then {
10451037 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10461038 if ((unstakeInv == unstakeInv))
10471039 then {
10481040 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
10491041 let outAmAmt = res._1
10501042 let outPrAmt = res._2
10511043 let state = res._10
10521044 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
10531045 then true
10541046 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
10551047 then true
10561048 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
10571049 if ((checkAmounts == checkAmounts))
10581050 then {
10591051 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
10601052 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10611053 then state
10621054 else throw("Strict value is not equal to itself.")
10631055 }
10641056 else throw("Strict value is not equal to itself.")
10651057 }
10661058 else throw("Strict value is not equal to itself.")
10671059 }
10681060 else throw("Strict value is not equal to itself.")
10691061 }
10701062
10711063
10721064
10731065 @Callable(i)
10741066 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
10751067 then throw("permissions denied")
10761068 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
10771069
10781070
10791071
10801072 @Callable(i)
10811073 func refreshKLp () = {
1082- let lastRefreshedBlockHeight = valueOrElse(getInteger(keyLastKLpRefreshed), 0)
1083- let delayNotReachedErrorMessage = throwErr(makeString([value(getString(keyRefreshKLpDelay)), "blocks have not passed since the previous call"], " "))
1084- let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= 30))
1085- then true
1086- else delayNotReachedErrorMessage
1074+ let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
1075+ let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
1076+ then unit
1077+ else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
10871078 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
10881079 then {
1089- let updatedKLp = asInt(refreshKLpInternal())
1090-[IntegerEntry(keyLastKLpRefreshed, height), IntegerEntry(keyKLp, updatedKLp)]
1080+ let updatedKLp = refreshKLpInternal()
1081+[IntegerEntry(keyKLpRefreshedHeight, height), IntegerEntry(keyKLp, updatedKLp)]
10911082 }
10921083 else throw("Strict value is not equal to itself.")
10931084 }
10941085
10951086
10961087
10971088 @Callable(i)
10981089 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
10991090
11001091
11011092
11021093 @Callable(i)
11031094 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
11041095
11051096
11061097
11071098 @Callable(i)
11081099 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
11091100 let prices = calcPrices(amAmt, prAmt, lpAmt)
11101101 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
11111102 }
11121103
11131104
11141105
11151106 @Callable(i)
11161107 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
11171108
11181109
11191110
11201111 @Callable(i)
11211112 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
11221113
11231114
11241115
11251116 @Callable(i)
11261117 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
11271118
11281119
11291120
11301121 @Callable(i)
11311122 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
11321123
11331124
11341125
11351126 @Callable(i)
11361127 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
11371128 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
11381129 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
11391130 }
11401131
11411132
11421133
11431134 @Callable(i)
11441135 func statsREADONLY () = {
11451136 let cfg = getPoolConfig()
11461137 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11471138 let amtAssetId = cfg[idxAmtAssetId]
11481139 let priceAssetId = cfg[idxPriceAssetId]
11491140 let iAmtAssetId = cfg[idxIAmtAssetId]
11501141 let iPriceAssetId = cfg[idxIPriceAssetId]
11511142 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
11521143 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
11531144 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
11541145 let accAmtAssetBalance = getAccBalance(amtAssetId)
11551146 let accPriceAssetBalance = getAccBalance(priceAssetId)
11561147 let pricesList = if ((poolLPBalance == 0))
11571148 then [zeroBigInt, zeroBigInt, zeroBigInt]
11581149 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
11591150 let curPrice = 0
11601151 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
11611152 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
11621153 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
11631154 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(accAmtAssetBalance), toString(accPriceAssetBalance), toString(poolLPBalance), toString(curPrice), toString(lpAmtAssetShare), toString(lpPriceAssetShare), toString(poolWeight)], SEP))
11641155 }
11651156
11661157
11671158
11681159 @Callable(i)
11691160 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
11701161 let cfg = getPoolConfig()
11711162 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11721163 let amAssetIdStr = cfg[idxAmtAssetId]
11731164 let amAssetId = fromBase58String(amAssetIdStr)
11741165 let prAssetIdStr = cfg[idxPriceAssetId]
11751166 let prAssetId = fromBase58String(prAssetIdStr)
11761167 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
11771168 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
11781169 let poolStatus = cfg[idxPoolStatus]
11791170 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
11801171 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
11811172 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
11821173 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
11831174 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
11841175 let curPriceX18 = if ((poolLPBalance == 0))
11851176 then zeroBigInt
11861177 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
11871178 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
11881179 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
11891180 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
11901181 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
11911182 let calcLpAmt = estPut._1
11921183 let curPriceCalc = estPut._3
11931184 let amBalance = estPut._4
11941185 let prBalance = estPut._5
11951186 let lpEmission = estPut._6
11961187 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP))
11971188 }
11981189
11991190
12001191
12011192 @Callable(i)
12021193 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
12031194 let cfg = getPoolConfig()
12041195 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12051196 let amAssetIdStr = cfg[idxAmtAssetId]
12061197 let amAssetId = fromBase58String(amAssetIdStr)
12071198 let prAssetIdStr = cfg[idxPriceAssetId]
12081199 let prAssetId = fromBase58String(prAssetIdStr)
12091200 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12101201 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12111202 let poolStatus = cfg[idxPoolStatus]
12121203 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12131204 let amBalanceRaw = getAccBalance(amAssetIdStr)
12141205 let prBalanceRaw = getAccBalance(prAssetIdStr)
12151206 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
12161207 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
12171208 let curPriceX18 = if ((poolLPBalance == 0))
12181209 then zeroBigInt
12191210 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
12201211 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
12211212 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
12221213 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
12231214 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
12241215 let calcLpAmt = estPut._1
12251216 let curPriceCalc = estPut._3
12261217 let amBalance = estPut._4
12271218 let prBalance = estPut._5
12281219 let lpEmission = estPut._6
12291220 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP))
12301221 }
12311222
12321223
12331224
12341225 @Callable(i)
12351226 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
12361227 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
12371228 let outAmAmt = res._1
12381229 let outPrAmt = res._2
12391230 let amBalance = res._5
12401231 let prBalance = res._6
12411232 let lpEmission = res._7
12421233 let curPrice = res._8
12431234 let poolStatus = parseIntValue(res._9)
12441235 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(outAmAmt), toString(outPrAmt), toString(amBalance), toString(prBalance), toString(lpEmission), toString(curPrice), toString(poolStatus)], SEP))
12451236 }
12461237
12471238
12481239 @Verifier(tx)
12491240 func verify () = {
12501241 let targetPublicKey = match managerPublicKeyOrUnit() {
12511242 case pk: ByteVector =>
12521243 pk
12531244 case _: Unit =>
12541245 tx.senderPublicKey
12551246 case _ =>
12561247 throw("Match error")
12571248 }
12581249 match tx {
12591250 case order: Order =>
12601251 let matcherPub = getMatcherPubOrFail()
12611252 let orderValid = validateMatcherOrderAllowed(order)
12621253 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
12631254 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
12641255 if (if (if (orderValid)
12651256 then senderValid
12661257 else false)
12671258 then matcherValid
12681259 else false)
12691260 then true
12701261 else throwOrderError(orderValid, senderValid, matcherValid)
12711262 case s: SetScriptTransaction =>
12721263 let newHash = blake2b256(value(s.script))
12731264 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
12741265 let currentHash = scriptHash(this)
12751266 if (if ((allowedHash == newHash))
12761267 then (currentHash != newHash)
12771268 else false)
12781269 then true
12791270 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
12801271 case _ =>
12811272 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
12821273 }
12831274 }
12841275

github/deemru/w8io/026f985 
160.29 ms