tx · 9y8zndgJNMVX6dUpnu26RThhviB6iKrrZywEQUy6QQsQ

3Msa444cj3rGwoUM28fK5iMwFXn61SfJpqs:  -0.03200000 Waves

2023.01.16 15:30 [2407503] smart account 3Msa444cj3rGwoUM28fK5iMwFXn61SfJpqs > SELF 0.00000000 Waves

{ "type": 13, "id": "9y8zndgJNMVX6dUpnu26RThhviB6iKrrZywEQUy6QQsQ", "fee": 3200000, "feeAssetId": null, "timestamp": 1673872238272, "version": 1, "sender": "3Msa444cj3rGwoUM28fK5iMwFXn61SfJpqs", "senderPublicKey": "Fv4cVRzKj6MwfJQ2BrrtpyPyc3dSbKxA91GqxHZCCqC3", "proofs": [ "22AkLcxwRoQXuVbkR2Jtjb8oJDUoScdev4UvB87VhETjKvvUtco7rTi7NHevh3Sba8cYP5MNvFYhrRXWGCVXhML3" ], "script": "base64:BgLhKAgCEgYKBAEEAQgSAwoBCBIDCgEIEgASBAoCAQQSAwoBARIECgIBBBIECgIIARIECgIIARIECgIIARIFCgMBCAESABIECgIBARIDCgEBEgUKAwEBARIECgIICBIAEgMKAQgSBQoDAQEBEgQKAgEBEgQKAggBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgASAwoBARIDCgEBEgQKAggBIgpsUGRlY2ltYWxzIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiILd2F2ZXNTdHJpbmciA1NFUCIKUG9vbEFjdGl2ZSIPUG9vbFB1dERpc2FibGVkIhNQb29sTWF0Y2hlckRpc2FibGVkIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIg1pZHhQb29sU3RhdHVzIhBpZHhQb29sTFBBc3NldElkIg1pZHhBbXRBc3NldElkIg9pZHhQcmljZUFzc2V0SWQiDmlkeEFtdEFzc2V0RGNtIhBpZHhQcmljZUFzc2V0RGNtIg5pZHhJQW10QXNzZXRJZCIQaWR4SVByaWNlQXNzZXRJZC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BQJjYwkAzAgCCQCkAwEFAmJWBQNuaWwFAWoBAmZVAQJmVgAEAmZXBAJkcgkBAmV3AAMJAAECBQJkcgIKQnl0ZVZlY3RvcgQCZUEFAmRyBQJlQQMJAAECBQJkcgIEVW5pdAgFAmZVD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yBAJkcgUCZlUDCQABAgUCZHICBU9yZGVyBAJjUwUCZHIEAmZYCQECYUgABAJhcwkBAmNSAQUCY1MEAmF0CQD0AwMIBQJjUwlib2R5Qnl0ZXMJAJEDAggFAmNTBnByb29mcwAACAUCY1MPc2VuZGVyUHVibGljS2V5BAJhdQkA9AMDCAUCY1MJYm9keUJ5dGVzCQCRAwIIBQJjUwZwcm9vZnMAAQUCZlgDAwMFAmFzBQJhdAcFAmF1BwYJAQJhcgMFAmFzBQJhdAUCYXUDCQABAgUCZHICFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJleAUCZHIEAmZZCQD2AwEJAQV2YWx1ZQEIBQJleAZzY3JpcHQEAmZaCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYUIJAQJhcAAEAmdhCQDxBwEFBHRoaXMDAwkAAAIFAmZaBQJmWQkBAiE9AgUCZ2EFAmZZBwYJAPQDAwgFAmZVCWJvZHlCeXRlcwkAkQMCCAUCZlUGcHJvb2ZzAAAFAmZXCQD0AwMIBQJmVQlib2R5Qnl0ZXMJAJEDAggFAmZVBnByb29mcwAABQJmV4zSVxk=", "chainId": 84, "height": 2407503, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7mFjE82dv1tE8aWMes4fLxdQ95hNv5jPSXgzP6sExAE6 Next: ES76bQFabsugZrU9mRDhVNBZmnrhj71arxd6bMEikKzb Diff:
OldNewDifferences
7676 func absBigInt (val) = if ((zeroBigInt > val))
7777 then -(val)
7878 else val
79+
80+
81+func swapContract () = "%s__swapContract"
7982
8083
8184 func fc () = "%s__factoryContract"
191194
192195 let poolConfigParsed = parsePoolConfig(getPoolConfig())
193196
194-let $t076017767 = poolConfigParsed
197+let $t076627828 = poolConfigParsed
195198
196-let cfgPoolAddress = $t076017767._1
199+let cfgPoolAddress = $t076627828._1
197200
198-let cfgPoolStatus = $t076017767._2
201+let cfgPoolStatus = $t076627828._2
199202
200-let cfgLpAssetId = $t076017767._3
203+let cfgLpAssetId = $t076627828._3
201204
202-let cfgAmountAssetId = $t076017767._4
205+let cfgAmountAssetId = $t076627828._4
203206
204-let cfgPriceAssetId = $t076017767._5
207+let cfgPriceAssetId = $t076627828._5
205208
206-let cfgAmountAssetDecimals = $t076017767._6
209+let cfgAmountAssetDecimals = $t076627828._6
207210
208-let cfgPriceAssetDecimals = $t076017767._7
211+let cfgPriceAssetDecimals = $t076627828._7
209212
210213 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
211214
484487 else if ((paymentAssetId == cfgPriceAssetId))
485488 then false
486489 else throwErr("invalid asset")
487- let $t02266422957 = if (isEval)
490+ let $t02272523018 = if (isEval)
488491 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
489492 else if (paymentInAmountAsset)
490493 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
491494 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
492- let amountBalanceOld = $t02266422957._1
493- let priceBalanceOld = $t02266422957._2
494- let $t02296123110 = if (paymentInAmountAsset)
495+ let amountBalanceOld = $t02272523018._1
496+ let priceBalanceOld = $t02272523018._2
497+ let $t02302223171 = if (paymentInAmountAsset)
495498 then $Tuple2(paymentAmountRaw, 0)
496499 else $Tuple2(0, paymentAmountRaw)
497- let amountAssetAmountRaw = $t02296123110._1
498- let priceAssetAmountRaw = $t02296123110._2
500+ let amountAssetAmountRaw = $t02302223171._1
501+ let priceAssetAmountRaw = $t02302223171._2
499502 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
500503 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
501- let $t02324223306 = takeFee(paymentAmountRaw, inFee)
502- let paymentAmount = $t02324223306._1
503- let feeAmount = $t02324223306._2
504+ let $t02330323367 = takeFee(paymentAmountRaw, inFee)
505+ let paymentAmount = $t02330323367._1
506+ let feeAmount = $t02330323367._2
504507 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
505508 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
506509 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
523526 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
524527 let priceOld = fromX18(priceOldX18, scale8)
525528 let loss = {
526- let $t02478324950 = if (paymentInAmountAsset)
529+ let $t02484425011 = if (paymentInAmountAsset)
527530 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
528531 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
529- let amount = $t02478324950._1
530- let balance = $t02478324950._2
532+ let amount = $t02484425011._1
533+ let balance = $t02484425011._2
531534 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
532535 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
533536 }
561564 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
562565 let redeemedBigInt = toBigInt(paymentAmount)
563566 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
564- let $t02653026586 = takeFee(amountRaw, outFee)
565- let totalAmount = $t02653026586._1
566- let feeAmount = $t02653026586._2
567- let $t02659026816 = if (outInAmountAsset)
567+ let $t02659126647 = takeFee(amountRaw, outFee)
568+ let totalAmount = $t02659126647._1
569+ let feeAmount = $t02659126647._2
570+ let $t02665126877 = if (outInAmountAsset)
568571 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
569572 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
570- let outAmAmount = $t02659026816._1
571- let outPrAmount = $t02659026816._2
572- let amBalanceNew = $t02659026816._3
573- let prBalanceNew = $t02659026816._4
573+ let outAmAmount = $t02665126877._1
574+ let outPrAmount = $t02665126877._2
575+ let amBalanceNew = $t02665126877._3
576+ let prBalanceNew = $t02665126877._4
574577 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
575578 let priceNew = fromX18(priceNewX18, scale8)
576579 let commonState = if (isEval)
633636 throw("Match error")
634637 }
635638 }
639+
640+
641+@Callable(i)
642+func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo) = {
643+ let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
644+ then true
645+ else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(getStringOrFail(this, swapContract()))))
646+ then true
647+ else throwErr("Permission denied")]
648+ if ((checks == checks))
649+ then {
650+ let pmt = value(i.payments[0])
651+ let assetIn = toBase58String(value(pmt.assetId))
652+ let assetOut = if ((isReverse == false))
653+ then {
654+ let assetOut = getStringOrFail(this, pa())
655+ assetOut
656+ }
657+ else {
658+ let assetOut = getStringOrFail(this, aa())
659+ assetOut
660+ }
661+ let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
662+ let poolAssetOutBalance = getAccBalance(assetOut)
663+ let amountOut = ((poolAssetOutBalance * cleanAmountIn) / (poolAssetInBalance + cleanAmountIn))
664+ let checkMin = [(amountOut >= amountOutMin), "Exchange resulted in fewer coins than expected"]
665+ if ((checkMin == checkMin))
666+ then [ScriptTransfer(addressFromStringValue(addressTo), amountOut, fromBase58String(assetOut))]
667+ else throw("Strict value is not equal to itself.")
668+ }
669+ else throw("Strict value is not equal to itself.")
670+ }
671+
672+
673+
674+@Callable(i)
675+func setSwapContract (swappAddr) = {
676+ let checkCaller = mustManager(i)
677+ if ((checkCaller == checkCaller))
678+ then [StringEntry(swapContract(), swappAddr)]
679+ else throw("Strict value is not equal to itself.")
680+ }
681+
636682
637683
638684 @Callable(i)
763809 let paymentAmountRaw = payment.amount
764810 let userAddress = i.caller
765811 let txId = i.transactionId
766- let $t03172331853 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
767- if (($t03172331853 == $t03172331853))
812+ let $t03299433124 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
813+ if (($t03299433124 == $t03299433124))
768814 then {
769- let bonus = $t03172331853._4
770- let feeAmount = $t03172331853._3
771- let commonState = $t03172331853._2
772- let emitAmountEstimated = $t03172331853._1
815+ let bonus = $t03299433124._4
816+ let feeAmount = $t03299433124._3
817+ let commonState = $t03299433124._2
818+ let emitAmountEstimated = $t03299433124._1
773819 let emitAmount = if (if ((minOutAmount > 0))
774820 then (minOutAmount > emitAmountEstimated)
775821 else false)
802848
803849 @Callable(i)
804850 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
805- let $t03258232717 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
806- let emitAmountEstimated = $t03258232717._1
807- let commonState = $t03258232717._2
808- let feeAmount = $t03258232717._3
809- let bonus = $t03258232717._4
851+ let $t03385333988 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
852+ let emitAmountEstimated = $t03385333988._1
853+ let commonState = $t03385333988._2
854+ let feeAmount = $t03385333988._3
855+ let bonus = $t03385333988._4
810856 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
811857 }
812858
840886 let paymentAmount = payment.amount
841887 let userAddress = i.caller
842888 let txId = i.transactionId
843- let $t03352233657 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
844- if (($t03352233657 == $t03352233657))
889+ let $t03479334928 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
890+ if (($t03479334928 == $t03479334928))
845891 then {
846- let bonus = $t03352233657._4
847- let feeAmount = $t03352233657._3
848- let commonState = $t03352233657._2
849- let amountEstimated = $t03352233657._1
892+ let bonus = $t03479334928._4
893+ let feeAmount = $t03479334928._3
894+ let commonState = $t03479334928._2
895+ let amountEstimated = $t03479334928._1
850896 let amount = if (if ((minOutAmount > 0))
851897 then (minOutAmount > amountEstimated)
852898 else false)
872918
873919 @Callable(i)
874920 func getOneTknREADONLY (outAssetId,paymentAmount) = {
875- let $t03429234430 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
876- let amountEstimated = $t03429234430._1
877- let commonState = $t03429234430._2
878- let feeAmount = $t03429234430._3
879- let bonus = $t03429234430._4
921+ let $t03556335701 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
922+ let amountEstimated = $t03556335701._1
923+ let commonState = $t03556335701._2
924+ let feeAmount = $t03556335701._3
925+ let bonus = $t03556335701._4
880926 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
881927 }
882928
910956 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
911957 if ((unstakeInv == unstakeInv))
912958 then {
913- let $t03525535388 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
914- if (($t03525535388 == $t03525535388))
959+ let $t03652636659 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
960+ if (($t03652636659 == $t03652636659))
915961 then {
916- let bonus = $t03525535388._4
917- let feeAmount = $t03525535388._3
918- let commonState = $t03525535388._2
919- let amountEstimated = $t03525535388._1
962+ let bonus = $t03652636659._4
963+ let feeAmount = $t03652636659._3
964+ let commonState = $t03652636659._2
965+ let amountEstimated = $t03652636659._1
920966 let amount = if (if ((minOutAmount > 0))
921967 then (minOutAmount > amountEstimated)
922968 else false)
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
79+
80+
81+func swapContract () = "%s__swapContract"
7982
8083
8184 func fc () = "%s__factoryContract"
8285
8386
8487 func mpk () = "%s__managerPublicKey"
8588
8689
8790 func pmpk () = "%s__pendingManagerPublicKey"
8891
8992
9093 func pl () = "%s%s__price__last"
9194
9295
9396 func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
9497
9598
9699 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
97100
98101
99102 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
100103
101104
102105 func aa () = "%s__amountAsset"
103106
104107
105108 func pa () = "%s__priceAsset"
106109
107110
108111 func keyFactoryConfig () = "%s__factoryConfig"
109112
110113
111114 func keyMatcherPub () = "%s%s__matcher__publicKey"
112115
113116
114117 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
115118
116119
117120 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
118121
119122
120123 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
121124
122125
123126 func keyAllPoolsShutdown () = "%s__shutdown"
124127
125128
126129 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
127130
128131
129132 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
130133
131134
132135 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
133136
134137 func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
135138
136139
137140 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
138141
139142
140143 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
141144
142145
143146 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
144147
145148
146149 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
147150
148151 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
149152
150153 let inFee = {
151154 let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil)
152155 if ($isInstanceOf(@, "Int"))
153156 then @
154157 else throw(($getType(@) + " couldn't be cast to Int"))
155158 }
156159
157160 let outFee = {
158161 let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil)
159162 if ($isInstanceOf(@, "Int"))
160163 then @
161164 else throw(($getType(@) + " couldn't be cast to Int"))
162165 }
163166
164167 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
165168
166169
167170 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
168171
169172
170173 func getPoolConfig () = {
171174 let amtAsset = getStringOrFail(this, aa())
172175 let priceAsset = getStringOrFail(this, pa())
173176 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
174177 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
175178 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
176179 }
177180
178181
179182 func parseAssetId (input) = if ((input == wavesString))
180183 then unit
181184 else fromBase58String(input)
182185
183186
184187 func assetIdToString (input) = if ((input == unit))
185188 then wavesString
186189 else toBase58String(value(input))
187190
188191
189192 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]))
190193
191194
192195 let poolConfigParsed = parsePoolConfig(getPoolConfig())
193196
194-let $t076017767 = poolConfigParsed
197+let $t076627828 = poolConfigParsed
195198
196-let cfgPoolAddress = $t076017767._1
199+let cfgPoolAddress = $t076627828._1
197200
198-let cfgPoolStatus = $t076017767._2
201+let cfgPoolStatus = $t076627828._2
199202
200-let cfgLpAssetId = $t076017767._3
203+let cfgLpAssetId = $t076627828._3
201204
202-let cfgAmountAssetId = $t076017767._4
205+let cfgAmountAssetId = $t076627828._4
203206
204-let cfgPriceAssetId = $t076017767._5
207+let cfgPriceAssetId = $t076627828._5
205208
206-let cfgAmountAssetDecimals = $t076017767._6
209+let cfgAmountAssetDecimals = $t076627828._6
207210
208-let cfgPriceAssetDecimals = $t076017767._7
211+let cfgPriceAssetDecimals = $t076627828._7
209212
210213 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
211214
212215
213216 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
214217
215218 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
216219
217220 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)
218221
219222
220223 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)
221224
222225
223226 func getAccBalance (assetId) = if ((assetId == "WAVES"))
224227 then wavesBalance(this).available
225228 else assetBalance(this, fromBase58String(assetId))
226229
227230
228231 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
229232
230233
231234 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
232235 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
233236 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
234237 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
235238 }
236239
237240
238241 func calcPrices (amAmt,prAmt,lpAmt) = {
239242 let cfg = getPoolConfig()
240243 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
241244 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
242245 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
243246 let amAmtX18 = toX18(amAmt, amtAssetDcm)
244247 let prAmtX18 = toX18(prAmt, priceAssetDcm)
245248 let lpAmtX18 = toX18(lpAmt, scale8)
246249 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
247250 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
248251 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
249252 }
250253
251254
252255 func calculatePrices (amAmt,prAmt,lpAmt) = {
253256 let prices = calcPrices(amAmt, prAmt, lpAmt)
254257 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
255258 }
256259
257260
258261 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
259262 let cfg = getPoolConfig()
260263 let lpAssetId = cfg[idxPoolLPAssetId]
261264 let amAssetId = cfg[idxAmtAssetId]
262265 let prAssetId = cfg[idxPriceAssetId]
263266 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
264267 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
265268 let poolStatus = cfg[idxPoolStatus]
266269 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
267270 if ((lpAssetId != pmtAssetId))
268271 then throw("Invalid asset passed.")
269272 else {
270273 let amBalance = getAccBalance(amAssetId)
271274 let amBalanceX18 = toX18(amBalance, amAssetDcm)
272275 let prBalance = getAccBalance(prAssetId)
273276 let prBalanceX18 = toX18(prBalance, prAssetDcm)
274277 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
275278 let curPrice = fromX18(curPriceX18, scale8)
276279 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
277280 let lpEmissionX18 = toX18(lpEmission, scale8)
278281 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
279282 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
280283 let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
281284 let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
282285 let state = if ((txId58 == ""))
283286 then nil
284287 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
285288 then unit
286289 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
287290 then unit
288291 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)]
289292 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
290293 }
291294 }
292295
293296
294297 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
295298 let cfg = getPoolConfig()
296299 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
297300 let amAssetIdStr = cfg[idxAmtAssetId]
298301 let prAssetIdStr = cfg[idxPriceAssetId]
299302 let iAmtAssetId = cfg[idxIAmtAssetId]
300303 let iPriceAssetId = cfg[idxIPriceAssetId]
301304 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
302305 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
303306 let poolStatus = cfg[idxPoolStatus]
304307 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
305308 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
306309 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
307310 if (if ((amAssetIdStr != inAmAssetIdStr))
308311 then true
309312 else (prAssetIdStr != inPrAssetIdStr))
310313 then throw("Invalid amt or price asset passed.")
311314 else {
312315 let amBalance = if (isEvaluate)
313316 then getAccBalance(amAssetIdStr)
314317 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
315318 let prBalance = if (isEvaluate)
316319 then getAccBalance(prAssetIdStr)
317320 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
318321 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
319322 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
320323 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
321324 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
322325 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
323326 let res = if ((lpEmission == 0))
324327 then {
325328 let curPriceX18 = zeroBigInt
326329 let slippageX18 = zeroBigInt
327330 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
328331 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
329332 }
330333 else {
331334 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
332335 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
333336 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
334337 if (if ((curPriceX18 != zeroBigInt))
335338 then (slippageX18 > slippageToleranceX18)
336339 else false)
337340 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
338341 else {
339342 let lpEmissionX18 = toX18(lpEmission, scale8)
340343 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
341344 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
342345 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
343346 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
344347 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
345348 let expAmtAssetAmtX18 = expectedAmts._1
346349 let expPriceAssetAmtX18 = expectedAmts._2
347350 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
348351 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18)
349352 }
350353 }
351354 let calcLpAmt = res._1
352355 let calcAmAssetPmt = res._2
353356 let calcPrAssetPmt = res._3
354357 let curPrice = fromX18(res._4, scale8)
355358 let slippageCalc = fromX18(res._5, scale8)
356359 if ((0 >= calcLpAmt))
357360 then throw("Invalid calculations. LP calculated is less than zero.")
358361 else {
359362 let emitLpAmt = if (!(emitLp))
360363 then 0
361364 else calcLpAmt
362365 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
363366 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
364367 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))]
365368 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
366369 }
367370 }
368371 }
369372
370373
371374 func validateMatcherOrderAllowed (order) = {
372375 let cfg = getPoolConfig()
373376 let amtAssetId = cfg[idxAmtAssetId]
374377 let priceAssetId = cfg[idxPriceAssetId]
375378 let poolStatus = parseIntValue(cfg[idxPoolStatus])
376379 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
377380 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
378381 let accAmtAssetBalance = getAccBalance(amtAssetId)
379382 let accPriceAssetBalance = getAccBalance(priceAssetId)
380383 let curPriceX18 = if ((order.orderType == Buy))
381384 then privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance + order.amount), accPriceAssetBalance)
382385 else privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance - order.amount), accPriceAssetBalance)
383386 let curPrice = fromX18(curPriceX18, scale8)
384387 if (if (if (isGlobalShutdown())
385388 then true
386389 else (poolStatus == PoolMatcherDisabled))
387390 then true
388391 else (poolStatus == PoolShutdown))
389392 then throw("Exchange operations disabled")
390393 else {
391394 let orderAmtAsset = order.assetPair.amountAsset
392395 let orderAmtAssetStr = if ((orderAmtAsset == unit))
393396 then "WAVES"
394397 else toBase58String(value(orderAmtAsset))
395398 let orderPriceAsset = order.assetPair.priceAsset
396399 let orderPriceAssetStr = if ((orderPriceAsset == unit))
397400 then "WAVES"
398401 else toBase58String(value(orderPriceAsset))
399402 if (if ((orderAmtAssetStr != amtAssetId))
400403 then true
401404 else (orderPriceAssetStr != priceAssetId))
402405 then throw("Wrong order assets.")
403406 else {
404407 let orderPrice = order.price
405408 let priceDcm = fraction(scale8, priceAssetDcm, amtAssetDcm)
406409 let castedOrderPrice = toScale(orderPrice, scale8, priceDcm)
407410 let isOrderPriceValid = if ((order.orderType == Buy))
408411 then (curPrice >= castedOrderPrice)
409412 else (castedOrderPrice >= curPrice)
410413 true
411414 }
412415 }
413416 }
414417
415418
416419 func commonGet (i) = if ((size(i.payments) != 1))
417420 then throw("exactly 1 payment is expected")
418421 else {
419422 let pmt = value(i.payments[0])
420423 let pmtAssetId = value(pmt.assetId)
421424 let pmtAmt = pmt.amount
422425 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
423426 let outAmAmt = res._1
424427 let outPrAmt = res._2
425428 let poolStatus = parseIntValue(res._9)
426429 let state = res._10
427430 if (if (isGlobalShutdown())
428431 then true
429432 else (poolStatus == PoolShutdown))
430433 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
431434 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
432435 }
433436
434437
435438 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
436439 then throw("exactly 2 payments are expected")
437440 else {
438441 let amAssetPmt = value(i.payments[0])
439442 let prAssetPmt = value(i.payments[1])
440443 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
441444 let poolStatus = parseIntValue(estPut._8)
442445 if (if (if (isGlobalShutdown())
443446 then true
444447 else (poolStatus == PoolPutDisabled))
445448 then true
446449 else (poolStatus == PoolShutdown))
447450 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
448451 else estPut
449452 }
450453
451454
452455 func emit (amount) = {
453456 let emitInv = invoke(factoryContract, "emit", [amount], nil)
454457 if ((emitInv == emitInv))
455458 then {
456459 let emitInvLegacy = match emitInv {
457460 case legacyFactoryContract: Address =>
458461 invoke(legacyFactoryContract, "emit", [amount], nil)
459462 case _ =>
460463 unit
461464 }
462465 if ((emitInvLegacy == emitInvLegacy))
463466 then amount
464467 else throw("Strict value is not equal to itself.")
465468 }
466469 else throw("Strict value is not equal to itself.")
467470 }
468471
469472
470473 func takeFee (amount,fee) = {
471474 let feeAmount = if ((fee == 0))
472475 then 0
473476 else fraction(amount, fee, scale8)
474477 $Tuple2((amount - feeAmount), feeAmount)
475478 }
476479
477480
478481 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
479482 let isEval = (txId == unit)
480483 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
481484 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
482485 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
483486 then true
484487 else if ((paymentAssetId == cfgPriceAssetId))
485488 then false
486489 else throwErr("invalid asset")
487- let $t02266422957 = if (isEval)
490+ let $t02272523018 = if (isEval)
488491 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
489492 else if (paymentInAmountAsset)
490493 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
491494 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
492- let amountBalanceOld = $t02266422957._1
493- let priceBalanceOld = $t02266422957._2
494- let $t02296123110 = if (paymentInAmountAsset)
495+ let amountBalanceOld = $t02272523018._1
496+ let priceBalanceOld = $t02272523018._2
497+ let $t02302223171 = if (paymentInAmountAsset)
495498 then $Tuple2(paymentAmountRaw, 0)
496499 else $Tuple2(0, paymentAmountRaw)
497- let amountAssetAmountRaw = $t02296123110._1
498- let priceAssetAmountRaw = $t02296123110._2
500+ let amountAssetAmountRaw = $t02302223171._1
501+ let priceAssetAmountRaw = $t02302223171._2
499502 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
500503 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
501- let $t02324223306 = takeFee(paymentAmountRaw, inFee)
502- let paymentAmount = $t02324223306._1
503- let feeAmount = $t02324223306._2
504+ let $t02330323367 = takeFee(paymentAmountRaw, inFee)
505+ let paymentAmount = $t02330323367._1
506+ let feeAmount = $t02330323367._2
504507 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
505508 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
506509 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
507510 let priceNew = fromX18(priceNewX18, scale8)
508511 let paymentBalance = if (paymentInAmountAsset)
509512 then amountBalanceOld
510513 else priceBalanceOld
511514 let paymentBalanceBigInt = toBigInt(paymentBalance)
512515 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
513516 let chechSupply = if ((supplyBigInt > big0))
514517 then true
515518 else throwErr("initial deposit requires all coins")
516519 if ((chechSupply == chechSupply))
517520 then {
518521 let depositBigInt = toBigInt(paymentAmount)
519522 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
520523 let commonState = if (isEval)
521524 then nil
522525 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))]
523526 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
524527 let priceOld = fromX18(priceOldX18, scale8)
525528 let loss = {
526- let $t02478324950 = if (paymentInAmountAsset)
529+ let $t02484425011 = if (paymentInAmountAsset)
527530 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
528531 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
529- let amount = $t02478324950._1
530- let balance = $t02478324950._2
532+ let amount = $t02484425011._1
533+ let balance = $t02484425011._2
531534 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
532535 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
533536 }
534537 $Tuple4(issueAmount, commonState, feeAmount, loss)
535538 }
536539 else throw("Strict value is not equal to itself.")
537540 }
538541
539542
540543 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
541544 let isEval = (txId == unit)
542545 let checks = [if ((paymentAssetId == cfgLpAssetId))
543546 then true
544547 else throwErr("invalid lp asset")]
545548 if ((checks == checks))
546549 then {
547550 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
548551 then true
549552 else if ((outAssetId == cfgPriceAssetId))
550553 then false
551554 else throwErr("invalid asset")
552555 let balanceBigInt = if (outInAmountAsset)
553556 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
554557 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
555558 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
556559 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
557560 let outBalance = if (outInAmountAsset)
558561 then amBalanceOld
559562 else prBalanceOld
560563 let outBalanceBigInt = toBigInt(outBalance)
561564 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
562565 let redeemedBigInt = toBigInt(paymentAmount)
563566 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
564- let $t02653026586 = takeFee(amountRaw, outFee)
565- let totalAmount = $t02653026586._1
566- let feeAmount = $t02653026586._2
567- let $t02659026816 = if (outInAmountAsset)
567+ let $t02659126647 = takeFee(amountRaw, outFee)
568+ let totalAmount = $t02659126647._1
569+ let feeAmount = $t02659126647._2
570+ let $t02665126877 = if (outInAmountAsset)
568571 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
569572 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
570- let outAmAmount = $t02659026816._1
571- let outPrAmount = $t02659026816._2
572- let amBalanceNew = $t02659026816._3
573- let prBalanceNew = $t02659026816._4
573+ let outAmAmount = $t02665126877._1
574+ let outPrAmount = $t02665126877._2
575+ let amBalanceNew = $t02665126877._3
576+ let prBalanceNew = $t02665126877._4
574577 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
575578 let priceNew = fromX18(priceNewX18, scale8)
576579 let commonState = if (isEval)
577580 then nil
578581 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)]
579582 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
580583 let priceOld = fromX18(priceOldX18, scale8)
581584 let loss = {
582585 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
583586 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
584587 }
585588 $Tuple4(totalAmount, commonState, feeAmount, loss)
586589 }
587590 else throw("Strict value is not equal to itself.")
588591 }
589592
590593
591594 func managerPublicKeyOrUnit () = match getString(mpk()) {
592595 case s: String =>
593596 fromBase58String(s)
594597 case _: Unit =>
595598 unit
596599 case _ =>
597600 throw("Match error")
598601 }
599602
600603
601604 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
602605 case s: String =>
603606 fromBase58String(s)
604607 case _: Unit =>
605608 unit
606609 case _ =>
607610 throw("Match error")
608611 }
609612
610613
611614 func isManager (i) = match managerPublicKeyOrUnit() {
612615 case pk: ByteVector =>
613616 (i.callerPublicKey == pk)
614617 case _: Unit =>
615618 (i.caller == this)
616619 case _ =>
617620 throw("Match error")
618621 }
619622
620623
621624 func mustManager (i) = {
622625 let pd = throw("Permission denied")
623626 match managerPublicKeyOrUnit() {
624627 case pk: ByteVector =>
625628 if ((i.callerPublicKey == pk))
626629 then true
627630 else pd
628631 case _: Unit =>
629632 if ((i.caller == this))
630633 then true
631634 else pd
632635 case _ =>
633636 throw("Match error")
634637 }
635638 }
639+
640+
641+@Callable(i)
642+func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo) = {
643+ let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
644+ then true
645+ else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(getStringOrFail(this, swapContract()))))
646+ then true
647+ else throwErr("Permission denied")]
648+ if ((checks == checks))
649+ then {
650+ let pmt = value(i.payments[0])
651+ let assetIn = toBase58String(value(pmt.assetId))
652+ let assetOut = if ((isReverse == false))
653+ then {
654+ let assetOut = getStringOrFail(this, pa())
655+ assetOut
656+ }
657+ else {
658+ let assetOut = getStringOrFail(this, aa())
659+ assetOut
660+ }
661+ let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
662+ let poolAssetOutBalance = getAccBalance(assetOut)
663+ let amountOut = ((poolAssetOutBalance * cleanAmountIn) / (poolAssetInBalance + cleanAmountIn))
664+ let checkMin = [(amountOut >= amountOutMin), "Exchange resulted in fewer coins than expected"]
665+ if ((checkMin == checkMin))
666+ then [ScriptTransfer(addressFromStringValue(addressTo), amountOut, fromBase58String(assetOut))]
667+ else throw("Strict value is not equal to itself.")
668+ }
669+ else throw("Strict value is not equal to itself.")
670+ }
671+
672+
673+
674+@Callable(i)
675+func setSwapContract (swappAddr) = {
676+ let checkCaller = mustManager(i)
677+ if ((checkCaller == checkCaller))
678+ then [StringEntry(swapContract(), swappAddr)]
679+ else throw("Strict value is not equal to itself.")
680+ }
681+
636682
637683
638684 @Callable(i)
639685 func setManager (pendingManagerPublicKey) = {
640686 let checkCaller = mustManager(i)
641687 if ((checkCaller == checkCaller))
642688 then {
643689 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
644690 if ((checkManagerPublicKey == checkManagerPublicKey))
645691 then [StringEntry(pmpk(), pendingManagerPublicKey)]
646692 else throw("Strict value is not equal to itself.")
647693 }
648694 else throw("Strict value is not equal to itself.")
649695 }
650696
651697
652698
653699 @Callable(i)
654700 func confirmManager () = {
655701 let pm = pendingManagerPublicKeyOrUnit()
656702 let hasPM = if (isDefined(pm))
657703 then true
658704 else throw("No pending manager")
659705 if ((hasPM == hasPM))
660706 then {
661707 let checkPM = if ((i.callerPublicKey == value(pm)))
662708 then true
663709 else throw("You are not pending manager")
664710 if ((checkPM == checkPM))
665711 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
666712 else throw("Strict value is not equal to itself.")
667713 }
668714 else throw("Strict value is not equal to itself.")
669715 }
670716
671717
672718
673719 @Callable(i)
674720 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
675721 then throw("Invalid slippageTolerance passed")
676722 else {
677723 let estPut = commonPut(i, slippageTolerance, true)
678724 let emitLpAmt = estPut._2
679725 let lpAssetId = estPut._7
680726 let state = estPut._9
681727 let amDiff = estPut._10
682728 let prDiff = estPut._11
683729 let amId = estPut._12
684730 let prId = estPut._13
685731 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
686732 if ((emitInv == emitInv))
687733 then {
688734 let emitInvLegacy = match emitInv {
689735 case legacyFactoryContract: Address =>
690736 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
691737 case _ =>
692738 unit
693739 }
694740 if ((emitInvLegacy == emitInvLegacy))
695741 then {
696742 let slippageAInv = if ((amDiff > 0))
697743 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
698744 else nil
699745 if ((slippageAInv == slippageAInv))
700746 then {
701747 let slippagePInv = if ((prDiff > 0))
702748 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
703749 else nil
704750 if ((slippagePInv == slippagePInv))
705751 then {
706752 let lpTransfer = if (shouldAutoStake)
707753 then {
708754 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
709755 if ((slpStakeInv == slpStakeInv))
710756 then nil
711757 else throw("Strict value is not equal to itself.")
712758 }
713759 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
714760 (state ++ lpTransfer)
715761 }
716762 else throw("Strict value is not equal to itself.")
717763 }
718764 else throw("Strict value is not equal to itself.")
719765 }
720766 else throw("Strict value is not equal to itself.")
721767 }
722768 else throw("Strict value is not equal to itself.")
723769 }
724770
725771
726772
727773 @Callable(i)
728774 func putForFree (maxSlippage) = if ((0 > maxSlippage))
729775 then throw("Invalid value passed")
730776 else {
731777 let estPut = commonPut(i, maxSlippage, false)
732778 estPut._9
733779 }
734780
735781
736782
737783 @Callable(i)
738784 func putOneTkn (minOutAmount,autoStake) = {
739785 let isPoolOneTokenOperationsDisabled = {
740786 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
741787 if ($isInstanceOf(@, "Boolean"))
742788 then @
743789 else throw(($getType(@) + " couldn't be cast to Boolean"))
744790 }
745791 let isPutDisabled = if (if (if (isGlobalShutdown())
746792 then true
747793 else (cfgPoolStatus == PoolPutDisabled))
748794 then true
749795 else (cfgPoolStatus == PoolShutdown))
750796 then true
751797 else isPoolOneTokenOperationsDisabled
752798 let checks = [if (if (!(isPutDisabled))
753799 then true
754800 else isManager(i))
755801 then true
756802 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
757803 then true
758804 else throwErr("exactly 1 payment are expected")]
759805 if ((checks == checks))
760806 then {
761807 let payment = i.payments[0]
762808 let paymentAssetId = payment.assetId
763809 let paymentAmountRaw = payment.amount
764810 let userAddress = i.caller
765811 let txId = i.transactionId
766- let $t03172331853 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
767- if (($t03172331853 == $t03172331853))
812+ let $t03299433124 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
813+ if (($t03299433124 == $t03299433124))
768814 then {
769- let bonus = $t03172331853._4
770- let feeAmount = $t03172331853._3
771- let commonState = $t03172331853._2
772- let emitAmountEstimated = $t03172331853._1
815+ let bonus = $t03299433124._4
816+ let feeAmount = $t03299433124._3
817+ let commonState = $t03299433124._2
818+ let emitAmountEstimated = $t03299433124._1
773819 let emitAmount = if (if ((minOutAmount > 0))
774820 then (minOutAmount > emitAmountEstimated)
775821 else false)
776822 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
777823 else emitAmountEstimated
778824 let emitInv = emit(emitAmount)
779825 if ((emitInv == emitInv))
780826 then {
781827 let lpTransfer = if (autoStake)
782828 then {
783829 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
784830 if ((stakeInv == stakeInv))
785831 then nil
786832 else throw("Strict value is not equal to itself.")
787833 }
788834 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
789835 let sendFee = if ((feeAmount > 0))
790836 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
791837 else nil
792838 $Tuple2(((commonState ++ lpTransfer) ++ sendFee), emitAmount)
793839 }
794840 else throw("Strict value is not equal to itself.")
795841 }
796842 else throw("Strict value is not equal to itself.")
797843 }
798844 else throw("Strict value is not equal to itself.")
799845 }
800846
801847
802848
803849 @Callable(i)
804850 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
805- let $t03258232717 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
806- let emitAmountEstimated = $t03258232717._1
807- let commonState = $t03258232717._2
808- let feeAmount = $t03258232717._3
809- let bonus = $t03258232717._4
851+ let $t03385333988 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
852+ let emitAmountEstimated = $t03385333988._1
853+ let commonState = $t03385333988._2
854+ let feeAmount = $t03385333988._3
855+ let bonus = $t03385333988._4
810856 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
811857 }
812858
813859
814860
815861 @Callable(i)
816862 func getOneTkn (outAssetIdStr,minOutAmount) = {
817863 let isPoolOneTokenOperationsDisabled = {
818864 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
819865 if ($isInstanceOf(@, "Boolean"))
820866 then @
821867 else throw(($getType(@) + " couldn't be cast to Boolean"))
822868 }
823869 let isGetDisabled = if (if (isGlobalShutdown())
824870 then true
825871 else (cfgPoolStatus == PoolShutdown))
826872 then true
827873 else isPoolOneTokenOperationsDisabled
828874 let checks = [if (if (!(isGetDisabled))
829875 then true
830876 else isManager(i))
831877 then true
832878 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
833879 then true
834880 else throwErr("exactly 1 payment are expected")]
835881 if ((checks == checks))
836882 then {
837883 let outAssetId = parseAssetId(outAssetIdStr)
838884 let payment = i.payments[0]
839885 let paymentAssetId = payment.assetId
840886 let paymentAmount = payment.amount
841887 let userAddress = i.caller
842888 let txId = i.transactionId
843- let $t03352233657 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
844- if (($t03352233657 == $t03352233657))
889+ let $t03479334928 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
890+ if (($t03479334928 == $t03479334928))
845891 then {
846- let bonus = $t03352233657._4
847- let feeAmount = $t03352233657._3
848- let commonState = $t03352233657._2
849- let amountEstimated = $t03352233657._1
892+ let bonus = $t03479334928._4
893+ let feeAmount = $t03479334928._3
894+ let commonState = $t03479334928._2
895+ let amountEstimated = $t03479334928._1
850896 let amount = if (if ((minOutAmount > 0))
851897 then (minOutAmount > amountEstimated)
852898 else false)
853899 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
854900 else amountEstimated
855901 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
856902 if ((burnInv == burnInv))
857903 then {
858904 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
859905 let sendFee = if ((feeAmount > 0))
860906 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
861907 else nil
862908 $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
863909 }
864910 else throw("Strict value is not equal to itself.")
865911 }
866912 else throw("Strict value is not equal to itself.")
867913 }
868914 else throw("Strict value is not equal to itself.")
869915 }
870916
871917
872918
873919 @Callable(i)
874920 func getOneTknREADONLY (outAssetId,paymentAmount) = {
875- let $t03429234430 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
876- let amountEstimated = $t03429234430._1
877- let commonState = $t03429234430._2
878- let feeAmount = $t03429234430._3
879- let bonus = $t03429234430._4
921+ let $t03556335701 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
922+ let amountEstimated = $t03556335701._1
923+ let commonState = $t03556335701._2
924+ let feeAmount = $t03556335701._3
925+ let bonus = $t03556335701._4
880926 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
881927 }
882928
883929
884930
885931 @Callable(i)
886932 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
887933 let isPoolOneTokenOperationsDisabled = {
888934 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
889935 if ($isInstanceOf(@, "Boolean"))
890936 then @
891937 else throw(($getType(@) + " couldn't be cast to Boolean"))
892938 }
893939 let isGetDisabled = if (if (isGlobalShutdown())
894940 then true
895941 else (cfgPoolStatus == PoolShutdown))
896942 then true
897943 else isPoolOneTokenOperationsDisabled
898944 let checks = [if (if (!(isGetDisabled))
899945 then true
900946 else isManager(i))
901947 then true
902948 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
903949 then true
904950 else throwErr("no payments are expected")]
905951 if ((checks == checks))
906952 then {
907953 let outAssetId = parseAssetId(outAssetIdStr)
908954 let userAddress = i.caller
909955 let txId = i.transactionId
910956 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
911957 if ((unstakeInv == unstakeInv))
912958 then {
913- let $t03525535388 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
914- if (($t03525535388 == $t03525535388))
959+ let $t03652636659 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
960+ if (($t03652636659 == $t03652636659))
915961 then {
916- let bonus = $t03525535388._4
917- let feeAmount = $t03525535388._3
918- let commonState = $t03525535388._2
919- let amountEstimated = $t03525535388._1
962+ let bonus = $t03652636659._4
963+ let feeAmount = $t03652636659._3
964+ let commonState = $t03652636659._2
965+ let amountEstimated = $t03652636659._1
920966 let amount = if (if ((minOutAmount > 0))
921967 then (minOutAmount > amountEstimated)
922968 else false)
923969 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
924970 else amountEstimated
925971 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
926972 if ((burnInv == burnInv))
927973 then {
928974 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
929975 let sendFee = if ((feeAmount > 0))
930976 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
931977 else nil
932978 $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
933979 }
934980 else throw("Strict value is not equal to itself.")
935981 }
936982 else throw("Strict value is not equal to itself.")
937983 }
938984 else throw("Strict value is not equal to itself.")
939985 }
940986 else throw("Strict value is not equal to itself.")
941987 }
942988
943989
944990
945991 @Callable(i)
946992 func get () = {
947993 let res = commonGet(i)
948994 let outAmtAmt = res._1
949995 let outPrAmt = res._2
950996 let pmtAmt = res._3
951997 let pmtAssetId = res._4
952998 let state = res._5
953999 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
9541000 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
9551001 then state
9561002 else throw("Strict value is not equal to itself.")
9571003 }
9581004
9591005
9601006
9611007 @Callable(i)
9621008 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
9631009 let res = commonGet(i)
9641010 let outAmAmt = res._1
9651011 let outPrAmt = res._2
9661012 let pmtAmt = res._3
9671013 let pmtAssetId = res._4
9681014 let state = res._5
9691015 if ((noLessThenAmtAsset > outAmAmt))
9701016 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
9711017 else if ((noLessThenPriceAsset > outPrAmt))
9721018 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
9731019 else {
9741020 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
9751021 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
9761022 then state
9771023 else throw("Strict value is not equal to itself.")
9781024 }
9791025 }
9801026
9811027
9821028
9831029 @Callable(i)
9841030 func unstakeAndGet (amount) = {
9851031 let checkPayments = if ((size(i.payments) != 0))
9861032 then throw("No payments are expected")
9871033 else true
9881034 if ((checkPayments == checkPayments))
9891035 then {
9901036 let cfg = getPoolConfig()
9911037 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
9921038 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
9931039 if ((unstakeInv == unstakeInv))
9941040 then {
9951041 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
9961042 let poolStatus = parseIntValue(res._9)
9971043 let state = res._10
9981044 let checkPoolStatus = if (if (isGlobalShutdown())
9991045 then true
10001046 else (poolStatus == PoolShutdown))
10011047 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
10021048 else true
10031049 if ((checkPoolStatus == checkPoolStatus))
10041050 then {
10051051 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
10061052 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10071053 then state
10081054 else throw("Strict value is not equal to itself.")
10091055 }
10101056 else throw("Strict value is not equal to itself.")
10111057 }
10121058 else throw("Strict value is not equal to itself.")
10131059 }
10141060 else throw("Strict value is not equal to itself.")
10151061 }
10161062
10171063
10181064
10191065 @Callable(i)
10201066 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
10211067 let isGetDisabled = if (isGlobalShutdown())
10221068 then true
10231069 else (cfgPoolStatus == PoolShutdown)
10241070 let checks = [if (!(isGetDisabled))
10251071 then true
10261072 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
10271073 then true
10281074 else throw("no payments are expected")]
10291075 if ((checks == checks))
10301076 then {
10311077 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10321078 if ((unstakeInv == unstakeInv))
10331079 then {
10341080 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
10351081 let outAmAmt = res._1
10361082 let outPrAmt = res._2
10371083 let state = res._10
10381084 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
10391085 then true
10401086 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
10411087 then true
10421088 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
10431089 if ((checkAmounts == checkAmounts))
10441090 then {
10451091 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
10461092 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10471093 then state
10481094 else throw("Strict value is not equal to itself.")
10491095 }
10501096 else throw("Strict value is not equal to itself.")
10511097 }
10521098 else throw("Strict value is not equal to itself.")
10531099 }
10541100 else throw("Strict value is not equal to itself.")
10551101 }
10561102
10571103
10581104
10591105 @Callable(i)
10601106 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
10611107 then throw("permissions denied")
10621108 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
10631109
10641110
10651111
10661112 @Callable(i)
10671113 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
10681114
10691115
10701116
10711117 @Callable(i)
10721118 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
10731119
10741120
10751121
10761122 @Callable(i)
10771123 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
10781124 let prices = calcPrices(amAmt, prAmt, lpAmt)
10791125 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
10801126 }
10811127
10821128
10831129
10841130 @Callable(i)
10851131 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
10861132
10871133
10881134
10891135 @Callable(i)
10901136 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
10911137
10921138
10931139
10941140 @Callable(i)
10951141 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
10961142
10971143
10981144
10991145 @Callable(i)
11001146 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
11011147
11021148
11031149
11041150 @Callable(i)
11051151 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
11061152 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
11071153 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
11081154 }
11091155
11101156
11111157
11121158 @Callable(i)
11131159 func statsREADONLY () = {
11141160 let cfg = getPoolConfig()
11151161 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11161162 let amtAssetId = cfg[idxAmtAssetId]
11171163 let priceAssetId = cfg[idxPriceAssetId]
11181164 let iAmtAssetId = cfg[idxIAmtAssetId]
11191165 let iPriceAssetId = cfg[idxIPriceAssetId]
11201166 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
11211167 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
11221168 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
11231169 let accAmtAssetBalance = getAccBalance(amtAssetId)
11241170 let accPriceAssetBalance = getAccBalance(priceAssetId)
11251171 let pricesList = if ((poolLPBalance == 0))
11261172 then [zeroBigInt, zeroBigInt, zeroBigInt]
11271173 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
11281174 let curPrice = 0
11291175 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
11301176 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
11311177 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
11321178 $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))
11331179 }
11341180
11351181
11361182
11371183 @Callable(i)
11381184 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
11391185 let cfg = getPoolConfig()
11401186 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11411187 let amAssetIdStr = cfg[idxAmtAssetId]
11421188 let amAssetId = fromBase58String(amAssetIdStr)
11431189 let prAssetIdStr = cfg[idxPriceAssetId]
11441190 let prAssetId = fromBase58String(prAssetIdStr)
11451191 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
11461192 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
11471193 let poolStatus = cfg[idxPoolStatus]
11481194 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
11491195 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
11501196 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
11511197 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
11521198 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
11531199 let curPriceX18 = if ((poolLPBalance == 0))
11541200 then zeroBigInt
11551201 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
11561202 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
11571203 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
11581204 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
11591205 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
11601206 let calcLpAmt = estPut._1
11611207 let curPriceCalc = estPut._3
11621208 let amBalance = estPut._4
11631209 let prBalance = estPut._5
11641210 let lpEmission = estPut._6
11651211 $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))
11661212 }
11671213
11681214
11691215
11701216 @Callable(i)
11711217 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
11721218 let cfg = getPoolConfig()
11731219 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11741220 let amAssetIdStr = cfg[idxAmtAssetId]
11751221 let amAssetId = fromBase58String(amAssetIdStr)
11761222 let prAssetIdStr = cfg[idxPriceAssetId]
11771223 let prAssetId = fromBase58String(prAssetIdStr)
11781224 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
11791225 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
11801226 let poolStatus = cfg[idxPoolStatus]
11811227 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
11821228 let amBalanceRaw = getAccBalance(amAssetIdStr)
11831229 let prBalanceRaw = getAccBalance(prAssetIdStr)
11841230 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
11851231 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
11861232 let curPriceX18 = if ((poolLPBalance == 0))
11871233 then zeroBigInt
11881234 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
11891235 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
11901236 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
11911237 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
11921238 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
11931239 let calcLpAmt = estPut._1
11941240 let curPriceCalc = estPut._3
11951241 let amBalance = estPut._4
11961242 let prBalance = estPut._5
11971243 let lpEmission = estPut._6
11981244 $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))
11991245 }
12001246
12011247
12021248
12031249 @Callable(i)
12041250 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
12051251 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
12061252 let outAmAmt = res._1
12071253 let outPrAmt = res._2
12081254 let amBalance = res._5
12091255 let prBalance = res._6
12101256 let lpEmission = res._7
12111257 let curPrice = res._8
12121258 let poolStatus = parseIntValue(res._9)
12131259 $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))
12141260 }
12151261
12161262
12171263 @Verifier(tx)
12181264 func verify () = {
12191265 let targetPublicKey = match managerPublicKeyOrUnit() {
12201266 case pk: ByteVector =>
12211267 pk
12221268 case _: Unit =>
12231269 tx.senderPublicKey
12241270 case _ =>
12251271 throw("Match error")
12261272 }
12271273 match tx {
12281274 case order: Order =>
12291275 let matcherPub = getMatcherPubOrFail()
12301276 let orderValid = validateMatcherOrderAllowed(order)
12311277 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
12321278 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
12331279 if (if (if (orderValid)
12341280 then senderValid
12351281 else false)
12361282 then matcherValid
12371283 else false)
12381284 then true
12391285 else throwOrderError(orderValid, senderValid, matcherValid)
12401286 case s: SetScriptTransaction =>
12411287 let newHash = blake2b256(value(s.script))
12421288 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
12431289 let currentHash = scriptHash(this)
12441290 if (if ((allowedHash == newHash))
12451291 then (currentHash != newHash)
12461292 else false)
12471293 then true
12481294 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
12491295 case _ =>
12501296 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
12511297 }
12521298 }
12531299

github/deemru/w8io/026f985 
147.81 ms