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