tx · DQqrz3F1MFERcBBP4qE4pmMMFWgBioPqLwMQbdK5fEyE

3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA:  -0.02900000 Waves

2022.09.14 15:48 [2228790] smart account 3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA > SELF 0.00000000 Waves

{ "type": 13, "id": "DQqrz3F1MFERcBBP4qE4pmMMFWgBioPqLwMQbdK5fEyE", "fee": 2900000, "feeAssetId": null, "timestamp": 1663159730500, "version": 1, "sender": "3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA", "senderPublicKey": "35yd3qw1gxKDxKwGAykHN9fANbXNWwseaUwbWDj24o3x", "proofs": [ "iYt3mGq7wbQxbetqRxmBgLfcPMXcPNMWzi8MMXCcWNwfwxxF7NWdJeS9AE6DMGbZoL8UWKSZsEzwuABU7hC2tux" ], "script": "base64:BgJ/CAISAwoBCBIDCgEIEgASBAoCAQQSBwoFAQEBAQQSAwoBARIAEgcKBQEBAQgBEgQKAgEBEgMKAQESBAoCCAgSBAoCCAgSBAoCCAESABIDCgEIEgUKAwEBARIECgIIARIECgIBARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCFIABnNjYWxlOACAwtcvAAxzY2FsZThCaWdJbnQJALYCAQCAwtcvAAdzY2FsZTE4CQC2AgEAgICQu7rWrfANAAh0aG91c2FuZADoBwAKemVyb0JpZ0ludAkAtgIBAAAACW9uZUJpZ0ludAkAtgIBAAEACnNsaXBwYWdlNEQJALYCAQkAZQIFBnNjYWxlOAkAaQIJAGgCBQZzY2FsZTgAAQUGc2NhbGU4AAVBbXVsdAIDMTAwAAVEY29udgIBMQADU0VQAgJfXwAFRU1QVFkCAAAKUG9vbEFjdGl2ZQABAApQb29sUHV0RGlzAAIADlBvb2xNYXRjaGVyRGlzAAMADFBvb2xTaHV0ZG93bgAEAA5pZHhQb29sQWRkcmVzcwABAAlpZHhQb29sU3QAAgAJaWR4TFBBc0lkAAMACWlkeEFtQXNJZAAEAAlpZHh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FAnR4BnByb29mcwAABQ90YXJnZXRQdWJsaWNLZXkJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tleei8Leo=", "chainId": 84, "height": 2228790, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5obmnocF7rafTFHbeJ4dvFwQ11FXKjq6AzjzkPj1WHF6 Next: 43WEka1CrkCccKrAkVzm6Zj3AzHQhpHa67ZS9E9pUjsJ Diff:
OldNewDifferences
66 let scale8BigInt = toBigInt(100000000)
77
88 let scale18 = toBigInt(1000000000000000000)
9+
10+let thousand = 1000
911
1012 let zeroBigInt = toBigInt(0)
1113
5355
5456 let idxFactGwxRewCntr = 10
5557
56-let delay = "%s__delay"
58+let feePermilleDefault = 0
5759
5860 func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
5961
102104 func ada () = "%s__addonAddr"
103105
104106
105-func lgotc (caller) = makeString(["%s%s__lastGetOneTknCall", caller], SEP)
107+let keyFeePermille = "%s__feePermille"
106108
107-
108-func lsotc (caller) = makeString(["%s%s__lastPutOneTknCall", caller], SEP)
109-
109+let feePermille = valueOrElse(getInteger(this, keyFeePermille), feePermilleDefault)
110110
111111 func fcfg () = "%s__factoryConfig"
112112
124124
125125
126126 func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash"
127+
128+
129+func keyFeeCollectorAddress () = "%s__feeCollectorAddress"
127130
128131
129132 func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV)))
153156 func mp () = fromBase58String(strf(fca, mtpk()))
154157
155158
159+let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress()))
160+
156161 func gpc () = {
157162 let amtAs = strf(this, aa())
158163 let priceAs = strf(this, pa())
164169
165170 func gfc () = split(strf(fca, fcfg()), SEP)
166171
167-
168-let factoryConfig = gfc()
169-
170-let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address")
171-
172-let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address")
173-
174-let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address")
175172
176173 func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slipByUser,slippageReal,txHeight,txTimestamp,slipageAmAmt,slipagePrAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slipByUser), toString(slippageReal), toString(txHeight), toString(txTimestamp), toString(slipageAmAmt), toString(slipagePrAmt)], SEP)
177174
270267 }
271268
272269
273-func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
270+func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,pmtAmt,pmtId) = {
274271 let cfg = gpc()
275272 let lpId = fromBase58String(cfg[idxLPAsId])
276273 let amIdStr = cfg[idxAmAsId]
315312 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
316313 let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18)
317314 let slippageX18 = t1(slippage, scale8)
318- if (if (if (validateSlippage)
319- then (curPriceX18 != zeroBigInt)
320- else false)
315+ if (if ((curPriceX18 != zeroBigInt))
321316 then (slippageRealX18 > slippageX18)
322317 else false)
323318 then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18)))
347342 else calcLpAmt
348343 let amDiff = (inAmAmt - calcAmAssetPmt)
349344 let prDiff = (inPrAmt - calcPrAssetPmt)
350- let $t01608316428 = if (if (isOneAsset)
345+ let $t01568216027 = if (if (isOneAsset)
351346 then (pmtId == amIdStr)
352347 else false)
353348 then $Tuple2(pmtAmt, 0)
356351 else false)
357352 then $Tuple2(0, pmtAmt)
358353 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
359- let writeAmAmt = $t01608316428._1
360- let writePrAmt = $t01608316428._2
354+ let writeAmAmt = $t01568216027._1
355+ let writePrAmt = $t01568216027._2
361356 let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))]
362357 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
363358 }
428423 }
429424
430425
431-func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
432- let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, false, emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId)
426+func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,pmtAmt,pmtId) = {
427+ let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, false, emitLp, isOneAsset, pmtAmt, pmtId)
433428 let sts = parseIntValue(r._8)
434429 if (if (if (igs())
435430 then true
441436 }
442437
443438
444-func estimatePutOneTknV2 (pmtAmt,pmtAssetId,userAddress,txId) = {
445- let poolConfig = gpc()
446- let amId = poolConfig[idxAmAsId]
447- let prId = poolConfig[idxPrAsId]
448- let amBalance = getAccBalance(amId)
449- let prBalance = getAccBalance(prId)
450- let $t02075121200 = if ((txId == ""))
451- then $Tuple2(amBalance, prBalance)
452- else if ((pmtAssetId == amId))
453- then if ((pmtAmt > amBalance))
454- then throw("invalid payment amount")
455- else $Tuple2((amBalance - pmtAmt), prBalance)
456- else if ((pmtAssetId == prId))
457- then if ((pmtAmt > prBalance))
458- then throw("invalid payment amount")
459- else $Tuple2(amBalance, (prBalance - pmtAmt))
460- else throw("wrong pmtAssetId")
461- let amBalanceNow = $t02075121200._1
462- let prBalanceNow = $t02075121200._2
463- let $t02120421338 = if ((pmtAssetId == amId))
464- then $Tuple2(amBalanceNow, prBalanceNow)
465- else $Tuple2(prBalanceNow, amBalanceNow)
466- let amBalanceForCalc = $t02120421338._1
467- let prBalanceForCalc = $t02120421338._2
468- let xPrecision = 1
469- let result = {
470- let @ = invoke(gwxContract, "calcPutXOnly", [toString(pmtAmt), toString(amBalanceForCalc), toString(prBalanceForCalc), "", A, Amult, toString(xPrecision), Dconv], nil)
471- if ($isInstanceOf(@, "(Int, Int)"))
472- then @
473- else throw(($getType(invoke(gwxContract, "calcPutXOnly", [toString(pmtAmt), toString(amBalanceForCalc), toString(prBalanceForCalc), "", A, Amult, toString(xPrecision), Dconv], nil)) + " couldn't be cast to (Int, Int)"))
474- }
475- let $t02180721903 = if ((pmtAssetId == amId))
476- then result
477- else $Tuple2(result._2, result._1)
478- let amAssetPart = $t02180721903._1
479- let prAssetPart = $t02180721903._2
480- let estPut = cp(userAddress, txId, AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), 0, true, true, false, pmtAmt, pmtAssetId)
481- let estimLP = estPut._2
482- let lpAssetId = estPut._7
483- let state = estPut._9
484- let amDiff = estPut._10
485- let prDiff = estPut._11
486- $Tuple5(estimLP, lpAssetId, state, amDiff, prDiff)
439+func takeFee (amount) = {
440+ let fee = fraction(amount, feePermille, thousand)
441+ $Tuple2((amount - fee), fee)
487442 }
488443
489444
578533 else if ((size(i.payments) != 2))
579534 then throw("2 pmnts expd")
580535 else {
581- let e = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], slip, true, false, true, 0, "")
536+ let e = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], slip, true, false, 0, "")
582537 let emitLpAmt = e._2
583538 let lpAssetId = e._7
584539 let state = e._9
644599 let userAddress = if ((addon == toString(i.caller)))
645600 then i.originCaller
646601 else i.caller
647- let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid")
648- let check = reentrantInvoke(addonContract, "ensureCanPutOneTkn", [toString(userAddress)], nil)
649- if ((check == check))
650- then if (if (if (if ((0 >= slippage))
651- then true
652- else (0 >= amAssetPart))
653- then true
654- else (0 >= prAssetPart))
655- then true
656- else (0 >= outLp))
657- then throw("Wrong params")
658- else if ((size(i.payments) != 1))
659- then throw("1 pmnt expd")
660- else {
661- let pmt = value(i.payments[0])
662- let pmtAssetId = toBase58String(value(pmt.assetId))
663- let pmtAmt = pmt.amount
664- if ((10000000 > pmtAmt))
665- then throw("Wrong pmt amt")
666- else {
667- let amBalance = getAccBalance(amId)
668- let prBalance = getAccBalance(prId)
669- let $t02731327889 = if ((pmtAssetId == amId))
670- then if (if ((pmtAmt > amBalance))
602+ if (if (if (if ((0 >= slippage))
603+ then true
604+ else (0 >= amAssetPart))
605+ then true
606+ else (0 >= prAssetPart))
607+ then true
608+ else (0 >= outLp))
609+ then throw("Wrong params")
610+ else if ((size(i.payments) != 1))
611+ then throw("1 pmnt expd")
612+ else {
613+ let pmt = value(i.payments[0])
614+ let pmtAssetId = toBase58String(value(pmt.assetId))
615+ let paymentAmountRaw = pmt.amount
616+ let $t02464424696 = takeFee(paymentAmountRaw)
617+ let pmtAmt = $t02464424696._1
618+ let feeAmount = $t02464424696._2
619+ if ((10000000 > paymentAmountRaw))
620+ then throw("Wrong pmt amt")
621+ else {
622+ let amBalance = getAccBalance(amId)
623+ let prBalance = getAccBalance(prId)
624+ let $t02485625472 = if ((pmtAssetId == amId))
625+ then if (if ((paymentAmountRaw > amBalance))
626+ then true
627+ else (amAssetPart > pmtAmt))
628+ then throw("invalid payment amount")
629+ else $Tuple6((amBalance - paymentAmountRaw), prBalance, (pmtAmt - amAssetPart), prAssetPart, 0, 0)
630+ else if ((pmtAssetId == prId))
631+ then if (if ((paymentAmountRaw > prBalance))
671632 then true
672- else (amAssetPart > pmtAmt))
633+ else (prAssetPart > pmtAmt))
673634 then throw("invalid payment amount")
674- else $Tuple6((amBalance - pmtAmt), prBalance, (pmtAmt - amAssetPart), prAssetPart, 0, 0)
675- else if ((pmtAssetId == prId))
676- then if (if ((pmtAmt > prBalance))
677- then true
678- else (prAssetPart > pmtAmt))
679- then throw("invalid payment amount")
680- else $Tuple6(amBalance, (prBalance - pmtAmt), 0, 0, (pmtAmt - prAssetPart), amAssetPart)
681- else throw("wrong pmtAssetId")
682- let amBalanceNow = $t02731327889._1
683- let prBalanceNow = $t02731327889._2
684- let virtSwapInAm = $t02731327889._3
685- let virtSwapOutPr = $t02731327889._4
686- let virtSwapInPr = $t02731327889._5
687- let virtSwapOutAm = $t02731327889._6
688- let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
689- let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil)
690- let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
691- if ((D0vsD1 == D0vsD1))
692- then {
693- let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), slippage, true, true, true, pmtAmt, pmtAssetId)
694- let estimLP = estPut._2
695- let lpAssetId = estPut._7
696- let state = estPut._9
697- let amDiff = estPut._10
698- let prDiff = estPut._11
699- let lpCalcRes = vad(toBigInt(estimLP), toBigInt(outLp), toBigInt(slippage))
700- let emitLpAmt = toInt(lpCalcRes._2)
701- let e = invoke(fca, "emit", [emitLpAmt], nil)
702- if ((e == e))
703- then {
704- let el = match e {
705- case legacy: Address =>
706- invoke(legacy, "emit", [emitLpAmt], nil)
707- case _ =>
708- unit
709- }
710- if ((el == el))
711- then {
712- let sa = if ((amDiff > 0))
713- then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)])
714- else nil
715- if ((sa == sa))
716- then {
717- let sp = if ((prDiff > 0))
718- then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)])
719- else nil
720- if ((sp == sp))
721- then {
722- let lpTrnsfr = if (autoStake)
723- then {
724- let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
725- if ((ss == ss))
726- then nil
727- else throw("Strict value is not equal to itself.")
728- }
729- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
730- (state ++ lpTrnsfr)
731- }
732- else throw("Strict value is not equal to itself.")
733- }
734- else throw("Strict value is not equal to itself.")
735- }
736- else throw("Strict value is not equal to itself.")
737- }
738- else throw("Strict value is not equal to itself.")
739- }
740- else throw("Strict value is not equal to itself.")
741- }
742- }
743- else throw("Strict value is not equal to itself.")
744- }
745-
746-
747-
748-@Callable(i)
749-func putOneTknV2 (minOutAmount,autoStake) = if ((size(i.payments) != 1))
750- then throw("1 pmnt expd")
751- else {
752- let poolConfig = gpc()
753- let amId = poolConfig[idxAmAsId]
754- let prId = poolConfig[idxPrAsId]
755- let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
756- let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
757- let userAddress = if ((i.caller == this))
758- then i.originCaller
759- else i.caller
760- let pmt = value(i.payments[0])
761- let pmtAssetId = toBase58String(value(pmt.assetId))
762- let pmtAmt = pmt.amount
763- if ((10000000 > pmtAmt))
764- then throw("Wrong pmt amt")
765- else {
766- let $t03059830745 = estimatePutOneTknV2(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId))
767- let estimLP = $t03059830745._1
768- let lpAssetId = $t03059830745._2
769- let state = $t03059830745._3
770- let amDiff = $t03059830745._4
771- let prDiff = $t03059830745._5
772- let emitLpAmt = if (if ((minOutAmount > 0))
773- then (minOutAmount > estimLP)
774- else false)
775- then throw(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
776- else estimLP
777- let e = invoke(fca, "emit", [emitLpAmt], nil)
778- if ((e == e))
779- then {
780- let el = match e {
781- case legacy: Address =>
782- invoke(legacy, "emit", [emitLpAmt], nil)
783- case _ =>
784- unit
785- }
786- if ((el == el))
635+ else $Tuple6(amBalance, (prBalance - paymentAmountRaw), 0, 0, (pmtAmt - prAssetPart), amAssetPart)
636+ else throw("wrong pmtAssetId")
637+ let amBalanceNow = $t02485625472._1
638+ let prBalanceNow = $t02485625472._2
639+ let virtSwapInAm = $t02485625472._3
640+ let virtSwapOutPr = $t02485625472._4
641+ let virtSwapInPr = $t02485625472._5
642+ let virtSwapOutAm = $t02485625472._6
643+ let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
644+ let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil)
645+ let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
646+ if ((D0vsD1 == D0vsD1))
787647 then {
788- let sa = if ((amDiff > 0))
789- then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)])
790- else nil
791- if ((sa == sa))
648+ let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), slippage, true, true, pmtAmt, pmtAssetId)
649+ let estimLP = estPut._2
650+ let lpAssetId = estPut._7
651+ let state = estPut._9
652+ let amDiff = estPut._10
653+ let prDiff = estPut._11
654+ let lpCalcRes = vad(toBigInt(estimLP), toBigInt(outLp), toBigInt(slippage))
655+ let emitLpAmt = toInt(lpCalcRes._2)
656+ let e = invoke(fca, "emit", [emitLpAmt], nil)
657+ if ((e == e))
792658 then {
793- let sp = if ((prDiff > 0))
794- then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)])
795- else nil
796- if ((sp == sp))
659+ let el = match e {
660+ case legacy: Address =>
661+ invoke(legacy, "emit", [emitLpAmt], nil)
662+ case _ =>
663+ unit
664+ }
665+ if ((el == el))
797666 then {
798- let lpTrnsfr = if (autoStake)
667+ let sa = if ((amDiff > 0))
668+ then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)])
669+ else nil
670+ if ((sa == sa))
799671 then {
800- let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
801- if ((ss == ss))
802- then nil
672+ let sp = if ((prDiff > 0))
673+ then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)])
674+ else nil
675+ if ((sp == sp))
676+ then {
677+ let lpTrnsfr = if (autoStake)
678+ then {
679+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
680+ if ((ss == ss))
681+ then nil
682+ else throw("Strict value is not equal to itself.")
683+ }
684+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
685+ let sendFeeToMatcher = if ((feeAmount > 0))
686+ then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
687+ else nil
688+ ((state ++ lpTrnsfr) ++ sendFeeToMatcher)
689+ }
803690 else throw("Strict value is not equal to itself.")
804691 }
805- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
806- $Tuple2((state ++ lpTrnsfr), emitLpAmt)
692+ else throw("Strict value is not equal to itself.")
807693 }
808694 else throw("Strict value is not equal to itself.")
809695 }
811697 }
812698 else throw("Strict value is not equal to itself.")
813699 }
814- else throw("Strict value is not equal to itself.")
815700 }
816- }
817-
818-
819-
820-@Callable(i)
821-func putOneTknV2READONLY (paymentAmount,paymentAssetId) = {
822- let $t03183031938 = estimatePutOneTknV2(paymentAmount, paymentAssetId, "", "")
823- let estimLP = $t03183031938._1
824- let lpAssetId = $t03183031938._2
825- let state = $t03183031938._3
826- let amDiff = $t03183031938._4
827- let prDiff = $t03183031938._5
828- $Tuple2(nil, estimLP)
829701 }
830702
831703
836708 else if ((size(i.payments) != 2))
837709 then throw("2 pmnts expd")
838710 else {
839- let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, true, 0, "")
711+ let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, 0, "")
840712 estPut._9
841713 }
842714
879751 let txId58 = toBase58String(i.transactionId)
880752 let pmtAssetId = value(pmt.assetId)
881753 let pmtAmt = pmt.amount
882- let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid")
883- let check = reentrantInvoke(addonContract, "ensureCanGetOneTkn", [toString(userAddress)], nil)
884- if ((check == check))
885- then if ((1000000000 > pmtAmt))
886- then throw("Min pmt 10 LP")
887- else if (if (if ((0 > slippage))
888- then true
889- else (0 > exchResult))
890- then true
891- else (0 > outAmount))
892- then throw("Wrong params")
893- else if ((lpId != toBase58String(pmtAssetId)))
894- then throw("Wrong LP")
895- else {
896- let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
897- let estimAmAmt = r._1
898- let estimPrAmt = r._2
899- let amBalance = getAccBalance(amId)
900- let prBalance = getAccBalance(prId)
901- let $t03497635433 = if ((outAssetId == amId))
902- then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult))
903- else if ((outAssetId == prId))
904- then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult))
905- else throw("wrong outAssetId")
906- let amBalanceNow = $t03497635433._1
907- let prBalanceNow = $t03497635433._2
908- let virtSwapInAm = $t03497635433._3
909- let virtSwapOutPr = $t03497635433._4
910- let virtSwapInPr = $t03497635433._5
911- let virtSwapOutAm = $t03497635433._6
912- let totalGet = $t03497635433._7
913- if (if ((0 > virtSwapInAm))
914- then true
915- else (0 > virtSwapInPr))
916- then throw("Wrong calc")
917- else {
918- let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
919- let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil)
920- let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
921- if ((D0vsD1 == D0vsD1))
922- then {
923- let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage))
924- if ((finalRes == finalRes))
925- then {
926- let $t03613836242 = if ((outAssetId == amId))
927- then $Tuple2(toInt(finalRes._2), 0)
928- else $Tuple2(0, toInt(finalRes._2))
929- let outAm = $t03613836242._1
930- let outPr = $t03613836242._2
931- let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm))
932- let curPr = f1(curPrX18, scale8)
933- let state = [ScriptTransfer(userAddress, (outAm + outPr), if ((outAssetId == "WAVES"))
934- then unit
935- else fromBase58String(outAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)]
936- if ((state == state))
937- then {
938- let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
939- if ((burn == burn))
940- then state
941- else throw("Strict value is not equal to itself.")
942- }
943- else throw("Strict value is not equal to itself.")
944- }
945- else throw("Strict value is not equal to itself.")
946- }
947- else throw("Strict value is not equal to itself.")
948- }
949- }
950- else throw("Strict value is not equal to itself.")
951- }
952-
953-
954-
955-@Callable(i)
956-func getOneTknV2 (outAssetId,minOutAmount) = if ((size(i.payments) != 1))
957- then throw("1 pmnt expd")
958- else {
959- let poolConfig = gpc()
960- let lpId = poolConfig[idxLPAsId]
961- let amId = poolConfig[idxAmAsId]
962- let prId = poolConfig[idxPrAsId]
963- let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
964- let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
965- let poolStatus = poolConfig[idxPoolSt]
966- let userAddress = if ((i.caller == this))
967- then i.originCaller
968- else i.caller
969- let pmt = value(i.payments[0])
970- let pmtAssetId = value(pmt.assetId)
971- let pmtAmt = pmt.amount
972754 if ((1000000000 > pmtAmt))
973755 then throw("Min pmt 10 LP")
974- else {
975- let txId58 = toBase58String(i.transactionId)
976- if ((lpId != toBase58String(pmtAssetId)))
756+ else if (if (if ((0 > slippage))
757+ then true
758+ else (0 > exchResult))
759+ then true
760+ else (0 > outAmount))
761+ then throw("Wrong params")
762+ else if ((lpId != toBase58String(pmtAssetId)))
977763 then throw("Wrong LP")
978764 else {
979- let r = ego(txId58, toBase58String(pmtAssetId), pmtAmt, i.caller)
765+ let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
980766 let estimAmAmt = r._1
981767 let estimPrAmt = r._2
982768 let amBalance = getAccBalance(amId)
983769 let prBalance = getAccBalance(prId)
984- let totalGet = {
985- let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
986- if ($isInstanceOf(@, "Int"))
987- then @
988- else throw(($getType(invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)) + " couldn't be cast to Int"))
989- }
990- let totalAmount = if (if ((minOutAmount > 0))
991- then (minOutAmount > totalGet)
992- else false)
993- then throw(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
994- else totalGet
995- let $t03819038277 = if ((outAssetId == amId))
996- then $Tuple2(totalAmount, 0)
997- else $Tuple2(0, totalAmount)
998- let outAm = $t03819038277._1
999- let outPr = $t03819038277._2
1000- let curPrX18 = cpbi(t1(prBalance, prDecimals), t1(amBalance, amDecimals))
1001- let curPr = f1(curPrX18, scale8)
1002- let state = [ScriptTransfer(userAddress, totalAmount, if ((outAssetId == "WAVES"))
1003- then unit
1004- else fromBase58String(outAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)]
1005- if ((state == state))
1006- then {
1007- let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1008- if ((burn == burn))
1009- then $Tuple2(state, totalAmount)
770+ let $t03041530875 = if ((outAssetId == amId))
771+ then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult))
772+ else if ((outAssetId == prId))
773+ then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult))
774+ else throw("wrong outAssetId")
775+ let amBalanceNow = $t03041530875._1
776+ let prBalanceNow = $t03041530875._2
777+ let virtSwapInAm = $t03041530875._3
778+ let virtSwapOutPr = $t03041530875._4
779+ let virtSwapInPr = $t03041530875._5
780+ let virtSwapOutAm = $t03041530875._6
781+ let totalGetRaw = $t03041530875._7
782+ if (if ((0 > virtSwapInAm))
783+ then true
784+ else (0 > virtSwapInPr))
785+ then throw("Wrong calc")
786+ else {
787+ let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
788+ let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil)
789+ let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
790+ if ((D0vsD1 == D0vsD1))
791+ then {
792+ let totalGet = takeFee(totalGetRaw)._1
793+ let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage))
794+ if ((finalRes == finalRes))
795+ then {
796+ let $t03162231726 = if ((outAssetId == amId))
797+ then $Tuple2(toInt(finalRes._2), 0)
798+ else $Tuple2(0, toInt(finalRes._2))
799+ let outAm = $t03162231726._1
800+ let outPr = $t03162231726._2
801+ let totalAmount = (outAm + outPr)
802+ let feeAmount = (totalGetRaw - totalGet)
803+ let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
804+ then unit
805+ else fromBase58String(outAssetId)
806+ let sendFeeToMatcher = if ((feeAmount > 0))
807+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
808+ else nil
809+ let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm))
810+ let curPr = f1(curPrX18, scale8)
811+ let state = [ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)]
812+ if ((state == state))
813+ then {
814+ let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
815+ if ((burn == burn))
816+ then (state ++ sendFeeToMatcher)
817+ else throw("Strict value is not equal to itself.")
818+ }
819+ else throw("Strict value is not equal to itself.")
820+ }
821+ else throw("Strict value is not equal to itself.")
822+ }
1010823 else throw("Strict value is not equal to itself.")
1011824 }
1012- else throw("Strict value is not equal to itself.")
1013825 }
1014- }
1015826 }
1016-
1017-
1018-
1019-@Callable(i)
1020-func getOneTknV2READONLY (outAssetId,lpAssetAmount) = {
1021- let poolConfig = gpc()
1022- let lpId = poolConfig[idxLPAsId]
1023- let amId = poolConfig[idxAmAsId]
1024- let prId = poolConfig[idxPrAsId]
1025- let r = ego("", lpId, lpAssetAmount, this)
1026- let estimAmAmt = r._1
1027- let estimPrAmt = r._2
1028- let amBalance = getAccBalance(amId)
1029- let prBalance = getAccBalance(prId)
1030- let amBalanceNow = (amBalance - estimAmAmt)
1031- let prBalanceNow = (prBalance - estimPrAmt)
1032- let $t03937139642 = if ((outAssetId == amId))
1033- then $Tuple3(prBalanceNow, amBalanceNow, estimPrAmt)
1034- else if ((outAssetId == prId))
1035- then $Tuple3(amBalanceNow, prBalanceNow, estimAmAmt)
1036- else throw("wrong outAssetId")
1037- let amountBalanceForSwap = $t03937139642._1
1038- let priceBalanceForSwap = $t03937139642._2
1039- let amountToSwap = $t03937139642._3
1040- let yPrecision = 1
1041- let exchResult = {
1042- let @ = invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil)
1043- if ($isInstanceOf(@, "Int"))
1044- then @
1045- else throw(($getType(invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil)) + " couldn't be cast to Int"))
1046- }
1047- let totalGet = (exchResult + (if ((outAssetId == amId))
1048- then estimAmAmt
1049- else estimPrAmt))
1050- $Tuple2(nil, totalGet)
1051- }
1052827
1053828
1054829
1113888
1114889
1115890 @Callable(i)
1116-func unstakeAndGetOneTkn (amount,outAmount,outAssetId,slippage) = {
1117- let checkPayments = if ((size(i.payments) != 0))
1118- then throw("No pmnts expd")
1119- else true
1120- if ((checkPayments == checkPayments))
1121- then {
1122- let cfg = gpc()
1123- let factoryCfg = gfc()
1124- let lpAssetId = fromBase58String(cfg[idxLPAsId])
1125- let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
1126- let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
1127- if ((unstakeInv == unstakeInv))
1128- then {
1129- let outAmountResult = {
1130- let @ = invoke(this, "getOneTknV2", [outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
1131- if ($isInstanceOf(@, "Int"))
1132- then @
1133- else unit
1134- }
1135- if ((outAmountResult == outAmountResult))
1136- then $Tuple2(nil, outAmountResult)
1137- else throw("Strict value is not equal to itself.")
1138- }
1139- else throw("Strict value is not equal to itself.")
1140- }
1141- else throw("Strict value is not equal to itself.")
1142- }
1143-
1144-
1145-
1146-@Callable(i)
1147891 func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca)))
1148892 then throw("denied")
1149893 else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success")
1198942
1199943
1200944 @Callable(i)
1201-func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, true, false, 0, ""))
945+func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, false, 0, ""))
1202946
1203947
1204948
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let scale8 = 100000000
55
66 let scale8BigInt = toBigInt(100000000)
77
88 let scale18 = toBigInt(1000000000000000000)
9+
10+let thousand = 1000
911
1012 let zeroBigInt = toBigInt(0)
1113
1214 let oneBigInt = toBigInt(1)
1315
1416 let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8)))
1517
1618 let Amult = "100"
1719
1820 let Dconv = "1"
1921
2022 let SEP = "__"
2123
2224 let EMPTY = ""
2325
2426 let PoolActive = 1
2527
2628 let PoolPutDis = 2
2729
2830 let PoolMatcherDis = 3
2931
3032 let PoolShutdown = 4
3133
3234 let idxPoolAddress = 1
3335
3436 let idxPoolSt = 2
3537
3638 let idxLPAsId = 3
3739
3840 let idxAmAsId = 4
3941
4042 let idxPrAsId = 5
4143
4244 let idxAmtAsDcm = 6
4345
4446 let idxPriceAsDcm = 7
4547
4648 let idxIAmtAsId = 8
4749
4850 let idxIPriceAsId = 9
4951
5052 let idxFactStakCntr = 1
5153
5254 let idxFactSlippCntr = 7
5355
5456 let idxFactGwxRewCntr = 10
5557
56-let delay = "%s__delay"
58+let feePermilleDefault = 0
5759
5860 func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
5961
6062
6163 func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
6264
6365
6466 func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale)
6567
6668
6769 func abs (val) = if ((zeroBigInt > val))
6870 then -(val)
6971 else val
7072
7173
7274 func fc () = "%s__factoryContract"
7375
7476
7577 func mpk () = "%s__managerPublicKey"
7678
7779
7880 func pmpk () = "%s__pendingManagerPublicKey"
7981
8082
8183 func pl () = "%s%s__price__last"
8284
8385
8486 func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP)
8587
8688
8789 func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId)
8890
8991
9092 func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId)
9193
9294
9395 func aa () = "%s__amountAsset"
9496
9597
9698 func pa () = "%s__priceAsset"
9799
98100
99101 func amp () = "%s__amp"
100102
101103
102104 func ada () = "%s__addonAddr"
103105
104106
105-func lgotc (caller) = makeString(["%s%s__lastGetOneTknCall", caller], SEP)
107+let keyFeePermille = "%s__feePermille"
106108
107-
108-func lsotc (caller) = makeString(["%s%s__lastPutOneTknCall", caller], SEP)
109-
109+let feePermille = valueOrElse(getInteger(this, keyFeePermille), feePermilleDefault)
110110
111111 func fcfg () = "%s__factoryConfig"
112112
113113
114114 func mtpk () = "%s%s__matcher__publicKey"
115115
116116
117117 func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
118118
119119
120120 func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
121121
122122
123123 func aps () = "%s__shutdown"
124124
125125
126126 func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash"
127+
128+
129+func keyFeeCollectorAddress () = "%s__feeCollectorAddress"
127130
128131
129132 func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV)))
130133
131134
132135 func str (val) = match val {
133136 case valStr: String =>
134137 valStr
135138 case _ =>
136139 throw("fail cast to String")
137140 }
138141
139142
140143 func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
141144
142145
143146 func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
144147
145148
146149 let fca = addressFromStringValue(strf(this, fc()))
147150
148151 let A = strf(this, amp())
149152
150153 func igs () = valueOrElse(getBoolean(fca, aps()), false)
151154
152155
153156 func mp () = fromBase58String(strf(fca, mtpk()))
154157
155158
159+let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress()))
160+
156161 func gpc () = {
157162 let amtAs = strf(this, aa())
158163 let priceAs = strf(this, pa())
159164 let iPriceAs = intf(fca, mba(priceAs))
160165 let iAmtAs = intf(fca, mba(amtAs))
161166 split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP)
162167 }
163168
164169
165170 func gfc () = split(strf(fca, fcfg()), SEP)
166171
167-
168-let factoryConfig = gfc()
169-
170-let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address")
171-
172-let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address")
173-
174-let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address")
175172
176173 func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slipByUser,slippageReal,txHeight,txTimestamp,slipageAmAmt,slipagePrAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slipByUser), toString(slippageReal), toString(txHeight), toString(txTimestamp), toString(slipageAmAmt), toString(slipagePrAmt)], SEP)
177174
178175
179176 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)
180177
181178
182179 func getAccBalance (assetId) = if ((assetId == "WAVES"))
183180 then wavesBalance(this).available
184181 else assetBalance(this, fromBase58String(assetId))
185182
186183
187184 func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
188185
189186
190187 func vad (A1,A2,slippage) = {
191188 let diff = fraction((A1 - A2), scale8BigInt, A2)
192189 let pass = ((slippage - abs(diff)) > zeroBigInt)
193190 if (!(pass))
194191 then throw(("Big slpg: " + toString(diff)))
195192 else $Tuple2(pass, min([A1, A2]))
196193 }
197194
198195
199196 func vd (D1,D0,slpg) = {
200197 let diff = fraction(D0, scale8BigInt, D1)
201198 let fail = (slpg > diff)
202199 if (if (fail)
203200 then true
204201 else (D0 > D1))
205202 then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg)))
206203 else fail
207204 }
208205
209206
210207 func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
211208 let amtAsAmtX18 = t1(amAmt, amAssetDcm)
212209 let prAsAmtX18 = t1(prAmt, prAssetDcm)
213210 cpbi(prAsAmtX18, amtAsAmtX18)
214211 }
215212
216213
217214 func calcPrices (amAmt,prAmt,lpAmt) = {
218215 let cfg = gpc()
219216 let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
220217 let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
221218 let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt)
222219 let amAmtX18 = t1(amAmt, amtAsDcm)
223220 let prAmtX18 = t1(prAmt, prAsDcm)
224221 let lpAmtX18 = t1(lpAmt, scale8)
225222 let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18)
226223 let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18)
227224 [priceX18, lpPrInAmAsX18, lpPrInPrAsX18]
228225 }
229226
230227
231228 func calculatePrices (amAmt,prAmt,lpAmt) = {
232229 let p = calcPrices(amAmt, prAmt, lpAmt)
233230 [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)]
234231 }
235232
236233
237234 func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
238235 let cfg = gpc()
239236 let lpId = cfg[idxLPAsId]
240237 let amId = cfg[idxAmAsId]
241238 let prId = cfg[idxPrAsId]
242239 let amDcm = parseIntValue(cfg[idxAmtAsDcm])
243240 let prDcm = parseIntValue(cfg[idxPriceAsDcm])
244241 let sts = cfg[idxPoolSt]
245242 let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity
246243 if ((lpId != pmtAssetId))
247244 then throw("Wrong pmt asset")
248245 else {
249246 let amBalance = getAccBalance(amId)
250247 let amBalanceX18 = t1(amBalance, amDcm)
251248 let prBalance = getAccBalance(prId)
252249 let prBalanceX18 = t1(prBalance, prDcm)
253250 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
254251 let curPrice = f1(curPriceX18, scale8)
255252 let pmtLpAmtX18 = t1(pmtLpAmt, scale8)
256253 let lpEmissX18 = t1(lpEmiss, scale8)
257254 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18)
258255 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18)
259256 let outAmAmt = f1(outAmAmtX18, amDcm)
260257 let outPrAmt = f1(outPrAmtX18, prDcm)
261258 let state = if ((txId58 == ""))
262259 then nil
263260 else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES"))
264261 then unit
265262 else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES"))
266263 then unit
267264 else fromBase58String(prId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)]
268265 $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state)
269266 }
270267 }
271268
272269
273-func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
270+func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,pmtAmt,pmtId) = {
274271 let cfg = gpc()
275272 let lpId = fromBase58String(cfg[idxLPAsId])
276273 let amIdStr = cfg[idxAmAsId]
277274 let prIdStr = cfg[idxPrAsId]
278275 let inAmIdStr = cfg[idxIAmtAsId]
279276 let inPrIdStr = cfg[idxIPriceAsId]
280277 let amtDcm = parseIntValue(cfg[idxAmtAsDcm])
281278 let priceDcm = parseIntValue(cfg[idxPriceAsDcm])
282279 let sts = cfg[idxPoolSt]
283280 let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity
284281 let amBalance = if (isEval)
285282 then getAccBalance(amIdStr)
286283 else if (if (isOneAsset)
287284 then (pmtId == amIdStr)
288285 else false)
289286 then (getAccBalance(amIdStr) - pmtAmt)
290287 else if (isOneAsset)
291288 then getAccBalance(amIdStr)
292289 else (getAccBalance(amIdStr) - inAmAmt)
293290 let prBalance = if (isEval)
294291 then getAccBalance(prIdStr)
295292 else if (if (isOneAsset)
296293 then (pmtId == prIdStr)
297294 else false)
298295 then (getAccBalance(prIdStr) - pmtAmt)
299296 else if (isOneAsset)
300297 then getAccBalance(prIdStr)
301298 else (getAccBalance(prIdStr) - inPrAmt)
302299 let inAmAssetAmtX18 = t1(inAmAmt, amtDcm)
303300 let inPrAssetAmtX18 = t1(inPrAmt, priceDcm)
304301 let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18)
305302 let amBalanceX18 = t1(amBalance, amtDcm)
306303 let prBalanceX18 = t1(prBalance, priceDcm)
307304 let r = if ((lpEm == 0))
308305 then {
309306 let curPriceX18 = zeroBigInt
310307 let slippageX18 = zeroBigInt
311308 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
312309 $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
313310 }
314311 else {
315312 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
316313 let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18)
317314 let slippageX18 = t1(slippage, scale8)
318- if (if (if (validateSlippage)
319- then (curPriceX18 != zeroBigInt)
320- else false)
315+ if (if ((curPriceX18 != zeroBigInt))
321316 then (slippageRealX18 > slippageX18)
322317 else false)
323318 then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18)))
324319 else {
325320 let lpEmissionX18 = t1(lpEm, scale8)
326321 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
327322 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
328323 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
329324 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
330325 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
331326 let expAmtAssetAmtX18 = expectedAmts._1
332327 let expPriceAssetAmtX18 = expectedAmts._2
333328 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
334329 $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18)
335330 }
336331 }
337332 let calcLpAmt = r._1
338333 let calcAmAssetPmt = r._2
339334 let calcPrAssetPmt = r._3
340335 let curPrice = f1(r._4, scale8)
341336 let slippageCalc = f1(r._5, scale8)
342337 if ((0 >= calcLpAmt))
343338 then throw("LP <= 0")
344339 else {
345340 let emitLpAmt = if (!(emitLp))
346341 then 0
347342 else calcLpAmt
348343 let amDiff = (inAmAmt - calcAmAssetPmt)
349344 let prDiff = (inPrAmt - calcPrAssetPmt)
350- let $t01608316428 = if (if (isOneAsset)
345+ let $t01568216027 = if (if (isOneAsset)
351346 then (pmtId == amIdStr)
352347 else false)
353348 then $Tuple2(pmtAmt, 0)
354349 else if (if (isOneAsset)
355350 then (pmtId == prIdStr)
356351 else false)
357352 then $Tuple2(0, pmtAmt)
358353 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
359- let writeAmAmt = $t01608316428._1
360- let writePrAmt = $t01608316428._2
354+ let writeAmAmt = $t01568216027._1
355+ let writePrAmt = $t01568216027._2
361356 let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))]
362357 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
363358 }
364359 }
365360
366361
367362 func moa (order) = {
368363 let cfg = gpc()
369364 let amtAsId = cfg[idxAmAsId]
370365 let prAsId = cfg[idxPrAsId]
371366 let sts = parseIntValue(cfg[idxPoolSt])
372367 let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
373368 let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
374369 let accAmtAsBalance = getAccBalance(amtAsId)
375370 let accPrAsBalance = getAccBalance(prAsId)
376371 let curPriceX18 = if ((order.orderType == Buy))
377372 then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance)
378373 else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance)
379374 let curPrice = f1(curPriceX18, scale8)
380375 if (if (if (igs())
381376 then true
382377 else (sts == PoolMatcherDis))
383378 then true
384379 else (sts == PoolShutdown))
385380 then throw("Admin blocked")
386381 else {
387382 let orAmtAsset = order.assetPair.amountAsset
388383 let orAmtAsStr = if ((orAmtAsset == unit))
389384 then "WAVES"
390385 else toBase58String(value(orAmtAsset))
391386 let orPrAsset = order.assetPair.priceAsset
392387 let orPrAsStr = if ((orPrAsset == unit))
393388 then "WAVES"
394389 else toBase58String(value(orPrAsset))
395390 if (if ((orAmtAsStr != amtAsId))
396391 then true
397392 else (orPrAsStr != prAsId))
398393 then throw("Wr assets")
399394 else {
400395 let orderPrice = order.price
401396 let priceDcm = fraction(scale8, prAsDcm, amtAsDcm)
402397 let castOrderPrice = ts(orderPrice, scale8, priceDcm)
403398 let isOrderPriceValid = if ((order.orderType == Buy))
404399 then (curPrice >= castOrderPrice)
405400 else (castOrderPrice >= curPrice)
406401 true
407402 }
408403 }
409404 }
410405
411406
412407 func cg (i) = if ((size(i.payments) != 1))
413408 then throw("1 pmnt exp")
414409 else {
415410 let pmt = value(i.payments[0])
416411 let pmtAssetId = value(pmt.assetId)
417412 let pmtAmt = pmt.amount
418413 let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
419414 let outAmAmt = r._1
420415 let outPrAmt = r._2
421416 let sts = parseIntValue(r._9)
422417 let state = r._10
423418 if (if (igs())
424419 then true
425420 else (sts == PoolShutdown))
426421 then throw(("Admin blocked: " + toString(sts)))
427422 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
428423 }
429424
430425
431-func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
432- let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, false, emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId)
426+func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,pmtAmt,pmtId) = {
427+ let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, false, emitLp, isOneAsset, pmtAmt, pmtId)
433428 let sts = parseIntValue(r._8)
434429 if (if (if (igs())
435430 then true
436431 else (sts == PoolPutDis))
437432 then true
438433 else (sts == PoolShutdown))
439434 then throw(("Blocked:" + toString(sts)))
440435 else r
441436 }
442437
443438
444-func estimatePutOneTknV2 (pmtAmt,pmtAssetId,userAddress,txId) = {
445- let poolConfig = gpc()
446- let amId = poolConfig[idxAmAsId]
447- let prId = poolConfig[idxPrAsId]
448- let amBalance = getAccBalance(amId)
449- let prBalance = getAccBalance(prId)
450- let $t02075121200 = if ((txId == ""))
451- then $Tuple2(amBalance, prBalance)
452- else if ((pmtAssetId == amId))
453- then if ((pmtAmt > amBalance))
454- then throw("invalid payment amount")
455- else $Tuple2((amBalance - pmtAmt), prBalance)
456- else if ((pmtAssetId == prId))
457- then if ((pmtAmt > prBalance))
458- then throw("invalid payment amount")
459- else $Tuple2(amBalance, (prBalance - pmtAmt))
460- else throw("wrong pmtAssetId")
461- let amBalanceNow = $t02075121200._1
462- let prBalanceNow = $t02075121200._2
463- let $t02120421338 = if ((pmtAssetId == amId))
464- then $Tuple2(amBalanceNow, prBalanceNow)
465- else $Tuple2(prBalanceNow, amBalanceNow)
466- let amBalanceForCalc = $t02120421338._1
467- let prBalanceForCalc = $t02120421338._2
468- let xPrecision = 1
469- let result = {
470- let @ = invoke(gwxContract, "calcPutXOnly", [toString(pmtAmt), toString(amBalanceForCalc), toString(prBalanceForCalc), "", A, Amult, toString(xPrecision), Dconv], nil)
471- if ($isInstanceOf(@, "(Int, Int)"))
472- then @
473- else throw(($getType(invoke(gwxContract, "calcPutXOnly", [toString(pmtAmt), toString(amBalanceForCalc), toString(prBalanceForCalc), "", A, Amult, toString(xPrecision), Dconv], nil)) + " couldn't be cast to (Int, Int)"))
474- }
475- let $t02180721903 = if ((pmtAssetId == amId))
476- then result
477- else $Tuple2(result._2, result._1)
478- let amAssetPart = $t02180721903._1
479- let prAssetPart = $t02180721903._2
480- let estPut = cp(userAddress, txId, AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), 0, true, true, false, pmtAmt, pmtAssetId)
481- let estimLP = estPut._2
482- let lpAssetId = estPut._7
483- let state = estPut._9
484- let amDiff = estPut._10
485- let prDiff = estPut._11
486- $Tuple5(estimLP, lpAssetId, state, amDiff, prDiff)
439+func takeFee (amount) = {
440+ let fee = fraction(amount, feePermille, thousand)
441+ $Tuple2((amount - fee), fee)
487442 }
488443
489444
490445 func m () = match getString(mpk()) {
491446 case s: String =>
492447 fromBase58String(s)
493448 case _: Unit =>
494449 unit
495450 case _ =>
496451 throw("Match error")
497452 }
498453
499454
500455 func pm () = match getString(pmpk()) {
501456 case s: String =>
502457 fromBase58String(s)
503458 case _: Unit =>
504459 unit
505460 case _ =>
506461 throw("Match error")
507462 }
508463
509464
510465 let pd = throw("Permission denied")
511466
512467 func mm (i) = match m() {
513468 case pk: ByteVector =>
514469 if ((i.callerPublicKey == pk))
515470 then true
516471 else pd
517472 case _: Unit =>
518473 if ((i.caller == this))
519474 then true
520475 else pd
521476 case _ =>
522477 throw("Match error")
523478 }
524479
525480
526481 @Callable(i)
527482 func constructor (fc) = {
528483 let c = mm(i)
529484 if ((c == c))
530485 then [StringEntry(fc(), fc)]
531486 else throw("Strict value is not equal to itself.")
532487 }
533488
534489
535490
536491 @Callable(i)
537492 func setManager (pendingManagerPublicKey) = {
538493 let c = mm(i)
539494 if ((c == c))
540495 then {
541496 let cm = fromBase58String(pendingManagerPublicKey)
542497 if ((cm == cm))
543498 then [StringEntry(pmpk(), pendingManagerPublicKey)]
544499 else throw("Strict value is not equal to itself.")
545500 }
546501 else throw("Strict value is not equal to itself.")
547502 }
548503
549504
550505
551506 @Callable(i)
552507 func confirmManager () = {
553508 let p = pm()
554509 let hpm = if (isDefined(p))
555510 then true
556511 else throw("No pending manager")
557512 if ((hpm == hpm))
558513 then {
559514 let cpm = if ((i.callerPublicKey == value(p)))
560515 then true
561516 else throw("You are not pending manager")
562517 if ((cpm == cpm))
563518 then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())]
564519 else throw("Strict value is not equal to itself.")
565520 }
566521 else throw("Strict value is not equal to itself.")
567522 }
568523
569524
570525
571526 @Callable(i)
572527 func put (slip,autoStake) = {
573528 let factCfg = gfc()
574529 let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr")
575530 let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr")
576531 if ((0 > slip))
577532 then throw("Wrong slippage")
578533 else if ((size(i.payments) != 2))
579534 then throw("2 pmnts expd")
580535 else {
581- let e = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], slip, true, false, true, 0, "")
536+ let e = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], slip, true, false, 0, "")
582537 let emitLpAmt = e._2
583538 let lpAssetId = e._7
584539 let state = e._9
585540 let amDiff = e._10
586541 let prDiff = e._11
587542 let amId = e._12
588543 let prId = e._13
589544 let r = invoke(fca, "emit", [emitLpAmt], nil)
590545 if ((r == r))
591546 then {
592547 let el = match r {
593548 case legacy: Address =>
594549 invoke(legacy, "emit", [emitLpAmt], nil)
595550 case _ =>
596551 unit
597552 }
598553 if ((el == el))
599554 then {
600555 let sa = if ((amDiff > 0))
601556 then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
602557 else nil
603558 if ((sa == sa))
604559 then {
605560 let sp = if ((prDiff > 0))
606561 then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
607562 else nil
608563 if ((sp == sp))
609564 then {
610565 let lpTrnsfr = if (autoStake)
611566 then {
612567 let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
613568 if ((ss == ss))
614569 then nil
615570 else throw("Strict value is not equal to itself.")
616571 }
617572 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
618573 (state ++ lpTrnsfr)
619574 }
620575 else throw("Strict value is not equal to itself.")
621576 }
622577 else throw("Strict value is not equal to itself.")
623578 }
624579 else throw("Strict value is not equal to itself.")
625580 }
626581 else throw("Strict value is not equal to itself.")
627582 }
628583 }
629584
630585
631586
632587 @Callable(i)
633588 func putOneTkn (amAssetPart,prAssetPart,outLp,slippage,autoStake) = {
634589 let cfg = gfc()
635590 let stakingCntr = valueOrErrorMessage(addressFromString(cfg[idxFactStakCntr]), "Wr st addr")
636591 let slipCntr = valueOrErrorMessage(addressFromString(cfg[idxFactSlippCntr]), "Wr sl addr")
637592 let gwxCntr = valueOrErrorMessage(addressFromString(cfg[idxFactGwxRewCntr]), "Wr gwx addr")
638593 let poolCfg = gpc()
639594 let amId = poolCfg[idxAmAsId]
640595 let prId = poolCfg[idxPrAsId]
641596 let amDcm = parseIntValue(poolCfg[idxAmtAsDcm])
642597 let prDcm = parseIntValue(poolCfg[idxPriceAsDcm])
643598 let addon = valueOrElse(getString(this, ada()), "")
644599 let userAddress = if ((addon == toString(i.caller)))
645600 then i.originCaller
646601 else i.caller
647- let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid")
648- let check = reentrantInvoke(addonContract, "ensureCanPutOneTkn", [toString(userAddress)], nil)
649- if ((check == check))
650- then if (if (if (if ((0 >= slippage))
651- then true
652- else (0 >= amAssetPart))
653- then true
654- else (0 >= prAssetPart))
655- then true
656- else (0 >= outLp))
657- then throw("Wrong params")
658- else if ((size(i.payments) != 1))
659- then throw("1 pmnt expd")
660- else {
661- let pmt = value(i.payments[0])
662- let pmtAssetId = toBase58String(value(pmt.assetId))
663- let pmtAmt = pmt.amount
664- if ((10000000 > pmtAmt))
665- then throw("Wrong pmt amt")
666- else {
667- let amBalance = getAccBalance(amId)
668- let prBalance = getAccBalance(prId)
669- let $t02731327889 = if ((pmtAssetId == amId))
670- then if (if ((pmtAmt > amBalance))
602+ if (if (if (if ((0 >= slippage))
603+ then true
604+ else (0 >= amAssetPart))
605+ then true
606+ else (0 >= prAssetPart))
607+ then true
608+ else (0 >= outLp))
609+ then throw("Wrong params")
610+ else if ((size(i.payments) != 1))
611+ then throw("1 pmnt expd")
612+ else {
613+ let pmt = value(i.payments[0])
614+ let pmtAssetId = toBase58String(value(pmt.assetId))
615+ let paymentAmountRaw = pmt.amount
616+ let $t02464424696 = takeFee(paymentAmountRaw)
617+ let pmtAmt = $t02464424696._1
618+ let feeAmount = $t02464424696._2
619+ if ((10000000 > paymentAmountRaw))
620+ then throw("Wrong pmt amt")
621+ else {
622+ let amBalance = getAccBalance(amId)
623+ let prBalance = getAccBalance(prId)
624+ let $t02485625472 = if ((pmtAssetId == amId))
625+ then if (if ((paymentAmountRaw > amBalance))
626+ then true
627+ else (amAssetPart > pmtAmt))
628+ then throw("invalid payment amount")
629+ else $Tuple6((amBalance - paymentAmountRaw), prBalance, (pmtAmt - amAssetPart), prAssetPart, 0, 0)
630+ else if ((pmtAssetId == prId))
631+ then if (if ((paymentAmountRaw > prBalance))
671632 then true
672- else (amAssetPart > pmtAmt))
633+ else (prAssetPart > pmtAmt))
673634 then throw("invalid payment amount")
674- else $Tuple6((amBalance - pmtAmt), prBalance, (pmtAmt - amAssetPart), prAssetPart, 0, 0)
675- else if ((pmtAssetId == prId))
676- then if (if ((pmtAmt > prBalance))
677- then true
678- else (prAssetPart > pmtAmt))
679- then throw("invalid payment amount")
680- else $Tuple6(amBalance, (prBalance - pmtAmt), 0, 0, (pmtAmt - prAssetPart), amAssetPart)
681- else throw("wrong pmtAssetId")
682- let amBalanceNow = $t02731327889._1
683- let prBalanceNow = $t02731327889._2
684- let virtSwapInAm = $t02731327889._3
685- let virtSwapOutPr = $t02731327889._4
686- let virtSwapInPr = $t02731327889._5
687- let virtSwapOutAm = $t02731327889._6
688- let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
689- let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil)
690- let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
691- if ((D0vsD1 == D0vsD1))
692- then {
693- let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), slippage, true, true, true, pmtAmt, pmtAssetId)
694- let estimLP = estPut._2
695- let lpAssetId = estPut._7
696- let state = estPut._9
697- let amDiff = estPut._10
698- let prDiff = estPut._11
699- let lpCalcRes = vad(toBigInt(estimLP), toBigInt(outLp), toBigInt(slippage))
700- let emitLpAmt = toInt(lpCalcRes._2)
701- let e = invoke(fca, "emit", [emitLpAmt], nil)
702- if ((e == e))
703- then {
704- let el = match e {
705- case legacy: Address =>
706- invoke(legacy, "emit", [emitLpAmt], nil)
707- case _ =>
708- unit
709- }
710- if ((el == el))
711- then {
712- let sa = if ((amDiff > 0))
713- then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)])
714- else nil
715- if ((sa == sa))
716- then {
717- let sp = if ((prDiff > 0))
718- then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)])
719- else nil
720- if ((sp == sp))
721- then {
722- let lpTrnsfr = if (autoStake)
723- then {
724- let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
725- if ((ss == ss))
726- then nil
727- else throw("Strict value is not equal to itself.")
728- }
729- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
730- (state ++ lpTrnsfr)
731- }
732- else throw("Strict value is not equal to itself.")
733- }
734- else throw("Strict value is not equal to itself.")
735- }
736- else throw("Strict value is not equal to itself.")
737- }
738- else throw("Strict value is not equal to itself.")
739- }
740- else throw("Strict value is not equal to itself.")
741- }
742- }
743- else throw("Strict value is not equal to itself.")
744- }
745-
746-
747-
748-@Callable(i)
749-func putOneTknV2 (minOutAmount,autoStake) = if ((size(i.payments) != 1))
750- then throw("1 pmnt expd")
751- else {
752- let poolConfig = gpc()
753- let amId = poolConfig[idxAmAsId]
754- let prId = poolConfig[idxPrAsId]
755- let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
756- let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
757- let userAddress = if ((i.caller == this))
758- then i.originCaller
759- else i.caller
760- let pmt = value(i.payments[0])
761- let pmtAssetId = toBase58String(value(pmt.assetId))
762- let pmtAmt = pmt.amount
763- if ((10000000 > pmtAmt))
764- then throw("Wrong pmt amt")
765- else {
766- let $t03059830745 = estimatePutOneTknV2(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId))
767- let estimLP = $t03059830745._1
768- let lpAssetId = $t03059830745._2
769- let state = $t03059830745._3
770- let amDiff = $t03059830745._4
771- let prDiff = $t03059830745._5
772- let emitLpAmt = if (if ((minOutAmount > 0))
773- then (minOutAmount > estimLP)
774- else false)
775- then throw(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
776- else estimLP
777- let e = invoke(fca, "emit", [emitLpAmt], nil)
778- if ((e == e))
779- then {
780- let el = match e {
781- case legacy: Address =>
782- invoke(legacy, "emit", [emitLpAmt], nil)
783- case _ =>
784- unit
785- }
786- if ((el == el))
635+ else $Tuple6(amBalance, (prBalance - paymentAmountRaw), 0, 0, (pmtAmt - prAssetPart), amAssetPart)
636+ else throw("wrong pmtAssetId")
637+ let amBalanceNow = $t02485625472._1
638+ let prBalanceNow = $t02485625472._2
639+ let virtSwapInAm = $t02485625472._3
640+ let virtSwapOutPr = $t02485625472._4
641+ let virtSwapInPr = $t02485625472._5
642+ let virtSwapOutAm = $t02485625472._6
643+ let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
644+ let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil)
645+ let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
646+ if ((D0vsD1 == D0vsD1))
787647 then {
788- let sa = if ((amDiff > 0))
789- then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)])
790- else nil
791- if ((sa == sa))
648+ let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), slippage, true, true, pmtAmt, pmtAssetId)
649+ let estimLP = estPut._2
650+ let lpAssetId = estPut._7
651+ let state = estPut._9
652+ let amDiff = estPut._10
653+ let prDiff = estPut._11
654+ let lpCalcRes = vad(toBigInt(estimLP), toBigInt(outLp), toBigInt(slippage))
655+ let emitLpAmt = toInt(lpCalcRes._2)
656+ let e = invoke(fca, "emit", [emitLpAmt], nil)
657+ if ((e == e))
792658 then {
793- let sp = if ((prDiff > 0))
794- then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)])
795- else nil
796- if ((sp == sp))
659+ let el = match e {
660+ case legacy: Address =>
661+ invoke(legacy, "emit", [emitLpAmt], nil)
662+ case _ =>
663+ unit
664+ }
665+ if ((el == el))
797666 then {
798- let lpTrnsfr = if (autoStake)
667+ let sa = if ((amDiff > 0))
668+ then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)])
669+ else nil
670+ if ((sa == sa))
799671 then {
800- let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
801- if ((ss == ss))
802- then nil
672+ let sp = if ((prDiff > 0))
673+ then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)])
674+ else nil
675+ if ((sp == sp))
676+ then {
677+ let lpTrnsfr = if (autoStake)
678+ then {
679+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
680+ if ((ss == ss))
681+ then nil
682+ else throw("Strict value is not equal to itself.")
683+ }
684+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
685+ let sendFeeToMatcher = if ((feeAmount > 0))
686+ then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
687+ else nil
688+ ((state ++ lpTrnsfr) ++ sendFeeToMatcher)
689+ }
803690 else throw("Strict value is not equal to itself.")
804691 }
805- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
806- $Tuple2((state ++ lpTrnsfr), emitLpAmt)
692+ else throw("Strict value is not equal to itself.")
807693 }
808694 else throw("Strict value is not equal to itself.")
809695 }
810696 else throw("Strict value is not equal to itself.")
811697 }
812698 else throw("Strict value is not equal to itself.")
813699 }
814- else throw("Strict value is not equal to itself.")
815700 }
816- }
817-
818-
819-
820-@Callable(i)
821-func putOneTknV2READONLY (paymentAmount,paymentAssetId) = {
822- let $t03183031938 = estimatePutOneTknV2(paymentAmount, paymentAssetId, "", "")
823- let estimLP = $t03183031938._1
824- let lpAssetId = $t03183031938._2
825- let state = $t03183031938._3
826- let amDiff = $t03183031938._4
827- let prDiff = $t03183031938._5
828- $Tuple2(nil, estimLP)
829701 }
830702
831703
832704
833705 @Callable(i)
834706 func putForFree (maxSlpg) = if ((0 > maxSlpg))
835707 then throw("Wrong slpg")
836708 else if ((size(i.payments) != 2))
837709 then throw("2 pmnts expd")
838710 else {
839- let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, true, 0, "")
711+ let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, 0, "")
840712 estPut._9
841713 }
842714
843715
844716
845717 @Callable(i)
846718 func get () = {
847719 let r = cg(i)
848720 let outAmtAmt = r._1
849721 let outPrAmt = r._2
850722 let pmtAmt = r._3
851723 let pmtAssetId = r._4
852724 let state = r._5
853725 let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
854726 if ((b == b))
855727 then state
856728 else throw("Strict value is not equal to itself.")
857729 }
858730
859731
860732
861733 @Callable(i)
862734 func getOneTkn (exchResult,notUsed,outAmount,outAssetId,slippage) = if ((size(i.payments) != 1))
863735 then throw("1 pmnt expd")
864736 else {
865737 let cfg = gpc()
866738 let lpId = cfg[idxLPAsId]
867739 let amId = cfg[idxAmAsId]
868740 let prId = cfg[idxPrAsId]
869741 let amDcm = parseIntValue(cfg[idxAmtAsDcm])
870742 let prDcm = parseIntValue(cfg[idxPriceAsDcm])
871743 let sts = cfg[idxPoolSt]
872744 let factCfg = gfc()
873745 let gwxCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactGwxRewCntr]), "Wr sl addr")
874746 let pmt = value(i.payments[0])
875747 let addon = valueOrElse(getString(this, ada()), "")
876748 let userAddress = if ((addon == toString(i.caller)))
877749 then i.originCaller
878750 else i.caller
879751 let txId58 = toBase58String(i.transactionId)
880752 let pmtAssetId = value(pmt.assetId)
881753 let pmtAmt = pmt.amount
882- let addonContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(ada()), "no addons")), "addon address in not valid")
883- let check = reentrantInvoke(addonContract, "ensureCanGetOneTkn", [toString(userAddress)], nil)
884- if ((check == check))
885- then if ((1000000000 > pmtAmt))
886- then throw("Min pmt 10 LP")
887- else if (if (if ((0 > slippage))
888- then true
889- else (0 > exchResult))
890- then true
891- else (0 > outAmount))
892- then throw("Wrong params")
893- else if ((lpId != toBase58String(pmtAssetId)))
894- then throw("Wrong LP")
895- else {
896- let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
897- let estimAmAmt = r._1
898- let estimPrAmt = r._2
899- let amBalance = getAccBalance(amId)
900- let prBalance = getAccBalance(prId)
901- let $t03497635433 = if ((outAssetId == amId))
902- then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult))
903- else if ((outAssetId == prId))
904- then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult))
905- else throw("wrong outAssetId")
906- let amBalanceNow = $t03497635433._1
907- let prBalanceNow = $t03497635433._2
908- let virtSwapInAm = $t03497635433._3
909- let virtSwapOutPr = $t03497635433._4
910- let virtSwapInPr = $t03497635433._5
911- let virtSwapOutAm = $t03497635433._6
912- let totalGet = $t03497635433._7
913- if (if ((0 > virtSwapInAm))
914- then true
915- else (0 > virtSwapInPr))
916- then throw("Wrong calc")
917- else {
918- let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
919- let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil)
920- let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
921- if ((D0vsD1 == D0vsD1))
922- then {
923- let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage))
924- if ((finalRes == finalRes))
925- then {
926- let $t03613836242 = if ((outAssetId == amId))
927- then $Tuple2(toInt(finalRes._2), 0)
928- else $Tuple2(0, toInt(finalRes._2))
929- let outAm = $t03613836242._1
930- let outPr = $t03613836242._2
931- let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm))
932- let curPr = f1(curPrX18, scale8)
933- let state = [ScriptTransfer(userAddress, (outAm + outPr), if ((outAssetId == "WAVES"))
934- then unit
935- else fromBase58String(outAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)]
936- if ((state == state))
937- then {
938- let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
939- if ((burn == burn))
940- then state
941- else throw("Strict value is not equal to itself.")
942- }
943- else throw("Strict value is not equal to itself.")
944- }
945- else throw("Strict value is not equal to itself.")
946- }
947- else throw("Strict value is not equal to itself.")
948- }
949- }
950- else throw("Strict value is not equal to itself.")
951- }
952-
953-
954-
955-@Callable(i)
956-func getOneTknV2 (outAssetId,minOutAmount) = if ((size(i.payments) != 1))
957- then throw("1 pmnt expd")
958- else {
959- let poolConfig = gpc()
960- let lpId = poolConfig[idxLPAsId]
961- let amId = poolConfig[idxAmAsId]
962- let prId = poolConfig[idxPrAsId]
963- let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
964- let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
965- let poolStatus = poolConfig[idxPoolSt]
966- let userAddress = if ((i.caller == this))
967- then i.originCaller
968- else i.caller
969- let pmt = value(i.payments[0])
970- let pmtAssetId = value(pmt.assetId)
971- let pmtAmt = pmt.amount
972754 if ((1000000000 > pmtAmt))
973755 then throw("Min pmt 10 LP")
974- else {
975- let txId58 = toBase58String(i.transactionId)
976- if ((lpId != toBase58String(pmtAssetId)))
756+ else if (if (if ((0 > slippage))
757+ then true
758+ else (0 > exchResult))
759+ then true
760+ else (0 > outAmount))
761+ then throw("Wrong params")
762+ else if ((lpId != toBase58String(pmtAssetId)))
977763 then throw("Wrong LP")
978764 else {
979- let r = ego(txId58, toBase58String(pmtAssetId), pmtAmt, i.caller)
765+ let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
980766 let estimAmAmt = r._1
981767 let estimPrAmt = r._2
982768 let amBalance = getAccBalance(amId)
983769 let prBalance = getAccBalance(prId)
984- let totalGet = {
985- let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
986- if ($isInstanceOf(@, "Int"))
987- then @
988- else throw(($getType(invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)) + " couldn't be cast to Int"))
989- }
990- let totalAmount = if (if ((minOutAmount > 0))
991- then (minOutAmount > totalGet)
992- else false)
993- then throw(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
994- else totalGet
995- let $t03819038277 = if ((outAssetId == amId))
996- then $Tuple2(totalAmount, 0)
997- else $Tuple2(0, totalAmount)
998- let outAm = $t03819038277._1
999- let outPr = $t03819038277._2
1000- let curPrX18 = cpbi(t1(prBalance, prDecimals), t1(amBalance, amDecimals))
1001- let curPr = f1(curPrX18, scale8)
1002- let state = [ScriptTransfer(userAddress, totalAmount, if ((outAssetId == "WAVES"))
1003- then unit
1004- else fromBase58String(outAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)]
1005- if ((state == state))
1006- then {
1007- let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1008- if ((burn == burn))
1009- then $Tuple2(state, totalAmount)
770+ let $t03041530875 = if ((outAssetId == amId))
771+ then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult))
772+ else if ((outAssetId == prId))
773+ then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult))
774+ else throw("wrong outAssetId")
775+ let amBalanceNow = $t03041530875._1
776+ let prBalanceNow = $t03041530875._2
777+ let virtSwapInAm = $t03041530875._3
778+ let virtSwapOutPr = $t03041530875._4
779+ let virtSwapInPr = $t03041530875._5
780+ let virtSwapOutAm = $t03041530875._6
781+ let totalGetRaw = $t03041530875._7
782+ if (if ((0 > virtSwapInAm))
783+ then true
784+ else (0 > virtSwapInPr))
785+ then throw("Wrong calc")
786+ else {
787+ let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
788+ let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil)
789+ let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
790+ if ((D0vsD1 == D0vsD1))
791+ then {
792+ let totalGet = takeFee(totalGetRaw)._1
793+ let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage))
794+ if ((finalRes == finalRes))
795+ then {
796+ let $t03162231726 = if ((outAssetId == amId))
797+ then $Tuple2(toInt(finalRes._2), 0)
798+ else $Tuple2(0, toInt(finalRes._2))
799+ let outAm = $t03162231726._1
800+ let outPr = $t03162231726._2
801+ let totalAmount = (outAm + outPr)
802+ let feeAmount = (totalGetRaw - totalGet)
803+ let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
804+ then unit
805+ else fromBase58String(outAssetId)
806+ let sendFeeToMatcher = if ((feeAmount > 0))
807+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
808+ else nil
809+ let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm))
810+ let curPr = f1(curPrX18, scale8)
811+ let state = [ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)]
812+ if ((state == state))
813+ then {
814+ let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
815+ if ((burn == burn))
816+ then (state ++ sendFeeToMatcher)
817+ else throw("Strict value is not equal to itself.")
818+ }
819+ else throw("Strict value is not equal to itself.")
820+ }
821+ else throw("Strict value is not equal to itself.")
822+ }
1010823 else throw("Strict value is not equal to itself.")
1011824 }
1012- else throw("Strict value is not equal to itself.")
1013825 }
1014- }
1015826 }
1016-
1017-
1018-
1019-@Callable(i)
1020-func getOneTknV2READONLY (outAssetId,lpAssetAmount) = {
1021- let poolConfig = gpc()
1022- let lpId = poolConfig[idxLPAsId]
1023- let amId = poolConfig[idxAmAsId]
1024- let prId = poolConfig[idxPrAsId]
1025- let r = ego("", lpId, lpAssetAmount, this)
1026- let estimAmAmt = r._1
1027- let estimPrAmt = r._2
1028- let amBalance = getAccBalance(amId)
1029- let prBalance = getAccBalance(prId)
1030- let amBalanceNow = (amBalance - estimAmAmt)
1031- let prBalanceNow = (prBalance - estimPrAmt)
1032- let $t03937139642 = if ((outAssetId == amId))
1033- then $Tuple3(prBalanceNow, amBalanceNow, estimPrAmt)
1034- else if ((outAssetId == prId))
1035- then $Tuple3(amBalanceNow, prBalanceNow, estimAmAmt)
1036- else throw("wrong outAssetId")
1037- let amountBalanceForSwap = $t03937139642._1
1038- let priceBalanceForSwap = $t03937139642._2
1039- let amountToSwap = $t03937139642._3
1040- let yPrecision = 1
1041- let exchResult = {
1042- let @ = invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil)
1043- if ($isInstanceOf(@, "Int"))
1044- then @
1045- else throw(($getType(invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil)) + " couldn't be cast to Int"))
1046- }
1047- let totalGet = (exchResult + (if ((outAssetId == amId))
1048- then estimAmAmt
1049- else estimPrAmt))
1050- $Tuple2(nil, totalGet)
1051- }
1052827
1053828
1054829
1055830 @Callable(i)
1056831 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
1057832 let r = cg(i)
1058833 let outAmAmt = r._1
1059834 let outPrAmt = r._2
1060835 let pmtAmt = r._3
1061836 let pmtAssetId = r._4
1062837 let state = r._5
1063838 if ((noLessThenAmtAsset > outAmAmt))
1064839 then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
1065840 else if ((noLessThenPriceAsset > outPrAmt))
1066841 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
1067842 else {
1068843 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1069844 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1070845 then state
1071846 else throw("Strict value is not equal to itself.")
1072847 }
1073848 }
1074849
1075850
1076851
1077852 @Callable(i)
1078853 func unstakeAndGet (amount) = {
1079854 let checkPayments = if ((size(i.payments) != 0))
1080855 then throw("No pmnts expd")
1081856 else true
1082857 if ((checkPayments == checkPayments))
1083858 then {
1084859 let cfg = gpc()
1085860 let factoryCfg = gfc()
1086861 let lpAssetId = fromBase58String(cfg[idxLPAsId])
1087862 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
1088863 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
1089864 if ((unstakeInv == unstakeInv))
1090865 then {
1091866 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1092867 let sts = parseIntValue(r._9)
1093868 let state = r._10
1094869 let v = if (if (igs())
1095870 then true
1096871 else (sts == PoolShutdown))
1097872 then throw(("Blocked: " + toString(sts)))
1098873 else true
1099874 if ((v == v))
1100875 then {
1101876 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
1102877 if ((burnA == burnA))
1103878 then state
1104879 else throw("Strict value is not equal to itself.")
1105880 }
1106881 else throw("Strict value is not equal to itself.")
1107882 }
1108883 else throw("Strict value is not equal to itself.")
1109884 }
1110885 else throw("Strict value is not equal to itself.")
1111886 }
1112887
1113888
1114889
1115890 @Callable(i)
1116-func unstakeAndGetOneTkn (amount,outAmount,outAssetId,slippage) = {
1117- let checkPayments = if ((size(i.payments) != 0))
1118- then throw("No pmnts expd")
1119- else true
1120- if ((checkPayments == checkPayments))
1121- then {
1122- let cfg = gpc()
1123- let factoryCfg = gfc()
1124- let lpAssetId = fromBase58String(cfg[idxLPAsId])
1125- let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
1126- let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
1127- if ((unstakeInv == unstakeInv))
1128- then {
1129- let outAmountResult = {
1130- let @ = invoke(this, "getOneTknV2", [outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
1131- if ($isInstanceOf(@, "Int"))
1132- then @
1133- else unit
1134- }
1135- if ((outAmountResult == outAmountResult))
1136- then $Tuple2(nil, outAmountResult)
1137- else throw("Strict value is not equal to itself.")
1138- }
1139- else throw("Strict value is not equal to itself.")
1140- }
1141- else throw("Strict value is not equal to itself.")
1142- }
1143-
1144-
1145-
1146-@Callable(i)
1147891 func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca)))
1148892 then throw("denied")
1149893 else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success")
1150894
1151895
1152896
1153897 @Callable(i)
1154898 func setS (k,v) = if ((toString(i.caller) != strf(this, ada())))
1155899 then pd
1156900 else [StringEntry(k, v)]
1157901
1158902
1159903
1160904 @Callable(i)
1161905 func setI (k,v) = if ((toString(i.caller) != strf(this, ada())))
1162906 then pd
1163907 else [IntegerEntry(k, v)]
1164908
1165909
1166910
1167911 @Callable(i)
1168912 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc())
1169913
1170914
1171915
1172916 @Callable(i)
1173917 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
1174918
1175919
1176920
1177921 @Callable(i)
1178922 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
1179923 let pr = calcPrices(amAmt, prAmt, lpAmt)
1180924 $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])])
1181925 }
1182926
1183927
1184928
1185929 @Callable(i)
1186930 func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult))
1187931
1188932
1189933
1190934 @Callable(i)
1191935 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult)))
1192936
1193937
1194938
1195939 @Callable(i)
1196940 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
1197941
1198942
1199943
1200944 @Callable(i)
1201-func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, true, false, 0, ""))
945+func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, false, 0, ""))
1202946
1203947
1204948
1205949 @Callable(i)
1206950 func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = {
1207951 let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr))
1208952 $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10))
1209953 }
1210954
1211955
1212956 @Verifier(tx)
1213957 func verify () = {
1214958 let targetPublicKey = match m() {
1215959 case pk: ByteVector =>
1216960 pk
1217961 case _: Unit =>
1218962 tx.senderPublicKey
1219963 case _ =>
1220964 throw("Match error")
1221965 }
1222966 match tx {
1223967 case order: Order =>
1224968 let matcherPub = mp()
1225969 let orderValid = moa(order)
1226970 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
1227971 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
1228972 if (if (if (orderValid)
1229973 then senderValid
1230974 else false)
1231975 then matcherValid
1232976 else false)
1233977 then true
1234978 else toe(orderValid, senderValid, matcherValid)
1235979 case s: SetScriptTransaction =>
1236980 let newHash = blake2b256(value(s.script))
1237981 let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash())))
1238982 let currentHash = scriptHash(this)
1239983 if (if ((allowedHash == newHash))
1240984 then (currentHash != newHash)
1241985 else false)
1242986 then true
1243987 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
1244988 case _ =>
1245989 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
1246990 }
1247991 }
1248992

github/deemru/w8io/026f985 
117.61 ms