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