tx · EXHtnxYWRNZYtRCLkc9hCwAG3rMpMda7gY7uacStSwYV 3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh: -0.04300000 Waves 2023.09.21 14:40 [2765088] smart account 3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh > SELF 0.00000000 Waves
{ "type": 13, "id": "EXHtnxYWRNZYtRCLkc9hCwAG3rMpMda7gY7uacStSwYV", "fee": 4300000, "feeAssetId": null, "timestamp": 1695296422638, "version": 2, "chainId": 84, "sender": "3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh", "senderPublicKey": "Cr8D7eozSzJh7XHsYTjBinPpo3SS83BrCGiBAJsjGxBo", "proofs": [ "2HBExHVqn9zH9vEhn7aEqJchMQVBNTj4meWvMFhN8Qzx4rNQMk6wri5KVwwmakENWm2ZzhcBsGU17moddZPYCbyb" ], "script": "base64:BgK4OAgCEgASBQoDAQQBEgcKBQEEAQgBEgQKAgEEEgMKAQESBAoCAQQSBAoCCAESBAoCCAESBAoCCAESBQoDAQgBEgASBAoCAQESAwoBARIFCgMBAQESBAoCCAgSABIAEgASAwoBCBIFCgMBAQESBAoCAQESBAoCCAESBAoCCAgSCwoJCAEBAgECCAQEEgYKBAgIAQgSABIDCgEBEgMKAQESBAoCCAEiCmxQZGVjaW1hbHMiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgt3YXZlc1N0cmluZyIDU0VQIgpQb29sQWN0aXZlIg9Qb29sUHV0RGlzYWJsZWQiE1Bvb2xNYXRjaGVyRGlzYWJsZWQiDFBvb2xTaHV0ZG93biIOaWR4UG9vbEFkZHJlc3MiDWlkeFBvb2xTdGF0dXMiEGlkeFBvb2xMUEFzc2V0SWQiDWlkeEFtdEFzc2V0SWQiD2lkeFByaWNlQXNzZXRJZCIOaWR4QW10QXNzZXREY20iEGlkeFByaWNlQXNzZXREY20iDmlkeElBbX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ZGVyBAJlUQUCYVEEAmluCQECYmoABAJpbwMJAQJlTQAJAJQKAgYCAAkBAmVQAQUCZVEEAmFLCAUCaW8CXzEEAmFMCAUCaW8CXzIEAmFNCQD0AwMIBQJlUQlib2R5Qnl0ZXMJAJEDAggFAmVRBnByb29mcwAACAUCZVEPc2VuZGVyUHVibGljS2V5BAJhTgkA9AMDCAUCZVEJYm9keUJ5dGVzCQCRAwIIBQJlUQZwcm9vZnMAAQUCaW4DAwMFAmFLBQJhTQcFAmFOBwYJAQJhSgQFAmFLBQJhTAUCYU0FAmFOAwkAAQIFAmFRAhRTZXRTY3JpcHRUcmFuc2FjdGlvbgQCYVYFAmFRAwkA9AMDCAUCaWsJYm9keUJ5dGVzCQCRAwIIBQJpawZwcm9vZnMAAAUCaW0GBAJpcAkA9gMBCQEFdmFsdWUBCAUCYVYGc2NyaXB0BAJpcQkA2wQBCQEFdmFsdWUBCQCdCAIFAmJkCQECYUYABAJpcgkA8QcBBQR0aGlzAwkAAAIFAmlxBQJpcAkBAiE9AgUCaXIFAmlwBwkA9AMDCAUCaWsJYm9keUJ5dGVzCQCRAwIIBQJpawZwcm9vZnMAAAUCaW1+ZcYd", "height": 2765088, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4pDvjMA6CDycpfjpeGnTnNdoWTKW6w6D9k8PG86HKLJ3 Next: BoxDay9RMidQ4C1r8DPgaSvBxt348qxuBvBRJyxLqjTZ Diff:
Old | New | Differences | |
---|---|---|---|
1584 | 1584 | ||
1585 | 1585 | ||
1586 | 1586 | @Callable(i) | |
1587 | + | func invert () = { | |
1588 | + | let checks = [if ((i.caller == factoryContract)) | |
1589 | + | then true | |
1590 | + | else throwErr("invalid caller")] | |
1591 | + | if ((checks == checks)) | |
1592 | + | then $Tuple2([StringEntry(aa(), assetIdToString(cfgPriceAssetId)), StringEntry(pa(), assetIdToString(cfgAmountAssetId))], unit) | |
1593 | + | else throw("Strict value is not equal to itself.") | |
1594 | + | } | |
1595 | + | ||
1596 | + | ||
1597 | + | ||
1598 | + | @Callable(i) | |
1587 | 1599 | func refreshKLp () = { | |
1588 | 1600 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0) | |
1589 | 1601 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay)) | |
1592 | 1604 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1593 | 1605 | then { | |
1594 | 1606 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1595 | - | let $ | |
1596 | - | let kLpUpdateActions = $ | |
1597 | - | let updatedKLp = $ | |
1607 | + | let $t06014360207 = refreshKLpInternal(0, 0, 0) | |
1608 | + | let kLpUpdateActions = $t06014360207._1 | |
1609 | + | let updatedKLp = $t06014360207._2 | |
1598 | 1610 | let actions = if ((kLp != updatedKLp)) | |
1599 | 1611 | then kLpUpdateActions | |
1600 | 1612 | else throwErr("nothing to refresh") | |
1769 | 1781 | match tx { | |
1770 | 1782 | case order: Order => | |
1771 | 1783 | let matcherPub = getMatcherPubOrFail() | |
1772 | - | let $ | |
1784 | + | let $t06886968986 = if (skipOrderValidation()) | |
1773 | 1785 | then $Tuple2(true, "") | |
1774 | 1786 | else validateMatcherOrderAllowed(order) | |
1775 | - | let orderValid = $ | |
1776 | - | let orderValidInfo = $ | |
1787 | + | let orderValid = $t06886968986._1 | |
1788 | + | let orderValidInfo = $t06886968986._2 | |
1777 | 1789 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1778 | 1790 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1779 | 1791 | if (if (if (orderValid) |
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 toX18BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult) | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func abs (val) = if ((0 > val)) | |
78 | 78 | then -(val) | |
79 | 79 | else val | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func absBigInt (val) = if ((zeroBigInt > val)) | |
83 | 83 | then -(val) | |
84 | 84 | else val | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func swapContract () = "%s__swapContract" | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func fc () = "%s__factoryContract" | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func pl () = "%s%s__price__last" | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId) | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func aa () = "%s__amountAsset" | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func pa () = "%s__priceAsset" | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | let keyFee = "%s__fee" | |
118 | 118 | ||
119 | 119 | let feeDefault = fraction(10, scale8, 10000) | |
120 | 120 | ||
121 | 121 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
122 | 122 | ||
123 | 123 | let keyKLp = makeString(["%s", "kLp"], SEP) | |
124 | 124 | ||
125 | 125 | let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP) | |
126 | 126 | ||
127 | 127 | let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP) | |
128 | 128 | ||
129 | 129 | let kLpRefreshDelayDefault = 30 | |
130 | 130 | ||
131 | 131 | let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault) | |
132 | 132 | ||
133 | 133 | func keyAdditionalBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP) | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func keyStakingAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP) | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0) | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0) | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func keyFactoryConfig () = "%s__factoryConfig" | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func keyMatcherPub () = "%s%s__matcher__publicKey" | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config") | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func keyAllPoolsShutdown () = "%s__shutdown" | |
161 | 161 | ||
162 | 162 | ||
163 | 163 | func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress) | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash" | |
167 | 167 | ||
168 | 168 | ||
169 | 169 | let keyFeeCollectorAddress = "%s__feeCollectorAddress" | |
170 | 170 | ||
171 | 171 | func keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress) | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func addressFromStringOrThis (addressString) = match addressFromString(addressString) { | |
178 | 178 | case a: Address => | |
179 | 179 | a | |
180 | 180 | case _ => | |
181 | 181 | this | |
182 | 182 | } | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | func getManagerVaultAddressOrThis () = { | |
186 | 186 | let factoryAddress = match getString(fc()) { | |
187 | 187 | case fca: String => | |
188 | 188 | addressFromStringOrThis(fca) | |
189 | 189 | case _ => | |
190 | 190 | this | |
191 | 191 | } | |
192 | 192 | match getString(factoryAddress, keyManagerVaultAddress()) { | |
193 | 193 | case s: String => | |
194 | 194 | addressFromStringOrThis(s) | |
195 | 195 | case _ => | |
196 | 196 | this | |
197 | 197 | } | |
198 | 198 | } | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
202 | 202 | ||
203 | 203 | ||
204 | 204 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | func throwErr (msg) = throw(makeString(["lp.ride:", msg], " ")) | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | func fmtErr (msg) = makeString(["lp.ride:", msg], " ") | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | let factoryContract = addressFromStringValue(getStringOrFail(this, fc())) | |
214 | 214 | ||
215 | 215 | let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress)) | |
216 | 216 | ||
217 | 217 | let inFee = { | |
218 | 218 | let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil) | |
219 | 219 | if ($isInstanceOf(@, "Int")) | |
220 | 220 | then @ | |
221 | 221 | else throw(($getType(@) + " couldn't be cast to Int")) | |
222 | 222 | } | |
223 | 223 | ||
224 | 224 | let outFee = { | |
225 | 225 | let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil) | |
226 | 226 | if ($isInstanceOf(@, "Int")) | |
227 | 227 | then @ | |
228 | 228 | else throw(($getType(@) + " couldn't be cast to Int")) | |
229 | 229 | } | |
230 | 230 | ||
231 | 231 | func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false) | |
232 | 232 | ||
233 | 233 | ||
234 | 234 | func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub())) | |
235 | 235 | ||
236 | 236 | ||
237 | 237 | func getPoolConfig () = { | |
238 | 238 | let amtAsset = getStringOrFail(this, aa()) | |
239 | 239 | let priceAsset = getStringOrFail(this, pa()) | |
240 | 240 | let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset)) | |
241 | 241 | let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset)) | |
242 | 242 | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP) | |
243 | 243 | } | |
244 | 244 | ||
245 | 245 | ||
246 | 246 | func parseAssetId (input) = if ((input == wavesString)) | |
247 | 247 | then unit | |
248 | 248 | else fromBase58String(input) | |
249 | 249 | ||
250 | 250 | ||
251 | 251 | func assetIdToString (input) = if ((input == unit)) | |
252 | 252 | then wavesString | |
253 | 253 | else toBase58String(value(input)) | |
254 | 254 | ||
255 | 255 | ||
256 | 256 | 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])) | |
257 | 257 | ||
258 | 258 | ||
259 | 259 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
260 | 260 | ||
261 | 261 | let $t095299695 = poolConfigParsed | |
262 | 262 | ||
263 | 263 | let cfgPoolAddress = $t095299695._1 | |
264 | 264 | ||
265 | 265 | let cfgPoolStatus = $t095299695._2 | |
266 | 266 | ||
267 | 267 | let cfgLpAssetId = $t095299695._3 | |
268 | 268 | ||
269 | 269 | let cfgAmountAssetId = $t095299695._4 | |
270 | 270 | ||
271 | 271 | let cfgPriceAssetId = $t095299695._5 | |
272 | 272 | ||
273 | 273 | let cfgAmountAssetDecimals = $t095299695._6 | |
274 | 274 | ||
275 | 275 | let cfgPriceAssetDecimals = $t095299695._7 | |
276 | 276 | ||
277 | 277 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
278 | 278 | ||
279 | 279 | ||
280 | 280 | let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address") | |
281 | 281 | ||
282 | 282 | let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address") | |
283 | 283 | ||
284 | 284 | 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) | |
285 | 285 | ||
286 | 286 | ||
287 | 287 | 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) | |
288 | 288 | ||
289 | 289 | ||
290 | 290 | func getAccBalance (assetId) = { | |
291 | 291 | let balanceOnPool = if ((assetId == "WAVES")) | |
292 | 292 | then wavesBalance(this).available | |
293 | 293 | else assetBalance(this, fromBase58String(assetId)) | |
294 | 294 | let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId)) | |
295 | 295 | max([0, totalBalance]) | |
296 | 296 | } | |
297 | 297 | ||
298 | 298 | ||
299 | 299 | func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
300 | 300 | ||
301 | 301 | ||
302 | 302 | func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
303 | 303 | ||
304 | 304 | ||
305 | 305 | func getRate (proxy) = { | |
306 | 306 | let inv = invoke(proxy, "getRate", nil, nil) | |
307 | 307 | if ((inv == inv)) | |
308 | 308 | then match inv { | |
309 | 309 | case r: Int => | |
310 | 310 | r | |
311 | 311 | case _ => | |
312 | 312 | throwErr("proxy.getRate() unexpected value") | |
313 | 313 | } | |
314 | 314 | else throw("Strict value is not equal to itself.") | |
315 | 315 | } | |
316 | 316 | ||
317 | 317 | ||
318 | 318 | func deposit (assetId,amount,stakingAssetId,proxy) = { | |
319 | 319 | let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId) | |
320 | 320 | if ((currentAdditionalBalance == currentAdditionalBalance)) | |
321 | 321 | then { | |
322 | 322 | let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId) | |
323 | 323 | if ((currentStakingAssetBalance == currentStakingAssetBalance)) | |
324 | 324 | then { | |
325 | 325 | let asset = parseAssetId(assetId) | |
326 | 326 | if ((amount > 0)) | |
327 | 327 | then { | |
328 | 328 | let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)]) | |
329 | 329 | if ((depositInvoke == depositInvoke)) | |
330 | 330 | then match depositInvoke { | |
331 | 331 | case receivedStakingAsset: Int => | |
332 | 332 | let newAdditionalBalance = (currentAdditionalBalance + amount) | |
333 | 333 | let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset) | |
334 | 334 | [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)] | |
335 | 335 | case _ => | |
336 | 336 | nil | |
337 | 337 | } | |
338 | 338 | else throw("Strict value is not equal to itself.") | |
339 | 339 | } | |
340 | 340 | else nil | |
341 | 341 | } | |
342 | 342 | else throw("Strict value is not equal to itself.") | |
343 | 343 | } | |
344 | 344 | else throw("Strict value is not equal to itself.") | |
345 | 345 | } | |
346 | 346 | ||
347 | 347 | ||
348 | 348 | func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = { | |
349 | 349 | let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId) | |
350 | 350 | if ((currentAdditionalBalance == currentAdditionalBalance)) | |
351 | 351 | then { | |
352 | 352 | let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId) | |
353 | 353 | if ((currentStakingAssetBalance == currentStakingAssetBalance)) | |
354 | 354 | then { | |
355 | 355 | let currentProxyRate = getRate(proxy) | |
356 | 356 | if ((currentProxyRate == currentProxyRate)) | |
357 | 357 | then { | |
358 | 358 | let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance) | |
359 | 359 | let stakingAsset = parseAssetId(stakingAssetId) | |
360 | 360 | let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate) | |
361 | 361 | let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate) | |
362 | 362 | let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)]) | |
363 | 363 | if ((sendStakingAssetAmount > 0)) | |
364 | 364 | then { | |
365 | 365 | let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)]) | |
366 | 366 | if ((withdrawInvoke == withdrawInvoke)) | |
367 | 367 | then match withdrawInvoke { | |
368 | 368 | case receivedAssets: Int => | |
369 | 369 | let newAdditionalBalance = (currentAdditionalBalance - receivedAssets) | |
370 | 370 | let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount) | |
371 | 371 | [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))] | |
372 | 372 | case _ => | |
373 | 373 | nil | |
374 | 374 | } | |
375 | 375 | else throw("Strict value is not equal to itself.") | |
376 | 376 | } | |
377 | 377 | else nil | |
378 | 378 | } | |
379 | 379 | else throw("Strict value is not equal to itself.") | |
380 | 380 | } | |
381 | 381 | else throw("Strict value is not equal to itself.") | |
382 | 382 | } | |
383 | 383 | else throw("Strict value is not equal to itself.") | |
384 | 384 | } | |
385 | 385 | ||
386 | 386 | ||
387 | 387 | func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) { | |
388 | 388 | case a: (Boolean, Int, Int, String, String, Int, String) => | |
389 | 389 | a | |
390 | 390 | case _ => | |
391 | 391 | throwErr((("[" + assetId) + "] getLeaseProxyConfig() error")) | |
392 | 392 | } | |
393 | 393 | ||
394 | 394 | ||
395 | 395 | func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = { | |
396 | 396 | let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId) | |
397 | 397 | if ((currentAdditionalBalance == currentAdditionalBalance)) | |
398 | 398 | then { | |
399 | 399 | let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId) | |
400 | 400 | if ((currentStakingAssetBalance == currentStakingAssetBalance)) | |
401 | 401 | then { | |
402 | 402 | let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)]) | |
403 | 403 | let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100) | |
404 | 404 | let diff = (currentAdditionalBalance - targetAdditionalBalance) | |
405 | 405 | if ((diff == 0)) | |
406 | 406 | then nil | |
407 | 407 | else if ((0 > diff)) | |
408 | 408 | then { | |
409 | 409 | let sendAssetAmount = -(diff) | |
410 | 410 | deposit(assetId, sendAssetAmount, stakingAssetId, proxy) | |
411 | 411 | } | |
412 | 412 | else { | |
413 | 413 | let getAssetAmount = diff | |
414 | 414 | withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress) | |
415 | 415 | } | |
416 | 416 | } | |
417 | 417 | else throw("Strict value is not equal to itself.") | |
418 | 418 | } | |
419 | 419 | else throw("Strict value is not equal to itself.") | |
420 | 420 | } | |
421 | 421 | ||
422 | 422 | ||
423 | 423 | func rebalanceAsset (assetId) = { | |
424 | 424 | let $t01593116067 = getLeaseProxyConfig(assetId) | |
425 | 425 | let isLeasable = $t01593116067._1 | |
426 | 426 | let leasedRatio = $t01593116067._2 | |
427 | 427 | let minBalance = $t01593116067._3 | |
428 | 428 | let proxyAddress = $t01593116067._4 | |
429 | 429 | let proxyAssetId = $t01593116067._5 | |
430 | 430 | let proxyRateMul = $t01593116067._6 | |
431 | 431 | let stakingProfitAddress = $t01593116067._7 | |
432 | 432 | if (isLeasable) | |
433 | 433 | then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress)) | |
434 | 434 | else nil | |
435 | 435 | } | |
436 | 436 | ||
437 | 437 | ||
438 | 438 | func withdrawAndRebalanceAsset (assetId,getAmount) = { | |
439 | 439 | let $t01646616602 = getLeaseProxyConfig(assetId) | |
440 | 440 | let isLeasable = $t01646616602._1 | |
441 | 441 | let leasedRatio = $t01646616602._2 | |
442 | 442 | let minBalance = $t01646616602._3 | |
443 | 443 | let proxyAddress = $t01646616602._4 | |
444 | 444 | let proxyAssetId = $t01646616602._5 | |
445 | 445 | let proxyRateMul = $t01646616602._6 | |
446 | 446 | let stakingProfitAddress = $t01646616602._7 | |
447 | 447 | if (isLeasable) | |
448 | 448 | then { | |
449 | 449 | let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)]) | |
450 | 450 | if ((newTotalLeasableBalance == newTotalLeasableBalance)) | |
451 | 451 | then { | |
452 | 452 | let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100) | |
453 | 453 | if ((newAdditionalBalance == newAdditionalBalance)) | |
454 | 454 | then { | |
455 | 455 | let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance) | |
456 | 456 | if ((withdrawAmount == withdrawAmount)) | |
457 | 457 | then if ((0 > withdrawAmount)) | |
458 | 458 | then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress)) | |
459 | 459 | else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress)) | |
460 | 460 | else throw("Strict value is not equal to itself.") | |
461 | 461 | } | |
462 | 462 | else throw("Strict value is not equal to itself.") | |
463 | 463 | } | |
464 | 464 | else throw("Strict value is not equal to itself.") | |
465 | 465 | } | |
466 | 466 | else nil | |
467 | 467 | } | |
468 | 468 | ||
469 | 469 | ||
470 | 470 | func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = { | |
471 | 471 | let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount) | |
472 | 472 | let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount) | |
473 | 473 | (AmAmtWithdrawState ++ PrAmtWithdrawState) | |
474 | 474 | } | |
475 | 475 | ||
476 | 476 | ||
477 | 477 | func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
478 | 478 | let amtAssetAmtX18 = toX18(amAmt, amAssetDcm) | |
479 | 479 | let priceAssetAmtX18 = toX18(prAmt, prAssetDcm) | |
480 | 480 | calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
481 | 481 | } | |
482 | 482 | ||
483 | 483 | ||
484 | 484 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
485 | 485 | let cfg = getPoolConfig() | |
486 | 486 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
487 | 487 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
488 | 488 | let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt) | |
489 | 489 | let amAmtX18 = toX18(amAmt, amtAssetDcm) | |
490 | 490 | let prAmtX18 = toX18(prAmt, priceAssetDcm) | |
491 | 491 | let lpAmtX18 = toX18(lpAmt, scale8) | |
492 | 492 | let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18) | |
493 | 493 | let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18) | |
494 | 494 | [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18] | |
495 | 495 | } | |
496 | 496 | ||
497 | 497 | ||
498 | 498 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
499 | 499 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
500 | 500 | [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)] | |
501 | 501 | } | |
502 | 502 | ||
503 | 503 | ||
504 | 504 | func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
505 | 505 | let cfg = getPoolConfig() | |
506 | 506 | let lpAssetId = cfg[idxPoolLPAssetId] | |
507 | 507 | let amAssetId = cfg[idxAmtAssetId] | |
508 | 508 | let prAssetId = cfg[idxPriceAssetId] | |
509 | 509 | let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
510 | 510 | let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
511 | 511 | let poolStatus = cfg[idxPoolStatus] | |
512 | 512 | let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity | |
513 | 513 | if ((lpAssetId != pmtAssetId)) | |
514 | 514 | then throw("Invalid asset passed.") | |
515 | 515 | else { | |
516 | 516 | let amBalance = getAccBalance(amAssetId) | |
517 | 517 | let amBalanceX18 = toX18(amBalance, amAssetDcm) | |
518 | 518 | let prBalance = getAccBalance(prAssetId) | |
519 | 519 | let prBalanceX18 = toX18(prBalance, prAssetDcm) | |
520 | 520 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
521 | 521 | let curPrice = fromX18(curPriceX18, scale8) | |
522 | 522 | let pmtLpAmtX18 = toX18(pmtLpAmt, scale8) | |
523 | 523 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
524 | 524 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
525 | 525 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
526 | 526 | let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR) | |
527 | 527 | let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR) | |
528 | 528 | let state = if ((txId58 == "")) | |
529 | 529 | then nil | |
530 | 530 | else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES")) | |
531 | 531 | then unit | |
532 | 532 | else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES")) | |
533 | 533 | then unit | |
534 | 534 | 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)] | |
535 | 535 | $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state) | |
536 | 536 | } | |
537 | 537 | } | |
538 | 538 | ||
539 | 539 | ||
540 | 540 | func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = { | |
541 | 541 | let cfg = getPoolConfig() | |
542 | 542 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
543 | 543 | let amAssetIdStr = cfg[idxAmtAssetId] | |
544 | 544 | let prAssetIdStr = cfg[idxPriceAssetId] | |
545 | 545 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
546 | 546 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
547 | 547 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
548 | 548 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
549 | 549 | let poolStatus = cfg[idxPoolStatus] | |
550 | 550 | let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
551 | 551 | let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES"))) | |
552 | 552 | let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES"))) | |
553 | 553 | if (if ((amAssetIdStr != inAmAssetIdStr)) | |
554 | 554 | then true | |
555 | 555 | else (prAssetIdStr != inPrAssetIdStr)) | |
556 | 556 | then throw("Invalid amt or price asset passed.") | |
557 | 557 | else { | |
558 | 558 | let amBalance = if (isEvaluate) | |
559 | 559 | then getAccBalance(amAssetIdStr) | |
560 | 560 | else (getAccBalance(amAssetIdStr) - inAmAssetAmt) | |
561 | 561 | let prBalance = if (isEvaluate) | |
562 | 562 | then getAccBalance(prAssetIdStr) | |
563 | 563 | else (getAccBalance(prAssetIdStr) - inPrAssetAmt) | |
564 | 564 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
565 | 565 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
566 | 566 | let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18) | |
567 | 567 | let amBalanceX18 = toX18(amBalance, amtAssetDcm) | |
568 | 568 | let prBalanceX18 = toX18(prBalance, priceAssetDcm) | |
569 | 569 | let res = if ((lpEmission == 0)) | |
570 | 570 | then { | |
571 | 571 | let curPriceX18 = zeroBigInt | |
572 | 572 | let slippageX18 = zeroBigInt | |
573 | 573 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
574 | 574 | $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
575 | 575 | } | |
576 | 576 | else { | |
577 | 577 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
578 | 578 | let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
579 | 579 | let slippageToleranceX18 = toX18(slippageTolerance, scale8) | |
580 | 580 | if (if ((curPriceX18 != zeroBigInt)) | |
581 | 581 | then (slippageX18 > slippageToleranceX18) | |
582 | 582 | else false) | |
583 | 583 | then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18))) | |
584 | 584 | else { | |
585 | 585 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
586 | 586 | let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
587 | 587 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
588 | 588 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
589 | 589 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
590 | 590 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
591 | 591 | let expAmtAssetAmtX18 = expectedAmts._1 | |
592 | 592 | let expPriceAssetAmtX18 = expectedAmts._2 | |
593 | 593 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR) | |
594 | 594 | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18) | |
595 | 595 | } | |
596 | 596 | } | |
597 | 597 | let calcLpAmt = res._1 | |
598 | 598 | let calcAmAssetPmt = res._2 | |
599 | 599 | let calcPrAssetPmt = res._3 | |
600 | 600 | let curPrice = fromX18(res._4, scale8) | |
601 | 601 | let slippageCalc = fromX18(res._5, scale8) | |
602 | 602 | if ((0 >= calcLpAmt)) | |
603 | 603 | then throw("Invalid calculations. LP calculated is less than zero.") | |
604 | 604 | else { | |
605 | 605 | let emitLpAmt = if (!(emitLp)) | |
606 | 606 | then 0 | |
607 | 607 | else calcLpAmt | |
608 | 608 | let amDiff = (inAmAssetAmt - calcAmAssetPmt) | |
609 | 609 | let prDiff = (inPrAssetAmt - calcPrAssetPmt) | |
610 | 610 | 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))] | |
611 | 611 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId) | |
612 | 612 | } | |
613 | 613 | } | |
614 | 614 | } | |
615 | 615 | ||
616 | 616 | ||
617 | 617 | func calcKLp (amountBalance,priceBalance,lpEmission) = { | |
618 | 618 | let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)) | |
619 | 619 | let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals)) | |
620 | 620 | let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission) | |
621 | 621 | if ((lpEmission == big0)) | |
622 | 622 | then big0 | |
623 | 623 | else updatedKLp | |
624 | 624 | } | |
625 | 625 | ||
626 | 626 | ||
627 | 627 | func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
628 | 628 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
629 | 629 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
630 | 630 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
631 | 631 | let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
632 | 632 | currentKLp | |
633 | 633 | } | |
634 | 634 | ||
635 | 635 | ||
636 | 636 | func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
637 | 637 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
638 | 638 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
639 | 639 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
640 | 640 | let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
641 | 641 | let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))] | |
642 | 642 | $Tuple2(actions, updatedKLp) | |
643 | 643 | } | |
644 | 644 | ||
645 | 645 | ||
646 | 646 | func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false) | |
647 | 647 | ||
648 | 648 | ||
649 | 649 | func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp)) | |
650 | 650 | then true | |
651 | 651 | else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " ")) | |
652 | 652 | ||
653 | 653 | ||
654 | 654 | func validateMatcherOrderAllowed (order) = { | |
655 | 655 | let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
656 | 656 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
657 | 657 | let amountAssetAmount = order.amount | |
658 | 658 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
659 | 659 | let $t02899129203 = if ((order.orderType == Buy)) | |
660 | 660 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
661 | 661 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
662 | 662 | let amountAssetBalanceDelta = $t02899129203._1 | |
663 | 663 | let priceAssetBalanceDelta = $t02899129203._2 | |
664 | 664 | if (if (if (isGlobalShutdown()) | |
665 | 665 | then true | |
666 | 666 | else (cfgPoolStatus == PoolMatcherDisabled)) | |
667 | 667 | then true | |
668 | 668 | else (cfgPoolStatus == PoolShutdown)) | |
669 | 669 | then throw("Exchange operations disabled") | |
670 | 670 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
671 | 671 | then true | |
672 | 672 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
673 | 673 | then throw("Wrong order assets.") | |
674 | 674 | else { | |
675 | 675 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
676 | 676 | let $t02964329743 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
677 | 677 | let unusedActions = $t02964329743._1 | |
678 | 678 | let kLpNew = $t02964329743._2 | |
679 | 679 | let isOrderValid = (kLpNew >= kLp) | |
680 | 680 | let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
681 | 681 | $Tuple2(isOrderValid, info) | |
682 | 682 | } | |
683 | 683 | } | |
684 | 684 | ||
685 | 685 | ||
686 | 686 | func commonGet (i) = if ((size(i.payments) != 1)) | |
687 | 687 | then throw("exactly 1 payment is expected") | |
688 | 688 | else { | |
689 | 689 | let pmt = value(i.payments[0]) | |
690 | 690 | let pmtAssetId = value(pmt.assetId) | |
691 | 691 | let pmtAmt = pmt.amount | |
692 | 692 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
693 | 693 | let outAmAmt = res._1 | |
694 | 694 | let outPrAmt = res._2 | |
695 | 695 | let poolStatus = parseIntValue(res._9) | |
696 | 696 | let state = res._10 | |
697 | 697 | if (if (isGlobalShutdown()) | |
698 | 698 | then true | |
699 | 699 | else (poolStatus == PoolShutdown)) | |
700 | 700 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
701 | 701 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
702 | 702 | } | |
703 | 703 | ||
704 | 704 | ||
705 | 705 | func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2)) | |
706 | 706 | then throw("exactly 2 payments are expected") | |
707 | 707 | else { | |
708 | 708 | let amAssetPmt = value(i.payments[0]) | |
709 | 709 | let prAssetPmt = value(i.payments[1]) | |
710 | 710 | let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp) | |
711 | 711 | let poolStatus = parseIntValue(estPut._8) | |
712 | 712 | if (if (if (isGlobalShutdown()) | |
713 | 713 | then true | |
714 | 714 | else (poolStatus == PoolPutDisabled)) | |
715 | 715 | then true | |
716 | 716 | else (poolStatus == PoolShutdown)) | |
717 | 717 | then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus))) | |
718 | 718 | else estPut | |
719 | 719 | } | |
720 | 720 | ||
721 | 721 | ||
722 | 722 | func emit (amount) = { | |
723 | 723 | let emitInv = invoke(factoryContract, "emit", [amount], nil) | |
724 | 724 | if ((emitInv == emitInv)) | |
725 | 725 | then { | |
726 | 726 | let emitInvLegacy = match emitInv { | |
727 | 727 | case legacyFactoryContract: Address => | |
728 | 728 | invoke(legacyFactoryContract, "emit", [amount], nil) | |
729 | 729 | case _ => | |
730 | 730 | unit | |
731 | 731 | } | |
732 | 732 | if ((emitInvLegacy == emitInvLegacy)) | |
733 | 733 | then amount | |
734 | 734 | else throw("Strict value is not equal to itself.") | |
735 | 735 | } | |
736 | 736 | else throw("Strict value is not equal to itself.") | |
737 | 737 | } | |
738 | 738 | ||
739 | 739 | ||
740 | 740 | func takeFee (amount,fee) = { | |
741 | 741 | let feeAmount = if ((fee == 0)) | |
742 | 742 | then 0 | |
743 | 743 | else fraction(amount, fee, scale8) | |
744 | 744 | $Tuple2((amount - feeAmount), feeAmount) | |
745 | 745 | } | |
746 | 746 | ||
747 | 747 | ||
748 | 748 | func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = { | |
749 | 749 | let isEval = (txId == unit) | |
750 | 750 | let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
751 | 751 | let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
752 | 752 | let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId)) | |
753 | 753 | then true | |
754 | 754 | else if ((paymentAssetId == cfgPriceAssetId)) | |
755 | 755 | then false | |
756 | 756 | else throwErr("invalid asset") | |
757 | 757 | let $t03285633149 = if (isEval) | |
758 | 758 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
759 | 759 | else if (paymentInAmountAsset) | |
760 | 760 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
761 | 761 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
762 | 762 | let amountBalanceOld = $t03285633149._1 | |
763 | 763 | let priceBalanceOld = $t03285633149._2 | |
764 | 764 | let $t03315333302 = if (paymentInAmountAsset) | |
765 | 765 | then $Tuple2(paymentAmountRaw, 0) | |
766 | 766 | else $Tuple2(0, paymentAmountRaw) | |
767 | 767 | let amountAssetAmountRaw = $t03315333302._1 | |
768 | 768 | let priceAssetAmountRaw = $t03315333302._2 | |
769 | 769 | let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1 | |
770 | 770 | let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1 | |
771 | 771 | let $t03343433498 = takeFee(paymentAmountRaw, inFee) | |
772 | 772 | let paymentAmount = $t03343433498._1 | |
773 | 773 | let feeAmount = $t03343433498._2 | |
774 | 774 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
775 | 775 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
776 | 776 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
777 | 777 | let priceNew = fromX18(priceNewX18, scale8) | |
778 | 778 | let paymentBalance = if (paymentInAmountAsset) | |
779 | 779 | then amountBalanceOld | |
780 | 780 | else priceBalanceOld | |
781 | 781 | let paymentBalanceBigInt = toBigInt(paymentBalance) | |
782 | 782 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
783 | 783 | let chechSupply = if ((supplyBigInt > big0)) | |
784 | 784 | then true | |
785 | 785 | else throwErr("initial deposit requires all coins") | |
786 | 786 | if ((chechSupply == chechSupply)) | |
787 | 787 | then { | |
788 | 788 | let depositBigInt = toBigInt(paymentAmount) | |
789 | 789 | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))]) | |
790 | 790 | let commonState = if (isEval) | |
791 | 791 | then nil | |
792 | 792 | 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))] | |
793 | 793 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
794 | 794 | let priceOld = fromX18(priceOldX18, scale8) | |
795 | 795 | let loss = { | |
796 | 796 | let $t03517935346 = if (paymentInAmountAsset) | |
797 | 797 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
798 | 798 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
799 | 799 | let amount = $t03517935346._1 | |
800 | 800 | let balance = $t03517935346._2 | |
801 | 801 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
802 | 802 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
803 | 803 | } | |
804 | 804 | $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset) | |
805 | 805 | } | |
806 | 806 | else throw("Strict value is not equal to itself.") | |
807 | 807 | } | |
808 | 808 | ||
809 | 809 | ||
810 | 810 | func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = { | |
811 | 811 | let isEval = (txId == unit) | |
812 | 812 | let cfg = getPoolConfig() | |
813 | 813 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
814 | 814 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
815 | 815 | let checks = [if ((paymentAssetId == cfgLpAssetId)) | |
816 | 816 | then true | |
817 | 817 | else throwErr("invalid lp asset")] | |
818 | 818 | if ((checks == checks)) | |
819 | 819 | then { | |
820 | 820 | let outInAmountAsset = if ((outAssetId == cfgAmountAssetId)) | |
821 | 821 | then true | |
822 | 822 | else if ((outAssetId == cfgPriceAssetId)) | |
823 | 823 | then false | |
824 | 824 | else throwErr("invalid asset") | |
825 | 825 | let balanceBigInt = if (outInAmountAsset) | |
826 | 826 | then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) | |
827 | 827 | else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) | |
828 | 828 | let outInAmountAssetDecimals = if (outInAmountAsset) | |
829 | 829 | then amtAssetDcm | |
830 | 830 | else priceAssetDcm | |
831 | 831 | let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
832 | 832 | let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
833 | 833 | let outBalance = if (outInAmountAsset) | |
834 | 834 | then amBalanceOld | |
835 | 835 | else prBalanceOld | |
836 | 836 | let outBalanceBigInt = toBigInt(outBalance) | |
837 | 837 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
838 | 838 | let redeemedBigInt = toBigInt(paymentAmount) | |
839 | 839 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
840 | 840 | let $t03742437480 = takeFee(amountRaw, outFee) | |
841 | 841 | let totalAmount = $t03742437480._1 | |
842 | 842 | let feeAmount = $t03742437480._2 | |
843 | 843 | let $t03748437710 = if (outInAmountAsset) | |
844 | 844 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
845 | 845 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
846 | 846 | let outAmAmount = $t03748437710._1 | |
847 | 847 | let outPrAmount = $t03748437710._2 | |
848 | 848 | let amBalanceNew = $t03748437710._3 | |
849 | 849 | let prBalanceNew = $t03748437710._4 | |
850 | 850 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
851 | 851 | let priceNew = fromX18(priceNewX18, scale8) | |
852 | 852 | let commonState = if (isEval) | |
853 | 853 | then nil | |
854 | 854 | 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)] | |
855 | 855 | let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals)) | |
856 | 856 | let priceOld = fromX18(priceOldX18, scale8) | |
857 | 857 | let loss = { | |
858 | 858 | let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2) | |
859 | 859 | fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset) | |
860 | 860 | } | |
861 | 861 | $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset) | |
862 | 862 | } | |
863 | 863 | else throw("Strict value is not equal to itself.") | |
864 | 864 | } | |
865 | 865 | ||
866 | 866 | ||
867 | 867 | func managerPublicKeyOrUnit () = { | |
868 | 868 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
869 | 869 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
870 | 870 | case s: String => | |
871 | 871 | fromBase58String(s) | |
872 | 872 | case _: Unit => | |
873 | 873 | unit | |
874 | 874 | case _ => | |
875 | 875 | throw("Match error") | |
876 | 876 | } | |
877 | 877 | } | |
878 | 878 | ||
879 | 879 | ||
880 | 880 | func isManager (i) = match managerPublicKeyOrUnit() { | |
881 | 881 | case pk: ByteVector => | |
882 | 882 | (i.callerPublicKey == pk) | |
883 | 883 | case _: Unit => | |
884 | 884 | (i.caller == this) | |
885 | 885 | case _ => | |
886 | 886 | throw("Match error") | |
887 | 887 | } | |
888 | 888 | ||
889 | 889 | ||
890 | 890 | func mustManager (i) = { | |
891 | 891 | let pd = throw("Permission denied") | |
892 | 892 | match managerPublicKeyOrUnit() { | |
893 | 893 | case pk: ByteVector => | |
894 | 894 | if ((i.callerPublicKey == pk)) | |
895 | 895 | then true | |
896 | 896 | else pd | |
897 | 897 | case _: Unit => | |
898 | 898 | if ((i.caller == this)) | |
899 | 899 | then true | |
900 | 900 | else pd | |
901 | 901 | case _ => | |
902 | 902 | throw("Match error") | |
903 | 903 | } | |
904 | 904 | } | |
905 | 905 | ||
906 | 906 | ||
907 | 907 | @Callable(i) | |
908 | 908 | func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa()))) | |
909 | 909 | ||
910 | 910 | ||
911 | 911 | ||
912 | 912 | @Callable(i) | |
913 | 913 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
914 | 914 | let $t03956839873 = if ((isReverse == false)) | |
915 | 915 | then { | |
916 | 916 | let assetOut = getStringOrFail(this, pa()) | |
917 | 917 | let assetIn = getStringOrFail(this, aa()) | |
918 | 918 | $Tuple2(assetOut, assetIn) | |
919 | 919 | } | |
920 | 920 | else { | |
921 | 921 | let assetOut = getStringOrFail(this, aa()) | |
922 | 922 | let assetIn = getStringOrFail(this, pa()) | |
923 | 923 | $Tuple2(assetOut, assetIn) | |
924 | 924 | } | |
925 | 925 | let assetOut = $t03956839873._1 | |
926 | 926 | let assetIn = $t03956839873._2 | |
927 | 927 | let poolAssetInBalance = getAccBalance(assetIn) | |
928 | 928 | let poolAssetOutBalance = getAccBalance(assetOut) | |
929 | 929 | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
930 | 930 | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
931 | 931 | let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
932 | 932 | let checkK = if ((newK >= oldK)) | |
933 | 933 | then true | |
934 | 934 | else throw("new K is fewer error") | |
935 | 935 | if ((checkK == checkK)) | |
936 | 936 | then $Tuple2(nil, amountOut) | |
937 | 937 | else throw("Strict value is not equal to itself.") | |
938 | 938 | } | |
939 | 939 | ||
940 | 940 | ||
941 | 941 | ||
942 | 942 | @Callable(i) | |
943 | 943 | func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = { | |
944 | 944 | let swapContact = { | |
945 | 945 | let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil) | |
946 | 946 | if ($isInstanceOf(@, "String")) | |
947 | 947 | then @ | |
948 | 948 | else throw(($getType(@) + " couldn't be cast to String")) | |
949 | 949 | } | |
950 | 950 | let isPoolSwapDisabled = { | |
951 | 951 | let @ = invoke(factoryContract, "isPoolSwapDisabledREADONLY", [toString(this)], nil) | |
952 | 952 | if ($isInstanceOf(@, "Boolean")) | |
953 | 953 | then @ | |
954 | 954 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
955 | 955 | } | |
956 | 956 | let isSwapDisabled = if (if (isGlobalShutdown()) | |
957 | 957 | then true | |
958 | 958 | else (cfgPoolStatus == PoolShutdown)) | |
959 | 959 | then true | |
960 | 960 | else isPoolSwapDisabled | |
961 | 961 | let checks = [if (if (!(isSwapDisabled)) | |
962 | 962 | then true | |
963 | 963 | else isManager(i)) | |
964 | 964 | then true | |
965 | 965 | else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
966 | 966 | then true | |
967 | 967 | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
968 | 968 | then true | |
969 | 969 | else throwErr("Permission denied")] | |
970 | 970 | if ((checks == checks)) | |
971 | 971 | then { | |
972 | 972 | let pmt = value(i.payments[0]) | |
973 | 973 | let assetIn = assetIdToString(pmt.assetId) | |
974 | 974 | let assetOut = if ((isReverse == false)) | |
975 | 975 | then getStringOrFail(this, pa()) | |
976 | 976 | else getStringOrFail(this, aa()) | |
977 | 977 | let poolAssetInBalance = ((getAccBalance(assetIn) - value(i.payments[0]).amount) - feePoolAmount) | |
978 | 978 | let poolAssetOutBalance = getAccBalance(assetOut) | |
979 | 979 | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
980 | 980 | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
981 | 981 | let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
982 | 982 | let checkK = if ((newK >= oldK)) | |
983 | 983 | then true | |
984 | 984 | else throw("new K is fewer error") | |
985 | 985 | if ((checkK == checkK)) | |
986 | 986 | then { | |
987 | 987 | let checkMin = if ((amountOut >= amountOutMin)) | |
988 | 988 | then true | |
989 | 989 | else throw("Exchange result is fewer coins than expected") | |
990 | 990 | if ((checkMin == checkMin)) | |
991 | 991 | then { | |
992 | 992 | let amountAssetBalanceDelta = if (isReverse) | |
993 | 993 | then -(amountOut) | |
994 | 994 | else feePoolAmount | |
995 | 995 | let priceAssetBalanceDelta = if (isReverse) | |
996 | 996 | then feePoolAmount | |
997 | 997 | else -(amountOut) | |
998 | 998 | let refreshKLpActions = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1 | |
999 | 999 | if ((refreshKLpActions == refreshKLpActions)) | |
1000 | 1000 | then { | |
1001 | 1001 | let rebalanceState = rebalanceAsset(assetIn) | |
1002 | 1002 | if ((rebalanceState == rebalanceState)) | |
1003 | 1003 | then { | |
1004 | 1004 | let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut) | |
1005 | 1005 | if ((withdrawState == withdrawState)) | |
1006 | 1006 | then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut) | |
1007 | 1007 | else throw("Strict value is not equal to itself.") | |
1008 | 1008 | } | |
1009 | 1009 | else throw("Strict value is not equal to itself.") | |
1010 | 1010 | } | |
1011 | 1011 | else throw("Strict value is not equal to itself.") | |
1012 | 1012 | } | |
1013 | 1013 | else throw("Strict value is not equal to itself.") | |
1014 | 1014 | } | |
1015 | 1015 | else throw("Strict value is not equal to itself.") | |
1016 | 1016 | } | |
1017 | 1017 | else throw("Strict value is not equal to itself.") | |
1018 | 1018 | } | |
1019 | 1019 | ||
1020 | 1020 | ||
1021 | 1021 | ||
1022 | 1022 | @Callable(i) | |
1023 | 1023 | func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance)) | |
1024 | 1024 | then throw("Invalid slippageTolerance passed") | |
1025 | 1025 | else { | |
1026 | 1026 | let estPut = commonPut(i, slippageTolerance, true) | |
1027 | 1027 | let emitLpAmt = estPut._2 | |
1028 | 1028 | let lpAssetId = estPut._7 | |
1029 | 1029 | let state = estPut._9 | |
1030 | 1030 | let amDiff = estPut._10 | |
1031 | 1031 | let prDiff = estPut._11 | |
1032 | 1032 | let amId = estPut._12 | |
1033 | 1033 | let prId = estPut._13 | |
1034 | 1034 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1035 | 1035 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1036 | 1036 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1037 | 1037 | if ((currentKLp == currentKLp)) | |
1038 | 1038 | then { | |
1039 | 1039 | let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil) | |
1040 | 1040 | if ((emitInv == emitInv)) | |
1041 | 1041 | then { | |
1042 | 1042 | let emitInvLegacy = match emitInv { | |
1043 | 1043 | case legacyFactoryContract: Address => | |
1044 | 1044 | invoke(legacyFactoryContract, "emit", [emitLpAmt], nil) | |
1045 | 1045 | case _ => | |
1046 | 1046 | unit | |
1047 | 1047 | } | |
1048 | 1048 | if ((emitInvLegacy == emitInvLegacy)) | |
1049 | 1049 | then { | |
1050 | 1050 | let slippageAInv = if ((amDiff > 0)) | |
1051 | 1051 | then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)]) | |
1052 | 1052 | else nil | |
1053 | 1053 | if ((slippageAInv == slippageAInv)) | |
1054 | 1054 | then { | |
1055 | 1055 | let slippagePInv = if ((prDiff > 0)) | |
1056 | 1056 | then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)]) | |
1057 | 1057 | else nil | |
1058 | 1058 | if ((slippagePInv == slippagePInv)) | |
1059 | 1059 | then { | |
1060 | 1060 | let lpTransfer = if (shouldAutoStake) | |
1061 | 1061 | then { | |
1062 | 1062 | let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
1063 | 1063 | if ((slpStakeInv == slpStakeInv)) | |
1064 | 1064 | then nil | |
1065 | 1065 | else throw("Strict value is not equal to itself.") | |
1066 | 1066 | } | |
1067 | 1067 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1068 | 1068 | let $t04500745469 = refreshKLpInternal(0, 0, 0) | |
1069 | 1069 | if (($t04500745469 == $t04500745469)) | |
1070 | 1070 | then { | |
1071 | 1071 | let updatedKLp = $t04500745469._2 | |
1072 | 1072 | let refreshKLpActions = $t04500745469._1 | |
1073 | 1073 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1074 | 1074 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1075 | 1075 | then { | |
1076 | 1076 | let reb = invoke(this, "rebalance", nil, nil) | |
1077 | 1077 | if ((reb == reb)) | |
1078 | 1078 | then ((state ++ lpTransfer) ++ refreshKLpActions) | |
1079 | 1079 | else throw("Strict value is not equal to itself.") | |
1080 | 1080 | } | |
1081 | 1081 | else throw("Strict value is not equal to itself.") | |
1082 | 1082 | } | |
1083 | 1083 | else throw("Strict value is not equal to itself.") | |
1084 | 1084 | } | |
1085 | 1085 | else throw("Strict value is not equal to itself.") | |
1086 | 1086 | } | |
1087 | 1087 | else throw("Strict value is not equal to itself.") | |
1088 | 1088 | } | |
1089 | 1089 | else throw("Strict value is not equal to itself.") | |
1090 | 1090 | } | |
1091 | 1091 | else throw("Strict value is not equal to itself.") | |
1092 | 1092 | } | |
1093 | 1093 | else throw("Strict value is not equal to itself.") | |
1094 | 1094 | } | |
1095 | 1095 | ||
1096 | 1096 | ||
1097 | 1097 | ||
1098 | 1098 | @Callable(i) | |
1099 | 1099 | func putForFree (maxSlippage) = if ((0 > maxSlippage)) | |
1100 | 1100 | then throw("Invalid value passed") | |
1101 | 1101 | else { | |
1102 | 1102 | let estPut = commonPut(i, maxSlippage, false) | |
1103 | 1103 | let state = estPut._9 | |
1104 | 1104 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1105 | 1105 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1106 | 1106 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1107 | 1107 | if ((currentKLp == currentKLp)) | |
1108 | 1108 | then { | |
1109 | 1109 | let $t04608146146 = refreshKLpInternal(0, 0, 0) | |
1110 | 1110 | let refreshKLpActions = $t04608146146._1 | |
1111 | 1111 | let updatedKLp = $t04608146146._2 | |
1112 | 1112 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1113 | 1113 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1114 | 1114 | then (state ++ refreshKLpActions) | |
1115 | 1115 | else throw("Strict value is not equal to itself.") | |
1116 | 1116 | } | |
1117 | 1117 | else throw("Strict value is not equal to itself.") | |
1118 | 1118 | } | |
1119 | 1119 | ||
1120 | 1120 | ||
1121 | 1121 | ||
1122 | 1122 | @Callable(i) | |
1123 | 1123 | func putOneTkn (minOutAmount,autoStake) = { | |
1124 | 1124 | let isPoolOneTokenOperationsDisabled = { | |
1125 | 1125 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1126 | 1126 | if ($isInstanceOf(@, "Boolean")) | |
1127 | 1127 | then @ | |
1128 | 1128 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1129 | 1129 | } | |
1130 | 1130 | let isPutDisabled = if (if (if (isGlobalShutdown()) | |
1131 | 1131 | then true | |
1132 | 1132 | else (cfgPoolStatus == PoolPutDisabled)) | |
1133 | 1133 | then true | |
1134 | 1134 | else (cfgPoolStatus == PoolShutdown)) | |
1135 | 1135 | then true | |
1136 | 1136 | else isPoolOneTokenOperationsDisabled | |
1137 | 1137 | let checks = [if (if (!(isPutDisabled)) | |
1138 | 1138 | then true | |
1139 | 1139 | else isManager(i)) | |
1140 | 1140 | then true | |
1141 | 1141 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1142 | 1142 | then true | |
1143 | 1143 | else throwErr("exactly 1 payment are expected")] | |
1144 | 1144 | if ((checks == checks)) | |
1145 | 1145 | then { | |
1146 | 1146 | let payment = i.payments[0] | |
1147 | 1147 | let paymentAssetId = payment.assetId | |
1148 | 1148 | let paymentAmountRaw = payment.amount | |
1149 | 1149 | let currentKLp = if ((paymentAssetId == cfgAmountAssetId)) | |
1150 | 1150 | then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0)) | |
1151 | 1151 | else if ((paymentAssetId == cfgPriceAssetId)) | |
1152 | 1152 | then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0)) | |
1153 | 1153 | else throwErr("payment asset is not supported") | |
1154 | 1154 | if ((currentKLp == currentKLp)) | |
1155 | 1155 | then { | |
1156 | 1156 | let userAddress = i.caller | |
1157 | 1157 | let txId = i.transactionId | |
1158 | 1158 | let $t04733447486 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
1159 | 1159 | if (($t04733447486 == $t04733447486)) | |
1160 | 1160 | then { | |
1161 | 1161 | let paymentInAmountAsset = $t04733447486._5 | |
1162 | 1162 | let bonus = $t04733447486._4 | |
1163 | 1163 | let feeAmount = $t04733447486._3 | |
1164 | 1164 | let commonState = $t04733447486._2 | |
1165 | 1165 | let emitAmountEstimated = $t04733447486._1 | |
1166 | 1166 | let emitAmount = if (if ((minOutAmount > 0)) | |
1167 | 1167 | then (minOutAmount > emitAmountEstimated) | |
1168 | 1168 | else false) | |
1169 | 1169 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1170 | 1170 | else emitAmountEstimated | |
1171 | 1171 | let emitInv = emit(emitAmount) | |
1172 | 1172 | if ((emitInv == emitInv)) | |
1173 | 1173 | then { | |
1174 | 1174 | let lpTransfer = if (autoStake) | |
1175 | 1175 | then { | |
1176 | 1176 | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
1177 | 1177 | if ((stakeInv == stakeInv)) | |
1178 | 1178 | then nil | |
1179 | 1179 | else throw("Strict value is not equal to itself.") | |
1180 | 1180 | } | |
1181 | 1181 | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
1182 | 1182 | let sendFee = if ((feeAmount > 0)) | |
1183 | 1183 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
1184 | 1184 | else nil | |
1185 | 1185 | let $t04807248269 = if ((this == feeCollectorAddress)) | |
1186 | 1186 | then $Tuple2(0, 0) | |
1187 | 1187 | else if (paymentInAmountAsset) | |
1188 | 1188 | then $Tuple2(-(feeAmount), 0) | |
1189 | 1189 | else $Tuple2(0, -(feeAmount)) | |
1190 | 1190 | let amountAssetBalanceDelta = $t04807248269._1 | |
1191 | 1191 | let priceAssetBalanceDelta = $t04807248269._2 | |
1192 | 1192 | let $t04827248380 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1193 | 1193 | let refreshKLpActions = $t04827248380._1 | |
1194 | 1194 | let updatedKLp = $t04827248380._2 | |
1195 | 1195 | let kLp = value(getString(keyKLp)) | |
1196 | 1196 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1197 | 1197 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1198 | 1198 | then { | |
1199 | 1199 | let reb = invoke(this, "rebalance", nil, nil) | |
1200 | 1200 | if ((reb == reb)) | |
1201 | 1201 | then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount) | |
1202 | 1202 | else throw("Strict value is not equal to itself.") | |
1203 | 1203 | } | |
1204 | 1204 | else throw("Strict value is not equal to itself.") | |
1205 | 1205 | } | |
1206 | 1206 | else throw("Strict value is not equal to itself.") | |
1207 | 1207 | } | |
1208 | 1208 | else throw("Strict value is not equal to itself.") | |
1209 | 1209 | } | |
1210 | 1210 | else throw("Strict value is not equal to itself.") | |
1211 | 1211 | } | |
1212 | 1212 | else throw("Strict value is not equal to itself.") | |
1213 | 1213 | } | |
1214 | 1214 | ||
1215 | 1215 | ||
1216 | 1216 | ||
1217 | 1217 | @Callable(i) | |
1218 | 1218 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
1219 | 1219 | let $t04873548892 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
1220 | 1220 | let emitAmountEstimated = $t04873548892._1 | |
1221 | 1221 | let commonState = $t04873548892._2 | |
1222 | 1222 | let feeAmount = $t04873548892._3 | |
1223 | 1223 | let bonus = $t04873548892._4 | |
1224 | 1224 | let paymentInAmountAsset = $t04873548892._5 | |
1225 | 1225 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
1226 | 1226 | } | |
1227 | 1227 | ||
1228 | 1228 | ||
1229 | 1229 | ||
1230 | 1230 | @Callable(i) | |
1231 | 1231 | func getOneTkn (outAssetIdStr,minOutAmount) = { | |
1232 | 1232 | let isPoolOneTokenOperationsDisabled = { | |
1233 | 1233 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1234 | 1234 | if ($isInstanceOf(@, "Boolean")) | |
1235 | 1235 | then @ | |
1236 | 1236 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1237 | 1237 | } | |
1238 | 1238 | let isGetDisabled = if (if (isGlobalShutdown()) | |
1239 | 1239 | then true | |
1240 | 1240 | else (cfgPoolStatus == PoolShutdown)) | |
1241 | 1241 | then true | |
1242 | 1242 | else isPoolOneTokenOperationsDisabled | |
1243 | 1243 | let checks = [if (if (!(isGetDisabled)) | |
1244 | 1244 | then true | |
1245 | 1245 | else isManager(i)) | |
1246 | 1246 | then true | |
1247 | 1247 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1248 | 1248 | then true | |
1249 | 1249 | else throwErr("exactly 1 payment are expected")] | |
1250 | 1250 | if ((checks == checks)) | |
1251 | 1251 | then { | |
1252 | 1252 | let outAssetId = parseAssetId(outAssetIdStr) | |
1253 | 1253 | let payment = i.payments[0] | |
1254 | 1254 | let paymentAssetId = payment.assetId | |
1255 | 1255 | let paymentAmount = payment.amount | |
1256 | 1256 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1257 | 1257 | if ((currentKLp == currentKLp)) | |
1258 | 1258 | then { | |
1259 | 1259 | let userAddress = i.caller | |
1260 | 1260 | let txId = i.transactionId | |
1261 | 1261 | let $t04977749930 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
1262 | 1262 | if (($t04977749930 == $t04977749930)) | |
1263 | 1263 | then { | |
1264 | 1264 | let outInAmountAsset = $t04977749930._5 | |
1265 | 1265 | let bonus = $t04977749930._4 | |
1266 | 1266 | let feeAmount = $t04977749930._3 | |
1267 | 1267 | let commonState = $t04977749930._2 | |
1268 | 1268 | let amountEstimated = $t04977749930._1 | |
1269 | 1269 | let amount = if (if ((minOutAmount > 0)) | |
1270 | 1270 | then (minOutAmount > amountEstimated) | |
1271 | 1271 | else false) | |
1272 | 1272 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1273 | 1273 | else amountEstimated | |
1274 | 1274 | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
1275 | 1275 | if ((burnInv == burnInv)) | |
1276 | 1276 | then { | |
1277 | 1277 | let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount]))) | |
1278 | 1278 | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
1279 | 1279 | let sendFee = if ((feeAmount > 0)) | |
1280 | 1280 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1281 | 1281 | else nil | |
1282 | 1282 | let $t05059450841 = { | |
1283 | 1283 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1284 | 1284 | then 0 | |
1285 | 1285 | else feeAmount | |
1286 | 1286 | if (outInAmountAsset) | |
1287 | 1287 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1288 | 1288 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1289 | 1289 | } | |
1290 | 1290 | let amountAssetBalanceDelta = $t05059450841._1 | |
1291 | 1291 | let priceAssetBalanceDelta = $t05059450841._2 | |
1292 | 1292 | let $t05084450952 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1293 | 1293 | let refreshKLpActions = $t05084450952._1 | |
1294 | 1294 | let updatedKLp = $t05084450952._2 | |
1295 | 1295 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1296 | 1296 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1297 | 1297 | then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1298 | 1298 | else throw("Strict value is not equal to itself.") | |
1299 | 1299 | } | |
1300 | 1300 | else throw("Strict value is not equal to itself.") | |
1301 | 1301 | } | |
1302 | 1302 | else throw("Strict value is not equal to itself.") | |
1303 | 1303 | } | |
1304 | 1304 | else throw("Strict value is not equal to itself.") | |
1305 | 1305 | } | |
1306 | 1306 | else throw("Strict value is not equal to itself.") | |
1307 | 1307 | } | |
1308 | 1308 | ||
1309 | 1309 | ||
1310 | 1310 | ||
1311 | 1311 | @Callable(i) | |
1312 | 1312 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
1313 | 1313 | let $t05123051386 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
1314 | 1314 | let amountEstimated = $t05123051386._1 | |
1315 | 1315 | let commonState = $t05123051386._2 | |
1316 | 1316 | let feeAmount = $t05123051386._3 | |
1317 | 1317 | let bonus = $t05123051386._4 | |
1318 | 1318 | let outInAmountAsset = $t05123051386._5 | |
1319 | 1319 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
1320 | 1320 | } | |
1321 | 1321 | ||
1322 | 1322 | ||
1323 | 1323 | ||
1324 | 1324 | @Callable(i) | |
1325 | 1325 | func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = { | |
1326 | 1326 | let isPoolOneTokenOperationsDisabled = { | |
1327 | 1327 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1328 | 1328 | if ($isInstanceOf(@, "Boolean")) | |
1329 | 1329 | then @ | |
1330 | 1330 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1331 | 1331 | } | |
1332 | 1332 | let isGetDisabled = if (if (isGlobalShutdown()) | |
1333 | 1333 | then true | |
1334 | 1334 | else (cfgPoolStatus == PoolShutdown)) | |
1335 | 1335 | then true | |
1336 | 1336 | else isPoolOneTokenOperationsDisabled | |
1337 | 1337 | let checks = [if (if (!(isGetDisabled)) | |
1338 | 1338 | then true | |
1339 | 1339 | else isManager(i)) | |
1340 | 1340 | then true | |
1341 | 1341 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1342 | 1342 | then true | |
1343 | 1343 | else throwErr("no payments are expected")] | |
1344 | 1344 | if ((checks == checks)) | |
1345 | 1345 | then { | |
1346 | 1346 | let outAssetId = parseAssetId(outAssetIdStr) | |
1347 | 1347 | let userAddress = i.caller | |
1348 | 1348 | let txId = i.transactionId | |
1349 | 1349 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1350 | 1350 | if ((currentKLp == currentKLp)) | |
1351 | 1351 | then { | |
1352 | 1352 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1353 | 1353 | if ((unstakeInv == unstakeInv)) | |
1354 | 1354 | then { | |
1355 | 1355 | let $t05229152442 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1356 | 1356 | if (($t05229152442 == $t05229152442)) | |
1357 | 1357 | then { | |
1358 | 1358 | let outInAmountAsset = $t05229152442._5 | |
1359 | 1359 | let bonus = $t05229152442._4 | |
1360 | 1360 | let feeAmount = $t05229152442._3 | |
1361 | 1361 | let commonState = $t05229152442._2 | |
1362 | 1362 | let amountEstimated = $t05229152442._1 | |
1363 | 1363 | let amount = if (if ((minOutAmount > 0)) | |
1364 | 1364 | then (minOutAmount > amountEstimated) | |
1365 | 1365 | else false) | |
1366 | 1366 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1367 | 1367 | else amountEstimated | |
1368 | 1368 | let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1369 | 1369 | if ((burnInv == burnInv)) | |
1370 | 1370 | then { | |
1371 | 1371 | let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount]))) | |
1372 | 1372 | let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)] | |
1373 | 1373 | let sendFee = if ((feeAmount > 0)) | |
1374 | 1374 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1375 | 1375 | else nil | |
1376 | 1376 | let $t05310153348 = { | |
1377 | 1377 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1378 | 1378 | then 0 | |
1379 | 1379 | else feeAmount | |
1380 | 1380 | if (outInAmountAsset) | |
1381 | 1381 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1382 | 1382 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1383 | 1383 | } | |
1384 | 1384 | let amountAssetBalanceDelta = $t05310153348._1 | |
1385 | 1385 | let priceAssetBalanceDelta = $t05310153348._2 | |
1386 | 1386 | let $t05335153459 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1387 | 1387 | let refreshKLpActions = $t05335153459._1 | |
1388 | 1388 | let updatedKLp = $t05335153459._2 | |
1389 | 1389 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1390 | 1390 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1391 | 1391 | then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1392 | 1392 | else throw("Strict value is not equal to itself.") | |
1393 | 1393 | } | |
1394 | 1394 | else throw("Strict value is not equal to itself.") | |
1395 | 1395 | } | |
1396 | 1396 | else throw("Strict value is not equal to itself.") | |
1397 | 1397 | } | |
1398 | 1398 | else throw("Strict value is not equal to itself.") | |
1399 | 1399 | } | |
1400 | 1400 | else throw("Strict value is not equal to itself.") | |
1401 | 1401 | } | |
1402 | 1402 | else throw("Strict value is not equal to itself.") | |
1403 | 1403 | } | |
1404 | 1404 | ||
1405 | 1405 | ||
1406 | 1406 | ||
1407 | 1407 | @Callable(i) | |
1408 | 1408 | func get () = { | |
1409 | 1409 | let res = commonGet(i) | |
1410 | 1410 | let outAmAmt = res._1 | |
1411 | 1411 | let outPrAmt = res._2 | |
1412 | 1412 | let pmtAmt = res._3 | |
1413 | 1413 | let pmtAssetId = res._4 | |
1414 | 1414 | let state = res._5 | |
1415 | 1415 | let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt) | |
1416 | 1416 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1417 | 1417 | if ((currentKLp == currentKLp)) | |
1418 | 1418 | then { | |
1419 | 1419 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1420 | 1420 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1421 | 1421 | then { | |
1422 | 1422 | let $t05455454635 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1423 | 1423 | let refreshKLpActions = $t05455454635._1 | |
1424 | 1424 | let updatedKLp = $t05455454635._2 | |
1425 | 1425 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1426 | 1426 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1427 | 1427 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1428 | 1428 | else throw("Strict value is not equal to itself.") | |
1429 | 1429 | } | |
1430 | 1430 | else throw("Strict value is not equal to itself.") | |
1431 | 1431 | } | |
1432 | 1432 | else throw("Strict value is not equal to itself.") | |
1433 | 1433 | } | |
1434 | 1434 | ||
1435 | 1435 | ||
1436 | 1436 | ||
1437 | 1437 | @Callable(i) | |
1438 | 1438 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1439 | 1439 | let res = commonGet(i) | |
1440 | 1440 | let outAmAmt = res._1 | |
1441 | 1441 | let outPrAmt = res._2 | |
1442 | 1442 | let pmtAmt = res._3 | |
1443 | 1443 | let pmtAssetId = res._4 | |
1444 | 1444 | let state = res._5 | |
1445 | 1445 | if ((noLessThenAmtAsset > outAmAmt)) | |
1446 | 1446 | then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1447 | 1447 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1448 | 1448 | then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1449 | 1449 | else { | |
1450 | 1450 | let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt) | |
1451 | 1451 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1452 | 1452 | if ((currentKLp == currentKLp)) | |
1453 | 1453 | then { | |
1454 | 1454 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1455 | 1455 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1456 | 1456 | then { | |
1457 | 1457 | let $t05573055811 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1458 | 1458 | let refreshKLpActions = $t05573055811._1 | |
1459 | 1459 | let updatedKLp = $t05573055811._2 | |
1460 | 1460 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1461 | 1461 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1462 | 1462 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1463 | 1463 | else throw("Strict value is not equal to itself.") | |
1464 | 1464 | } | |
1465 | 1465 | else throw("Strict value is not equal to itself.") | |
1466 | 1466 | } | |
1467 | 1467 | else throw("Strict value is not equal to itself.") | |
1468 | 1468 | } | |
1469 | 1469 | } | |
1470 | 1470 | ||
1471 | 1471 | ||
1472 | 1472 | ||
1473 | 1473 | @Callable(i) | |
1474 | 1474 | func unstakeAndGet (amount) = { | |
1475 | 1475 | let checkPayments = if ((size(i.payments) != 0)) | |
1476 | 1476 | then throw("No payments are expected") | |
1477 | 1477 | else true | |
1478 | 1478 | if ((checkPayments == checkPayments)) | |
1479 | 1479 | then { | |
1480 | 1480 | let cfg = getPoolConfig() | |
1481 | 1481 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1482 | 1482 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1483 | 1483 | if ((currentKLp == currentKLp)) | |
1484 | 1484 | then { | |
1485 | 1485 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1486 | 1486 | if ((unstakeInv == unstakeInv)) | |
1487 | 1487 | then { | |
1488 | 1488 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1489 | 1489 | let outAmAmt = res._1 | |
1490 | 1490 | let outPrAmt = res._2 | |
1491 | 1491 | let poolStatus = parseIntValue(res._9) | |
1492 | 1492 | let state = res._10 | |
1493 | 1493 | let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt) | |
1494 | 1494 | let checkPoolStatus = if (if (isGlobalShutdown()) | |
1495 | 1495 | then true | |
1496 | 1496 | else (poolStatus == PoolShutdown)) | |
1497 | 1497 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
1498 | 1498 | else true | |
1499 | 1499 | if ((checkPoolStatus == checkPoolStatus)) | |
1500 | 1500 | then { | |
1501 | 1501 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1502 | 1502 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1503 | 1503 | then { | |
1504 | 1504 | let $t05708357164 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1505 | 1505 | let refreshKLpActions = $t05708357164._1 | |
1506 | 1506 | let updatedKLp = $t05708357164._2 | |
1507 | 1507 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1508 | 1508 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1509 | 1509 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1510 | 1510 | else throw("Strict value is not equal to itself.") | |
1511 | 1511 | } | |
1512 | 1512 | else throw("Strict value is not equal to itself.") | |
1513 | 1513 | } | |
1514 | 1514 | else throw("Strict value is not equal to itself.") | |
1515 | 1515 | } | |
1516 | 1516 | else throw("Strict value is not equal to itself.") | |
1517 | 1517 | } | |
1518 | 1518 | else throw("Strict value is not equal to itself.") | |
1519 | 1519 | } | |
1520 | 1520 | else throw("Strict value is not equal to itself.") | |
1521 | 1521 | } | |
1522 | 1522 | ||
1523 | 1523 | ||
1524 | 1524 | ||
1525 | 1525 | @Callable(i) | |
1526 | 1526 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1527 | 1527 | let isGetDisabled = if (isGlobalShutdown()) | |
1528 | 1528 | then true | |
1529 | 1529 | else (cfgPoolStatus == PoolShutdown) | |
1530 | 1530 | let checks = [if (!(isGetDisabled)) | |
1531 | 1531 | then true | |
1532 | 1532 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1533 | 1533 | then true | |
1534 | 1534 | else throw("no payments are expected")] | |
1535 | 1535 | if ((checks == checks)) | |
1536 | 1536 | then { | |
1537 | 1537 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1538 | 1538 | if ((currentKLp == currentKLp)) | |
1539 | 1539 | then { | |
1540 | 1540 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1541 | 1541 | if ((unstakeInv == unstakeInv)) | |
1542 | 1542 | then { | |
1543 | 1543 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1544 | 1544 | let outAmAmt = res._1 | |
1545 | 1545 | let outPrAmt = res._2 | |
1546 | 1546 | let state = res._10 | |
1547 | 1547 | let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt) | |
1548 | 1548 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1549 | 1549 | then true | |
1550 | 1550 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1551 | 1551 | then true | |
1552 | 1552 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1553 | 1553 | if ((checkAmounts == checkAmounts)) | |
1554 | 1554 | then { | |
1555 | 1555 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1556 | 1556 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1557 | 1557 | then { | |
1558 | 1558 | let $t05860558686 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1559 | 1559 | let refreshKLpActions = $t05860558686._1 | |
1560 | 1560 | let updatedKLp = $t05860558686._2 | |
1561 | 1561 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1562 | 1562 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1563 | 1563 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1564 | 1564 | else throw("Strict value is not equal to itself.") | |
1565 | 1565 | } | |
1566 | 1566 | else throw("Strict value is not equal to itself.") | |
1567 | 1567 | } | |
1568 | 1568 | else throw("Strict value is not equal to itself.") | |
1569 | 1569 | } | |
1570 | 1570 | else throw("Strict value is not equal to itself.") | |
1571 | 1571 | } | |
1572 | 1572 | else throw("Strict value is not equal to itself.") | |
1573 | 1573 | } | |
1574 | 1574 | else throw("Strict value is not equal to itself.") | |
1575 | 1575 | } | |
1576 | 1576 | ||
1577 | 1577 | ||
1578 | 1578 | ||
1579 | 1579 | @Callable(i) | |
1580 | 1580 | func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract))) | |
1581 | 1581 | then throw("permissions denied") | |
1582 | 1582 | else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success") | |
1583 | 1583 | ||
1584 | 1584 | ||
1585 | 1585 | ||
1586 | 1586 | @Callable(i) | |
1587 | + | func invert () = { | |
1588 | + | let checks = [if ((i.caller == factoryContract)) | |
1589 | + | then true | |
1590 | + | else throwErr("invalid caller")] | |
1591 | + | if ((checks == checks)) | |
1592 | + | then $Tuple2([StringEntry(aa(), assetIdToString(cfgPriceAssetId)), StringEntry(pa(), assetIdToString(cfgAmountAssetId))], unit) | |
1593 | + | else throw("Strict value is not equal to itself.") | |
1594 | + | } | |
1595 | + | ||
1596 | + | ||
1597 | + | ||
1598 | + | @Callable(i) | |
1587 | 1599 | func refreshKLp () = { | |
1588 | 1600 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0) | |
1589 | 1601 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay)) | |
1590 | 1602 | then unit | |
1591 | 1603 | else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1592 | 1604 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1593 | 1605 | then { | |
1594 | 1606 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1595 | - | let $ | |
1596 | - | let kLpUpdateActions = $ | |
1597 | - | let updatedKLp = $ | |
1607 | + | let $t06014360207 = refreshKLpInternal(0, 0, 0) | |
1608 | + | let kLpUpdateActions = $t06014360207._1 | |
1609 | + | let updatedKLp = $t06014360207._2 | |
1598 | 1610 | let actions = if ((kLp != updatedKLp)) | |
1599 | 1611 | then kLpUpdateActions | |
1600 | 1612 | else throwErr("nothing to refresh") | |
1601 | 1613 | $Tuple2(actions, toString(updatedKLp)) | |
1602 | 1614 | } | |
1603 | 1615 | else throw("Strict value is not equal to itself.") | |
1604 | 1616 | } | |
1605 | 1617 | ||
1606 | 1618 | ||
1607 | 1619 | ||
1608 | 1620 | @Callable(i) | |
1609 | 1621 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig()) | |
1610 | 1622 | ||
1611 | 1623 | ||
1612 | 1624 | ||
1613 | 1625 | @Callable(i) | |
1614 | 1626 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1615 | 1627 | ||
1616 | 1628 | ||
1617 | 1629 | ||
1618 | 1630 | @Callable(i) | |
1619 | 1631 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1620 | 1632 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
1621 | 1633 | $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])]) | |
1622 | 1634 | } | |
1623 | 1635 | ||
1624 | 1636 | ||
1625 | 1637 | ||
1626 | 1638 | @Callable(i) | |
1627 | 1639 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult))) | |
1628 | 1640 | ||
1629 | 1641 | ||
1630 | 1642 | ||
1631 | 1643 | @Callable(i) | |
1632 | 1644 | func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult)) | |
1633 | 1645 | ||
1634 | 1646 | ||
1635 | 1647 | ||
1636 | 1648 | @Callable(i) | |
1637 | 1649 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1638 | 1650 | ||
1639 | 1651 | ||
1640 | 1652 | ||
1641 | 1653 | @Callable(i) | |
1642 | 1654 | func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp)) | |
1643 | 1655 | ||
1644 | 1656 | ||
1645 | 1657 | ||
1646 | 1658 | @Callable(i) | |
1647 | 1659 | func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
1648 | 1660 | let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress)) | |
1649 | 1661 | $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10)) | |
1650 | 1662 | } | |
1651 | 1663 | ||
1652 | 1664 | ||
1653 | 1665 | ||
1654 | 1666 | @Callable(i) | |
1655 | 1667 | func statsREADONLY () = { | |
1656 | 1668 | let cfg = getPoolConfig() | |
1657 | 1669 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1658 | 1670 | let amtAssetId = cfg[idxAmtAssetId] | |
1659 | 1671 | let priceAssetId = cfg[idxPriceAssetId] | |
1660 | 1672 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
1661 | 1673 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
1662 | 1674 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1663 | 1675 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1664 | 1676 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1665 | 1677 | let accAmtAssetBalance = getAccBalance(amtAssetId) | |
1666 | 1678 | let accPriceAssetBalance = getAccBalance(priceAssetId) | |
1667 | 1679 | let pricesList = if ((poolLPBalance == 0)) | |
1668 | 1680 | then [zeroBigInt, zeroBigInt, zeroBigInt] | |
1669 | 1681 | else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance) | |
1670 | 1682 | let curPrice = 0 | |
1671 | 1683 | let lpAmtAssetShare = fromX18(pricesList[1], scale8) | |
1672 | 1684 | let lpPriceAssetShare = fromX18(pricesList[2], scale8) | |
1673 | 1685 | let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this)))) | |
1674 | 1686 | $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)) | |
1675 | 1687 | } | |
1676 | 1688 | ||
1677 | 1689 | ||
1678 | 1690 | ||
1679 | 1691 | @Callable(i) | |
1680 | 1692 | func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = { | |
1681 | 1693 | let cfg = getPoolConfig() | |
1682 | 1694 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1683 | 1695 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1684 | 1696 | let amAssetId = fromBase58String(amAssetIdStr) | |
1685 | 1697 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1686 | 1698 | let prAssetId = fromBase58String(prAssetIdStr) | |
1687 | 1699 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1688 | 1700 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1689 | 1701 | let poolStatus = cfg[idxPoolStatus] | |
1690 | 1702 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1691 | 1703 | let accAmtAssetBalance = getAccBalance(amAssetIdStr) | |
1692 | 1704 | let accPriceAssetBalance = getAccBalance(prAssetIdStr) | |
1693 | 1705 | let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm) | |
1694 | 1706 | let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm) | |
1695 | 1707 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1696 | 1708 | then zeroBigInt | |
1697 | 1709 | else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
1698 | 1710 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
1699 | 1711 | let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
1700 | 1712 | let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm) | |
1701 | 1713 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1702 | 1714 | let calcLpAmt = estPut._1 | |
1703 | 1715 | let curPriceCalc = estPut._3 | |
1704 | 1716 | let amBalance = estPut._4 | |
1705 | 1717 | let prBalance = estPut._5 | |
1706 | 1718 | let lpEmission = estPut._6 | |
1707 | 1719 | $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)) | |
1708 | 1720 | } | |
1709 | 1721 | ||
1710 | 1722 | ||
1711 | 1723 | ||
1712 | 1724 | @Callable(i) | |
1713 | 1725 | func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = { | |
1714 | 1726 | let cfg = getPoolConfig() | |
1715 | 1727 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1716 | 1728 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1717 | 1729 | let amAssetId = fromBase58String(amAssetIdStr) | |
1718 | 1730 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1719 | 1731 | let prAssetId = fromBase58String(prAssetIdStr) | |
1720 | 1732 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1721 | 1733 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1722 | 1734 | let poolStatus = cfg[idxPoolStatus] | |
1723 | 1735 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1724 | 1736 | let amBalanceRaw = getAccBalance(amAssetIdStr) | |
1725 | 1737 | let prBalanceRaw = getAccBalance(prAssetIdStr) | |
1726 | 1738 | let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm) | |
1727 | 1739 | let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm) | |
1728 | 1740 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1729 | 1741 | then zeroBigInt | |
1730 | 1742 | else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18) | |
1731 | 1743 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
1732 | 1744 | let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
1733 | 1745 | let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm) | |
1734 | 1746 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1735 | 1747 | let calcLpAmt = estPut._1 | |
1736 | 1748 | let curPriceCalc = estPut._3 | |
1737 | 1749 | let amBalance = estPut._4 | |
1738 | 1750 | let prBalance = estPut._5 | |
1739 | 1751 | let lpEmission = estPut._6 | |
1740 | 1752 | $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)) | |
1741 | 1753 | } | |
1742 | 1754 | ||
1743 | 1755 | ||
1744 | 1756 | ||
1745 | 1757 | @Callable(i) | |
1746 | 1758 | func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = { | |
1747 | 1759 | let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this) | |
1748 | 1760 | let outAmAmt = res._1 | |
1749 | 1761 | let outPrAmt = res._2 | |
1750 | 1762 | let amBalance = res._5 | |
1751 | 1763 | let prBalance = res._6 | |
1752 | 1764 | let lpEmission = res._7 | |
1753 | 1765 | let curPrice = res._8 | |
1754 | 1766 | let poolStatus = parseIntValue(res._9) | |
1755 | 1767 | $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)) | |
1756 | 1768 | } | |
1757 | 1769 | ||
1758 | 1770 | ||
1759 | 1771 | @Verifier(tx) | |
1760 | 1772 | func verify () = { | |
1761 | 1773 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1762 | 1774 | case pk: ByteVector => | |
1763 | 1775 | pk | |
1764 | 1776 | case _: Unit => | |
1765 | 1777 | tx.senderPublicKey | |
1766 | 1778 | case _ => | |
1767 | 1779 | throw("Match error") | |
1768 | 1780 | } | |
1769 | 1781 | match tx { | |
1770 | 1782 | case order: Order => | |
1771 | 1783 | let matcherPub = getMatcherPubOrFail() | |
1772 | - | let $ | |
1784 | + | let $t06886968986 = if (skipOrderValidation()) | |
1773 | 1785 | then $Tuple2(true, "") | |
1774 | 1786 | else validateMatcherOrderAllowed(order) | |
1775 | - | let orderValid = $ | |
1776 | - | let orderValidInfo = $ | |
1787 | + | let orderValid = $t06886968986._1 | |
1788 | + | let orderValidInfo = $t06886968986._2 | |
1777 | 1789 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1778 | 1790 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1779 | 1791 | if (if (if (orderValid) | |
1780 | 1792 | then senderValid | |
1781 | 1793 | else false) | |
1782 | 1794 | then matcherValid | |
1783 | 1795 | else false) | |
1784 | 1796 | then true | |
1785 | 1797 | else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid) | |
1786 | 1798 | case s: SetScriptTransaction => | |
1787 | 1799 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
1788 | 1800 | then true | |
1789 | 1801 | else { | |
1790 | 1802 | let newHash = blake2b256(value(s.script)) | |
1791 | 1803 | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash()))) | |
1792 | 1804 | let currentHash = scriptHash(this) | |
1793 | 1805 | if ((allowedHash == newHash)) | |
1794 | 1806 | then (currentHash != newHash) | |
1795 | 1807 | else false | |
1796 | 1808 | } | |
1797 | 1809 | case _ => | |
1798 | 1810 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1799 | 1811 | } | |
1800 | 1812 | } | |
1801 | 1813 |
github/deemru/w8io/169f3d6 168.83 ms ◑