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