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