tx · 7qeTDJZn4LaYsgJzFkLvUDfohq4PyThmF9agu58eqZ9N 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT: -0.03100000 Waves 2022.11.28 16:08 [2336997] smart account 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT > SELF 0.00000000 Waves
{ "type": 13, "id": "7qeTDJZn4LaYsgJzFkLvUDfohq4PyThmF9agu58eqZ9N", "fee": 3100000, "feeAssetId": null, "timestamp": 1669640862601, "version": 1, "sender": "3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT", "senderPublicKey": "D1BL65meykxFZTCuq7jq9HSGLLnWvQamQPUNrguW5w39", "proofs": [ "3KF7d5rUWrzP6GGzm48yeRkvv2vyZNCBY5e47jbSDh1ahAwqG7MronzB2Y9KqrwEDrmzWrN21MSA3YQDo6ePwKQW" ], "script": "base64:BgKjIggCEgMKAQgSAwoBCBIAEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIAEgQKAggBEgQKAggBEgQKAgEBEgMKAQESBQoDAQEBEgUKAwEIARIECgIBCBIECgIBCBIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgpzbGlwcGFnZTREIgt3YXZlc1N0cmluZyIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFzSWQiDWlkeElQcmljZUFzSWQiD2lkeEZhY3RTdGFrQ250ciISaW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UAMDAwUCZ1EFAmdSBwUCZ1MHBgkBAmFzAwUCZ1EFAmdSBQJnUwMJAAECBQJheAIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAmRYBQJheAQCZ1QJAPYDAQkBBXZhbHVlAQgFAmRYBnNjcmlwdAQCZ1UJANsEAQkBBXZhbHVlAQkAnQgCBQJhRgkBAmFxAAQCZ1YJAPEHAQUEdGhpcwMDCQAAAgUCZ1UFAmdUCQECIT0CBQJnVgUCZ1QHBgkA9AMDCAUCZ00JYm9keUJ5dGVzCQCRAwIIBQJnTQZwcm9vZnMAAAUCZ08JAPQDAwgFAmdNCWJvZHlCeXRlcwkAkQMCCAUCZ00GcHJvb2ZzAAAFAmdPE2zoyw==", "chainId": 84, "height": 2336997, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FPMLZ8iV3ZL6aewP5GiNV1egWBvmBWWrno9SS3WDru46 Next: GE24pgEr6yjW1wACdqv9tTWNNUStTC1HyubAKEgNJsuD Diff:
Old | New | Differences | |
---|---|---|---|
689 | 689 | else { | |
690 | 690 | let amBalance = getAccBalance(amId) | |
691 | 691 | let prBalance = getAccBalance(prId) | |
692 | - | let $ | |
692 | + | let $t02737827489 = { | |
693 | 693 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
694 | 694 | if ($isInstanceOf(@, "(Int, Int)")) | |
695 | 695 | then @ | |
696 | 696 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
697 | 697 | } | |
698 | - | let totalGet = $t02737827486._1 | |
699 | - | let feeAmount = $t02737827486._2 | |
700 | - | let totalAmount = if (if ((minOutAmount > 0)) | |
701 | - | then (minOutAmount > totalGet) | |
702 | - | else false) | |
703 | - | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
704 | - | else totalGet | |
705 | - | let $t02767627983 = 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 = $t02767627983._1 | |
711 | - | let outPr = $t02767627983._2 | |
712 | - | let amBalanceNew = $t02767627983._3 | |
713 | - | let prBalanceNew = $t02767627983._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)) | |
698 | + | if (($t02737827489 == $t02737827489)) | |
724 | 699 | then { | |
725 | - | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
726 | - | if ((burn == burn)) | |
727 | - | then $Tuple2(state, totalAmount) | |
700 | + | let feeAmount = $t02737827489._2 | |
701 | + | let totalGet = $t02737827489._1 | |
702 | + | let totalAmount = if (if ((minOutAmount > 0)) | |
703 | + | then (minOutAmount > totalGet) | |
704 | + | else false) | |
705 | + | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
706 | + | else totalGet | |
707 | + | let $t02767927986 = if ((outAssetId == amId)) | |
708 | + | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
709 | + | else if ((outAssetId == prId)) | |
710 | + | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
711 | + | else throw("invalid out asset id") | |
712 | + | let outAm = $t02767927986._1 | |
713 | + | let outPr = $t02767927986._2 | |
714 | + | let amBalanceNew = $t02767927986._3 | |
715 | + | let prBalanceNew = $t02767927986._4 | |
716 | + | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
717 | + | let curPr = f1(curPrX18, scale8) | |
718 | + | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
719 | + | then unit | |
720 | + | else fromBase58String(outAssetId) | |
721 | + | let sendFeeToMatcher = if ((feeAmount > 0)) | |
722 | + | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
723 | + | else nil | |
724 | + | 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 | + | if ((state == state)) | |
726 | + | then { | |
727 | + | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
728 | + | if ((burn == burn)) | |
729 | + | then $Tuple2(state, totalAmount) | |
730 | + | else throw("Strict value is not equal to itself.") | |
731 | + | } | |
728 | 732 | else throw("Strict value is not equal to itself.") | |
729 | 733 | } | |
730 | 734 | else throw("Strict value is not equal to itself.") | |
920 | 924 | let pmt = value(i.payments[0]) | |
921 | 925 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
922 | 926 | let pmtAmt = pmt.amount | |
923 | - | let $t03334533500 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
924 | - | let estimLP = $t03334533500._1 | |
925 | - | let state = $t03334533500._2 | |
926 | - | let feeAmount = $t03334533500._3 | |
927 | - | let emitLpAmt = if (if ((minOutAmount > 0)) | |
928 | - | then (minOutAmount > estimLP) | |
929 | - | else false) | |
930 | - | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
931 | - | else estimLP | |
932 | - | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
933 | - | if ((e == e)) | |
927 | + | let $t03334833506 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
928 | + | if (($t03334833506 == $t03334833506)) | |
934 | 929 | then { | |
935 | - | let el = match e { | |
936 | - | case legacy: Address => | |
937 | - | invoke(legacy, "emit", [emitLpAmt], nil) | |
938 | - | case _ => | |
939 | - | unit | |
940 | - | } | |
941 | - | if ((el == el)) | |
930 | + | let feeAmount = $t03334833506._3 | |
931 | + | let state = $t03334833506._2 | |
932 | + | let estimLP = $t03334833506._1 | |
933 | + | let emitLpAmt = if (if ((minOutAmount > 0)) | |
934 | + | then (minOutAmount > estimLP) | |
935 | + | else false) | |
936 | + | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
937 | + | else estimLP | |
938 | + | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
939 | + | if ((e == e)) | |
942 | 940 | then { | |
943 | - | let lpTrnsfr = if (autoStake) | |
941 | + | let el = match e { | |
942 | + | case legacy: Address => | |
943 | + | invoke(legacy, "emit", [emitLpAmt], nil) | |
944 | + | case _ => | |
945 | + | unit | |
946 | + | } | |
947 | + | if ((el == el)) | |
944 | 948 | then { | |
945 | - | let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)]) | |
946 | - | if ((ss == ss)) | |
947 | - | then nil | |
948 | - | else throw("Strict value is not equal to itself.") | |
949 | + | let lpTrnsfr = if (autoStake) | |
950 | + | then { | |
951 | + | let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)]) | |
952 | + | if ((ss == ss)) | |
953 | + | then nil | |
954 | + | else throw("Strict value is not equal to itself.") | |
955 | + | } | |
956 | + | else [ScriptTransfer(i.caller, emitLpAmt, lpId)] | |
957 | + | let sendFeeToMatcher = if ((feeAmount > 0)) | |
958 | + | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
959 | + | else nil | |
960 | + | $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt) | |
949 | 961 | } | |
950 | - | else [ScriptTransfer(i.caller, emitLpAmt, lpId)] | |
951 | - | let sendFeeToMatcher = if ((feeAmount > 0)) | |
952 | - | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
953 | - | else nil | |
954 | - | $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt) | |
962 | + | else throw("Strict value is not equal to itself.") | |
955 | 963 | } | |
956 | 964 | else throw("Strict value is not equal to itself.") | |
957 | 965 | } | |
1012 | 1020 | else throwErr("exactly 1 payment are expected")] | |
1013 | 1021 | if ((checks == checks)) | |
1014 | 1022 | then { | |
1015 | - | let $ | |
1016 | - | let state = $ | |
1017 | - | let totalAmount = $ | |
1023 | + | let $t03612836283 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1024 | + | let state = $t03612836283._1 | |
1025 | + | let totalAmount = $t03612836283._2 | |
1018 | 1026 | $Tuple2(state, totalAmount) | |
1019 | 1027 | } | |
1020 | 1028 | else throw("Strict value is not equal to itself.") | |
1045 | 1053 | let newY = getYD(xp, index, D1) | |
1046 | 1054 | let dy = (xp[index] - newY) | |
1047 | 1055 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1048 | - | let $ | |
1049 | - | let totalGet = $ | |
1050 | - | let feeAmount = $ | |
1056 | + | let $t03712437173 = takeFee(totalGetRaw) | |
1057 | + | let totalGet = $t03712437173._1 | |
1058 | + | let feeAmount = $t03712437173._2 | |
1051 | 1059 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1052 | 1060 | } | |
1053 | 1061 | ||
1061 | 1069 | let lpId = poolConfig[idxLPAsId] | |
1062 | 1070 | let amBalance = getAccBalance(amId) | |
1063 | 1071 | let prBalance = getAccBalance(prId) | |
1064 | - | let $ | |
1072 | + | let $t03751837633 = { | |
1065 | 1073 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1066 | 1074 | if ($isInstanceOf(@, "(Int, Int)")) | |
1067 | 1075 | then @ | |
1068 | 1076 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1069 | 1077 | } | |
1070 | - | let totalGet = $ | |
1071 | - | let feeAmount = $ | |
1078 | + | let totalGet = $t03751837633._1 | |
1079 | + | let feeAmount = $t03751837633._2 | |
1072 | 1080 | let r = ego("", lpId, lpAssetAmount, this) | |
1073 | 1081 | let outAmAmt = r._1 | |
1074 | 1082 | let outPrAmt = r._2 | |
1212 | 1220 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1213 | 1221 | if ((unstakeInv == unstakeInv)) | |
1214 | 1222 | then { | |
1215 | - | let $ | |
1216 | - | let state = $ | |
1217 | - | let totalAmount = $ | |
1223 | + | let $t04147141659 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1224 | + | let state = $t04147141659._1 | |
1225 | + | let totalAmount = $t04147141659._2 | |
1218 | 1226 | $Tuple2(state, totalAmount) | |
1219 | 1227 | } | |
1220 | 1228 | else throw("Strict value is not equal to itself.") | |
1230 | 1238 | let amId = poolConfig[idxAmAsId] | |
1231 | 1239 | let prId = poolConfig[idxPrAsId] | |
1232 | 1240 | let lpId = poolConfig[idxLPAsId] | |
1233 | - | let $ | |
1234 | - | let lpAmount = $ | |
1235 | - | let state = $ | |
1236 | - | let feeAmount = $ | |
1237 | - | let bonus = $ | |
1241 | + | let $t04191842021 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1242 | + | let lpAmount = $t04191842021._1 | |
1243 | + | let state = $t04191842021._2 | |
1244 | + | let feeAmount = $t04191842021._3 | |
1245 | + | let bonus = $t04191842021._4 | |
1238 | 1246 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1239 | 1247 | } | |
1240 | 1248 | ||
1246 | 1254 | let amId = poolConfig[idxAmAsId] | |
1247 | 1255 | let prId = poolConfig[idxPrAsId] | |
1248 | 1256 | let lpId = poolConfig[idxLPAsId] | |
1249 | - | let $ | |
1250 | - | let lpAmount = $ | |
1251 | - | let state = $ | |
1252 | - | let feeAmount = $ | |
1253 | - | let bonus = $ | |
1257 | + | let $t04230042404 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1258 | + | let lpAmount = $t04230042404._1 | |
1259 | + | let state = $t04230042404._2 | |
1260 | + | let feeAmount = $t04230042404._3 | |
1261 | + | let bonus = $t04230042404._4 | |
1254 | 1262 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1255 | 1263 | } | |
1256 | 1264 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let scale8 = 100000000 | |
5 | 5 | ||
6 | 6 | let scale8BigInt = toBigInt(100000000) | |
7 | 7 | ||
8 | 8 | let scale18 = toBigInt(1000000000000000000) | |
9 | 9 | ||
10 | 10 | let zeroBigInt = toBigInt(0) | |
11 | 11 | ||
12 | 12 | let big0 = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big1 = toBigInt(1) | |
15 | 15 | ||
16 | 16 | let big2 = toBigInt(2) | |
17 | 17 | ||
18 | 18 | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
19 | 19 | ||
20 | 20 | let wavesString = "WAVES" | |
21 | 21 | ||
22 | 22 | let Amult = "100" | |
23 | 23 | ||
24 | 24 | let Dconv = "1" | |
25 | 25 | ||
26 | 26 | let SEP = "__" | |
27 | 27 | ||
28 | 28 | let EMPTY = "" | |
29 | 29 | ||
30 | 30 | let PoolActive = 1 | |
31 | 31 | ||
32 | 32 | let PoolPutDis = 2 | |
33 | 33 | ||
34 | 34 | let PoolMatcherDis = 3 | |
35 | 35 | ||
36 | 36 | let PoolShutdown = 4 | |
37 | 37 | ||
38 | 38 | let idxPoolAddress = 1 | |
39 | 39 | ||
40 | 40 | let idxPoolSt = 2 | |
41 | 41 | ||
42 | 42 | let idxLPAsId = 3 | |
43 | 43 | ||
44 | 44 | let idxAmAsId = 4 | |
45 | 45 | ||
46 | 46 | let idxPrAsId = 5 | |
47 | 47 | ||
48 | 48 | let idxAmtAsDcm = 6 | |
49 | 49 | ||
50 | 50 | let idxPriceAsDcm = 7 | |
51 | 51 | ||
52 | 52 | let idxIAmtAsId = 8 | |
53 | 53 | ||
54 | 54 | let idxIPriceAsId = 9 | |
55 | 55 | ||
56 | 56 | let idxFactStakCntr = 1 | |
57 | 57 | ||
58 | 58 | let idxFactoryRestCntr = 6 | |
59 | 59 | ||
60 | 60 | let idxFactSlippCntr = 7 | |
61 | 61 | ||
62 | 62 | let idxFactGwxRewCntr = 10 | |
63 | 63 | ||
64 | 64 | let feeDefault = fraction(10, scale8, 10000) | |
65 | 65 | ||
66 | 66 | func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func abs (val) = if ((zeroBigInt > val)) | |
76 | 76 | then -(val) | |
77 | 77 | else val | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func absBigInt (val) = if ((zeroBigInt > val)) | |
81 | 81 | then -(val) | |
82 | 82 | else val | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func fc () = "%s__factoryContract" | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func mpk () = "%s__managerPublicKey" | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func pmpk () = "%s__pendingManagerPublicKey" | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func pl () = "%s%s__price__last" | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId) | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func aa () = "%s__amountAsset" | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func pa () = "%s__priceAsset" | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func amp () = "%s__amp" | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func ada () = "%s__addonAddr" | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | let keyFee = "%s__fee" | |
119 | 119 | ||
120 | 120 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
121 | 121 | ||
122 | 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 $t068307016 = poolConfigParsed | |
200 | 200 | ||
201 | 201 | let cfgPoolAddress = $t068307016._1 | |
202 | 202 | ||
203 | 203 | let cfgPoolStatus = $t068307016._2 | |
204 | 204 | ||
205 | 205 | let cfgLpAssetId = $t068307016._3 | |
206 | 206 | ||
207 | 207 | let cfgAmountAssetId = $t068307016._4 | |
208 | 208 | ||
209 | 209 | let cfgPriceAssetId = $t068307016._5 | |
210 | 210 | ||
211 | 211 | let cfgAmountAssetDecimals = $t068307016._6 | |
212 | 212 | ||
213 | 213 | let cfgPriceAssetDecimals = $t068307016._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 $t01744717792 = 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 = $t01744717792._1 | |
418 | 418 | let writePrAmt = $t01744717792._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 $t02234422364 = acc | |
519 | 519 | let d = $t02234422364._1 | |
520 | 520 | let found = $t02234422364._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 $t02278522832 = { | |
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 = $t02278522832._1 | |
549 | 549 | let found = $t02278522832._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 $t02333223352 = acc | |
570 | 570 | let y = $t02333223352._1 | |
571 | 571 | let found = $t02333223352._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 $t02365923706 = { | |
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 = $t02365923706._1 | |
599 | 599 | let found = $t02365923706._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,withTakeFee) = { | |
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 $t02448924951 = 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 = $t02448924951._1 | |
633 | 633 | let prBalanceOld = $t02448924951._2 | |
634 | 634 | let $t02495725133 = 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 = $t02495725133._1 | |
640 | 640 | let prAmountRaw = $t02495725133._2 | |
641 | 641 | let $t02513725376 = if (withTakeFee) | |
642 | 642 | then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2) | |
643 | 643 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
644 | 644 | let amAmount = $t02513725376._1 | |
645 | 645 | let prAmount = $t02513725376._2 | |
646 | 646 | let feeAmount = $t02513725376._3 | |
647 | 647 | let amBalanceNew = (amBalanceOld + amAmount) | |
648 | 648 | let prBalanceNew = (prBalanceOld + prAmount) | |
649 | 649 | let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)]) | |
650 | 650 | let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)]) | |
651 | 651 | let checkD = if ((D1 > D0)) | |
652 | 652 | then true | |
653 | 653 | else throw() | |
654 | 654 | if ((checkD == checkD)) | |
655 | 655 | then { | |
656 | 656 | let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0) | |
657 | 657 | let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8) | |
658 | 658 | 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 | 659 | let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld) | |
660 | 660 | let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8)) | |
661 | 661 | let priceAssetPart = (pmtAmtRaw - amountAssetPart) | |
662 | 662 | let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld)) | |
663 | 663 | let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth)) | |
664 | 664 | $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus) | |
665 | 665 | } | |
666 | 666 | else throw("Strict value is not equal to itself.") | |
667 | 667 | } | |
668 | 668 | else throw("Strict value is not equal to itself.") | |
669 | 669 | } | |
670 | 670 | ||
671 | 671 | ||
672 | 672 | func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = { | |
673 | 673 | let poolConfig = gpc() | |
674 | 674 | let lpId = poolConfig[idxLPAsId] | |
675 | 675 | let amId = poolConfig[idxAmAsId] | |
676 | 676 | let prId = poolConfig[idxPrAsId] | |
677 | 677 | let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm]) | |
678 | 678 | let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm]) | |
679 | 679 | let poolStatus = poolConfig[idxPoolSt] | |
680 | 680 | let userAddress = if ((caller == restContract)) | |
681 | 681 | then originCaller | |
682 | 682 | else caller | |
683 | 683 | let pmt = value(payments[0]) | |
684 | 684 | let pmtAssetId = value(pmt.assetId) | |
685 | 685 | let pmtAmt = pmt.amount | |
686 | 686 | let txId58 = toBase58String(transactionId) | |
687 | 687 | if ((lpId != toBase58String(pmtAssetId))) | |
688 | 688 | then throw("Wrong LP") | |
689 | 689 | else { | |
690 | 690 | let amBalance = getAccBalance(amId) | |
691 | 691 | let prBalance = getAccBalance(prId) | |
692 | - | let $ | |
692 | + | let $t02737827489 = { | |
693 | 693 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
694 | 694 | if ($isInstanceOf(@, "(Int, Int)")) | |
695 | 695 | then @ | |
696 | 696 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
697 | 697 | } | |
698 | - | let totalGet = $t02737827486._1 | |
699 | - | let feeAmount = $t02737827486._2 | |
700 | - | let totalAmount = if (if ((minOutAmount > 0)) | |
701 | - | then (minOutAmount > totalGet) | |
702 | - | else false) | |
703 | - | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
704 | - | else totalGet | |
705 | - | let $t02767627983 = 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 = $t02767627983._1 | |
711 | - | let outPr = $t02767627983._2 | |
712 | - | let amBalanceNew = $t02767627983._3 | |
713 | - | let prBalanceNew = $t02767627983._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)) | |
698 | + | if (($t02737827489 == $t02737827489)) | |
724 | 699 | then { | |
725 | - | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
726 | - | if ((burn == burn)) | |
727 | - | then $Tuple2(state, totalAmount) | |
700 | + | let feeAmount = $t02737827489._2 | |
701 | + | let totalGet = $t02737827489._1 | |
702 | + | let totalAmount = if (if ((minOutAmount > 0)) | |
703 | + | then (minOutAmount > totalGet) | |
704 | + | else false) | |
705 | + | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
706 | + | else totalGet | |
707 | + | let $t02767927986 = if ((outAssetId == amId)) | |
708 | + | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
709 | + | else if ((outAssetId == prId)) | |
710 | + | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
711 | + | else throw("invalid out asset id") | |
712 | + | let outAm = $t02767927986._1 | |
713 | + | let outPr = $t02767927986._2 | |
714 | + | let amBalanceNew = $t02767927986._3 | |
715 | + | let prBalanceNew = $t02767927986._4 | |
716 | + | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
717 | + | let curPr = f1(curPrX18, scale8) | |
718 | + | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
719 | + | then unit | |
720 | + | else fromBase58String(outAssetId) | |
721 | + | let sendFeeToMatcher = if ((feeAmount > 0)) | |
722 | + | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
723 | + | else nil | |
724 | + | 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 | + | if ((state == state)) | |
726 | + | then { | |
727 | + | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
728 | + | if ((burn == burn)) | |
729 | + | then $Tuple2(state, totalAmount) | |
730 | + | else throw("Strict value is not equal to itself.") | |
731 | + | } | |
728 | 732 | else throw("Strict value is not equal to itself.") | |
729 | 733 | } | |
730 | 734 | else throw("Strict value is not equal to itself.") | |
731 | 735 | } | |
732 | 736 | } | |
733 | 737 | ||
734 | 738 | ||
735 | 739 | func m () = match getString(mpk()) { | |
736 | 740 | case s: String => | |
737 | 741 | fromBase58String(s) | |
738 | 742 | case _: Unit => | |
739 | 743 | unit | |
740 | 744 | case _ => | |
741 | 745 | throw("Match error") | |
742 | 746 | } | |
743 | 747 | ||
744 | 748 | ||
745 | 749 | func pm () = match getString(pmpk()) { | |
746 | 750 | case s: String => | |
747 | 751 | fromBase58String(s) | |
748 | 752 | case _: Unit => | |
749 | 753 | unit | |
750 | 754 | case _ => | |
751 | 755 | throw("Match error") | |
752 | 756 | } | |
753 | 757 | ||
754 | 758 | ||
755 | 759 | let pd = throw("Permission denied") | |
756 | 760 | ||
757 | 761 | func isManager (i) = match m() { | |
758 | 762 | case pk: ByteVector => | |
759 | 763 | (i.callerPublicKey == pk) | |
760 | 764 | case _: Unit => | |
761 | 765 | (i.caller == this) | |
762 | 766 | case _ => | |
763 | 767 | throw("Match error") | |
764 | 768 | } | |
765 | 769 | ||
766 | 770 | ||
767 | 771 | func mm (i) = match m() { | |
768 | 772 | case pk: ByteVector => | |
769 | 773 | if ((i.callerPublicKey == pk)) | |
770 | 774 | then true | |
771 | 775 | else pd | |
772 | 776 | case _: Unit => | |
773 | 777 | if ((i.caller == this)) | |
774 | 778 | then true | |
775 | 779 | else pd | |
776 | 780 | case _ => | |
777 | 781 | throw("Match error") | |
778 | 782 | } | |
779 | 783 | ||
780 | 784 | ||
781 | 785 | @Callable(i) | |
782 | 786 | func constructor (fc) = { | |
783 | 787 | let c = mm(i) | |
784 | 788 | if ((c == c)) | |
785 | 789 | then [StringEntry(fc(), fc)] | |
786 | 790 | else throw("Strict value is not equal to itself.") | |
787 | 791 | } | |
788 | 792 | ||
789 | 793 | ||
790 | 794 | ||
791 | 795 | @Callable(i) | |
792 | 796 | func setManager (pendingManagerPublicKey) = { | |
793 | 797 | let c = mm(i) | |
794 | 798 | if ((c == c)) | |
795 | 799 | then { | |
796 | 800 | let cm = fromBase58String(pendingManagerPublicKey) | |
797 | 801 | if ((cm == cm)) | |
798 | 802 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
799 | 803 | else throw("Strict value is not equal to itself.") | |
800 | 804 | } | |
801 | 805 | else throw("Strict value is not equal to itself.") | |
802 | 806 | } | |
803 | 807 | ||
804 | 808 | ||
805 | 809 | ||
806 | 810 | @Callable(i) | |
807 | 811 | func confirmManager () = { | |
808 | 812 | let p = pm() | |
809 | 813 | let hpm = if (isDefined(p)) | |
810 | 814 | then true | |
811 | 815 | else throw("No pending manager") | |
812 | 816 | if ((hpm == hpm)) | |
813 | 817 | then { | |
814 | 818 | let cpm = if ((i.callerPublicKey == value(p))) | |
815 | 819 | then true | |
816 | 820 | else throw("You are not pending manager") | |
817 | 821 | if ((cpm == cpm)) | |
818 | 822 | then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())] | |
819 | 823 | else throw("Strict value is not equal to itself.") | |
820 | 824 | } | |
821 | 825 | else throw("Strict value is not equal to itself.") | |
822 | 826 | } | |
823 | 827 | ||
824 | 828 | ||
825 | 829 | ||
826 | 830 | @Callable(i) | |
827 | 831 | func put (slip,autoStake) = { | |
828 | 832 | let factCfg = gfc() | |
829 | 833 | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
830 | 834 | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
831 | 835 | if ((0 > slip)) | |
832 | 836 | then throw("Wrong slippage") | |
833 | 837 | else if ((size(i.payments) != 2)) | |
834 | 838 | then throw("2 pmnts expd") | |
835 | 839 | else { | |
836 | 840 | 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, "") | |
837 | 841 | let emitLpAmt = e._2 | |
838 | 842 | let lpAssetId = e._7 | |
839 | 843 | let state = e._9 | |
840 | 844 | let amDiff = e._10 | |
841 | 845 | let prDiff = e._11 | |
842 | 846 | let amId = e._12 | |
843 | 847 | let prId = e._13 | |
844 | 848 | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
845 | 849 | if ((r == r)) | |
846 | 850 | then { | |
847 | 851 | let el = match r { | |
848 | 852 | case legacy: Address => | |
849 | 853 | invoke(legacy, "emit", [emitLpAmt], nil) | |
850 | 854 | case _ => | |
851 | 855 | unit | |
852 | 856 | } | |
853 | 857 | if ((el == el)) | |
854 | 858 | then { | |
855 | 859 | let sa = if ((amDiff > 0)) | |
856 | 860 | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
857 | 861 | else nil | |
858 | 862 | if ((sa == sa)) | |
859 | 863 | then { | |
860 | 864 | let sp = if ((prDiff > 0)) | |
861 | 865 | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
862 | 866 | else nil | |
863 | 867 | if ((sp == sp)) | |
864 | 868 | then { | |
865 | 869 | let lpTrnsfr = if (autoStake) | |
866 | 870 | then { | |
867 | 871 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
868 | 872 | if ((ss == ss)) | |
869 | 873 | then nil | |
870 | 874 | else throw("Strict value is not equal to itself.") | |
871 | 875 | } | |
872 | 876 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
873 | 877 | (state ++ lpTrnsfr) | |
874 | 878 | } | |
875 | 879 | else throw("Strict value is not equal to itself.") | |
876 | 880 | } | |
877 | 881 | else throw("Strict value is not equal to itself.") | |
878 | 882 | } | |
879 | 883 | else throw("Strict value is not equal to itself.") | |
880 | 884 | } | |
881 | 885 | else throw("Strict value is not equal to itself.") | |
882 | 886 | } | |
883 | 887 | } | |
884 | 888 | ||
885 | 889 | ||
886 | 890 | ||
887 | 891 | @Callable(i) | |
888 | 892 | func putOneTknV2 (minOutAmount,autoStake) = { | |
889 | 893 | let isPoolOneTokenOperationsDisabled = { | |
890 | 894 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
891 | 895 | if ($isInstanceOf(@, "Boolean")) | |
892 | 896 | then @ | |
893 | 897 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
894 | 898 | } | |
895 | 899 | let isPutDisabled = if (if (if (igs()) | |
896 | 900 | then true | |
897 | 901 | else (cfgPoolStatus == PoolPutDis)) | |
898 | 902 | then true | |
899 | 903 | else (cfgPoolStatus == PoolShutdown)) | |
900 | 904 | then true | |
901 | 905 | else isPoolOneTokenOperationsDisabled | |
902 | 906 | let checks = [if (if (!(isPutDisabled)) | |
903 | 907 | then true | |
904 | 908 | else isManager(i)) | |
905 | 909 | then true | |
906 | 910 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
907 | 911 | then true | |
908 | 912 | else throwErr("exactly 1 payment are expected")] | |
909 | 913 | if ((checks == checks)) | |
910 | 914 | then { | |
911 | 915 | let poolConfig = gpc() | |
912 | 916 | let amId = poolConfig[idxAmAsId] | |
913 | 917 | let prId = poolConfig[idxPrAsId] | |
914 | 918 | let lpId = fromBase58String(poolConfig[idxLPAsId]) | |
915 | 919 | let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm]) | |
916 | 920 | let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm]) | |
917 | 921 | let userAddress = if ((i.caller == this)) | |
918 | 922 | then i.originCaller | |
919 | 923 | else i.caller | |
920 | 924 | let pmt = value(i.payments[0]) | |
921 | 925 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
922 | 926 | let pmtAmt = pmt.amount | |
923 | - | let $t03334533500 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
924 | - | let estimLP = $t03334533500._1 | |
925 | - | let state = $t03334533500._2 | |
926 | - | let feeAmount = $t03334533500._3 | |
927 | - | let emitLpAmt = if (if ((minOutAmount > 0)) | |
928 | - | then (minOutAmount > estimLP) | |
929 | - | else false) | |
930 | - | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
931 | - | else estimLP | |
932 | - | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
933 | - | if ((e == e)) | |
927 | + | let $t03334833506 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
928 | + | if (($t03334833506 == $t03334833506)) | |
934 | 929 | then { | |
935 | - | let el = match e { | |
936 | - | case legacy: Address => | |
937 | - | invoke(legacy, "emit", [emitLpAmt], nil) | |
938 | - | case _ => | |
939 | - | unit | |
940 | - | } | |
941 | - | if ((el == el)) | |
930 | + | let feeAmount = $t03334833506._3 | |
931 | + | let state = $t03334833506._2 | |
932 | + | let estimLP = $t03334833506._1 | |
933 | + | let emitLpAmt = if (if ((minOutAmount > 0)) | |
934 | + | then (minOutAmount > estimLP) | |
935 | + | else false) | |
936 | + | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
937 | + | else estimLP | |
938 | + | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
939 | + | if ((e == e)) | |
942 | 940 | then { | |
943 | - | let lpTrnsfr = if (autoStake) | |
941 | + | let el = match e { | |
942 | + | case legacy: Address => | |
943 | + | invoke(legacy, "emit", [emitLpAmt], nil) | |
944 | + | case _ => | |
945 | + | unit | |
946 | + | } | |
947 | + | if ((el == el)) | |
944 | 948 | then { | |
945 | - | let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)]) | |
946 | - | if ((ss == ss)) | |
947 | - | then nil | |
948 | - | else throw("Strict value is not equal to itself.") | |
949 | + | let lpTrnsfr = if (autoStake) | |
950 | + | then { | |
951 | + | let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)]) | |
952 | + | if ((ss == ss)) | |
953 | + | then nil | |
954 | + | else throw("Strict value is not equal to itself.") | |
955 | + | } | |
956 | + | else [ScriptTransfer(i.caller, emitLpAmt, lpId)] | |
957 | + | let sendFeeToMatcher = if ((feeAmount > 0)) | |
958 | + | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
959 | + | else nil | |
960 | + | $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt) | |
949 | 961 | } | |
950 | - | else [ScriptTransfer(i.caller, emitLpAmt, lpId)] | |
951 | - | let sendFeeToMatcher = if ((feeAmount > 0)) | |
952 | - | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
953 | - | else nil | |
954 | - | $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt) | |
962 | + | else throw("Strict value is not equal to itself.") | |
955 | 963 | } | |
956 | 964 | else throw("Strict value is not equal to itself.") | |
957 | 965 | } | |
958 | 966 | else throw("Strict value is not equal to itself.") | |
959 | 967 | } | |
960 | 968 | else throw("Strict value is not equal to itself.") | |
961 | 969 | } | |
962 | 970 | ||
963 | 971 | ||
964 | 972 | ||
965 | 973 | @Callable(i) | |
966 | 974 | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
967 | 975 | then throw("Wrong slpg") | |
968 | 976 | else if ((size(i.payments) != 2)) | |
969 | 977 | then throw("2 pmnts expd") | |
970 | 978 | else { | |
971 | 979 | 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, "") | |
972 | 980 | estPut._9 | |
973 | 981 | } | |
974 | 982 | ||
975 | 983 | ||
976 | 984 | ||
977 | 985 | @Callable(i) | |
978 | 986 | func get () = { | |
979 | 987 | let r = cg(i) | |
980 | 988 | let outAmtAmt = r._1 | |
981 | 989 | let outPrAmt = r._2 | |
982 | 990 | let pmtAmt = r._3 | |
983 | 991 | let pmtAssetId = r._4 | |
984 | 992 | let state = r._5 | |
985 | 993 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
986 | 994 | if ((b == b)) | |
987 | 995 | then state | |
988 | 996 | else throw("Strict value is not equal to itself.") | |
989 | 997 | } | |
990 | 998 | ||
991 | 999 | ||
992 | 1000 | ||
993 | 1001 | @Callable(i) | |
994 | 1002 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
995 | 1003 | let isPoolOneTokenOperationsDisabled = { | |
996 | 1004 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
997 | 1005 | if ($isInstanceOf(@, "Boolean")) | |
998 | 1006 | then @ | |
999 | 1007 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1000 | 1008 | } | |
1001 | 1009 | let isGetDisabled = if (if (igs()) | |
1002 | 1010 | then true | |
1003 | 1011 | else (cfgPoolStatus == PoolShutdown)) | |
1004 | 1012 | then true | |
1005 | 1013 | else isPoolOneTokenOperationsDisabled | |
1006 | 1014 | let checks = [if (if (!(isGetDisabled)) | |
1007 | 1015 | then true | |
1008 | 1016 | else isManager(i)) | |
1009 | 1017 | then true | |
1010 | 1018 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1011 | 1019 | then true | |
1012 | 1020 | else throwErr("exactly 1 payment are expected")] | |
1013 | 1021 | if ((checks == checks)) | |
1014 | 1022 | then { | |
1015 | - | let $ | |
1016 | - | let state = $ | |
1017 | - | let totalAmount = $ | |
1023 | + | let $t03612836283 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1024 | + | let state = $t03612836283._1 | |
1025 | + | let totalAmount = $t03612836283._2 | |
1018 | 1026 | $Tuple2(state, totalAmount) | |
1019 | 1027 | } | |
1020 | 1028 | else throw("Strict value is not equal to itself.") | |
1021 | 1029 | } | |
1022 | 1030 | ||
1023 | 1031 | ||
1024 | 1032 | ||
1025 | 1033 | @Callable(i) | |
1026 | 1034 | func refreshDlp () = nil | |
1027 | 1035 | ||
1028 | 1036 | ||
1029 | 1037 | ||
1030 | 1038 | @Callable(i) | |
1031 | 1039 | func getOneTknV2READONLY (outAssetId,lpAssetAmount) = { | |
1032 | 1040 | let poolConfig = gpc() | |
1033 | 1041 | let amId = poolConfig[idxAmAsId] | |
1034 | 1042 | let prId = poolConfig[idxPrAsId] | |
1035 | 1043 | let lpId = poolConfig[idxLPAsId] | |
1036 | 1044 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
1037 | 1045 | let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity) | |
1038 | 1046 | let D0 = getD(xp) | |
1039 | 1047 | let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission)) | |
1040 | 1048 | let index = if ((outAssetId == amId)) | |
1041 | 1049 | then 0 | |
1042 | 1050 | else if ((outAssetId == prId)) | |
1043 | 1051 | then 1 | |
1044 | 1052 | else throw("invalid out asset id") | |
1045 | 1053 | let newY = getYD(xp, index, D1) | |
1046 | 1054 | let dy = (xp[index] - newY) | |
1047 | 1055 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1048 | - | let $ | |
1049 | - | let totalGet = $ | |
1050 | - | let feeAmount = $ | |
1056 | + | let $t03712437173 = takeFee(totalGetRaw) | |
1057 | + | let totalGet = $t03712437173._1 | |
1058 | + | let feeAmount = $t03712437173._2 | |
1051 | 1059 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1052 | 1060 | } | |
1053 | 1061 | ||
1054 | 1062 | ||
1055 | 1063 | ||
1056 | 1064 | @Callable(i) | |
1057 | 1065 | func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = { | |
1058 | 1066 | let poolConfig = gpc() | |
1059 | 1067 | let amId = poolConfig[idxAmAsId] | |
1060 | 1068 | let prId = poolConfig[idxPrAsId] | |
1061 | 1069 | let lpId = poolConfig[idxLPAsId] | |
1062 | 1070 | let amBalance = getAccBalance(amId) | |
1063 | 1071 | let prBalance = getAccBalance(prId) | |
1064 | - | let $ | |
1072 | + | let $t03751837633 = { | |
1065 | 1073 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1066 | 1074 | if ($isInstanceOf(@, "(Int, Int)")) | |
1067 | 1075 | then @ | |
1068 | 1076 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1069 | 1077 | } | |
1070 | - | let totalGet = $ | |
1071 | - | let feeAmount = $ | |
1078 | + | let totalGet = $t03751837633._1 | |
1079 | + | let feeAmount = $t03751837633._2 | |
1072 | 1080 | let r = ego("", lpId, lpAssetAmount, this) | |
1073 | 1081 | let outAmAmt = r._1 | |
1074 | 1082 | let outPrAmt = r._2 | |
1075 | 1083 | let sumOfGetAssets = (outAmAmt + outPrAmt) | |
1076 | 1084 | let bonus = if ((sumOfGetAssets == 0)) | |
1077 | 1085 | then if ((totalGet == 0)) | |
1078 | 1086 | then 0 | |
1079 | 1087 | else throw("bonus calculation error") | |
1080 | 1088 | else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets) | |
1081 | 1089 | $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus)) | |
1082 | 1090 | } | |
1083 | 1091 | ||
1084 | 1092 | ||
1085 | 1093 | ||
1086 | 1094 | @Callable(i) | |
1087 | 1095 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1088 | 1096 | let r = cg(i) | |
1089 | 1097 | let outAmAmt = r._1 | |
1090 | 1098 | let outPrAmt = r._2 | |
1091 | 1099 | let pmtAmt = r._3 | |
1092 | 1100 | let pmtAssetId = r._4 | |
1093 | 1101 | let state = r._5 | |
1094 | 1102 | if ((noLessThenAmtAsset > outAmAmt)) | |
1095 | 1103 | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1096 | 1104 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1097 | 1105 | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1098 | 1106 | else { | |
1099 | 1107 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1100 | 1108 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1101 | 1109 | then state | |
1102 | 1110 | else throw("Strict value is not equal to itself.") | |
1103 | 1111 | } | |
1104 | 1112 | } | |
1105 | 1113 | ||
1106 | 1114 | ||
1107 | 1115 | ||
1108 | 1116 | @Callable(i) | |
1109 | 1117 | func unstakeAndGet (amount) = { | |
1110 | 1118 | let checkPayments = if ((size(i.payments) != 0)) | |
1111 | 1119 | then throw("No pmnts expd") | |
1112 | 1120 | else true | |
1113 | 1121 | if ((checkPayments == checkPayments)) | |
1114 | 1122 | then { | |
1115 | 1123 | let cfg = gpc() | |
1116 | 1124 | let factoryCfg = gfc() | |
1117 | 1125 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1118 | 1126 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1119 | 1127 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1120 | 1128 | if ((unstakeInv == unstakeInv)) | |
1121 | 1129 | then { | |
1122 | 1130 | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1123 | 1131 | let sts = parseIntValue(r._9) | |
1124 | 1132 | let state = r._10 | |
1125 | 1133 | let v = if (if (igs()) | |
1126 | 1134 | then true | |
1127 | 1135 | else (sts == PoolShutdown)) | |
1128 | 1136 | then throw(("Blocked: " + toString(sts))) | |
1129 | 1137 | else true | |
1130 | 1138 | if ((v == v)) | |
1131 | 1139 | then { | |
1132 | 1140 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1133 | 1141 | if ((burnA == burnA)) | |
1134 | 1142 | then state | |
1135 | 1143 | else throw("Strict value is not equal to itself.") | |
1136 | 1144 | } | |
1137 | 1145 | else throw("Strict value is not equal to itself.") | |
1138 | 1146 | } | |
1139 | 1147 | else throw("Strict value is not equal to itself.") | |
1140 | 1148 | } | |
1141 | 1149 | else throw("Strict value is not equal to itself.") | |
1142 | 1150 | } | |
1143 | 1151 | ||
1144 | 1152 | ||
1145 | 1153 | ||
1146 | 1154 | @Callable(i) | |
1147 | 1155 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1148 | 1156 | let isGetDisabled = if (igs()) | |
1149 | 1157 | then true | |
1150 | 1158 | else (cfgPoolStatus == PoolShutdown) | |
1151 | 1159 | let checks = [if (!(isGetDisabled)) | |
1152 | 1160 | then true | |
1153 | 1161 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1154 | 1162 | then true | |
1155 | 1163 | else throw("no payments are expected")] | |
1156 | 1164 | if ((checks == checks)) | |
1157 | 1165 | then { | |
1158 | 1166 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1159 | 1167 | if ((unstakeInv == unstakeInv)) | |
1160 | 1168 | then { | |
1161 | 1169 | let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1162 | 1170 | let outAmAmt = res._1 | |
1163 | 1171 | let outPrAmt = res._2 | |
1164 | 1172 | let state = res._10 | |
1165 | 1173 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1166 | 1174 | then true | |
1167 | 1175 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1168 | 1176 | then true | |
1169 | 1177 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1170 | 1178 | if ((checkAmounts == checkAmounts)) | |
1171 | 1179 | then { | |
1172 | 1180 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1173 | 1181 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1174 | 1182 | then state | |
1175 | 1183 | else throw("Strict value is not equal to itself.") | |
1176 | 1184 | } | |
1177 | 1185 | else throw("Strict value is not equal to itself.") | |
1178 | 1186 | } | |
1179 | 1187 | else throw("Strict value is not equal to itself.") | |
1180 | 1188 | } | |
1181 | 1189 | else throw("Strict value is not equal to itself.") | |
1182 | 1190 | } | |
1183 | 1191 | ||
1184 | 1192 | ||
1185 | 1193 | ||
1186 | 1194 | @Callable(i) | |
1187 | 1195 | func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = { | |
1188 | 1196 | let isPoolOneTokenOperationsDisabled = { | |
1189 | 1197 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1190 | 1198 | if ($isInstanceOf(@, "Boolean")) | |
1191 | 1199 | then @ | |
1192 | 1200 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1193 | 1201 | } | |
1194 | 1202 | let isGetDisabled = if (if (igs()) | |
1195 | 1203 | then true | |
1196 | 1204 | else (cfgPoolStatus == PoolShutdown)) | |
1197 | 1205 | then true | |
1198 | 1206 | else isPoolOneTokenOperationsDisabled | |
1199 | 1207 | let checks = [if (if (!(isGetDisabled)) | |
1200 | 1208 | then true | |
1201 | 1209 | else isManager(i)) | |
1202 | 1210 | then true | |
1203 | 1211 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1204 | 1212 | then true | |
1205 | 1213 | else throwErr("no payments are expected")] | |
1206 | 1214 | if ((checks == checks)) | |
1207 | 1215 | then { | |
1208 | 1216 | let cfg = gpc() | |
1209 | 1217 | let factoryCfg = gfc() | |
1210 | 1218 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1211 | 1219 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1212 | 1220 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1213 | 1221 | if ((unstakeInv == unstakeInv)) | |
1214 | 1222 | then { | |
1215 | - | let $ | |
1216 | - | let state = $ | |
1217 | - | let totalAmount = $ | |
1223 | + | let $t04147141659 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1224 | + | let state = $t04147141659._1 | |
1225 | + | let totalAmount = $t04147141659._2 | |
1218 | 1226 | $Tuple2(state, totalAmount) | |
1219 | 1227 | } | |
1220 | 1228 | else throw("Strict value is not equal to itself.") | |
1221 | 1229 | } | |
1222 | 1230 | else throw("Strict value is not equal to itself.") | |
1223 | 1231 | } | |
1224 | 1232 | ||
1225 | 1233 | ||
1226 | 1234 | ||
1227 | 1235 | @Callable(i) | |
1228 | 1236 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1229 | 1237 | let poolConfig = gpc() | |
1230 | 1238 | let amId = poolConfig[idxAmAsId] | |
1231 | 1239 | let prId = poolConfig[idxPrAsId] | |
1232 | 1240 | let lpId = poolConfig[idxLPAsId] | |
1233 | - | let $ | |
1234 | - | let lpAmount = $ | |
1235 | - | let state = $ | |
1236 | - | let feeAmount = $ | |
1237 | - | let bonus = $ | |
1241 | + | let $t04191842021 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1242 | + | let lpAmount = $t04191842021._1 | |
1243 | + | let state = $t04191842021._2 | |
1244 | + | let feeAmount = $t04191842021._3 | |
1245 | + | let bonus = $t04191842021._4 | |
1238 | 1246 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1239 | 1247 | } | |
1240 | 1248 | ||
1241 | 1249 | ||
1242 | 1250 | ||
1243 | 1251 | @Callable(i) | |
1244 | 1252 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1245 | 1253 | let poolConfig = gpc() | |
1246 | 1254 | let amId = poolConfig[idxAmAsId] | |
1247 | 1255 | let prId = poolConfig[idxPrAsId] | |
1248 | 1256 | let lpId = poolConfig[idxLPAsId] | |
1249 | - | let $ | |
1250 | - | let lpAmount = $ | |
1251 | - | let state = $ | |
1252 | - | let feeAmount = $ | |
1253 | - | let bonus = $ | |
1257 | + | let $t04230042404 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1258 | + | let lpAmount = $t04230042404._1 | |
1259 | + | let state = $t04230042404._2 | |
1260 | + | let feeAmount = $t04230042404._3 | |
1261 | + | let bonus = $t04230042404._4 | |
1254 | 1262 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1255 | 1263 | } | |
1256 | 1264 | ||
1257 | 1265 | ||
1258 | 1266 | ||
1259 | 1267 | @Callable(i) | |
1260 | 1268 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1261 | 1269 | then throw("denied") | |
1262 | 1270 | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success") | |
1263 | 1271 | ||
1264 | 1272 | ||
1265 | 1273 | ||
1266 | 1274 | @Callable(i) | |
1267 | 1275 | func setS (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1268 | 1276 | then pd | |
1269 | 1277 | else [StringEntry(k, v)] | |
1270 | 1278 | ||
1271 | 1279 | ||
1272 | 1280 | ||
1273 | 1281 | @Callable(i) | |
1274 | 1282 | func setI (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1275 | 1283 | then pd | |
1276 | 1284 | else [IntegerEntry(k, v)] | |
1277 | 1285 | ||
1278 | 1286 | ||
1279 | 1287 | ||
1280 | 1288 | @Callable(i) | |
1281 | 1289 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
1282 | 1290 | ||
1283 | 1291 | ||
1284 | 1292 | ||
1285 | 1293 | @Callable(i) | |
1286 | 1294 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1287 | 1295 | ||
1288 | 1296 | ||
1289 | 1297 | ||
1290 | 1298 | @Callable(i) | |
1291 | 1299 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1292 | 1300 | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
1293 | 1301 | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
1294 | 1302 | } | |
1295 | 1303 | ||
1296 | 1304 | ||
1297 | 1305 | ||
1298 | 1306 | @Callable(i) | |
1299 | 1307 | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
1300 | 1308 | ||
1301 | 1309 | ||
1302 | 1310 | ||
1303 | 1311 | @Callable(i) | |
1304 | 1312 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
1305 | 1313 | ||
1306 | 1314 | ||
1307 | 1315 | ||
1308 | 1316 | @Callable(i) | |
1309 | 1317 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1310 | 1318 | ||
1311 | 1319 | ||
1312 | 1320 | ||
1313 | 1321 | @Callable(i) | |
1314 | 1322 | 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, "")) | |
1315 | 1323 | ||
1316 | 1324 | ||
1317 | 1325 | ||
1318 | 1326 | @Callable(i) | |
1319 | 1327 | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
1320 | 1328 | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
1321 | 1329 | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
1322 | 1330 | } | |
1323 | 1331 | ||
1324 | 1332 | ||
1325 | 1333 | ||
1326 | 1334 | @Callable(i) | |
1327 | 1335 | func getFeeREADONLY () = $Tuple2(nil, fee) | |
1328 | 1336 | ||
1329 | 1337 | ||
1330 | 1338 | @Verifier(tx) | |
1331 | 1339 | func verify () = { | |
1332 | 1340 | let targetPublicKey = match m() { | |
1333 | 1341 | case pk: ByteVector => | |
1334 | 1342 | pk | |
1335 | 1343 | case _: Unit => | |
1336 | 1344 | tx.senderPublicKey | |
1337 | 1345 | case _ => | |
1338 | 1346 | throw("Match error") | |
1339 | 1347 | } | |
1340 | 1348 | match tx { | |
1341 | 1349 | case order: Order => | |
1342 | 1350 | let matcherPub = mp() | |
1343 | 1351 | let orderValid = moa(order) | |
1344 | 1352 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1345 | 1353 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1346 | 1354 | if (if (if (orderValid) | |
1347 | 1355 | then senderValid | |
1348 | 1356 | else false) | |
1349 | 1357 | then matcherValid | |
1350 | 1358 | else false) | |
1351 | 1359 | then true | |
1352 | 1360 | else toe(orderValid, senderValid, matcherValid) | |
1353 | 1361 | case s: SetScriptTransaction => | |
1354 | 1362 | let newHash = blake2b256(value(s.script)) | |
1355 | 1363 | let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash()))) | |
1356 | 1364 | let currentHash = scriptHash(this) | |
1357 | 1365 | if (if ((allowedHash == newHash)) | |
1358 | 1366 | then (currentHash != newHash) | |
1359 | 1367 | else false) | |
1360 | 1368 | then true | |
1361 | 1369 | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1362 | 1370 | case _ => | |
1363 | 1371 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1364 | 1372 | } | |
1365 | 1373 | } | |
1366 | 1374 |
github/deemru/w8io/026f985 168.81 ms ◑