tx · 7wUm6fDrGbuotMxNgsESgEo5vkgbkx5VGbhChsAQy113 3MsCuhfTF9EnyVoNh2yqo4eZ1Q24Ki3fntS: -0.03000000 Waves 2022.11.17 18:16 [2321281] smart account 3MsCuhfTF9EnyVoNh2yqo4eZ1Q24Ki3fntS > SELF 0.00000000 Waves
{ "type": 13, "id": "7wUm6fDrGbuotMxNgsESgEo5vkgbkx5VGbhChsAQy113", "fee": 3000000, "feeAssetId": null, "timestamp": 1668698060813, "version": 1, "sender": "3MsCuhfTF9EnyVoNh2yqo4eZ1Q24Ki3fntS", "senderPublicKey": "8rqHfvDx1Q95zF6SWwiQWVTu2vr2wNQpxUzAx84ZAedj", "proofs": [ "3qsYgTKijvqspoY89oos7peHd4RjXhzqUx7dvWdVwcypcyhMrFsyHtfoCjvKu46Bw8eSKWoYjt29CjUG7CUq2ba6" ], "script": "base64:BgK8JwgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASAwoBCBIFCgMBAQESBAoCAQESBAoCCAESBAoCCAgSCwoJCAEBAgECCAQEEgYKBAgIAQgSABIDCgEBEgMKAQESBAoCCAEiCmxQZGVjaW1hbHMiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgt3YXZlc1N0cmluZyIDU0VQIgpQb29sQWN0aXZlIg9Qb29sUHV0RGlzYWJsZWQiE1Bvb2xNYXRjaGVyRGlzYWJsZWQiDFBvb2xTaHV0ZG93biIOaWR4UG9vbEFkZHJlc3MiDWlkeFBvb2xTdGF0dXMiEGlkeFBvb2xMUEFzc2V0SWQiDWlkeEFtdEFzc2V0SWQiD2lkeFByaWNlQXNzZXRJZCIOaWR4QW10QXNzZXREY20iEGlkeFByaWNlQXNzZXREY20iDmlkeElBbXRBc3NldElkIhBpZHhJUHJpY2VBc3Nld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XMDAwkAAAIFAmZOBQJmTQkBAiE9AgUCZk8FAmZNBwYJAPQDAwgFAmZJCWJvZHlCeXRlcwkAkQMCCAUCZkkGcHJvb2ZzAAAFAmZLCQD0AwMIBQJmSQlib2R5Qnl0ZXMJAJEDAggFAmZJBnByb29mcwAABQJmS0Bl1TM=", "chainId": 84, "height": 2321281, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HdVuXJVRrmBY1KZVZDxD9uZcEqyH1GzTZ6kQvmBvFkAc Next: CZfJ7LoQzTZX2DeNHHfYYkgHJy3EuKpbrc2Pkoc2g6uy Diff:
Old | New | Differences | |
---|---|---|---|
753 | 753 | let paymentAmountRaw = payment.amount | |
754 | 754 | let userAddress = i.caller | |
755 | 755 | let txId = i.transactionId | |
756 | - | let $t03160931736 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
757 | - | let emitAmountEstimated = $t03160931736._1 | |
758 | - | let commonState = $t03160931736._2 | |
759 | - | let feeAmount = $t03160931736._3 | |
760 | - | let bonus = $t03160931736._4 | |
761 | - | let emitAmount = if (if ((minOutAmount > 0)) | |
762 | - | then (minOutAmount > emitAmountEstimated) | |
763 | - | else false) | |
764 | - | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
765 | - | else emitAmountEstimated | |
766 | - | let emitInv = emit(emitAmount) | |
767 | - | if ((emitInv == emitInv)) | |
756 | + | let $t03160931739 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
757 | + | if (($t03160931739 == $t03160931739)) | |
768 | 758 | then { | |
769 | - | let lpTransfer = if (autoStake) | |
759 | + | let bonus = $t03160931739._4 | |
760 | + | let feeAmount = $t03160931739._3 | |
761 | + | let commonState = $t03160931739._2 | |
762 | + | let emitAmountEstimated = $t03160931739._1 | |
763 | + | let emitAmount = if (if ((minOutAmount > 0)) | |
764 | + | then (minOutAmount > emitAmountEstimated) | |
765 | + | else false) | |
766 | + | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
767 | + | else emitAmountEstimated | |
768 | + | let emitInv = emit(emitAmount) | |
769 | + | if ((emitInv == emitInv)) | |
770 | 770 | then { | |
771 | - | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
772 | - | if ((stakeInv == stakeInv)) | |
773 | - | then nil | |
774 | - | else throw("Strict value is not equal to itself.") | |
771 | + | let lpTransfer = if (autoStake) | |
772 | + | then { | |
773 | + | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
774 | + | if ((stakeInv == stakeInv)) | |
775 | + | then nil | |
776 | + | else throw("Strict value is not equal to itself.") | |
777 | + | } | |
778 | + | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
779 | + | let sendFee = if ((feeAmount > 0)) | |
780 | + | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
781 | + | else nil | |
782 | + | $Tuple2(((commonState ++ lpTransfer) ++ sendFee), emitAmount) | |
775 | 783 | } | |
776 | - | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
777 | - | let sendFee = if ((feeAmount > 0)) | |
778 | - | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
779 | - | else nil | |
780 | - | $Tuple2(((commonState ++ lpTransfer) ++ sendFee), emitAmount) | |
784 | + | else throw("Strict value is not equal to itself.") | |
781 | 785 | } | |
782 | 786 | else throw("Strict value is not equal to itself.") | |
783 | 787 | } | |
788 | 792 | ||
789 | 793 | @Callable(i) | |
790 | 794 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
791 | - | let $ | |
792 | - | let emitAmountEstimated = $ | |
793 | - | let commonState = $ | |
794 | - | let feeAmount = $ | |
795 | - | let bonus = $ | |
795 | + | let $t03246832603 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
796 | + | let emitAmountEstimated = $t03246832603._1 | |
797 | + | let commonState = $t03246832603._2 | |
798 | + | let feeAmount = $t03246832603._3 | |
799 | + | let bonus = $t03246832603._4 | |
796 | 800 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
797 | 801 | } | |
798 | 802 | ||
826 | 830 | let paymentAmount = payment.amount | |
827 | 831 | let userAddress = i.caller | |
828 | 832 | let txId = i.transactionId | |
829 | - | let $t03340533537 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
830 | - | let amountEstimated = $t03340533537._1 | |
831 | - | let commonState = $t03340533537._2 | |
832 | - | let feeAmount = $t03340533537._3 | |
833 | - | let bonus = $t03340533537._4 | |
834 | - | let amount = if (if ((minOutAmount > 0)) | |
835 | - | then (minOutAmount > amountEstimated) | |
836 | - | else false) | |
837 | - | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
838 | - | else amountEstimated | |
839 | - | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
840 | - | if ((burnInv == burnInv)) | |
833 | + | let $t03340833543 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
834 | + | if (($t03340833543 == $t03340833543)) | |
841 | 835 | then { | |
842 | - | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
843 | - | let sendFee = if ((feeAmount > 0)) | |
844 | - | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
845 | - | else nil | |
846 | - | $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount) | |
836 | + | let bonus = $t03340833543._4 | |
837 | + | let feeAmount = $t03340833543._3 | |
838 | + | let commonState = $t03340833543._2 | |
839 | + | let amountEstimated = $t03340833543._1 | |
840 | + | let amount = if (if ((minOutAmount > 0)) | |
841 | + | then (minOutAmount > amountEstimated) | |
842 | + | else false) | |
843 | + | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
844 | + | else amountEstimated | |
845 | + | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
846 | + | if ((burnInv == burnInv)) | |
847 | + | then { | |
848 | + | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
849 | + | let sendFee = if ((feeAmount > 0)) | |
850 | + | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
851 | + | else nil | |
852 | + | $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount) | |
853 | + | } | |
854 | + | else throw("Strict value is not equal to itself.") | |
847 | 855 | } | |
848 | 856 | else throw("Strict value is not equal to itself.") | |
849 | 857 | } | |
854 | 862 | ||
855 | 863 | @Callable(i) | |
856 | 864 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
857 | - | let $ | |
858 | - | let amountEstimated = $ | |
859 | - | let commonState = $ | |
860 | - | let feeAmount = $ | |
861 | - | let bonus = $ | |
865 | + | let $t03417834316 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
866 | + | let amountEstimated = $t03417834316._1 | |
867 | + | let commonState = $t03417834316._2 | |
868 | + | let feeAmount = $t03417834316._3 | |
869 | + | let bonus = $t03417834316._4 | |
862 | 870 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
863 | 871 | } | |
864 | 872 | ||
892 | 900 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
893 | 901 | if ((unstakeInv == unstakeInv)) | |
894 | 902 | then { | |
895 | - | let $ | |
896 | - | let amountEstimated = $ | |
897 | - | let commonState = $ | |
898 | - | let feeAmount = $ | |
899 | - | let bonus = $ | |
903 | + | let $t03514135271 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
904 | + | let amountEstimated = $t03514135271._1 | |
905 | + | let commonState = $t03514135271._2 | |
906 | + | let feeAmount = $t03514135271._3 | |
907 | + | let bonus = $t03514135271._4 | |
900 | 908 | let amount = if (if ((minOutAmount > 0)) | |
901 | 909 | then (minOutAmount > amountEstimated) | |
902 | 910 | else false) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let lPdecimals = 8 | |
5 | 5 | ||
6 | 6 | let scale8 = 100000000 | |
7 | 7 | ||
8 | 8 | let scale8BigInt = toBigInt(100000000) | |
9 | 9 | ||
10 | 10 | let scale18 = toBigInt(1000000000000000000) | |
11 | 11 | ||
12 | 12 | let zeroBigInt = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big0 = toBigInt(0) | |
15 | 15 | ||
16 | 16 | let big1 = toBigInt(1) | |
17 | 17 | ||
18 | 18 | let big2 = toBigInt(2) | |
19 | 19 | ||
20 | 20 | let wavesString = "WAVES" | |
21 | 21 | ||
22 | 22 | let SEP = "__" | |
23 | 23 | ||
24 | 24 | let PoolActive = 1 | |
25 | 25 | ||
26 | 26 | let PoolPutDisabled = 2 | |
27 | 27 | ||
28 | 28 | let PoolMatcherDisabled = 3 | |
29 | 29 | ||
30 | 30 | let PoolShutdown = 4 | |
31 | 31 | ||
32 | 32 | let idxPoolAddress = 1 | |
33 | 33 | ||
34 | 34 | let idxPoolStatus = 2 | |
35 | 35 | ||
36 | 36 | let idxPoolLPAssetId = 3 | |
37 | 37 | ||
38 | 38 | let idxAmtAssetId = 4 | |
39 | 39 | ||
40 | 40 | let idxPriceAssetId = 5 | |
41 | 41 | ||
42 | 42 | let idxAmtAssetDcm = 6 | |
43 | 43 | ||
44 | 44 | let idxPriceAssetDcm = 7 | |
45 | 45 | ||
46 | 46 | let idxIAmtAssetId = 8 | |
47 | 47 | ||
48 | 48 | let idxIPriceAssetId = 9 | |
49 | 49 | ||
50 | 50 | let idxLPAssetDcm = 10 | |
51 | 51 | ||
52 | 52 | let idxPoolAmtAssetAmt = 1 | |
53 | 53 | ||
54 | 54 | let idxPoolPriceAssetAmt = 2 | |
55 | 55 | ||
56 | 56 | let idxPoolLPAssetAmt = 3 | |
57 | 57 | ||
58 | 58 | let idxFactoryStakingContract = 1 | |
59 | 59 | ||
60 | 60 | let idxFactorySlippageContract = 7 | |
61 | 61 | ||
62 | 62 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func abs (val) = if ((0 > val)) | |
72 | 72 | then -(val) | |
73 | 73 | else val | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func absBigInt (val) = if ((zeroBigInt > val)) | |
77 | 77 | then -(val) | |
78 | 78 | else val | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func fc () = "%s__factoryContract" | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func mpk () = "%s__managerPublicKey" | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func pmpk () = "%s__pendingManagerPublicKey" | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func pl () = "%s%s__price__last" | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP) | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func aa () = "%s__amountAsset" | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func pa () = "%s__priceAsset" | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | let keyFee = "%s__fee" | |
109 | 109 | ||
110 | 110 | let feeDefault = fraction(10, scale8, 10000) | |
111 | 111 | ||
112 | 112 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
113 | 113 | ||
114 | 114 | func keyFactoryConfig () = "%s__factoryConfig" | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func keyMatcherPub () = "%s%s__matcher__publicKey" | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config") | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | func keyAllPoolsShutdown () = "%s__shutdown" | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress) | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash" | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | let keyFeeCollectorAddress = "%s__feeCollectorAddress" | |
139 | 139 | ||
140 | 140 | func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | func throwErr (msg) = throw(makeString(["lp.ride:", msg], " ")) | |
150 | 150 | ||
151 | 151 | ||
152 | 152 | let factoryContract = addressFromStringValue(getStringOrFail(this, fc())) | |
153 | 153 | ||
154 | 154 | let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress)) | |
155 | 155 | ||
156 | 156 | func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false) | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub())) | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func getPoolConfig () = { | |
163 | 163 | let amtAsset = getStringOrFail(this, aa()) | |
164 | 164 | let priceAsset = getStringOrFail(this, pa()) | |
165 | 165 | let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset)) | |
166 | 166 | let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset)) | |
167 | 167 | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP) | |
168 | 168 | } | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func parseAssetId (input) = if ((input == wavesString)) | |
172 | 172 | then unit | |
173 | 173 | else fromBase58String(input) | |
174 | 174 | ||
175 | 175 | ||
176 | 176 | func assetIdToString (input) = if ((input == unit)) | |
177 | 177 | then wavesString | |
178 | 178 | else toBase58String(value(input)) | |
179 | 179 | ||
180 | 180 | ||
181 | 181 | func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolStatus]), fromBase58String(poolConfig[idxPoolLPAssetId]), parseAssetId(poolConfig[idxAmtAssetId]), parseAssetId(poolConfig[idxPriceAssetId]), parseIntValue(poolConfig[idxAmtAssetDcm]), parseIntValue(poolConfig[idxPriceAssetDcm])) | |
182 | 182 | ||
183 | 183 | ||
184 | 184 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
185 | 185 | ||
186 | 186 | let $t075447710 = poolConfigParsed | |
187 | 187 | ||
188 | 188 | let cfgPoolAddress = $t075447710._1 | |
189 | 189 | ||
190 | 190 | let cfgPoolStatus = $t075447710._2 | |
191 | 191 | ||
192 | 192 | let cfgLpAssetId = $t075447710._3 | |
193 | 193 | ||
194 | 194 | let cfgAmountAssetId = $t075447710._4 | |
195 | 195 | ||
196 | 196 | let cfgPriceAssetId = $t075447710._5 | |
197 | 197 | ||
198 | 198 | let cfgAmountAssetDecimals = $t075447710._6 | |
199 | 199 | ||
200 | 200 | let cfgPriceAssetDecimals = $t075447710._7 | |
201 | 201 | ||
202 | 202 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
203 | 203 | ||
204 | 204 | ||
205 | 205 | let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address") | |
206 | 206 | ||
207 | 207 | let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address") | |
208 | 208 | ||
209 | 209 | func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,slippageToleranceReal,txHeight,txTimestamp,slipageAmtAssetAmt,slipagePriceAssetAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(slippageToleranceReal), toString(txHeight), toString(txTimestamp), toString(slipageAmtAssetAmt), toString(slipagePriceAssetAmt)], SEP) | |
210 | 210 | ||
211 | 211 | ||
212 | 212 | 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) | |
213 | 213 | ||
214 | 214 | ||
215 | 215 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
216 | 216 | then wavesBalance(this).available | |
217 | 217 | else assetBalance(this, fromBase58String(assetId)) | |
218 | 218 | ||
219 | 219 | ||
220 | 220 | func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
221 | 221 | ||
222 | 222 | ||
223 | 223 | func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
224 | 224 | let amtAssetAmtX18 = toX18(amAmt, amAssetDcm) | |
225 | 225 | let priceAssetAmtX18 = toX18(prAmt, prAssetDcm) | |
226 | 226 | calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
227 | 227 | } | |
228 | 228 | ||
229 | 229 | ||
230 | 230 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
231 | 231 | let cfg = getPoolConfig() | |
232 | 232 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
233 | 233 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
234 | 234 | let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt) | |
235 | 235 | let amAmtX18 = toX18(amAmt, amtAssetDcm) | |
236 | 236 | let prAmtX18 = toX18(prAmt, priceAssetDcm) | |
237 | 237 | let lpAmtX18 = toX18(lpAmt, scale8) | |
238 | 238 | let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18) | |
239 | 239 | let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18) | |
240 | 240 | [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18] | |
241 | 241 | } | |
242 | 242 | ||
243 | 243 | ||
244 | 244 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
245 | 245 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
246 | 246 | [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)] | |
247 | 247 | } | |
248 | 248 | ||
249 | 249 | ||
250 | 250 | func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
251 | 251 | let cfg = getPoolConfig() | |
252 | 252 | let lpAssetId = cfg[idxPoolLPAssetId] | |
253 | 253 | let amAssetId = cfg[idxAmtAssetId] | |
254 | 254 | let prAssetId = cfg[idxPriceAssetId] | |
255 | 255 | let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
256 | 256 | let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
257 | 257 | let poolStatus = cfg[idxPoolStatus] | |
258 | 258 | let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity | |
259 | 259 | if ((lpAssetId != pmtAssetId)) | |
260 | 260 | then throw("Invalid asset passed.") | |
261 | 261 | else { | |
262 | 262 | let amBalance = getAccBalance(amAssetId) | |
263 | 263 | let amBalanceX18 = toX18(amBalance, amAssetDcm) | |
264 | 264 | let prBalance = getAccBalance(prAssetId) | |
265 | 265 | let prBalanceX18 = toX18(prBalance, prAssetDcm) | |
266 | 266 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
267 | 267 | let curPrice = fromX18(curPriceX18, scale8) | |
268 | 268 | let pmtLpAmtX18 = toX18(pmtLpAmt, scale8) | |
269 | 269 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
270 | 270 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
271 | 271 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
272 | 272 | let outAmAmt = fromX18(outAmAmtX18, amAssetDcm) | |
273 | 273 | let outPrAmt = fromX18(outPrAmtX18, prAssetDcm) | |
274 | 274 | let state = if ((txId58 == "")) | |
275 | 275 | then nil | |
276 | 276 | else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES")) | |
277 | 277 | then unit | |
278 | 278 | else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES")) | |
279 | 279 | then unit | |
280 | 280 | else fromBase58String(prAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)] | |
281 | 281 | $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state) | |
282 | 282 | } | |
283 | 283 | } | |
284 | 284 | ||
285 | 285 | ||
286 | 286 | func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = { | |
287 | 287 | let cfg = getPoolConfig() | |
288 | 288 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
289 | 289 | let amAssetIdStr = cfg[idxAmtAssetId] | |
290 | 290 | let prAssetIdStr = cfg[idxPriceAssetId] | |
291 | 291 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
292 | 292 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
293 | 293 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
294 | 294 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
295 | 295 | let poolStatus = cfg[idxPoolStatus] | |
296 | 296 | let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
297 | 297 | let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES"))) | |
298 | 298 | let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES"))) | |
299 | 299 | if (if ((amAssetIdStr != inAmAssetIdStr)) | |
300 | 300 | then true | |
301 | 301 | else (prAssetIdStr != inPrAssetIdStr)) | |
302 | 302 | then throw("Invalid amt or price asset passed.") | |
303 | 303 | else { | |
304 | 304 | let amBalance = if (isEvaluate) | |
305 | 305 | then getAccBalance(amAssetIdStr) | |
306 | 306 | else (getAccBalance(amAssetIdStr) - inAmAssetAmt) | |
307 | 307 | let prBalance = if (isEvaluate) | |
308 | 308 | then getAccBalance(prAssetIdStr) | |
309 | 309 | else (getAccBalance(prAssetIdStr) - inPrAssetAmt) | |
310 | 310 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
311 | 311 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
312 | 312 | let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18) | |
313 | 313 | let amBalanceX18 = toX18(amBalance, amtAssetDcm) | |
314 | 314 | let prBalanceX18 = toX18(prBalance, priceAssetDcm) | |
315 | 315 | let res = if ((lpEmission == 0)) | |
316 | 316 | then { | |
317 | 317 | let curPriceX18 = zeroBigInt | |
318 | 318 | let slippageX18 = zeroBigInt | |
319 | 319 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
320 | 320 | $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
321 | 321 | } | |
322 | 322 | else { | |
323 | 323 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
324 | 324 | let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
325 | 325 | let slippageToleranceX18 = toX18(slippageTolerance, scale8) | |
326 | 326 | if (if ((curPriceX18 != zeroBigInt)) | |
327 | 327 | then (slippageX18 > slippageToleranceX18) | |
328 | 328 | else false) | |
329 | 329 | then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18))) | |
330 | 330 | else { | |
331 | 331 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
332 | 332 | let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
333 | 333 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
334 | 334 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
335 | 335 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
336 | 336 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
337 | 337 | let expAmtAssetAmtX18 = expectedAmts._1 | |
338 | 338 | let expPriceAssetAmtX18 = expectedAmts._2 | |
339 | 339 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18) | |
340 | 340 | $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18) | |
341 | 341 | } | |
342 | 342 | } | |
343 | 343 | let calcLpAmt = res._1 | |
344 | 344 | let calcAmAssetPmt = res._2 | |
345 | 345 | let calcPrAssetPmt = res._3 | |
346 | 346 | let curPrice = fromX18(res._4, scale8) | |
347 | 347 | let slippageCalc = fromX18(res._5, scale8) | |
348 | 348 | if ((0 >= calcLpAmt)) | |
349 | 349 | then throw("Invalid calculations. LP calculated is less than zero.") | |
350 | 350 | else { | |
351 | 351 | let emitLpAmt = if (!(emitLp)) | |
352 | 352 | then 0 | |
353 | 353 | else calcLpAmt | |
354 | 354 | let amDiff = (inAmAssetAmt - calcAmAssetPmt) | |
355 | 355 | let prDiff = (inPrAssetAmt - calcPrAssetPmt) | |
356 | 356 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(calcAmAssetPmt, calcPrAssetPmt, emitLpAmt, curPrice, slippageTolerance, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
357 | 357 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId) | |
358 | 358 | } | |
359 | 359 | } | |
360 | 360 | } | |
361 | 361 | ||
362 | 362 | ||
363 | 363 | func validateMatcherOrderAllowed (order) = { | |
364 | 364 | let cfg = getPoolConfig() | |
365 | 365 | let amtAssetId = cfg[idxAmtAssetId] | |
366 | 366 | let priceAssetId = cfg[idxPriceAssetId] | |
367 | 367 | let poolStatus = parseIntValue(cfg[idxPoolStatus]) | |
368 | 368 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
369 | 369 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
370 | 370 | let accAmtAssetBalance = getAccBalance(amtAssetId) | |
371 | 371 | let accPriceAssetBalance = getAccBalance(priceAssetId) | |
372 | 372 | let curPriceX18 = if ((order.orderType == Buy)) | |
373 | 373 | then privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance + order.amount), accPriceAssetBalance) | |
374 | 374 | else privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance - order.amount), accPriceAssetBalance) | |
375 | 375 | let curPrice = fromX18(curPriceX18, scale8) | |
376 | 376 | if (if (if (isGlobalShutdown()) | |
377 | 377 | then true | |
378 | 378 | else (poolStatus == PoolMatcherDisabled)) | |
379 | 379 | then true | |
380 | 380 | else (poolStatus == PoolShutdown)) | |
381 | 381 | then throw("Exchange operations disabled") | |
382 | 382 | else { | |
383 | 383 | let orderAmtAsset = order.assetPair.amountAsset | |
384 | 384 | let orderAmtAssetStr = if ((orderAmtAsset == unit)) | |
385 | 385 | then "WAVES" | |
386 | 386 | else toBase58String(value(orderAmtAsset)) | |
387 | 387 | let orderPriceAsset = order.assetPair.priceAsset | |
388 | 388 | let orderPriceAssetStr = if ((orderPriceAsset == unit)) | |
389 | 389 | then "WAVES" | |
390 | 390 | else toBase58String(value(orderPriceAsset)) | |
391 | 391 | if (if ((orderAmtAssetStr != amtAssetId)) | |
392 | 392 | then true | |
393 | 393 | else (orderPriceAssetStr != priceAssetId)) | |
394 | 394 | then throw("Wrong order assets.") | |
395 | 395 | else { | |
396 | 396 | let orderPrice = order.price | |
397 | 397 | let priceDcm = fraction(scale8, priceAssetDcm, amtAssetDcm) | |
398 | 398 | let castedOrderPrice = toScale(orderPrice, scale8, priceDcm) | |
399 | 399 | let isOrderPriceValid = if ((order.orderType == Buy)) | |
400 | 400 | then (curPrice >= castedOrderPrice) | |
401 | 401 | else (castedOrderPrice >= curPrice) | |
402 | 402 | true | |
403 | 403 | } | |
404 | 404 | } | |
405 | 405 | } | |
406 | 406 | ||
407 | 407 | ||
408 | 408 | func commonGet (i) = if ((size(i.payments) != 1)) | |
409 | 409 | then throw("exactly 1 payment is expected") | |
410 | 410 | else { | |
411 | 411 | let pmt = value(i.payments[0]) | |
412 | 412 | let pmtAssetId = value(pmt.assetId) | |
413 | 413 | let pmtAmt = pmt.amount | |
414 | 414 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
415 | 415 | let outAmAmt = res._1 | |
416 | 416 | let outPrAmt = res._2 | |
417 | 417 | let poolStatus = parseIntValue(res._9) | |
418 | 418 | let state = res._10 | |
419 | 419 | if (if (isGlobalShutdown()) | |
420 | 420 | then true | |
421 | 421 | else (poolStatus == PoolShutdown)) | |
422 | 422 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
423 | 423 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
424 | 424 | } | |
425 | 425 | ||
426 | 426 | ||
427 | 427 | func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2)) | |
428 | 428 | then throw("exactly 2 payments are expected") | |
429 | 429 | else { | |
430 | 430 | let amAssetPmt = value(i.payments[0]) | |
431 | 431 | let prAssetPmt = value(i.payments[1]) | |
432 | 432 | let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp) | |
433 | 433 | let poolStatus = parseIntValue(estPut._8) | |
434 | 434 | if (if (if (isGlobalShutdown()) | |
435 | 435 | then true | |
436 | 436 | else (poolStatus == PoolPutDisabled)) | |
437 | 437 | then true | |
438 | 438 | else (poolStatus == PoolShutdown)) | |
439 | 439 | then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus))) | |
440 | 440 | else estPut | |
441 | 441 | } | |
442 | 442 | ||
443 | 443 | ||
444 | 444 | func emit (amount) = { | |
445 | 445 | let emitInv = invoke(factoryContract, "emit", [amount], nil) | |
446 | 446 | if ((emitInv == emitInv)) | |
447 | 447 | then { | |
448 | 448 | let emitInvLegacy = match emitInv { | |
449 | 449 | case legacyFactoryContract: Address => | |
450 | 450 | invoke(legacyFactoryContract, "emit", [amount], nil) | |
451 | 451 | case _ => | |
452 | 452 | unit | |
453 | 453 | } | |
454 | 454 | if ((emitInvLegacy == emitInvLegacy)) | |
455 | 455 | then amount | |
456 | 456 | else throw("Strict value is not equal to itself.") | |
457 | 457 | } | |
458 | 458 | else throw("Strict value is not equal to itself.") | |
459 | 459 | } | |
460 | 460 | ||
461 | 461 | ||
462 | 462 | func takeFee (amount) = { | |
463 | 463 | let feeAmount = fraction(amount, fee, scale8) | |
464 | 464 | $Tuple2((amount - feeAmount), feeAmount) | |
465 | 465 | } | |
466 | 466 | ||
467 | 467 | ||
468 | 468 | func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = { | |
469 | 469 | let isEval = (txId == unit) | |
470 | 470 | let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
471 | 471 | let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
472 | 472 | let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId)) | |
473 | 473 | then true | |
474 | 474 | else if ((paymentAssetId == cfgPriceAssetId)) | |
475 | 475 | then false | |
476 | 476 | else throwErr("invalid asset") | |
477 | 477 | let $t02257122864 = if (isEval) | |
478 | 478 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
479 | 479 | else if (paymentInAmountAsset) | |
480 | 480 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
481 | 481 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
482 | 482 | let amountBalanceOld = $t02257122864._1 | |
483 | 483 | let priceBalanceOld = $t02257122864._2 | |
484 | 484 | let $t02286823017 = if (paymentInAmountAsset) | |
485 | 485 | then $Tuple2(paymentAmountRaw, 0) | |
486 | 486 | else $Tuple2(0, paymentAmountRaw) | |
487 | 487 | let amountAssetAmountRaw = $t02286823017._1 | |
488 | 488 | let priceAssetAmountRaw = $t02286823017._2 | |
489 | 489 | let amountAssetAmount = takeFee(amountAssetAmountRaw)._1 | |
490 | 490 | let priceAssetAmount = takeFee(priceAssetAmountRaw)._1 | |
491 | 491 | let $t02313923198 = takeFee(paymentAmountRaw) | |
492 | 492 | let paymentAmount = $t02313923198._1 | |
493 | 493 | let feeAmount = $t02313923198._2 | |
494 | 494 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
495 | 495 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
496 | 496 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
497 | 497 | let priceNew = fromX18(priceNewX18, scale8) | |
498 | 498 | let paymentBalance = if (paymentInAmountAsset) | |
499 | 499 | then amountBalanceOld | |
500 | 500 | else priceBalanceOld | |
501 | 501 | let paymentBalanceBigInt = toBigInt(paymentBalance) | |
502 | 502 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
503 | 503 | let chechSupply = if ((supplyBigInt > big0)) | |
504 | 504 | then true | |
505 | 505 | else throwErr("initial deposit requires all coins") | |
506 | 506 | if ((chechSupply == chechSupply)) | |
507 | 507 | then { | |
508 | 508 | let depositBigInt = toBigInt(paymentAmount) | |
509 | 509 | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))]) | |
510 | 510 | let commonState = if (isEval) | |
511 | 511 | then nil | |
512 | 512 | else [IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew), StringEntry(pau(toString(value(userAddress)), toBase58String(value(txId))), dataPutActionInfo(amountAssetAmountRaw, priceAssetAmountRaw, issueAmount, priceNew, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
513 | 513 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
514 | 514 | let priceOld = fromX18(priceOldX18, scale8) | |
515 | 515 | let loss = { | |
516 | 516 | let $t02467524842 = if (paymentInAmountAsset) | |
517 | 517 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
518 | 518 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
519 | 519 | let amount = $t02467524842._1 | |
520 | 520 | let balance = $t02467524842._2 | |
521 | 521 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
522 | 522 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
523 | 523 | } | |
524 | 524 | $Tuple4(issueAmount, commonState, feeAmount, loss) | |
525 | 525 | } | |
526 | 526 | else throw("Strict value is not equal to itself.") | |
527 | 527 | } | |
528 | 528 | ||
529 | 529 | ||
530 | 530 | func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = { | |
531 | 531 | let isEval = (txId == unit) | |
532 | 532 | let checks = [if ((paymentAssetId == cfgLpAssetId)) | |
533 | 533 | then true | |
534 | 534 | else throwErr("invalid lp asset")] | |
535 | 535 | if ((checks == checks)) | |
536 | 536 | then { | |
537 | 537 | let outInAmountAsset = if ((outAssetId == cfgAmountAssetId)) | |
538 | 538 | then true | |
539 | 539 | else if ((outAssetId == cfgPriceAssetId)) | |
540 | 540 | then false | |
541 | 541 | else throwErr("invalid asset") | |
542 | 542 | let balanceBigInt = if (outInAmountAsset) | |
543 | 543 | then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) | |
544 | 544 | else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) | |
545 | 545 | let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
546 | 546 | let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
547 | 547 | let outBalance = if (outInAmountAsset) | |
548 | 548 | then amBalanceOld | |
549 | 549 | else prBalanceOld | |
550 | 550 | let outBalanceBigInt = toBigInt(outBalance) | |
551 | 551 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
552 | 552 | let redeemedBigInt = toBigInt(paymentAmount) | |
553 | 553 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
554 | 554 | let $t02642226472 = takeFee(amountRaw) | |
555 | 555 | let totalAmount = $t02642226472._1 | |
556 | 556 | let feeAmount = $t02642226472._2 | |
557 | 557 | let $t02647626702 = if (outInAmountAsset) | |
558 | 558 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
559 | 559 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
560 | 560 | let outAmAmount = $t02647626702._1 | |
561 | 561 | let outPrAmount = $t02647626702._2 | |
562 | 562 | let amBalanceNew = $t02647626702._3 | |
563 | 563 | let prBalanceNew = $t02647626702._4 | |
564 | 564 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
565 | 565 | let priceNew = fromX18(priceNewX18, scale8) | |
566 | 566 | let commonState = if (isEval) | |
567 | 567 | then nil | |
568 | 568 | else [StringEntry(gau(toString(value(userAddress)), toBase58String(value(txId))), dataGetActionInfo(outAmAmount, outPrAmount, paymentAmount, priceNew, height, lastBlock.timestamp)), IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew)] | |
569 | 569 | let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals)) | |
570 | 570 | let priceOld = fromX18(priceOldX18, scale8) | |
571 | 571 | let loss = { | |
572 | 572 | let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2) | |
573 | 573 | fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset) | |
574 | 574 | } | |
575 | 575 | $Tuple4(totalAmount, commonState, feeAmount, loss) | |
576 | 576 | } | |
577 | 577 | else throw("Strict value is not equal to itself.") | |
578 | 578 | } | |
579 | 579 | ||
580 | 580 | ||
581 | 581 | func managerPublicKeyOrUnit () = match getString(mpk()) { | |
582 | 582 | case s: String => | |
583 | 583 | fromBase58String(s) | |
584 | 584 | case _: Unit => | |
585 | 585 | unit | |
586 | 586 | case _ => | |
587 | 587 | throw("Match error") | |
588 | 588 | } | |
589 | 589 | ||
590 | 590 | ||
591 | 591 | func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) { | |
592 | 592 | case s: String => | |
593 | 593 | fromBase58String(s) | |
594 | 594 | case _: Unit => | |
595 | 595 | unit | |
596 | 596 | case _ => | |
597 | 597 | throw("Match error") | |
598 | 598 | } | |
599 | 599 | ||
600 | 600 | ||
601 | 601 | func isManager (i) = match managerPublicKeyOrUnit() { | |
602 | 602 | case pk: ByteVector => | |
603 | 603 | (i.callerPublicKey == pk) | |
604 | 604 | case _: Unit => | |
605 | 605 | (i.caller == this) | |
606 | 606 | case _ => | |
607 | 607 | throw("Match error") | |
608 | 608 | } | |
609 | 609 | ||
610 | 610 | ||
611 | 611 | func mustManager (i) = { | |
612 | 612 | let pd = throw("Permission denied") | |
613 | 613 | match managerPublicKeyOrUnit() { | |
614 | 614 | case pk: ByteVector => | |
615 | 615 | if ((i.callerPublicKey == pk)) | |
616 | 616 | then true | |
617 | 617 | else pd | |
618 | 618 | case _: Unit => | |
619 | 619 | if ((i.caller == this)) | |
620 | 620 | then true | |
621 | 621 | else pd | |
622 | 622 | case _ => | |
623 | 623 | throw("Match error") | |
624 | 624 | } | |
625 | 625 | } | |
626 | 626 | ||
627 | 627 | ||
628 | 628 | @Callable(i) | |
629 | 629 | func setManager (pendingManagerPublicKey) = { | |
630 | 630 | let checkCaller = mustManager(i) | |
631 | 631 | if ((checkCaller == checkCaller)) | |
632 | 632 | then { | |
633 | 633 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
634 | 634 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
635 | 635 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
636 | 636 | else throw("Strict value is not equal to itself.") | |
637 | 637 | } | |
638 | 638 | else throw("Strict value is not equal to itself.") | |
639 | 639 | } | |
640 | 640 | ||
641 | 641 | ||
642 | 642 | ||
643 | 643 | @Callable(i) | |
644 | 644 | func confirmManager () = { | |
645 | 645 | let pm = pendingManagerPublicKeyOrUnit() | |
646 | 646 | let hasPM = if (isDefined(pm)) | |
647 | 647 | then true | |
648 | 648 | else throw("No pending manager") | |
649 | 649 | if ((hasPM == hasPM)) | |
650 | 650 | then { | |
651 | 651 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
652 | 652 | then true | |
653 | 653 | else throw("You are not pending manager") | |
654 | 654 | if ((checkPM == checkPM)) | |
655 | 655 | then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())] | |
656 | 656 | else throw("Strict value is not equal to itself.") | |
657 | 657 | } | |
658 | 658 | else throw("Strict value is not equal to itself.") | |
659 | 659 | } | |
660 | 660 | ||
661 | 661 | ||
662 | 662 | ||
663 | 663 | @Callable(i) | |
664 | 664 | func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance)) | |
665 | 665 | then throw("Invalid slippageTolerance passed") | |
666 | 666 | else { | |
667 | 667 | let estPut = commonPut(i, slippageTolerance, true) | |
668 | 668 | let emitLpAmt = estPut._2 | |
669 | 669 | let lpAssetId = estPut._7 | |
670 | 670 | let state = estPut._9 | |
671 | 671 | let amDiff = estPut._10 | |
672 | 672 | let prDiff = estPut._11 | |
673 | 673 | let amId = estPut._12 | |
674 | 674 | let prId = estPut._13 | |
675 | 675 | let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil) | |
676 | 676 | if ((emitInv == emitInv)) | |
677 | 677 | then { | |
678 | 678 | let emitInvLegacy = match emitInv { | |
679 | 679 | case legacyFactoryContract: Address => | |
680 | 680 | invoke(legacyFactoryContract, "emit", [emitLpAmt], nil) | |
681 | 681 | case _ => | |
682 | 682 | unit | |
683 | 683 | } | |
684 | 684 | if ((emitInvLegacy == emitInvLegacy)) | |
685 | 685 | then { | |
686 | 686 | let slippageAInv = if ((amDiff > 0)) | |
687 | 687 | then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)]) | |
688 | 688 | else nil | |
689 | 689 | if ((slippageAInv == slippageAInv)) | |
690 | 690 | then { | |
691 | 691 | let slippagePInv = if ((prDiff > 0)) | |
692 | 692 | then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)]) | |
693 | 693 | else nil | |
694 | 694 | if ((slippagePInv == slippagePInv)) | |
695 | 695 | then { | |
696 | 696 | let lpTransfer = if (shouldAutoStake) | |
697 | 697 | then { | |
698 | 698 | let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
699 | 699 | if ((slpStakeInv == slpStakeInv)) | |
700 | 700 | then nil | |
701 | 701 | else throw("Strict value is not equal to itself.") | |
702 | 702 | } | |
703 | 703 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
704 | 704 | (state ++ lpTransfer) | |
705 | 705 | } | |
706 | 706 | else throw("Strict value is not equal to itself.") | |
707 | 707 | } | |
708 | 708 | else throw("Strict value is not equal to itself.") | |
709 | 709 | } | |
710 | 710 | else throw("Strict value is not equal to itself.") | |
711 | 711 | } | |
712 | 712 | else throw("Strict value is not equal to itself.") | |
713 | 713 | } | |
714 | 714 | ||
715 | 715 | ||
716 | 716 | ||
717 | 717 | @Callable(i) | |
718 | 718 | func putForFree (maxSlippage) = if ((0 > maxSlippage)) | |
719 | 719 | then throw("Invalid value passed") | |
720 | 720 | else { | |
721 | 721 | let estPut = commonPut(i, maxSlippage, false) | |
722 | 722 | estPut._9 | |
723 | 723 | } | |
724 | 724 | ||
725 | 725 | ||
726 | 726 | ||
727 | 727 | @Callable(i) | |
728 | 728 | func putOneTkn (minOutAmount,autoStake) = { | |
729 | 729 | let isPoolOneTokenOperationsDisabled = { | |
730 | 730 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
731 | 731 | if ($isInstanceOf(@, "Boolean")) | |
732 | 732 | then @ | |
733 | 733 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
734 | 734 | } | |
735 | 735 | let isPutDisabled = if (if (if (isGlobalShutdown()) | |
736 | 736 | then true | |
737 | 737 | else (cfgPoolStatus == PoolPutDisabled)) | |
738 | 738 | then true | |
739 | 739 | else (cfgPoolStatus == PoolShutdown)) | |
740 | 740 | then true | |
741 | 741 | else isPoolOneTokenOperationsDisabled | |
742 | 742 | let checks = [if (if (!(isPutDisabled)) | |
743 | 743 | then true | |
744 | 744 | else isManager(i)) | |
745 | 745 | then true | |
746 | 746 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
747 | 747 | then true | |
748 | 748 | else throwErr("exactly 1 payment are expected")] | |
749 | 749 | if ((checks == checks)) | |
750 | 750 | then { | |
751 | 751 | let payment = i.payments[0] | |
752 | 752 | let paymentAssetId = payment.assetId | |
753 | 753 | let paymentAmountRaw = payment.amount | |
754 | 754 | let userAddress = i.caller | |
755 | 755 | let txId = i.transactionId | |
756 | - | let $t03160931736 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
757 | - | let emitAmountEstimated = $t03160931736._1 | |
758 | - | let commonState = $t03160931736._2 | |
759 | - | let feeAmount = $t03160931736._3 | |
760 | - | let bonus = $t03160931736._4 | |
761 | - | let emitAmount = if (if ((minOutAmount > 0)) | |
762 | - | then (minOutAmount > emitAmountEstimated) | |
763 | - | else false) | |
764 | - | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
765 | - | else emitAmountEstimated | |
766 | - | let emitInv = emit(emitAmount) | |
767 | - | if ((emitInv == emitInv)) | |
756 | + | let $t03160931739 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
757 | + | if (($t03160931739 == $t03160931739)) | |
768 | 758 | then { | |
769 | - | let lpTransfer = if (autoStake) | |
759 | + | let bonus = $t03160931739._4 | |
760 | + | let feeAmount = $t03160931739._3 | |
761 | + | let commonState = $t03160931739._2 | |
762 | + | let emitAmountEstimated = $t03160931739._1 | |
763 | + | let emitAmount = if (if ((minOutAmount > 0)) | |
764 | + | then (minOutAmount > emitAmountEstimated) | |
765 | + | else false) | |
766 | + | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
767 | + | else emitAmountEstimated | |
768 | + | let emitInv = emit(emitAmount) | |
769 | + | if ((emitInv == emitInv)) | |
770 | 770 | then { | |
771 | - | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
772 | - | if ((stakeInv == stakeInv)) | |
773 | - | then nil | |
774 | - | else throw("Strict value is not equal to itself.") | |
771 | + | let lpTransfer = if (autoStake) | |
772 | + | then { | |
773 | + | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
774 | + | if ((stakeInv == stakeInv)) | |
775 | + | then nil | |
776 | + | else throw("Strict value is not equal to itself.") | |
777 | + | } | |
778 | + | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
779 | + | let sendFee = if ((feeAmount > 0)) | |
780 | + | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
781 | + | else nil | |
782 | + | $Tuple2(((commonState ++ lpTransfer) ++ sendFee), emitAmount) | |
775 | 783 | } | |
776 | - | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
777 | - | let sendFee = if ((feeAmount > 0)) | |
778 | - | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
779 | - | else nil | |
780 | - | $Tuple2(((commonState ++ lpTransfer) ++ sendFee), emitAmount) | |
784 | + | else throw("Strict value is not equal to itself.") | |
781 | 785 | } | |
782 | 786 | else throw("Strict value is not equal to itself.") | |
783 | 787 | } | |
784 | 788 | else throw("Strict value is not equal to itself.") | |
785 | 789 | } | |
786 | 790 | ||
787 | 791 | ||
788 | 792 | ||
789 | 793 | @Callable(i) | |
790 | 794 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
791 | - | let $ | |
792 | - | let emitAmountEstimated = $ | |
793 | - | let commonState = $ | |
794 | - | let feeAmount = $ | |
795 | - | let bonus = $ | |
795 | + | let $t03246832603 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
796 | + | let emitAmountEstimated = $t03246832603._1 | |
797 | + | let commonState = $t03246832603._2 | |
798 | + | let feeAmount = $t03246832603._3 | |
799 | + | let bonus = $t03246832603._4 | |
796 | 800 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
797 | 801 | } | |
798 | 802 | ||
799 | 803 | ||
800 | 804 | ||
801 | 805 | @Callable(i) | |
802 | 806 | func getOneTkn (outAssetIdStr,minOutAmount) = { | |
803 | 807 | let isPoolOneTokenOperationsDisabled = { | |
804 | 808 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
805 | 809 | if ($isInstanceOf(@, "Boolean")) | |
806 | 810 | then @ | |
807 | 811 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
808 | 812 | } | |
809 | 813 | let isGetDisabled = if (if (isGlobalShutdown()) | |
810 | 814 | then true | |
811 | 815 | else (cfgPoolStatus == PoolShutdown)) | |
812 | 816 | then true | |
813 | 817 | else isPoolOneTokenOperationsDisabled | |
814 | 818 | let checks = [if (if (!(isGetDisabled)) | |
815 | 819 | then true | |
816 | 820 | else isManager(i)) | |
817 | 821 | then true | |
818 | 822 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
819 | 823 | then true | |
820 | 824 | else throwErr("exactly 1 payment are expected")] | |
821 | 825 | if ((checks == checks)) | |
822 | 826 | then { | |
823 | 827 | let outAssetId = parseAssetId(outAssetIdStr) | |
824 | 828 | let payment = i.payments[0] | |
825 | 829 | let paymentAssetId = payment.assetId | |
826 | 830 | let paymentAmount = payment.amount | |
827 | 831 | let userAddress = i.caller | |
828 | 832 | let txId = i.transactionId | |
829 | - | let $t03340533537 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
830 | - | let amountEstimated = $t03340533537._1 | |
831 | - | let commonState = $t03340533537._2 | |
832 | - | let feeAmount = $t03340533537._3 | |
833 | - | let bonus = $t03340533537._4 | |
834 | - | let amount = if (if ((minOutAmount > 0)) | |
835 | - | then (minOutAmount > amountEstimated) | |
836 | - | else false) | |
837 | - | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
838 | - | else amountEstimated | |
839 | - | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
840 | - | if ((burnInv == burnInv)) | |
833 | + | let $t03340833543 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
834 | + | if (($t03340833543 == $t03340833543)) | |
841 | 835 | then { | |
842 | - | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
843 | - | let sendFee = if ((feeAmount > 0)) | |
844 | - | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
845 | - | else nil | |
846 | - | $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount) | |
836 | + | let bonus = $t03340833543._4 | |
837 | + | let feeAmount = $t03340833543._3 | |
838 | + | let commonState = $t03340833543._2 | |
839 | + | let amountEstimated = $t03340833543._1 | |
840 | + | let amount = if (if ((minOutAmount > 0)) | |
841 | + | then (minOutAmount > amountEstimated) | |
842 | + | else false) | |
843 | + | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
844 | + | else amountEstimated | |
845 | + | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
846 | + | if ((burnInv == burnInv)) | |
847 | + | then { | |
848 | + | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
849 | + | let sendFee = if ((feeAmount > 0)) | |
850 | + | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
851 | + | else nil | |
852 | + | $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount) | |
853 | + | } | |
854 | + | else throw("Strict value is not equal to itself.") | |
847 | 855 | } | |
848 | 856 | else throw("Strict value is not equal to itself.") | |
849 | 857 | } | |
850 | 858 | else throw("Strict value is not equal to itself.") | |
851 | 859 | } | |
852 | 860 | ||
853 | 861 | ||
854 | 862 | ||
855 | 863 | @Callable(i) | |
856 | 864 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
857 | - | let $ | |
858 | - | let amountEstimated = $ | |
859 | - | let commonState = $ | |
860 | - | let feeAmount = $ | |
861 | - | let bonus = $ | |
865 | + | let $t03417834316 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
866 | + | let amountEstimated = $t03417834316._1 | |
867 | + | let commonState = $t03417834316._2 | |
868 | + | let feeAmount = $t03417834316._3 | |
869 | + | let bonus = $t03417834316._4 | |
862 | 870 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
863 | 871 | } | |
864 | 872 | ||
865 | 873 | ||
866 | 874 | ||
867 | 875 | @Callable(i) | |
868 | 876 | func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = { | |
869 | 877 | let isPoolOneTokenOperationsDisabled = { | |
870 | 878 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
871 | 879 | if ($isInstanceOf(@, "Boolean")) | |
872 | 880 | then @ | |
873 | 881 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
874 | 882 | } | |
875 | 883 | let isGetDisabled = if (if (isGlobalShutdown()) | |
876 | 884 | then true | |
877 | 885 | else (cfgPoolStatus == PoolShutdown)) | |
878 | 886 | then true | |
879 | 887 | else isPoolOneTokenOperationsDisabled | |
880 | 888 | let checks = [if (if (!(isGetDisabled)) | |
881 | 889 | then true | |
882 | 890 | else isManager(i)) | |
883 | 891 | then true | |
884 | 892 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
885 | 893 | then true | |
886 | 894 | else throwErr("no payments are expected")] | |
887 | 895 | if ((checks == checks)) | |
888 | 896 | then { | |
889 | 897 | let outAssetId = parseAssetId(outAssetIdStr) | |
890 | 898 | let userAddress = i.caller | |
891 | 899 | let txId = i.transactionId | |
892 | 900 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
893 | 901 | if ((unstakeInv == unstakeInv)) | |
894 | 902 | then { | |
895 | - | let $ | |
896 | - | let amountEstimated = $ | |
897 | - | let commonState = $ | |
898 | - | let feeAmount = $ | |
899 | - | let bonus = $ | |
903 | + | let $t03514135271 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
904 | + | let amountEstimated = $t03514135271._1 | |
905 | + | let commonState = $t03514135271._2 | |
906 | + | let feeAmount = $t03514135271._3 | |
907 | + | let bonus = $t03514135271._4 | |
900 | 908 | let amount = if (if ((minOutAmount > 0)) | |
901 | 909 | then (minOutAmount > amountEstimated) | |
902 | 910 | else false) | |
903 | 911 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
904 | 912 | else amountEstimated | |
905 | 913 | let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
906 | 914 | if ((burnInv == burnInv)) | |
907 | 915 | then { | |
908 | 916 | let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)] | |
909 | 917 | let sendFee = if ((feeAmount > 0)) | |
910 | 918 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
911 | 919 | else nil | |
912 | 920 | $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount) | |
913 | 921 | } | |
914 | 922 | else throw("Strict value is not equal to itself.") | |
915 | 923 | } | |
916 | 924 | else throw("Strict value is not equal to itself.") | |
917 | 925 | } | |
918 | 926 | else throw("Strict value is not equal to itself.") | |
919 | 927 | } | |
920 | 928 | ||
921 | 929 | ||
922 | 930 | ||
923 | 931 | @Callable(i) | |
924 | 932 | func get () = { | |
925 | 933 | let res = commonGet(i) | |
926 | 934 | let outAmtAmt = res._1 | |
927 | 935 | let outPrAmt = res._2 | |
928 | 936 | let pmtAmt = res._3 | |
929 | 937 | let pmtAssetId = res._4 | |
930 | 938 | let state = res._5 | |
931 | 939 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
932 | 940 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
933 | 941 | then state | |
934 | 942 | else throw("Strict value is not equal to itself.") | |
935 | 943 | } | |
936 | 944 | ||
937 | 945 | ||
938 | 946 | ||
939 | 947 | @Callable(i) | |
940 | 948 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
941 | 949 | let res = commonGet(i) | |
942 | 950 | let outAmAmt = res._1 | |
943 | 951 | let outPrAmt = res._2 | |
944 | 952 | let pmtAmt = res._3 | |
945 | 953 | let pmtAssetId = res._4 | |
946 | 954 | let state = res._5 | |
947 | 955 | if ((noLessThenAmtAsset > outAmAmt)) | |
948 | 956 | then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
949 | 957 | else if ((noLessThenPriceAsset > outPrAmt)) | |
950 | 958 | then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
951 | 959 | else { | |
952 | 960 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
953 | 961 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
954 | 962 | then state | |
955 | 963 | else throw("Strict value is not equal to itself.") | |
956 | 964 | } | |
957 | 965 | } | |
958 | 966 | ||
959 | 967 | ||
960 | 968 | ||
961 | 969 | @Callable(i) | |
962 | 970 | func unstakeAndGet (amount) = { | |
963 | 971 | let checkPayments = if ((size(i.payments) != 0)) | |
964 | 972 | then throw("No payments are expected") | |
965 | 973 | else true | |
966 | 974 | if ((checkPayments == checkPayments)) | |
967 | 975 | then { | |
968 | 976 | let cfg = getPoolConfig() | |
969 | 977 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
970 | 978 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil) | |
971 | 979 | if ((unstakeInv == unstakeInv)) | |
972 | 980 | then { | |
973 | 981 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
974 | 982 | let poolStatus = parseIntValue(res._9) | |
975 | 983 | let state = res._10 | |
976 | 984 | let checkPoolStatus = if (if (isGlobalShutdown()) | |
977 | 985 | then true | |
978 | 986 | else (poolStatus == PoolShutdown)) | |
979 | 987 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
980 | 988 | else true | |
981 | 989 | if ((checkPoolStatus == checkPoolStatus)) | |
982 | 990 | then { | |
983 | 991 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
984 | 992 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
985 | 993 | then state | |
986 | 994 | else throw("Strict value is not equal to itself.") | |
987 | 995 | } | |
988 | 996 | else throw("Strict value is not equal to itself.") | |
989 | 997 | } | |
990 | 998 | else throw("Strict value is not equal to itself.") | |
991 | 999 | } | |
992 | 1000 | else throw("Strict value is not equal to itself.") | |
993 | 1001 | } | |
994 | 1002 | ||
995 | 1003 | ||
996 | 1004 | ||
997 | 1005 | @Callable(i) | |
998 | 1006 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
999 | 1007 | let isGetDisabled = if (isGlobalShutdown()) | |
1000 | 1008 | then true | |
1001 | 1009 | else (cfgPoolStatus == PoolShutdown) | |
1002 | 1010 | let checks = [if (!(isGetDisabled)) | |
1003 | 1011 | then true | |
1004 | 1012 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1005 | 1013 | then true | |
1006 | 1014 | else throw("no payments are expected")] | |
1007 | 1015 | if ((checks == checks)) | |
1008 | 1016 | then { | |
1009 | 1017 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1010 | 1018 | if ((unstakeInv == unstakeInv)) | |
1011 | 1019 | then { | |
1012 | 1020 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1013 | 1021 | let outAmAmt = res._1 | |
1014 | 1022 | let outPrAmt = res._2 | |
1015 | 1023 | let state = res._10 | |
1016 | 1024 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1017 | 1025 | then true | |
1018 | 1026 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1019 | 1027 | then true | |
1020 | 1028 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1021 | 1029 | if ((checkAmounts == checkAmounts)) | |
1022 | 1030 | then { | |
1023 | 1031 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1024 | 1032 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1025 | 1033 | then state | |
1026 | 1034 | else throw("Strict value is not equal to itself.") | |
1027 | 1035 | } | |
1028 | 1036 | else throw("Strict value is not equal to itself.") | |
1029 | 1037 | } | |
1030 | 1038 | else throw("Strict value is not equal to itself.") | |
1031 | 1039 | } | |
1032 | 1040 | else throw("Strict value is not equal to itself.") | |
1033 | 1041 | } | |
1034 | 1042 | ||
1035 | 1043 | ||
1036 | 1044 | ||
1037 | 1045 | @Callable(i) | |
1038 | 1046 | func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract))) | |
1039 | 1047 | then throw("permissions denied") | |
1040 | 1048 | else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success") | |
1041 | 1049 | ||
1042 | 1050 | ||
1043 | 1051 | ||
1044 | 1052 | @Callable(i) | |
1045 | 1053 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig()) | |
1046 | 1054 | ||
1047 | 1055 | ||
1048 | 1056 | ||
1049 | 1057 | @Callable(i) | |
1050 | 1058 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1051 | 1059 | ||
1052 | 1060 | ||
1053 | 1061 | ||
1054 | 1062 | @Callable(i) | |
1055 | 1063 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1056 | 1064 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
1057 | 1065 | $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])]) | |
1058 | 1066 | } | |
1059 | 1067 | ||
1060 | 1068 | ||
1061 | 1069 | ||
1062 | 1070 | @Callable(i) | |
1063 | 1071 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult))) | |
1064 | 1072 | ||
1065 | 1073 | ||
1066 | 1074 | ||
1067 | 1075 | @Callable(i) | |
1068 | 1076 | func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult)) | |
1069 | 1077 | ||
1070 | 1078 | ||
1071 | 1079 | ||
1072 | 1080 | @Callable(i) | |
1073 | 1081 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1074 | 1082 | ||
1075 | 1083 | ||
1076 | 1084 | ||
1077 | 1085 | @Callable(i) | |
1078 | 1086 | func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp)) | |
1079 | 1087 | ||
1080 | 1088 | ||
1081 | 1089 | ||
1082 | 1090 | @Callable(i) | |
1083 | 1091 | func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
1084 | 1092 | let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress)) | |
1085 | 1093 | $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10)) | |
1086 | 1094 | } | |
1087 | 1095 | ||
1088 | 1096 | ||
1089 | 1097 | ||
1090 | 1098 | @Callable(i) | |
1091 | 1099 | func statsREADONLY () = { | |
1092 | 1100 | let cfg = getPoolConfig() | |
1093 | 1101 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1094 | 1102 | let amtAssetId = cfg[idxAmtAssetId] | |
1095 | 1103 | let priceAssetId = cfg[idxPriceAssetId] | |
1096 | 1104 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
1097 | 1105 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
1098 | 1106 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1099 | 1107 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1100 | 1108 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1101 | 1109 | let accAmtAssetBalance = getAccBalance(amtAssetId) | |
1102 | 1110 | let accPriceAssetBalance = getAccBalance(priceAssetId) | |
1103 | 1111 | let pricesList = if ((poolLPBalance == 0)) | |
1104 | 1112 | then [zeroBigInt, zeroBigInt, zeroBigInt] | |
1105 | 1113 | else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance) | |
1106 | 1114 | let curPrice = 0 | |
1107 | 1115 | let lpAmtAssetShare = fromX18(pricesList[1], scale8) | |
1108 | 1116 | let lpPriceAssetShare = fromX18(pricesList[2], scale8) | |
1109 | 1117 | let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this)))) | |
1110 | 1118 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(accAmtAssetBalance), toString(accPriceAssetBalance), toString(poolLPBalance), toString(curPrice), toString(lpAmtAssetShare), toString(lpPriceAssetShare), toString(poolWeight)], SEP)) | |
1111 | 1119 | } | |
1112 | 1120 | ||
1113 | 1121 | ||
1114 | 1122 | ||
1115 | 1123 | @Callable(i) | |
1116 | 1124 | func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = { | |
1117 | 1125 | let cfg = getPoolConfig() | |
1118 | 1126 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1119 | 1127 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1120 | 1128 | let amAssetId = fromBase58String(amAssetIdStr) | |
1121 | 1129 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1122 | 1130 | let prAssetId = fromBase58String(prAssetIdStr) | |
1123 | 1131 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1124 | 1132 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1125 | 1133 | let poolStatus = cfg[idxPoolStatus] | |
1126 | 1134 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1127 | 1135 | let accAmtAssetBalance = getAccBalance(amAssetIdStr) | |
1128 | 1136 | let accPriceAssetBalance = getAccBalance(prAssetIdStr) | |
1129 | 1137 | let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm) | |
1130 | 1138 | let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm) | |
1131 | 1139 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1132 | 1140 | then zeroBigInt | |
1133 | 1141 | else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
1134 | 1142 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
1135 | 1143 | let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
1136 | 1144 | let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm) | |
1137 | 1145 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1138 | 1146 | let calcLpAmt = estPut._1 | |
1139 | 1147 | let curPriceCalc = estPut._3 | |
1140 | 1148 | let amBalance = estPut._4 | |
1141 | 1149 | let prBalance = estPut._5 | |
1142 | 1150 | let lpEmission = estPut._6 | |
1143 | 1151 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP)) | |
1144 | 1152 | } | |
1145 | 1153 | ||
1146 | 1154 | ||
1147 | 1155 | ||
1148 | 1156 | @Callable(i) | |
1149 | 1157 | func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = { | |
1150 | 1158 | let cfg = getPoolConfig() | |
1151 | 1159 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1152 | 1160 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1153 | 1161 | let amAssetId = fromBase58String(amAssetIdStr) | |
1154 | 1162 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1155 | 1163 | let prAssetId = fromBase58String(prAssetIdStr) | |
1156 | 1164 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1157 | 1165 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1158 | 1166 | let poolStatus = cfg[idxPoolStatus] | |
1159 | 1167 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1160 | 1168 | let amBalanceRaw = getAccBalance(amAssetIdStr) | |
1161 | 1169 | let prBalanceRaw = getAccBalance(prAssetIdStr) | |
1162 | 1170 | let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm) | |
1163 | 1171 | let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm) | |
1164 | 1172 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1165 | 1173 | then zeroBigInt | |
1166 | 1174 | else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18) | |
1167 | 1175 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
1168 | 1176 | let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
1169 | 1177 | let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm) | |
1170 | 1178 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1171 | 1179 | let calcLpAmt = estPut._1 | |
1172 | 1180 | let curPriceCalc = estPut._3 | |
1173 | 1181 | let amBalance = estPut._4 | |
1174 | 1182 | let prBalance = estPut._5 | |
1175 | 1183 | let lpEmission = estPut._6 | |
1176 | 1184 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP)) | |
1177 | 1185 | } | |
1178 | 1186 | ||
1179 | 1187 | ||
1180 | 1188 | ||
1181 | 1189 | @Callable(i) | |
1182 | 1190 | func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = { | |
1183 | 1191 | let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this) | |
1184 | 1192 | let outAmAmt = res._1 | |
1185 | 1193 | let outPrAmt = res._2 | |
1186 | 1194 | let amBalance = res._5 | |
1187 | 1195 | let prBalance = res._6 | |
1188 | 1196 | let lpEmission = res._7 | |
1189 | 1197 | let curPrice = res._8 | |
1190 | 1198 | let poolStatus = parseIntValue(res._9) | |
1191 | 1199 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(outAmAmt), toString(outPrAmt), toString(amBalance), toString(prBalance), toString(lpEmission), toString(curPrice), toString(poolStatus)], SEP)) | |
1192 | 1200 | } | |
1193 | 1201 | ||
1194 | 1202 | ||
1195 | 1203 | @Verifier(tx) | |
1196 | 1204 | func verify () = { | |
1197 | 1205 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1198 | 1206 | case pk: ByteVector => | |
1199 | 1207 | pk | |
1200 | 1208 | case _: Unit => | |
1201 | 1209 | tx.senderPublicKey | |
1202 | 1210 | case _ => | |
1203 | 1211 | throw("Match error") | |
1204 | 1212 | } | |
1205 | 1213 | match tx { | |
1206 | 1214 | case order: Order => | |
1207 | 1215 | let matcherPub = getMatcherPubOrFail() | |
1208 | 1216 | let orderValid = validateMatcherOrderAllowed(order) | |
1209 | 1217 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1210 | 1218 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1211 | 1219 | if (if (if (orderValid) | |
1212 | 1220 | then senderValid | |
1213 | 1221 | else false) | |
1214 | 1222 | then matcherValid | |
1215 | 1223 | else false) | |
1216 | 1224 | then true | |
1217 | 1225 | else throwOrderError(orderValid, senderValid, matcherValid) | |
1218 | 1226 | case s: SetScriptTransaction => | |
1219 | 1227 | let newHash = blake2b256(value(s.script)) | |
1220 | 1228 | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash()))) | |
1221 | 1229 | let currentHash = scriptHash(this) | |
1222 | 1230 | if (if ((allowedHash == newHash)) | |
1223 | 1231 | then (currentHash != newHash) | |
1224 | 1232 | else false) | |
1225 | 1233 | then true | |
1226 | 1234 | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1227 | 1235 | case _ => | |
1228 | 1236 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1229 | 1237 | } | |
1230 | 1238 | } | |
1231 | 1239 |
github/deemru/w8io/026f985 119.20 ms ◑