tx · GE24pgEr6yjW1wACdqv9tTWNNUStTC1HyubAKEgNJsuD 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT: -0.03200000 Waves 2022.11.29 18:48 [2338589] smart account 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT > SELF 0.00000000 Waves
{ "type": 13, "id": "GE24pgEr6yjW1wACdqv9tTWNNUStTC1HyubAKEgNJsuD", "fee": 3200000, "feeAssetId": null, "timestamp": 1669736951429, "version": 1, "sender": "3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT", "senderPublicKey": "D1BL65meykxFZTCuq7jq9HSGLLnWvQamQPUNrguW5w39", "proofs": [ "22X97hAjr45GjKyW7TDcGYDb5vdmFiQjcnkTQHkijf1MZoEifDaETdjN7r2DP9iFqLpofa4v53xedAv5PwziqWHe" ], "script": "base64:BgLEJAgCEgMKAQgSAwoBCBIAEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIAEgQKAggBEgQKAggBEgQKAgEBEgMKAQESBQoDAQEBEgUKAwEIARIECgIBCBIECgIBCBIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgpzbGlwcGFnZTREIgt3YXZlc1N0cmluZyIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFzSWQiDWlkeElQcmljZUFzSWQiD2lkeEZhY3RTdGFrQ250ciISaWR4RmFjdG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MCFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJlcQUCYUMEAmhrCQD2AwEJAQV2YWx1ZQEIBQJlcQZzY3JpcHQEAmhsCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYUwJAQJhdgAEAmhtCQDxBwEFBHRoaXMDAwkAAAIFAmhsBQJoawkBAiE9AgUCaG0FAmhrBwYJAPQDAwgFAmhkCWJvZHlCeXRlcwkAkQMCCAUCaGQGcHJvb2ZzAAAFAmhmCQD0AwMIBQJoZAlib2R5Qnl0ZXMJAJEDAggFAmhkBnByb29mcwAABQJoZnDQvME=", "chainId": 84, "height": 2338589, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7qeTDJZn4LaYsgJzFkLvUDfohq4PyThmF9agu58eqZ9N Next: 8rK5KoYi8F3fGjzvSu5FwGmBFHYG6WoL3ToAbYnfgLoC Diff:
Old | New | Differences | |
---|---|---|---|
119 | 119 | ||
120 | 120 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
121 | 121 | ||
122 | + | let keyDLp = makeString(["%s", "dLp"], SEP) | |
123 | + | ||
124 | + | let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP) | |
125 | + | ||
126 | + | let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP) | |
127 | + | ||
128 | + | let dLpRefreshDelayDefault = 30 | |
129 | + | ||
130 | + | let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault) | |
131 | + | ||
122 | 132 | func fcfg () = "%s__factoryConfig" | |
123 | 133 | ||
124 | 134 | ||
160 | 170 | func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " ")) | |
161 | 171 | ||
162 | 172 | ||
173 | + | func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ") | |
174 | + | ||
175 | + | ||
163 | 176 | let fca = addressFromStringValue(strf(this, fc())) | |
164 | 177 | ||
165 | 178 | let A = strf(this, amp()) | |
196 | 209 | ||
197 | 210 | let poolConfigParsed = parsePoolConfig(gpc()) | |
198 | 211 | ||
199 | - | let $ | |
212 | + | let $t072087394 = poolConfigParsed | |
200 | 213 | ||
201 | - | let cfgPoolAddress = $ | |
214 | + | let cfgPoolAddress = $t072087394._1 | |
202 | 215 | ||
203 | - | let cfgPoolStatus = $ | |
216 | + | let cfgPoolStatus = $t072087394._2 | |
204 | 217 | ||
205 | - | let cfgLpAssetId = $ | |
218 | + | let cfgLpAssetId = $t072087394._3 | |
206 | 219 | ||
207 | - | let cfgAmountAssetId = $ | |
220 | + | let cfgAmountAssetId = $t072087394._4 | |
208 | 221 | ||
209 | - | let cfgPriceAssetId = $ | |
222 | + | let cfgPriceAssetId = $t072087394._5 | |
210 | 223 | ||
211 | - | let cfgAmountAssetDecimals = $ | |
224 | + | let cfgAmountAssetDecimals = $t072087394._6 | |
212 | 225 | ||
213 | - | let cfgPriceAssetDecimals = $ | |
226 | + | let cfgPriceAssetDecimals = $t072087394._7 | |
214 | 227 | ||
215 | 228 | func gfc () = split(strf(fca, fcfg()), SEP) | |
216 | 229 | ||
405 | 418 | else calcLpAmt | |
406 | 419 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
407 | 420 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
408 | - | let $ | |
421 | + | let $t01782518170 = if (if (isOneAsset) | |
409 | 422 | then (pmtId == amIdStr) | |
410 | 423 | else false) | |
411 | 424 | then $Tuple2(pmtAmt, 0) | |
414 | 427 | else false) | |
415 | 428 | then $Tuple2(0, pmtAmt) | |
416 | 429 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
417 | - | let writeAmAmt = $ | |
418 | - | let writePrAmt = $ | |
430 | + | let writeAmAmt = $t01782518170._1 | |
431 | + | let writePrAmt = $t01782518170._2 | |
419 | 432 | 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))] | |
420 | 433 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
421 | 434 | } | |
435 | + | } | |
436 | + | ||
437 | + | ||
438 | + | func calcDLp (amountBalance,priceBalance,lpEmission) = { | |
439 | + | let updatedDLp = fraction((amountBalance * priceBalance), scale18, lpEmission) | |
440 | + | updatedDLp | |
441 | + | } | |
442 | + | ||
443 | + | ||
444 | + | func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
445 | + | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
446 | + | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
447 | + | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
448 | + | let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
449 | + | let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))] | |
450 | + | $Tuple2(actions, updatedDLp) | |
422 | 451 | } | |
423 | 452 | ||
424 | 453 | ||
515 | 544 | let ann_aPrecision = (ann - aPrecision) | |
516 | 545 | let n1 = (n + big1) | |
517 | 546 | func calc (acc,cur) = { | |
518 | - | let $ | |
519 | - | let d = $ | |
520 | - | let found = $ | |
547 | + | let $t02363623656 = acc | |
548 | + | let d = $t02363623656._1 | |
549 | + | let found = $t02363623656._2 | |
521 | 550 | if ((found != unit)) | |
522 | 551 | then acc | |
523 | 552 | else { | |
531 | 560 | } | |
532 | 561 | ||
533 | 562 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
534 | - | let $ | |
563 | + | let $t02407724124 = { | |
535 | 564 | let $l = arr | |
536 | 565 | let $s = size($l) | |
537 | 566 | let $acc0 = $Tuple2(s, unit) | |
545 | 574 | ||
546 | 575 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
547 | 576 | } | |
548 | - | let d = $ | |
549 | - | let found = $ | |
577 | + | let d = $t02407724124._1 | |
578 | + | let found = $t02407724124._2 | |
550 | 579 | if ((found != unit)) | |
551 | 580 | then d | |
552 | 581 | else throw(("D calculation error, D = " + toString(d))) | |
566 | 595 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
567 | 596 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
568 | 597 | func calc (acc,cur) = { | |
569 | - | let $ | |
570 | - | let y = $ | |
571 | - | let found = $ | |
598 | + | let $t02462424644 = acc | |
599 | + | let y = $t02462424644._1 | |
600 | + | let found = $t02462424644._2 | |
572 | 601 | if ((found != unit)) | |
573 | 602 | then acc | |
574 | 603 | else { | |
581 | 610 | } | |
582 | 611 | ||
583 | 612 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
584 | - | let $ | |
613 | + | let $t02495124998 = { | |
585 | 614 | let $l = arr | |
586 | 615 | let $s = size($l) | |
587 | 616 | let $acc0 = $Tuple2(D, unit) | |
595 | 624 | ||
596 | 625 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
597 | 626 | } | |
598 | - | let y = $ | |
599 | - | let found = $ | |
627 | + | let y = $t02495124998._1 | |
628 | + | let found = $t02495124998._2 | |
600 | 629 | if ((found != unit)) | |
601 | 630 | then y | |
602 | 631 | else throw(("Y calculation error, Y = " + toString(y))) | |
618 | 647 | then { | |
619 | 648 | let amBalance = getAccBalance(amId) | |
620 | 649 | let prBalance = getAccBalance(prId) | |
621 | - | let $ | |
650 | + | let $t02578126243 = if ((txId == "")) | |
622 | 651 | then $Tuple2(amBalance, prBalance) | |
623 | 652 | else if ((pmtAssetId == amId)) | |
624 | 653 | then if ((pmtAmtRaw > amBalance)) | |
629 | 658 | then throw("invalid payment amount") | |
630 | 659 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
631 | 660 | else throw("wrong pmtAssetId") | |
632 | - | let amBalanceOld = $ | |
633 | - | let prBalanceOld = $ | |
634 | - | let $ | |
661 | + | let amBalanceOld = $t02578126243._1 | |
662 | + | let prBalanceOld = $t02578126243._2 | |
663 | + | let $t02624926425 = if ((pmtAssetId == amId)) | |
635 | 664 | then $Tuple2(pmtAmtRaw, 0) | |
636 | 665 | else if ((pmtAssetId == prId)) | |
637 | 666 | then $Tuple2(0, pmtAmtRaw) | |
638 | 667 | else throw("invalid payment") | |
639 | - | let amAmountRaw = $ | |
640 | - | let prAmountRaw = $ | |
641 | - | let $ | |
668 | + | let amAmountRaw = $t02624926425._1 | |
669 | + | let prAmountRaw = $t02624926425._2 | |
670 | + | let $t02642926668 = if (withTakeFee) | |
642 | 671 | then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2) | |
643 | 672 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
644 | - | let amAmount = $ | |
645 | - | let prAmount = $ | |
646 | - | let feeAmount = $ | |
673 | + | let amAmount = $t02642926668._1 | |
674 | + | let prAmount = $t02642926668._2 | |
675 | + | let feeAmount = $t02642926668._3 | |
647 | 676 | let amBalanceNew = (amBalanceOld + amAmount) | |
648 | 677 | let prBalanceNew = (prBalanceOld + prAmount) | |
649 | 678 | let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)]) | |
689 | 718 | else { | |
690 | 719 | let amBalance = getAccBalance(amId) | |
691 | 720 | let prBalance = getAccBalance(prId) | |
692 | - | let $ | |
721 | + | let $t02867028781 = { | |
693 | 722 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
694 | 723 | if ($isInstanceOf(@, "(Int, Int)")) | |
695 | 724 | then @ | |
696 | 725 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
697 | 726 | } | |
698 | - | if (($ | |
727 | + | if (($t02867028781 == $t02867028781)) | |
699 | 728 | then { | |
700 | - | let feeAmount = $ | |
701 | - | let totalGet = $ | |
729 | + | let feeAmount = $t02867028781._2 | |
730 | + | let totalGet = $t02867028781._1 | |
702 | 731 | let totalAmount = if (if ((minOutAmount > 0)) | |
703 | 732 | then (minOutAmount > totalGet) | |
704 | 733 | else false) | |
705 | 734 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
706 | 735 | else totalGet | |
707 | - | let $ | |
736 | + | let $t02897129278 = if ((outAssetId == amId)) | |
708 | 737 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
709 | 738 | else if ((outAssetId == prId)) | |
710 | 739 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
711 | 740 | else throw("invalid out asset id") | |
712 | - | let outAm = $ | |
713 | - | let outPr = $ | |
714 | - | let amBalanceNew = $ | |
715 | - | let prBalanceNew = $ | |
741 | + | let outAm = $t02897129278._1 | |
742 | + | let outPr = $t02897129278._2 | |
743 | + | let amBalanceNew = $t02897129278._3 | |
744 | + | let prBalanceNew = $t02897129278._4 | |
716 | 745 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
717 | 746 | let curPr = f1(curPrX18, scale8) | |
718 | 747 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
924 | 953 | let pmt = value(i.payments[0]) | |
925 | 954 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
926 | 955 | let pmtAmt = pmt.amount | |
927 | - | let $ | |
928 | - | if (($ | |
956 | + | let $t03464034798 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
957 | + | if (($t03464034798 == $t03464034798)) | |
929 | 958 | then { | |
930 | - | let feeAmount = $ | |
931 | - | let state = $ | |
932 | - | let estimLP = $ | |
959 | + | let feeAmount = $t03464034798._3 | |
960 | + | let state = $t03464034798._2 | |
961 | + | let estimLP = $t03464034798._1 | |
933 | 962 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
934 | 963 | then (minOutAmount > estimLP) | |
935 | 964 | else false) | |
1020 | 1049 | else throwErr("exactly 1 payment are expected")] | |
1021 | 1050 | if ((checks == checks)) | |
1022 | 1051 | then { | |
1023 | - | let $ | |
1024 | - | let state = $ | |
1025 | - | let totalAmount = $ | |
1052 | + | let $t03742037575 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1053 | + | let state = $t03742037575._1 | |
1054 | + | let totalAmount = $t03742037575._2 | |
1026 | 1055 | $Tuple2(state, totalAmount) | |
1027 | 1056 | } | |
1028 | 1057 | else throw("Strict value is not equal to itself.") | |
1053 | 1082 | let newY = getYD(xp, index, D1) | |
1054 | 1083 | let dy = (xp[index] - newY) | |
1055 | 1084 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1056 | - | let $ | |
1057 | - | let totalGet = $ | |
1058 | - | let feeAmount = $ | |
1085 | + | let $t03841638465 = takeFee(totalGetRaw) | |
1086 | + | let totalGet = $t03841638465._1 | |
1087 | + | let feeAmount = $t03841638465._2 | |
1059 | 1088 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1060 | 1089 | } | |
1061 | 1090 | ||
1069 | 1098 | let lpId = poolConfig[idxLPAsId] | |
1070 | 1099 | let amBalance = getAccBalance(amId) | |
1071 | 1100 | let prBalance = getAccBalance(prId) | |
1072 | - | let $ | |
1101 | + | let $t03881038925 = { | |
1073 | 1102 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1074 | 1103 | if ($isInstanceOf(@, "(Int, Int)")) | |
1075 | 1104 | then @ | |
1076 | 1105 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1077 | 1106 | } | |
1078 | - | let totalGet = $ | |
1079 | - | let feeAmount = $ | |
1107 | + | let totalGet = $t03881038925._1 | |
1108 | + | let feeAmount = $t03881038925._2 | |
1080 | 1109 | let r = ego("", lpId, lpAssetAmount, this) | |
1081 | 1110 | let outAmAmt = r._1 | |
1082 | 1111 | let outPrAmt = r._2 | |
1220 | 1249 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1221 | 1250 | if ((unstakeInv == unstakeInv)) | |
1222 | 1251 | then { | |
1223 | - | let $ | |
1224 | - | let state = $ | |
1225 | - | let totalAmount = $ | |
1252 | + | let $t04276342951 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1253 | + | let state = $t04276342951._1 | |
1254 | + | let totalAmount = $t04276342951._2 | |
1226 | 1255 | $Tuple2(state, totalAmount) | |
1227 | 1256 | } | |
1228 | 1257 | else throw("Strict value is not equal to itself.") | |
1238 | 1267 | let amId = poolConfig[idxAmAsId] | |
1239 | 1268 | let prId = poolConfig[idxPrAsId] | |
1240 | 1269 | let lpId = poolConfig[idxLPAsId] | |
1241 | - | let $ | |
1242 | - | let lpAmount = $ | |
1243 | - | let state = $ | |
1244 | - | let feeAmount = $ | |
1245 | - | let bonus = $ | |
1270 | + | let $t04321043313 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1271 | + | let lpAmount = $t04321043313._1 | |
1272 | + | let state = $t04321043313._2 | |
1273 | + | let feeAmount = $t04321043313._3 | |
1274 | + | let bonus = $t04321043313._4 | |
1246 | 1275 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1247 | 1276 | } | |
1248 | 1277 | ||
1254 | 1283 | let amId = poolConfig[idxAmAsId] | |
1255 | 1284 | let prId = poolConfig[idxPrAsId] | |
1256 | 1285 | let lpId = poolConfig[idxLPAsId] | |
1257 | - | let $ | |
1258 | - | let lpAmount = $ | |
1259 | - | let state = $ | |
1260 | - | let feeAmount = $ | |
1261 | - | let bonus = $ | |
1286 | + | let $t04359243696 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1287 | + | let lpAmount = $t04359243696._1 | |
1288 | + | let state = $t04359243696._2 | |
1289 | + | let feeAmount = $t04359243696._3 | |
1290 | + | let bonus = $t04359243696._4 | |
1262 | 1291 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1263 | 1292 | } | |
1264 | 1293 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let scale8 = 100000000 | |
5 | 5 | ||
6 | 6 | let scale8BigInt = toBigInt(100000000) | |
7 | 7 | ||
8 | 8 | let scale18 = toBigInt(1000000000000000000) | |
9 | 9 | ||
10 | 10 | let zeroBigInt = toBigInt(0) | |
11 | 11 | ||
12 | 12 | let big0 = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big1 = toBigInt(1) | |
15 | 15 | ||
16 | 16 | let big2 = toBigInt(2) | |
17 | 17 | ||
18 | 18 | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
19 | 19 | ||
20 | 20 | let wavesString = "WAVES" | |
21 | 21 | ||
22 | 22 | let Amult = "100" | |
23 | 23 | ||
24 | 24 | let Dconv = "1" | |
25 | 25 | ||
26 | 26 | let SEP = "__" | |
27 | 27 | ||
28 | 28 | let EMPTY = "" | |
29 | 29 | ||
30 | 30 | let PoolActive = 1 | |
31 | 31 | ||
32 | 32 | let PoolPutDis = 2 | |
33 | 33 | ||
34 | 34 | let PoolMatcherDis = 3 | |
35 | 35 | ||
36 | 36 | let PoolShutdown = 4 | |
37 | 37 | ||
38 | 38 | let idxPoolAddress = 1 | |
39 | 39 | ||
40 | 40 | let idxPoolSt = 2 | |
41 | 41 | ||
42 | 42 | let idxLPAsId = 3 | |
43 | 43 | ||
44 | 44 | let idxAmAsId = 4 | |
45 | 45 | ||
46 | 46 | let idxPrAsId = 5 | |
47 | 47 | ||
48 | 48 | let idxAmtAsDcm = 6 | |
49 | 49 | ||
50 | 50 | let idxPriceAsDcm = 7 | |
51 | 51 | ||
52 | 52 | let idxIAmtAsId = 8 | |
53 | 53 | ||
54 | 54 | let idxIPriceAsId = 9 | |
55 | 55 | ||
56 | 56 | let idxFactStakCntr = 1 | |
57 | 57 | ||
58 | 58 | let idxFactoryRestCntr = 6 | |
59 | 59 | ||
60 | 60 | let idxFactSlippCntr = 7 | |
61 | 61 | ||
62 | 62 | let idxFactGwxRewCntr = 10 | |
63 | 63 | ||
64 | 64 | let feeDefault = fraction(10, scale8, 10000) | |
65 | 65 | ||
66 | 66 | func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func abs (val) = if ((zeroBigInt > val)) | |
76 | 76 | then -(val) | |
77 | 77 | else val | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func absBigInt (val) = if ((zeroBigInt > val)) | |
81 | 81 | then -(val) | |
82 | 82 | else val | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func fc () = "%s__factoryContract" | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func mpk () = "%s__managerPublicKey" | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func pmpk () = "%s__pendingManagerPublicKey" | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func pl () = "%s%s__price__last" | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId) | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func aa () = "%s__amountAsset" | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func pa () = "%s__priceAsset" | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func amp () = "%s__amp" | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func ada () = "%s__addonAddr" | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | let keyFee = "%s__fee" | |
119 | 119 | ||
120 | 120 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
121 | 121 | ||
122 | + | let keyDLp = makeString(["%s", "dLp"], SEP) | |
123 | + | ||
124 | + | let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP) | |
125 | + | ||
126 | + | let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP) | |
127 | + | ||
128 | + | let dLpRefreshDelayDefault = 30 | |
129 | + | ||
130 | + | let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault) | |
131 | + | ||
122 | 132 | func fcfg () = "%s__factoryConfig" | |
123 | 133 | ||
124 | 134 | ||
125 | 135 | func mtpk () = "%s%s__matcher__publicKey" | |
126 | 136 | ||
127 | 137 | ||
128 | 138 | func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
129 | 139 | ||
130 | 140 | ||
131 | 141 | func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
132 | 142 | ||
133 | 143 | ||
134 | 144 | func aps () = "%s__shutdown" | |
135 | 145 | ||
136 | 146 | ||
137 | 147 | func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash" | |
138 | 148 | ||
139 | 149 | ||
140 | 150 | func keyFeeCollectorAddress () = "%s__feeCollectorAddress" | |
141 | 151 | ||
142 | 152 | ||
143 | 153 | func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV))) | |
144 | 154 | ||
145 | 155 | ||
146 | 156 | func str (val) = match val { | |
147 | 157 | case valStr: String => | |
148 | 158 | valStr | |
149 | 159 | case _ => | |
150 | 160 | throw("fail cast to String") | |
151 | 161 | } | |
152 | 162 | ||
153 | 163 | ||
154 | 164 | func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
155 | 165 | ||
156 | 166 | ||
157 | 167 | func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
158 | 168 | ||
159 | 169 | ||
160 | 170 | func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " ")) | |
161 | 171 | ||
162 | 172 | ||
173 | + | func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ") | |
174 | + | ||
175 | + | ||
163 | 176 | let fca = addressFromStringValue(strf(this, fc())) | |
164 | 177 | ||
165 | 178 | let A = strf(this, amp()) | |
166 | 179 | ||
167 | 180 | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
168 | 181 | ||
169 | 182 | ||
170 | 183 | func mp () = fromBase58String(strf(fca, mtpk())) | |
171 | 184 | ||
172 | 185 | ||
173 | 186 | let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress())) | |
174 | 187 | ||
175 | 188 | func gpc () = { | |
176 | 189 | let amtAs = strf(this, aa()) | |
177 | 190 | let priceAs = strf(this, pa()) | |
178 | 191 | let iPriceAs = intf(fca, mba(priceAs)) | |
179 | 192 | let iAmtAs = intf(fca, mba(amtAs)) | |
180 | 193 | split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP) | |
181 | 194 | } | |
182 | 195 | ||
183 | 196 | ||
184 | 197 | func parseAssetId (input) = if ((input == wavesString)) | |
185 | 198 | then unit | |
186 | 199 | else fromBase58String(input) | |
187 | 200 | ||
188 | 201 | ||
189 | 202 | func assetIdToString (input) = if ((input == unit)) | |
190 | 203 | then wavesString | |
191 | 204 | else toBase58String(value(input)) | |
192 | 205 | ||
193 | 206 | ||
194 | 207 | func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolSt]), fromBase58String(poolConfig[idxLPAsId]), parseAssetId(poolConfig[idxAmAsId]), parseAssetId(poolConfig[idxPrAsId]), parseIntValue(poolConfig[idxAmtAsDcm]), parseIntValue(poolConfig[idxPriceAsDcm])) | |
195 | 208 | ||
196 | 209 | ||
197 | 210 | let poolConfigParsed = parsePoolConfig(gpc()) | |
198 | 211 | ||
199 | - | let $ | |
212 | + | let $t072087394 = poolConfigParsed | |
200 | 213 | ||
201 | - | let cfgPoolAddress = $ | |
214 | + | let cfgPoolAddress = $t072087394._1 | |
202 | 215 | ||
203 | - | let cfgPoolStatus = $ | |
216 | + | let cfgPoolStatus = $t072087394._2 | |
204 | 217 | ||
205 | - | let cfgLpAssetId = $ | |
218 | + | let cfgLpAssetId = $t072087394._3 | |
206 | 219 | ||
207 | - | let cfgAmountAssetId = $ | |
220 | + | let cfgAmountAssetId = $t072087394._4 | |
208 | 221 | ||
209 | - | let cfgPriceAssetId = $ | |
222 | + | let cfgPriceAssetId = $t072087394._5 | |
210 | 223 | ||
211 | - | let cfgAmountAssetDecimals = $ | |
224 | + | let cfgAmountAssetDecimals = $t072087394._6 | |
212 | 225 | ||
213 | - | let cfgPriceAssetDecimals = $ | |
226 | + | let cfgPriceAssetDecimals = $t072087394._7 | |
214 | 227 | ||
215 | 228 | func gfc () = split(strf(fca, fcfg()), SEP) | |
216 | 229 | ||
217 | 230 | ||
218 | 231 | let factoryConfig = gfc() | |
219 | 232 | ||
220 | 233 | let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address") | |
221 | 234 | ||
222 | 235 | let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address") | |
223 | 236 | ||
224 | 237 | let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address") | |
225 | 238 | ||
226 | 239 | let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address") | |
227 | 240 | ||
228 | 241 | 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) | |
229 | 242 | ||
230 | 243 | ||
231 | 244 | 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) | |
232 | 245 | ||
233 | 246 | ||
234 | 247 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
235 | 248 | then wavesBalance(this).available | |
236 | 249 | else assetBalance(this, fromBase58String(assetId)) | |
237 | 250 | ||
238 | 251 | ||
239 | 252 | func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
240 | 253 | ||
241 | 254 | ||
242 | 255 | func vad (A1,A2,slippage) = { | |
243 | 256 | let diff = fraction((A1 - A2), scale8BigInt, A2) | |
244 | 257 | let pass = ((slippage - abs(diff)) > zeroBigInt) | |
245 | 258 | if (!(pass)) | |
246 | 259 | then throw(("Big slpg: " + toString(diff))) | |
247 | 260 | else $Tuple2(pass, min([A1, A2])) | |
248 | 261 | } | |
249 | 262 | ||
250 | 263 | ||
251 | 264 | func vd (D1,D0,slpg) = { | |
252 | 265 | let diff = fraction(D0, scale8BigInt, D1) | |
253 | 266 | let fail = (slpg > diff) | |
254 | 267 | if (if (fail) | |
255 | 268 | then true | |
256 | 269 | else (D0 > D1)) | |
257 | 270 | then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg))) | |
258 | 271 | else fail | |
259 | 272 | } | |
260 | 273 | ||
261 | 274 | ||
262 | 275 | func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
263 | 276 | let amtAsAmtX18 = t1(amAmt, amAssetDcm) | |
264 | 277 | let prAsAmtX18 = t1(prAmt, prAssetDcm) | |
265 | 278 | cpbi(prAsAmtX18, amtAsAmtX18) | |
266 | 279 | } | |
267 | 280 | ||
268 | 281 | ||
269 | 282 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
270 | 283 | let cfg = gpc() | |
271 | 284 | let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
272 | 285 | let prAsDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
273 | 286 | let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt) | |
274 | 287 | let amAmtX18 = t1(amAmt, amtAsDcm) | |
275 | 288 | let prAmtX18 = t1(prAmt, prAsDcm) | |
276 | 289 | let lpAmtX18 = t1(lpAmt, scale8) | |
277 | 290 | let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18) | |
278 | 291 | let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18) | |
279 | 292 | [priceX18, lpPrInAmAsX18, lpPrInPrAsX18] | |
280 | 293 | } | |
281 | 294 | ||
282 | 295 | ||
283 | 296 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
284 | 297 | let p = calcPrices(amAmt, prAmt, lpAmt) | |
285 | 298 | [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)] | |
286 | 299 | } | |
287 | 300 | ||
288 | 301 | ||
289 | 302 | func takeFee (amount) = { | |
290 | 303 | let feeAmount = fraction(amount, fee, scale8) | |
291 | 304 | $Tuple2((amount - feeAmount), feeAmount) | |
292 | 305 | } | |
293 | 306 | ||
294 | 307 | ||
295 | 308 | func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
296 | 309 | let cfg = gpc() | |
297 | 310 | let lpId = cfg[idxLPAsId] | |
298 | 311 | let amId = cfg[idxAmAsId] | |
299 | 312 | let prId = cfg[idxPrAsId] | |
300 | 313 | let amDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
301 | 314 | let prDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
302 | 315 | let sts = cfg[idxPoolSt] | |
303 | 316 | let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity | |
304 | 317 | if ((lpId != pmtAssetId)) | |
305 | 318 | then throw("Wrong pmt asset") | |
306 | 319 | else { | |
307 | 320 | let amBalance = getAccBalance(amId) | |
308 | 321 | let amBalanceX18 = t1(amBalance, amDcm) | |
309 | 322 | let prBalance = getAccBalance(prId) | |
310 | 323 | let prBalanceX18 = t1(prBalance, prDcm) | |
311 | 324 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
312 | 325 | let curPrice = f1(curPriceX18, scale8) | |
313 | 326 | let pmtLpAmtX18 = t1(pmtLpAmt, scale8) | |
314 | 327 | let lpEmissX18 = t1(lpEmiss, scale8) | |
315 | 328 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18) | |
316 | 329 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18) | |
317 | 330 | let outAmAmt = f1(outAmAmtX18, amDcm) | |
318 | 331 | let outPrAmt = f1(outPrAmtX18, prDcm) | |
319 | 332 | let state = if ((txId58 == "")) | |
320 | 333 | then nil | |
321 | 334 | else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES")) | |
322 | 335 | then unit | |
323 | 336 | else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES")) | |
324 | 337 | then unit | |
325 | 338 | 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)] | |
326 | 339 | $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state) | |
327 | 340 | } | |
328 | 341 | } | |
329 | 342 | ||
330 | 343 | ||
331 | 344 | func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
332 | 345 | let cfg = gpc() | |
333 | 346 | let lpId = fromBase58String(cfg[idxLPAsId]) | |
334 | 347 | let amIdStr = cfg[idxAmAsId] | |
335 | 348 | let prIdStr = cfg[idxPrAsId] | |
336 | 349 | let inAmIdStr = cfg[idxIAmtAsId] | |
337 | 350 | let inPrIdStr = cfg[idxIPriceAsId] | |
338 | 351 | let amtDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
339 | 352 | let priceDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
340 | 353 | let sts = cfg[idxPoolSt] | |
341 | 354 | let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity | |
342 | 355 | let amBalance = if (isEval) | |
343 | 356 | then getAccBalance(amIdStr) | |
344 | 357 | else if (if (isOneAsset) | |
345 | 358 | then (pmtId == amIdStr) | |
346 | 359 | else false) | |
347 | 360 | then (getAccBalance(amIdStr) - pmtAmt) | |
348 | 361 | else if (isOneAsset) | |
349 | 362 | then getAccBalance(amIdStr) | |
350 | 363 | else (getAccBalance(amIdStr) - inAmAmt) | |
351 | 364 | let prBalance = if (isEval) | |
352 | 365 | then getAccBalance(prIdStr) | |
353 | 366 | else if (if (isOneAsset) | |
354 | 367 | then (pmtId == prIdStr) | |
355 | 368 | else false) | |
356 | 369 | then (getAccBalance(prIdStr) - pmtAmt) | |
357 | 370 | else if (isOneAsset) | |
358 | 371 | then getAccBalance(prIdStr) | |
359 | 372 | else (getAccBalance(prIdStr) - inPrAmt) | |
360 | 373 | let inAmAssetAmtX18 = t1(inAmAmt, amtDcm) | |
361 | 374 | let inPrAssetAmtX18 = t1(inPrAmt, priceDcm) | |
362 | 375 | let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18) | |
363 | 376 | let amBalanceX18 = t1(amBalance, amtDcm) | |
364 | 377 | let prBalanceX18 = t1(prBalance, priceDcm) | |
365 | 378 | let r = if ((lpEm == 0)) | |
366 | 379 | then { | |
367 | 380 | let curPriceX18 = zeroBigInt | |
368 | 381 | let slippageX18 = zeroBigInt | |
369 | 382 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
370 | 383 | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
371 | 384 | } | |
372 | 385 | else { | |
373 | 386 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
374 | 387 | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
375 | 388 | let slippageX18 = t1(slippage, scale8) | |
376 | 389 | if (if (if (validateSlippage) | |
377 | 390 | then (curPriceX18 != zeroBigInt) | |
378 | 391 | else false) | |
379 | 392 | then (slippageRealX18 > slippageX18) | |
380 | 393 | else false) | |
381 | 394 | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
382 | 395 | else { | |
383 | 396 | let lpEmissionX18 = t1(lpEm, scale8) | |
384 | 397 | let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
385 | 398 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
386 | 399 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
387 | 400 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
388 | 401 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
389 | 402 | let expAmtAssetAmtX18 = expectedAmts._1 | |
390 | 403 | let expPriceAssetAmtX18 = expectedAmts._2 | |
391 | 404 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18) | |
392 | 405 | $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18) | |
393 | 406 | } | |
394 | 407 | } | |
395 | 408 | let calcLpAmt = r._1 | |
396 | 409 | let calcAmAssetPmt = r._2 | |
397 | 410 | let calcPrAssetPmt = r._3 | |
398 | 411 | let curPrice = f1(r._4, scale8) | |
399 | 412 | let slippageCalc = f1(r._5, scale8) | |
400 | 413 | if ((0 >= calcLpAmt)) | |
401 | 414 | then throw("LP <= 0") | |
402 | 415 | else { | |
403 | 416 | let emitLpAmt = if (!(emitLp)) | |
404 | 417 | then 0 | |
405 | 418 | else calcLpAmt | |
406 | 419 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
407 | 420 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
408 | - | let $ | |
421 | + | let $t01782518170 = if (if (isOneAsset) | |
409 | 422 | then (pmtId == amIdStr) | |
410 | 423 | else false) | |
411 | 424 | then $Tuple2(pmtAmt, 0) | |
412 | 425 | else if (if (isOneAsset) | |
413 | 426 | then (pmtId == prIdStr) | |
414 | 427 | else false) | |
415 | 428 | then $Tuple2(0, pmtAmt) | |
416 | 429 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
417 | - | let writeAmAmt = $ | |
418 | - | let writePrAmt = $ | |
430 | + | let writeAmAmt = $t01782518170._1 | |
431 | + | let writePrAmt = $t01782518170._2 | |
419 | 432 | 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))] | |
420 | 433 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
421 | 434 | } | |
435 | + | } | |
436 | + | ||
437 | + | ||
438 | + | func calcDLp (amountBalance,priceBalance,lpEmission) = { | |
439 | + | let updatedDLp = fraction((amountBalance * priceBalance), scale18, lpEmission) | |
440 | + | updatedDLp | |
441 | + | } | |
442 | + | ||
443 | + | ||
444 | + | func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
445 | + | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
446 | + | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
447 | + | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
448 | + | let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
449 | + | let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))] | |
450 | + | $Tuple2(actions, updatedDLp) | |
422 | 451 | } | |
423 | 452 | ||
424 | 453 | ||
425 | 454 | func moa (order) = { | |
426 | 455 | let cfg = gpc() | |
427 | 456 | let amtAsId = cfg[idxAmAsId] | |
428 | 457 | let prAsId = cfg[idxPrAsId] | |
429 | 458 | let sts = parseIntValue(cfg[idxPoolSt]) | |
430 | 459 | let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
431 | 460 | let prAsDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
432 | 461 | let accAmtAsBalance = getAccBalance(amtAsId) | |
433 | 462 | let accPrAsBalance = getAccBalance(prAsId) | |
434 | 463 | let curPriceX18 = if ((order.orderType == Buy)) | |
435 | 464 | then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance) | |
436 | 465 | else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance) | |
437 | 466 | let curPrice = f1(curPriceX18, scale8) | |
438 | 467 | if (if (if (igs()) | |
439 | 468 | then true | |
440 | 469 | else (sts == PoolMatcherDis)) | |
441 | 470 | then true | |
442 | 471 | else (sts == PoolShutdown)) | |
443 | 472 | then throw("Admin blocked") | |
444 | 473 | else { | |
445 | 474 | let orAmtAsset = order.assetPair.amountAsset | |
446 | 475 | let orAmtAsStr = if ((orAmtAsset == unit)) | |
447 | 476 | then "WAVES" | |
448 | 477 | else toBase58String(value(orAmtAsset)) | |
449 | 478 | let orPrAsset = order.assetPair.priceAsset | |
450 | 479 | let orPrAsStr = if ((orPrAsset == unit)) | |
451 | 480 | then "WAVES" | |
452 | 481 | else toBase58String(value(orPrAsset)) | |
453 | 482 | if (if ((orAmtAsStr != amtAsId)) | |
454 | 483 | then true | |
455 | 484 | else (orPrAsStr != prAsId)) | |
456 | 485 | then throw("Wr assets") | |
457 | 486 | else { | |
458 | 487 | let orderPrice = order.price | |
459 | 488 | let priceDcm = fraction(scale8, prAsDcm, amtAsDcm) | |
460 | 489 | let castOrderPrice = ts(orderPrice, scale8, priceDcm) | |
461 | 490 | let isOrderPriceValid = if ((order.orderType == Buy)) | |
462 | 491 | then (curPrice >= castOrderPrice) | |
463 | 492 | else (castOrderPrice >= curPrice) | |
464 | 493 | true | |
465 | 494 | } | |
466 | 495 | } | |
467 | 496 | } | |
468 | 497 | ||
469 | 498 | ||
470 | 499 | func cg (i) = if ((size(i.payments) != 1)) | |
471 | 500 | then throw("1 pmnt exp") | |
472 | 501 | else { | |
473 | 502 | let pmt = value(i.payments[0]) | |
474 | 503 | let pmtAssetId = value(pmt.assetId) | |
475 | 504 | let pmtAmt = pmt.amount | |
476 | 505 | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
477 | 506 | let outAmAmt = r._1 | |
478 | 507 | let outPrAmt = r._2 | |
479 | 508 | let sts = parseIntValue(r._9) | |
480 | 509 | let state = r._10 | |
481 | 510 | if (if (igs()) | |
482 | 511 | then true | |
483 | 512 | else (sts == PoolShutdown)) | |
484 | 513 | then throw(("Admin blocked: " + toString(sts))) | |
485 | 514 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
486 | 515 | } | |
487 | 516 | ||
488 | 517 | ||
489 | 518 | func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
490 | 519 | let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId) | |
491 | 520 | let sts = parseIntValue(r._8) | |
492 | 521 | if (if (if (igs()) | |
493 | 522 | then true | |
494 | 523 | else (sts == PoolPutDis)) | |
495 | 524 | then true | |
496 | 525 | else (sts == PoolShutdown)) | |
497 | 526 | then throw(("Blocked:" + toString(sts))) | |
498 | 527 | else r | |
499 | 528 | } | |
500 | 529 | ||
501 | 530 | ||
502 | 531 | func getD (xp) = { | |
503 | 532 | let n = big2 | |
504 | 533 | let xp0 = xp[0] | |
505 | 534 | let xp1 = xp[1] | |
506 | 535 | let aPrecision = parseBigIntValue(Amult) | |
507 | 536 | let a = (parseBigIntValue(A) * aPrecision) | |
508 | 537 | let s = (xp0 + xp1) | |
509 | 538 | if ((s == big0)) | |
510 | 539 | then big0 | |
511 | 540 | else { | |
512 | 541 | let ann = (a * n) | |
513 | 542 | let xp0_xp1_n_n = (((xp0 * xp1) * n) * n) | |
514 | 543 | let ann_s_aPrecision = ((ann * s) / aPrecision) | |
515 | 544 | let ann_aPrecision = (ann - aPrecision) | |
516 | 545 | let n1 = (n + big1) | |
517 | 546 | func calc (acc,cur) = { | |
518 | - | let $ | |
519 | - | let d = $ | |
520 | - | let found = $ | |
547 | + | let $t02363623656 = acc | |
548 | + | let d = $t02363623656._1 | |
549 | + | let found = $t02363623656._2 | |
521 | 550 | if ((found != unit)) | |
522 | 551 | then acc | |
523 | 552 | else { | |
524 | 553 | let dp = (((d * d) * d) / xp0_xp1_n_n) | |
525 | 554 | let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp))) | |
526 | 555 | let dDiff = absBigInt((dNext - value(d))) | |
527 | 556 | if ((big1 >= dDiff)) | |
528 | 557 | then $Tuple2(dNext, cur) | |
529 | 558 | else $Tuple2(dNext, unit) | |
530 | 559 | } | |
531 | 560 | } | |
532 | 561 | ||
533 | 562 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
534 | - | let $ | |
563 | + | let $t02407724124 = { | |
535 | 564 | let $l = arr | |
536 | 565 | let $s = size($l) | |
537 | 566 | let $acc0 = $Tuple2(s, unit) | |
538 | 567 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
539 | 568 | then $a | |
540 | 569 | else calc($a, $l[$i]) | |
541 | 570 | ||
542 | 571 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
543 | 572 | then $a | |
544 | 573 | else throw("List size exceeds 15") | |
545 | 574 | ||
546 | 575 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
547 | 576 | } | |
548 | - | let d = $ | |
549 | - | let found = $ | |
577 | + | let d = $t02407724124._1 | |
578 | + | let found = $t02407724124._2 | |
550 | 579 | if ((found != unit)) | |
551 | 580 | then d | |
552 | 581 | else throw(("D calculation error, D = " + toString(d))) | |
553 | 582 | } | |
554 | 583 | } | |
555 | 584 | ||
556 | 585 | ||
557 | 586 | func getYD (xp,i,D) = { | |
558 | 587 | let n = big2 | |
559 | 588 | let x = xp[if ((i == 0)) | |
560 | 589 | then 1 | |
561 | 590 | else 0] | |
562 | 591 | let aPrecision = parseBigIntValue(Amult) | |
563 | 592 | let a = (parseBigIntValue(A) * aPrecision) | |
564 | 593 | let s = x | |
565 | 594 | let ann = (a * n) | |
566 | 595 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
567 | 596 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
568 | 597 | func calc (acc,cur) = { | |
569 | - | let $ | |
570 | - | let y = $ | |
571 | - | let found = $ | |
598 | + | let $t02462424644 = acc | |
599 | + | let y = $t02462424644._1 | |
600 | + | let found = $t02462424644._2 | |
572 | 601 | if ((found != unit)) | |
573 | 602 | then acc | |
574 | 603 | else { | |
575 | 604 | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
576 | 605 | let yDiff = absBigInt((yNext - value(y))) | |
577 | 606 | if ((big1 >= yDiff)) | |
578 | 607 | then $Tuple2(yNext, cur) | |
579 | 608 | else $Tuple2(yNext, unit) | |
580 | 609 | } | |
581 | 610 | } | |
582 | 611 | ||
583 | 612 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
584 | - | let $ | |
613 | + | let $t02495124998 = { | |
585 | 614 | let $l = arr | |
586 | 615 | let $s = size($l) | |
587 | 616 | let $acc0 = $Tuple2(D, unit) | |
588 | 617 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
589 | 618 | then $a | |
590 | 619 | else calc($a, $l[$i]) | |
591 | 620 | ||
592 | 621 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
593 | 622 | then $a | |
594 | 623 | else throw("List size exceeds 15") | |
595 | 624 | ||
596 | 625 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
597 | 626 | } | |
598 | - | let y = $ | |
599 | - | let found = $ | |
627 | + | let y = $t02495124998._1 | |
628 | + | let found = $t02495124998._2 | |
600 | 629 | if ((found != unit)) | |
601 | 630 | then y | |
602 | 631 | else throw(("Y calculation error, Y = " + toString(y))) | |
603 | 632 | } | |
604 | 633 | ||
605 | 634 | ||
606 | 635 | func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = { | |
607 | 636 | let poolConfig = gpc() | |
608 | 637 | let amId = poolConfig[idxAmAsId] | |
609 | 638 | let prId = poolConfig[idxPrAsId] | |
610 | 639 | let lpId = poolConfig[idxLPAsId] | |
611 | 640 | let amtDcm = parseIntValue(poolConfig[idxAmtAsDcm]) | |
612 | 641 | let priceDcm = parseIntValue(poolConfig[idxPriceAsDcm]) | |
613 | 642 | let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity) | |
614 | 643 | let chechEmission = if ((lpAssetEmission > big0)) | |
615 | 644 | then true | |
616 | 645 | else throw("initial deposit requires all coins") | |
617 | 646 | if ((chechEmission == chechEmission)) | |
618 | 647 | then { | |
619 | 648 | let amBalance = getAccBalance(amId) | |
620 | 649 | let prBalance = getAccBalance(prId) | |
621 | - | let $ | |
650 | + | let $t02578126243 = if ((txId == "")) | |
622 | 651 | then $Tuple2(amBalance, prBalance) | |
623 | 652 | else if ((pmtAssetId == amId)) | |
624 | 653 | then if ((pmtAmtRaw > amBalance)) | |
625 | 654 | then throw("invalid payment amount") | |
626 | 655 | else $Tuple2((amBalance - pmtAmtRaw), prBalance) | |
627 | 656 | else if ((pmtAssetId == prId)) | |
628 | 657 | then if ((pmtAmtRaw > prBalance)) | |
629 | 658 | then throw("invalid payment amount") | |
630 | 659 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
631 | 660 | else throw("wrong pmtAssetId") | |
632 | - | let amBalanceOld = $ | |
633 | - | let prBalanceOld = $ | |
634 | - | let $ | |
661 | + | let amBalanceOld = $t02578126243._1 | |
662 | + | let prBalanceOld = $t02578126243._2 | |
663 | + | let $t02624926425 = if ((pmtAssetId == amId)) | |
635 | 664 | then $Tuple2(pmtAmtRaw, 0) | |
636 | 665 | else if ((pmtAssetId == prId)) | |
637 | 666 | then $Tuple2(0, pmtAmtRaw) | |
638 | 667 | else throw("invalid payment") | |
639 | - | let amAmountRaw = $ | |
640 | - | let prAmountRaw = $ | |
641 | - | let $ | |
668 | + | let amAmountRaw = $t02624926425._1 | |
669 | + | let prAmountRaw = $t02624926425._2 | |
670 | + | let $t02642926668 = if (withTakeFee) | |
642 | 671 | then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2) | |
643 | 672 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
644 | - | let amAmount = $ | |
645 | - | let prAmount = $ | |
646 | - | let feeAmount = $ | |
673 | + | let amAmount = $t02642926668._1 | |
674 | + | let prAmount = $t02642926668._2 | |
675 | + | let feeAmount = $t02642926668._3 | |
647 | 676 | let amBalanceNew = (amBalanceOld + amAmount) | |
648 | 677 | let prBalanceNew = (prBalanceOld + prAmount) | |
649 | 678 | let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)]) | |
650 | 679 | let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)]) | |
651 | 680 | let checkD = if ((D1 > D0)) | |
652 | 681 | then true | |
653 | 682 | else throw() | |
654 | 683 | if ((checkD == checkD)) | |
655 | 684 | then { | |
656 | 685 | let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0) | |
657 | 686 | let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8) | |
658 | 687 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId), dataPutActionInfo(amAmountRaw, prAmountRaw, toInt(lpAmount), curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
659 | 688 | let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld) | |
660 | 689 | let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8)) | |
661 | 690 | let priceAssetPart = (pmtAmtRaw - amountAssetPart) | |
662 | 691 | let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld)) | |
663 | 692 | let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth)) | |
664 | 693 | $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus) | |
665 | 694 | } | |
666 | 695 | else throw("Strict value is not equal to itself.") | |
667 | 696 | } | |
668 | 697 | else throw("Strict value is not equal to itself.") | |
669 | 698 | } | |
670 | 699 | ||
671 | 700 | ||
672 | 701 | func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = { | |
673 | 702 | let poolConfig = gpc() | |
674 | 703 | let lpId = poolConfig[idxLPAsId] | |
675 | 704 | let amId = poolConfig[idxAmAsId] | |
676 | 705 | let prId = poolConfig[idxPrAsId] | |
677 | 706 | let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm]) | |
678 | 707 | let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm]) | |
679 | 708 | let poolStatus = poolConfig[idxPoolSt] | |
680 | 709 | let userAddress = if ((caller == restContract)) | |
681 | 710 | then originCaller | |
682 | 711 | else caller | |
683 | 712 | let pmt = value(payments[0]) | |
684 | 713 | let pmtAssetId = value(pmt.assetId) | |
685 | 714 | let pmtAmt = pmt.amount | |
686 | 715 | let txId58 = toBase58String(transactionId) | |
687 | 716 | if ((lpId != toBase58String(pmtAssetId))) | |
688 | 717 | then throw("Wrong LP") | |
689 | 718 | else { | |
690 | 719 | let amBalance = getAccBalance(amId) | |
691 | 720 | let prBalance = getAccBalance(prId) | |
692 | - | let $ | |
721 | + | let $t02867028781 = { | |
693 | 722 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
694 | 723 | if ($isInstanceOf(@, "(Int, Int)")) | |
695 | 724 | then @ | |
696 | 725 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
697 | 726 | } | |
698 | - | if (($ | |
727 | + | if (($t02867028781 == $t02867028781)) | |
699 | 728 | then { | |
700 | - | let feeAmount = $ | |
701 | - | let totalGet = $ | |
729 | + | let feeAmount = $t02867028781._2 | |
730 | + | let totalGet = $t02867028781._1 | |
702 | 731 | let totalAmount = if (if ((minOutAmount > 0)) | |
703 | 732 | then (minOutAmount > totalGet) | |
704 | 733 | else false) | |
705 | 734 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
706 | 735 | else totalGet | |
707 | - | let $ | |
736 | + | let $t02897129278 = if ((outAssetId == amId)) | |
708 | 737 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
709 | 738 | else if ((outAssetId == prId)) | |
710 | 739 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
711 | 740 | else throw("invalid out asset id") | |
712 | - | let outAm = $ | |
713 | - | let outPr = $ | |
714 | - | let amBalanceNew = $ | |
715 | - | let prBalanceNew = $ | |
741 | + | let outAm = $t02897129278._1 | |
742 | + | let outPr = $t02897129278._2 | |
743 | + | let amBalanceNew = $t02897129278._3 | |
744 | + | let prBalanceNew = $t02897129278._4 | |
716 | 745 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
717 | 746 | let curPr = f1(curPrX18, scale8) | |
718 | 747 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
719 | 748 | then unit | |
720 | 749 | else fromBase58String(outAssetId) | |
721 | 750 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
722 | 751 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
723 | 752 | else nil | |
724 | 753 | 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)] ++ sendFeeToMatcher) | |
725 | 754 | if ((state == state)) | |
726 | 755 | then { | |
727 | 756 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
728 | 757 | if ((burn == burn)) | |
729 | 758 | then $Tuple2(state, totalAmount) | |
730 | 759 | else throw("Strict value is not equal to itself.") | |
731 | 760 | } | |
732 | 761 | else throw("Strict value is not equal to itself.") | |
733 | 762 | } | |
734 | 763 | else throw("Strict value is not equal to itself.") | |
735 | 764 | } | |
736 | 765 | } | |
737 | 766 | ||
738 | 767 | ||
739 | 768 | func m () = match getString(mpk()) { | |
740 | 769 | case s: String => | |
741 | 770 | fromBase58String(s) | |
742 | 771 | case _: Unit => | |
743 | 772 | unit | |
744 | 773 | case _ => | |
745 | 774 | throw("Match error") | |
746 | 775 | } | |
747 | 776 | ||
748 | 777 | ||
749 | 778 | func pm () = match getString(pmpk()) { | |
750 | 779 | case s: String => | |
751 | 780 | fromBase58String(s) | |
752 | 781 | case _: Unit => | |
753 | 782 | unit | |
754 | 783 | case _ => | |
755 | 784 | throw("Match error") | |
756 | 785 | } | |
757 | 786 | ||
758 | 787 | ||
759 | 788 | let pd = throw("Permission denied") | |
760 | 789 | ||
761 | 790 | func isManager (i) = match m() { | |
762 | 791 | case pk: ByteVector => | |
763 | 792 | (i.callerPublicKey == pk) | |
764 | 793 | case _: Unit => | |
765 | 794 | (i.caller == this) | |
766 | 795 | case _ => | |
767 | 796 | throw("Match error") | |
768 | 797 | } | |
769 | 798 | ||
770 | 799 | ||
771 | 800 | func mm (i) = match m() { | |
772 | 801 | case pk: ByteVector => | |
773 | 802 | if ((i.callerPublicKey == pk)) | |
774 | 803 | then true | |
775 | 804 | else pd | |
776 | 805 | case _: Unit => | |
777 | 806 | if ((i.caller == this)) | |
778 | 807 | then true | |
779 | 808 | else pd | |
780 | 809 | case _ => | |
781 | 810 | throw("Match error") | |
782 | 811 | } | |
783 | 812 | ||
784 | 813 | ||
785 | 814 | @Callable(i) | |
786 | 815 | func constructor (fc) = { | |
787 | 816 | let c = mm(i) | |
788 | 817 | if ((c == c)) | |
789 | 818 | then [StringEntry(fc(), fc)] | |
790 | 819 | else throw("Strict value is not equal to itself.") | |
791 | 820 | } | |
792 | 821 | ||
793 | 822 | ||
794 | 823 | ||
795 | 824 | @Callable(i) | |
796 | 825 | func setManager (pendingManagerPublicKey) = { | |
797 | 826 | let c = mm(i) | |
798 | 827 | if ((c == c)) | |
799 | 828 | then { | |
800 | 829 | let cm = fromBase58String(pendingManagerPublicKey) | |
801 | 830 | if ((cm == cm)) | |
802 | 831 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
803 | 832 | else throw("Strict value is not equal to itself.") | |
804 | 833 | } | |
805 | 834 | else throw("Strict value is not equal to itself.") | |
806 | 835 | } | |
807 | 836 | ||
808 | 837 | ||
809 | 838 | ||
810 | 839 | @Callable(i) | |
811 | 840 | func confirmManager () = { | |
812 | 841 | let p = pm() | |
813 | 842 | let hpm = if (isDefined(p)) | |
814 | 843 | then true | |
815 | 844 | else throw("No pending manager") | |
816 | 845 | if ((hpm == hpm)) | |
817 | 846 | then { | |
818 | 847 | let cpm = if ((i.callerPublicKey == value(p))) | |
819 | 848 | then true | |
820 | 849 | else throw("You are not pending manager") | |
821 | 850 | if ((cpm == cpm)) | |
822 | 851 | then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())] | |
823 | 852 | else throw("Strict value is not equal to itself.") | |
824 | 853 | } | |
825 | 854 | else throw("Strict value is not equal to itself.") | |
826 | 855 | } | |
827 | 856 | ||
828 | 857 | ||
829 | 858 | ||
830 | 859 | @Callable(i) | |
831 | 860 | func put (slip,autoStake) = { | |
832 | 861 | let factCfg = gfc() | |
833 | 862 | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
834 | 863 | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
835 | 864 | if ((0 > slip)) | |
836 | 865 | then throw("Wrong slippage") | |
837 | 866 | else if ((size(i.payments) != 2)) | |
838 | 867 | then throw("2 pmnts expd") | |
839 | 868 | else { | |
840 | 869 | 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, "") | |
841 | 870 | let emitLpAmt = e._2 | |
842 | 871 | let lpAssetId = e._7 | |
843 | 872 | let state = e._9 | |
844 | 873 | let amDiff = e._10 | |
845 | 874 | let prDiff = e._11 | |
846 | 875 | let amId = e._12 | |
847 | 876 | let prId = e._13 | |
848 | 877 | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
849 | 878 | if ((r == r)) | |
850 | 879 | then { | |
851 | 880 | let el = match r { | |
852 | 881 | case legacy: Address => | |
853 | 882 | invoke(legacy, "emit", [emitLpAmt], nil) | |
854 | 883 | case _ => | |
855 | 884 | unit | |
856 | 885 | } | |
857 | 886 | if ((el == el)) | |
858 | 887 | then { | |
859 | 888 | let sa = if ((amDiff > 0)) | |
860 | 889 | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
861 | 890 | else nil | |
862 | 891 | if ((sa == sa)) | |
863 | 892 | then { | |
864 | 893 | let sp = if ((prDiff > 0)) | |
865 | 894 | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
866 | 895 | else nil | |
867 | 896 | if ((sp == sp)) | |
868 | 897 | then { | |
869 | 898 | let lpTrnsfr = if (autoStake) | |
870 | 899 | then { | |
871 | 900 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
872 | 901 | if ((ss == ss)) | |
873 | 902 | then nil | |
874 | 903 | else throw("Strict value is not equal to itself.") | |
875 | 904 | } | |
876 | 905 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
877 | 906 | (state ++ lpTrnsfr) | |
878 | 907 | } | |
879 | 908 | else throw("Strict value is not equal to itself.") | |
880 | 909 | } | |
881 | 910 | else throw("Strict value is not equal to itself.") | |
882 | 911 | } | |
883 | 912 | else throw("Strict value is not equal to itself.") | |
884 | 913 | } | |
885 | 914 | else throw("Strict value is not equal to itself.") | |
886 | 915 | } | |
887 | 916 | } | |
888 | 917 | ||
889 | 918 | ||
890 | 919 | ||
891 | 920 | @Callable(i) | |
892 | 921 | func putOneTknV2 (minOutAmount,autoStake) = { | |
893 | 922 | let isPoolOneTokenOperationsDisabled = { | |
894 | 923 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
895 | 924 | if ($isInstanceOf(@, "Boolean")) | |
896 | 925 | then @ | |
897 | 926 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
898 | 927 | } | |
899 | 928 | let isPutDisabled = if (if (if (igs()) | |
900 | 929 | then true | |
901 | 930 | else (cfgPoolStatus == PoolPutDis)) | |
902 | 931 | then true | |
903 | 932 | else (cfgPoolStatus == PoolShutdown)) | |
904 | 933 | then true | |
905 | 934 | else isPoolOneTokenOperationsDisabled | |
906 | 935 | let checks = [if (if (!(isPutDisabled)) | |
907 | 936 | then true | |
908 | 937 | else isManager(i)) | |
909 | 938 | then true | |
910 | 939 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
911 | 940 | then true | |
912 | 941 | else throwErr("exactly 1 payment are expected")] | |
913 | 942 | if ((checks == checks)) | |
914 | 943 | then { | |
915 | 944 | let poolConfig = gpc() | |
916 | 945 | let amId = poolConfig[idxAmAsId] | |
917 | 946 | let prId = poolConfig[idxPrAsId] | |
918 | 947 | let lpId = fromBase58String(poolConfig[idxLPAsId]) | |
919 | 948 | let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm]) | |
920 | 949 | let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm]) | |
921 | 950 | let userAddress = if ((i.caller == this)) | |
922 | 951 | then i.originCaller | |
923 | 952 | else i.caller | |
924 | 953 | let pmt = value(i.payments[0]) | |
925 | 954 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
926 | 955 | let pmtAmt = pmt.amount | |
927 | - | let $ | |
928 | - | if (($ | |
956 | + | let $t03464034798 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
957 | + | if (($t03464034798 == $t03464034798)) | |
929 | 958 | then { | |
930 | - | let feeAmount = $ | |
931 | - | let state = $ | |
932 | - | let estimLP = $ | |
959 | + | let feeAmount = $t03464034798._3 | |
960 | + | let state = $t03464034798._2 | |
961 | + | let estimLP = $t03464034798._1 | |
933 | 962 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
934 | 963 | then (minOutAmount > estimLP) | |
935 | 964 | else false) | |
936 | 965 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
937 | 966 | else estimLP | |
938 | 967 | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
939 | 968 | if ((e == e)) | |
940 | 969 | then { | |
941 | 970 | let el = match e { | |
942 | 971 | case legacy: Address => | |
943 | 972 | invoke(legacy, "emit", [emitLpAmt], nil) | |
944 | 973 | case _ => | |
945 | 974 | unit | |
946 | 975 | } | |
947 | 976 | if ((el == el)) | |
948 | 977 | then { | |
949 | 978 | let lpTrnsfr = if (autoStake) | |
950 | 979 | then { | |
951 | 980 | let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)]) | |
952 | 981 | if ((ss == ss)) | |
953 | 982 | then nil | |
954 | 983 | else throw("Strict value is not equal to itself.") | |
955 | 984 | } | |
956 | 985 | else [ScriptTransfer(i.caller, emitLpAmt, lpId)] | |
957 | 986 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
958 | 987 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
959 | 988 | else nil | |
960 | 989 | $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt) | |
961 | 990 | } | |
962 | 991 | else throw("Strict value is not equal to itself.") | |
963 | 992 | } | |
964 | 993 | else throw("Strict value is not equal to itself.") | |
965 | 994 | } | |
966 | 995 | else throw("Strict value is not equal to itself.") | |
967 | 996 | } | |
968 | 997 | else throw("Strict value is not equal to itself.") | |
969 | 998 | } | |
970 | 999 | ||
971 | 1000 | ||
972 | 1001 | ||
973 | 1002 | @Callable(i) | |
974 | 1003 | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
975 | 1004 | then throw("Wrong slpg") | |
976 | 1005 | else if ((size(i.payments) != 2)) | |
977 | 1006 | then throw("2 pmnts expd") | |
978 | 1007 | else { | |
979 | 1008 | 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, "") | |
980 | 1009 | estPut._9 | |
981 | 1010 | } | |
982 | 1011 | ||
983 | 1012 | ||
984 | 1013 | ||
985 | 1014 | @Callable(i) | |
986 | 1015 | func get () = { | |
987 | 1016 | let r = cg(i) | |
988 | 1017 | let outAmtAmt = r._1 | |
989 | 1018 | let outPrAmt = r._2 | |
990 | 1019 | let pmtAmt = r._3 | |
991 | 1020 | let pmtAssetId = r._4 | |
992 | 1021 | let state = r._5 | |
993 | 1022 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
994 | 1023 | if ((b == b)) | |
995 | 1024 | then state | |
996 | 1025 | else throw("Strict value is not equal to itself.") | |
997 | 1026 | } | |
998 | 1027 | ||
999 | 1028 | ||
1000 | 1029 | ||
1001 | 1030 | @Callable(i) | |
1002 | 1031 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1003 | 1032 | let isPoolOneTokenOperationsDisabled = { | |
1004 | 1033 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1005 | 1034 | if ($isInstanceOf(@, "Boolean")) | |
1006 | 1035 | then @ | |
1007 | 1036 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1008 | 1037 | } | |
1009 | 1038 | let isGetDisabled = if (if (igs()) | |
1010 | 1039 | then true | |
1011 | 1040 | else (cfgPoolStatus == PoolShutdown)) | |
1012 | 1041 | then true | |
1013 | 1042 | else isPoolOneTokenOperationsDisabled | |
1014 | 1043 | let checks = [if (if (!(isGetDisabled)) | |
1015 | 1044 | then true | |
1016 | 1045 | else isManager(i)) | |
1017 | 1046 | then true | |
1018 | 1047 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1019 | 1048 | then true | |
1020 | 1049 | else throwErr("exactly 1 payment are expected")] | |
1021 | 1050 | if ((checks == checks)) | |
1022 | 1051 | then { | |
1023 | - | let $ | |
1024 | - | let state = $ | |
1025 | - | let totalAmount = $ | |
1052 | + | let $t03742037575 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1053 | + | let state = $t03742037575._1 | |
1054 | + | let totalAmount = $t03742037575._2 | |
1026 | 1055 | $Tuple2(state, totalAmount) | |
1027 | 1056 | } | |
1028 | 1057 | else throw("Strict value is not equal to itself.") | |
1029 | 1058 | } | |
1030 | 1059 | ||
1031 | 1060 | ||
1032 | 1061 | ||
1033 | 1062 | @Callable(i) | |
1034 | 1063 | func refreshDlp () = nil | |
1035 | 1064 | ||
1036 | 1065 | ||
1037 | 1066 | ||
1038 | 1067 | @Callable(i) | |
1039 | 1068 | func getOneTknV2READONLY (outAssetId,lpAssetAmount) = { | |
1040 | 1069 | let poolConfig = gpc() | |
1041 | 1070 | let amId = poolConfig[idxAmAsId] | |
1042 | 1071 | let prId = poolConfig[idxPrAsId] | |
1043 | 1072 | let lpId = poolConfig[idxLPAsId] | |
1044 | 1073 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
1045 | 1074 | let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity) | |
1046 | 1075 | let D0 = getD(xp) | |
1047 | 1076 | let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission)) | |
1048 | 1077 | let index = if ((outAssetId == amId)) | |
1049 | 1078 | then 0 | |
1050 | 1079 | else if ((outAssetId == prId)) | |
1051 | 1080 | then 1 | |
1052 | 1081 | else throw("invalid out asset id") | |
1053 | 1082 | let newY = getYD(xp, index, D1) | |
1054 | 1083 | let dy = (xp[index] - newY) | |
1055 | 1084 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1056 | - | let $ | |
1057 | - | let totalGet = $ | |
1058 | - | let feeAmount = $ | |
1085 | + | let $t03841638465 = takeFee(totalGetRaw) | |
1086 | + | let totalGet = $t03841638465._1 | |
1087 | + | let feeAmount = $t03841638465._2 | |
1059 | 1088 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1060 | 1089 | } | |
1061 | 1090 | ||
1062 | 1091 | ||
1063 | 1092 | ||
1064 | 1093 | @Callable(i) | |
1065 | 1094 | func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = { | |
1066 | 1095 | let poolConfig = gpc() | |
1067 | 1096 | let amId = poolConfig[idxAmAsId] | |
1068 | 1097 | let prId = poolConfig[idxPrAsId] | |
1069 | 1098 | let lpId = poolConfig[idxLPAsId] | |
1070 | 1099 | let amBalance = getAccBalance(amId) | |
1071 | 1100 | let prBalance = getAccBalance(prId) | |
1072 | - | let $ | |
1101 | + | let $t03881038925 = { | |
1073 | 1102 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1074 | 1103 | if ($isInstanceOf(@, "(Int, Int)")) | |
1075 | 1104 | then @ | |
1076 | 1105 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1077 | 1106 | } | |
1078 | - | let totalGet = $ | |
1079 | - | let feeAmount = $ | |
1107 | + | let totalGet = $t03881038925._1 | |
1108 | + | let feeAmount = $t03881038925._2 | |
1080 | 1109 | let r = ego("", lpId, lpAssetAmount, this) | |
1081 | 1110 | let outAmAmt = r._1 | |
1082 | 1111 | let outPrAmt = r._2 | |
1083 | 1112 | let sumOfGetAssets = (outAmAmt + outPrAmt) | |
1084 | 1113 | let bonus = if ((sumOfGetAssets == 0)) | |
1085 | 1114 | then if ((totalGet == 0)) | |
1086 | 1115 | then 0 | |
1087 | 1116 | else throw("bonus calculation error") | |
1088 | 1117 | else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets) | |
1089 | 1118 | $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus)) | |
1090 | 1119 | } | |
1091 | 1120 | ||
1092 | 1121 | ||
1093 | 1122 | ||
1094 | 1123 | @Callable(i) | |
1095 | 1124 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1096 | 1125 | let r = cg(i) | |
1097 | 1126 | let outAmAmt = r._1 | |
1098 | 1127 | let outPrAmt = r._2 | |
1099 | 1128 | let pmtAmt = r._3 | |
1100 | 1129 | let pmtAssetId = r._4 | |
1101 | 1130 | let state = r._5 | |
1102 | 1131 | if ((noLessThenAmtAsset > outAmAmt)) | |
1103 | 1132 | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1104 | 1133 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1105 | 1134 | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1106 | 1135 | else { | |
1107 | 1136 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1108 | 1137 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1109 | 1138 | then state | |
1110 | 1139 | else throw("Strict value is not equal to itself.") | |
1111 | 1140 | } | |
1112 | 1141 | } | |
1113 | 1142 | ||
1114 | 1143 | ||
1115 | 1144 | ||
1116 | 1145 | @Callable(i) | |
1117 | 1146 | func unstakeAndGet (amount) = { | |
1118 | 1147 | let checkPayments = if ((size(i.payments) != 0)) | |
1119 | 1148 | then throw("No pmnts expd") | |
1120 | 1149 | else true | |
1121 | 1150 | if ((checkPayments == checkPayments)) | |
1122 | 1151 | then { | |
1123 | 1152 | let cfg = gpc() | |
1124 | 1153 | let factoryCfg = gfc() | |
1125 | 1154 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1126 | 1155 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1127 | 1156 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1128 | 1157 | if ((unstakeInv == unstakeInv)) | |
1129 | 1158 | then { | |
1130 | 1159 | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1131 | 1160 | let sts = parseIntValue(r._9) | |
1132 | 1161 | let state = r._10 | |
1133 | 1162 | let v = if (if (igs()) | |
1134 | 1163 | then true | |
1135 | 1164 | else (sts == PoolShutdown)) | |
1136 | 1165 | then throw(("Blocked: " + toString(sts))) | |
1137 | 1166 | else true | |
1138 | 1167 | if ((v == v)) | |
1139 | 1168 | then { | |
1140 | 1169 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1141 | 1170 | if ((burnA == burnA)) | |
1142 | 1171 | then state | |
1143 | 1172 | else throw("Strict value is not equal to itself.") | |
1144 | 1173 | } | |
1145 | 1174 | else throw("Strict value is not equal to itself.") | |
1146 | 1175 | } | |
1147 | 1176 | else throw("Strict value is not equal to itself.") | |
1148 | 1177 | } | |
1149 | 1178 | else throw("Strict value is not equal to itself.") | |
1150 | 1179 | } | |
1151 | 1180 | ||
1152 | 1181 | ||
1153 | 1182 | ||
1154 | 1183 | @Callable(i) | |
1155 | 1184 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1156 | 1185 | let isGetDisabled = if (igs()) | |
1157 | 1186 | then true | |
1158 | 1187 | else (cfgPoolStatus == PoolShutdown) | |
1159 | 1188 | let checks = [if (!(isGetDisabled)) | |
1160 | 1189 | then true | |
1161 | 1190 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1162 | 1191 | then true | |
1163 | 1192 | else throw("no payments are expected")] | |
1164 | 1193 | if ((checks == checks)) | |
1165 | 1194 | then { | |
1166 | 1195 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1167 | 1196 | if ((unstakeInv == unstakeInv)) | |
1168 | 1197 | then { | |
1169 | 1198 | let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1170 | 1199 | let outAmAmt = res._1 | |
1171 | 1200 | let outPrAmt = res._2 | |
1172 | 1201 | let state = res._10 | |
1173 | 1202 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1174 | 1203 | then true | |
1175 | 1204 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1176 | 1205 | then true | |
1177 | 1206 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1178 | 1207 | if ((checkAmounts == checkAmounts)) | |
1179 | 1208 | then { | |
1180 | 1209 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1181 | 1210 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1182 | 1211 | then state | |
1183 | 1212 | else throw("Strict value is not equal to itself.") | |
1184 | 1213 | } | |
1185 | 1214 | else throw("Strict value is not equal to itself.") | |
1186 | 1215 | } | |
1187 | 1216 | else throw("Strict value is not equal to itself.") | |
1188 | 1217 | } | |
1189 | 1218 | else throw("Strict value is not equal to itself.") | |
1190 | 1219 | } | |
1191 | 1220 | ||
1192 | 1221 | ||
1193 | 1222 | ||
1194 | 1223 | @Callable(i) | |
1195 | 1224 | func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = { | |
1196 | 1225 | let isPoolOneTokenOperationsDisabled = { | |
1197 | 1226 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1198 | 1227 | if ($isInstanceOf(@, "Boolean")) | |
1199 | 1228 | then @ | |
1200 | 1229 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1201 | 1230 | } | |
1202 | 1231 | let isGetDisabled = if (if (igs()) | |
1203 | 1232 | then true | |
1204 | 1233 | else (cfgPoolStatus == PoolShutdown)) | |
1205 | 1234 | then true | |
1206 | 1235 | else isPoolOneTokenOperationsDisabled | |
1207 | 1236 | let checks = [if (if (!(isGetDisabled)) | |
1208 | 1237 | then true | |
1209 | 1238 | else isManager(i)) | |
1210 | 1239 | then true | |
1211 | 1240 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1212 | 1241 | then true | |
1213 | 1242 | else throwErr("no payments are expected")] | |
1214 | 1243 | if ((checks == checks)) | |
1215 | 1244 | then { | |
1216 | 1245 | let cfg = gpc() | |
1217 | 1246 | let factoryCfg = gfc() | |
1218 | 1247 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1219 | 1248 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1220 | 1249 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1221 | 1250 | if ((unstakeInv == unstakeInv)) | |
1222 | 1251 | then { | |
1223 | - | let $ | |
1224 | - | let state = $ | |
1225 | - | let totalAmount = $ | |
1252 | + | let $t04276342951 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1253 | + | let state = $t04276342951._1 | |
1254 | + | let totalAmount = $t04276342951._2 | |
1226 | 1255 | $Tuple2(state, totalAmount) | |
1227 | 1256 | } | |
1228 | 1257 | else throw("Strict value is not equal to itself.") | |
1229 | 1258 | } | |
1230 | 1259 | else throw("Strict value is not equal to itself.") | |
1231 | 1260 | } | |
1232 | 1261 | ||
1233 | 1262 | ||
1234 | 1263 | ||
1235 | 1264 | @Callable(i) | |
1236 | 1265 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1237 | 1266 | let poolConfig = gpc() | |
1238 | 1267 | let amId = poolConfig[idxAmAsId] | |
1239 | 1268 | let prId = poolConfig[idxPrAsId] | |
1240 | 1269 | let lpId = poolConfig[idxLPAsId] | |
1241 | - | let $ | |
1242 | - | let lpAmount = $ | |
1243 | - | let state = $ | |
1244 | - | let feeAmount = $ | |
1245 | - | let bonus = $ | |
1270 | + | let $t04321043313 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1271 | + | let lpAmount = $t04321043313._1 | |
1272 | + | let state = $t04321043313._2 | |
1273 | + | let feeAmount = $t04321043313._3 | |
1274 | + | let bonus = $t04321043313._4 | |
1246 | 1275 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1247 | 1276 | } | |
1248 | 1277 | ||
1249 | 1278 | ||
1250 | 1279 | ||
1251 | 1280 | @Callable(i) | |
1252 | 1281 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1253 | 1282 | let poolConfig = gpc() | |
1254 | 1283 | let amId = poolConfig[idxAmAsId] | |
1255 | 1284 | let prId = poolConfig[idxPrAsId] | |
1256 | 1285 | let lpId = poolConfig[idxLPAsId] | |
1257 | - | let $ | |
1258 | - | let lpAmount = $ | |
1259 | - | let state = $ | |
1260 | - | let feeAmount = $ | |
1261 | - | let bonus = $ | |
1286 | + | let $t04359243696 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1287 | + | let lpAmount = $t04359243696._1 | |
1288 | + | let state = $t04359243696._2 | |
1289 | + | let feeAmount = $t04359243696._3 | |
1290 | + | let bonus = $t04359243696._4 | |
1262 | 1291 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1263 | 1292 | } | |
1264 | 1293 | ||
1265 | 1294 | ||
1266 | 1295 | ||
1267 | 1296 | @Callable(i) | |
1268 | 1297 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1269 | 1298 | then throw("denied") | |
1270 | 1299 | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success") | |
1271 | 1300 | ||
1272 | 1301 | ||
1273 | 1302 | ||
1274 | 1303 | @Callable(i) | |
1275 | 1304 | func setS (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1276 | 1305 | then pd | |
1277 | 1306 | else [StringEntry(k, v)] | |
1278 | 1307 | ||
1279 | 1308 | ||
1280 | 1309 | ||
1281 | 1310 | @Callable(i) | |
1282 | 1311 | func setI (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1283 | 1312 | then pd | |
1284 | 1313 | else [IntegerEntry(k, v)] | |
1285 | 1314 | ||
1286 | 1315 | ||
1287 | 1316 | ||
1288 | 1317 | @Callable(i) | |
1289 | 1318 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
1290 | 1319 | ||
1291 | 1320 | ||
1292 | 1321 | ||
1293 | 1322 | @Callable(i) | |
1294 | 1323 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1295 | 1324 | ||
1296 | 1325 | ||
1297 | 1326 | ||
1298 | 1327 | @Callable(i) | |
1299 | 1328 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1300 | 1329 | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
1301 | 1330 | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
1302 | 1331 | } | |
1303 | 1332 | ||
1304 | 1333 | ||
1305 | 1334 | ||
1306 | 1335 | @Callable(i) | |
1307 | 1336 | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
1308 | 1337 | ||
1309 | 1338 | ||
1310 | 1339 | ||
1311 | 1340 | @Callable(i) | |
1312 | 1341 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
1313 | 1342 | ||
1314 | 1343 | ||
1315 | 1344 | ||
1316 | 1345 | @Callable(i) | |
1317 | 1346 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1318 | 1347 | ||
1319 | 1348 | ||
1320 | 1349 | ||
1321 | 1350 | @Callable(i) | |
1322 | 1351 | 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, "")) | |
1323 | 1352 | ||
1324 | 1353 | ||
1325 | 1354 | ||
1326 | 1355 | @Callable(i) | |
1327 | 1356 | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
1328 | 1357 | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
1329 | 1358 | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
1330 | 1359 | } | |
1331 | 1360 | ||
1332 | 1361 | ||
1333 | 1362 | ||
1334 | 1363 | @Callable(i) | |
1335 | 1364 | func getFeeREADONLY () = $Tuple2(nil, fee) | |
1336 | 1365 | ||
1337 | 1366 | ||
1338 | 1367 | @Verifier(tx) | |
1339 | 1368 | func verify () = { | |
1340 | 1369 | let targetPublicKey = match m() { | |
1341 | 1370 | case pk: ByteVector => | |
1342 | 1371 | pk | |
1343 | 1372 | case _: Unit => | |
1344 | 1373 | tx.senderPublicKey | |
1345 | 1374 | case _ => | |
1346 | 1375 | throw("Match error") | |
1347 | 1376 | } | |
1348 | 1377 | match tx { | |
1349 | 1378 | case order: Order => | |
1350 | 1379 | let matcherPub = mp() | |
1351 | 1380 | let orderValid = moa(order) | |
1352 | 1381 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1353 | 1382 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1354 | 1383 | if (if (if (orderValid) | |
1355 | 1384 | then senderValid | |
1356 | 1385 | else false) | |
1357 | 1386 | then matcherValid | |
1358 | 1387 | else false) | |
1359 | 1388 | then true | |
1360 | 1389 | else toe(orderValid, senderValid, matcherValid) | |
1361 | 1390 | case s: SetScriptTransaction => | |
1362 | 1391 | let newHash = blake2b256(value(s.script)) | |
1363 | 1392 | let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash()))) | |
1364 | 1393 | let currentHash = scriptHash(this) | |
1365 | 1394 | if (if ((allowedHash == newHash)) | |
1366 | 1395 | then (currentHash != newHash) | |
1367 | 1396 | else false) | |
1368 | 1397 | then true | |
1369 | 1398 | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1370 | 1399 | case _ => | |
1371 | 1400 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1372 | 1401 | } | |
1373 | 1402 | } | |
1374 | 1403 |
github/deemru/w8io/169f3d6 166.63 ms ◑