tx · D5NUkZEeMuTpBXah1PAMmWfW3MnvtjKgkJBANnVL75Cm 3N8iNNRC4UfDK4aJctSvHajiZ81fzSumCeP: -0.04300000 Waves 2023.04.05 11:55 [2521031] smart account 3N8iNNRC4UfDK4aJctSvHajiZ81fzSumCeP > SELF 0.00000000 Waves
{ "type": 13, "id": "D5NUkZEeMuTpBXah1PAMmWfW3MnvtjKgkJBANnVL75Cm", "fee": 4300000, "feeAssetId": null, "timestamp": 1680684924510, "version": 2, "chainId": 84, "sender": "3N8iNNRC4UfDK4aJctSvHajiZ81fzSumCeP", "senderPublicKey": "F7NZd812aXMUyDcj1XaB3wgMJXJfUsq3RhPhrEZ9b6ND", "proofs": [ "3AwiVCW9SqFieSZV8Hjq8XS6J6fjoM9gav9hfuQ5Batcr6ZRbjmFFabDt6btbDRd9ULJPoJnZrnVbTqXRuwXuhjb" ], "script": "base64:BgK8NwgCEgASBQoDAQQBEgcKBQEEAQgBEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiE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yBAJiWAUCaWsDCQABAgUCYlgCBU9yZGVyBAJlTAUCYlgEAmluCQECYmQABAJpbwkBAmVLAQUCZUwEAmFLCAUCaW8CXzEEAmFMCAUCaW8CXzIEAmFNCQD0AwMIBQJlTAlib2R5Qnl0ZXMJAJEDAggFAmVMBnByb29mcwAACAUCZUwPc2VuZGVyUHVibGljS2V5BAJhTgkA9AMDCAUCZUwJYm9keUJ5dGVzCQCRAwIIBQJlTAZwcm9vZnMAAQUCaW4DAwMFAmFLBQJhTQcFAmFOBwYJAQJhSgQFAmFLBQJhTAUCYU0FAmFOAwkAAQIFAmJYAhRTZXRTY3JpcHRUcmFuc2FjdGlvbgQCZ2oFAmJYAwkA9AMDCAUCaWsJYm9keUJ5dGVzCQCRAwIIBQJpawZwcm9vZnMAAAUCaW0GBAJpcAkA9gMBCQEFdmFsdWUBCAUCZ2oGc2NyaXB0BAJpcQkA2wQBCQEFdmFsdWUBCQCdCAIFAmFWCQECYUgABAJpcgkA8QcBBQR0aGlzAwkAAAIFAmlxBQJpcAkBAiE9AgUCaXIFAmlwBwkA9AMDCAUCaWsJYm9keUJ5dGVzCQCRAwIIBQJpawZwcm9vZnMAAAUCaW2Yt2P0", "height": 2521031, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GpaGvbTm1qfTceWoVUGx3Kg3wLdDKeXb1dhshkhQ7RJ1 Next: 4yXW7aWGGeGZgqGqA5oDcPjdUFEKJh1JUyeJPBgK8X6M Diff:
Old | New | Differences | |
---|---|---|---|
977 | 977 | else throw("Exchange result is fewer coins than expected") | |
978 | 978 | if ((checkMin == checkMin)) | |
979 | 979 | then { | |
980 | - | let lsConf = match getLeaseProxyConfig(assetOut) { | |
981 | - | case a: (Boolean, Int, Int, String, String, Int, String) => | |
982 | - | a | |
983 | - | case _ => | |
984 | - | throw("error lease config") | |
985 | - | } | |
986 | 980 | let withdrawState = getWithdrawAssetState(assetOut, amountOut) | |
987 | 981 | if ((withdrawState == withdrawState)) | |
988 | 982 | then $Tuple2((withdrawState ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut) | |
1078 | 1072 | else throw("Strict value is not equal to itself.") | |
1079 | 1073 | } | |
1080 | 1074 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1081 | - | let $ | |
1082 | - | if (($ | |
1075 | + | let $t04459045052 = refreshKLpInternal(0, 0, 0) | |
1076 | + | if (($t04459045052 == $t04459045052)) | |
1083 | 1077 | then { | |
1084 | - | let updatedKLp = $ | |
1085 | - | let refreshKLpActions = $ | |
1078 | + | let updatedKLp = $t04459045052._2 | |
1079 | + | let refreshKLpActions = $t04459045052._1 | |
1086 | 1080 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1087 | 1081 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1088 | 1082 | then { | |
1119 | 1113 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1120 | 1114 | if ((currentKLp == currentKLp)) | |
1121 | 1115 | then { | |
1122 | - | let $ | |
1123 | - | let refreshKLpActions = $ | |
1124 | - | let updatedKLp = $ | |
1116 | + | let $t04566445729 = refreshKLpInternal(0, 0, 0) | |
1117 | + | let refreshKLpActions = $t04566445729._1 | |
1118 | + | let updatedKLp = $t04566445729._2 | |
1125 | 1119 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1126 | 1120 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1127 | 1121 | then (state ++ refreshKLpActions) | |
1168 | 1162 | then { | |
1169 | 1163 | let userAddress = i.caller | |
1170 | 1164 | let txId = i.transactionId | |
1171 | - | let $ | |
1172 | - | if (($ | |
1165 | + | let $t04691747069 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
1166 | + | if (($t04691747069 == $t04691747069)) | |
1173 | 1167 | then { | |
1174 | - | let paymentInAmountAsset = $ | |
1175 | - | let bonus = $ | |
1176 | - | let feeAmount = $ | |
1177 | - | let commonState = $ | |
1178 | - | let emitAmountEstimated = $ | |
1168 | + | let paymentInAmountAsset = $t04691747069._5 | |
1169 | + | let bonus = $t04691747069._4 | |
1170 | + | let feeAmount = $t04691747069._3 | |
1171 | + | let commonState = $t04691747069._2 | |
1172 | + | let emitAmountEstimated = $t04691747069._1 | |
1179 | 1173 | let emitAmount = if (if ((minOutAmount > 0)) | |
1180 | 1174 | then (minOutAmount > emitAmountEstimated) | |
1181 | 1175 | else false) | |
1195 | 1189 | let sendFee = if ((feeAmount > 0)) | |
1196 | 1190 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
1197 | 1191 | else nil | |
1198 | - | let $ | |
1192 | + | let $t04765547852 = if ((this == feeCollectorAddress)) | |
1199 | 1193 | then $Tuple2(0, 0) | |
1200 | 1194 | else if (paymentInAmountAsset) | |
1201 | 1195 | then $Tuple2(-(feeAmount), 0) | |
1202 | 1196 | else $Tuple2(0, -(feeAmount)) | |
1203 | - | let amountAssetBalanceDelta = $ | |
1204 | - | let priceAssetBalanceDelta = $ | |
1205 | - | let $ | |
1206 | - | let refreshKLpActions = $ | |
1207 | - | let updatedKLp = $ | |
1197 | + | let amountAssetBalanceDelta = $t04765547852._1 | |
1198 | + | let priceAssetBalanceDelta = $t04765547852._2 | |
1199 | + | let $t04785547963 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1200 | + | let refreshKLpActions = $t04785547963._1 | |
1201 | + | let updatedKLp = $t04785547963._2 | |
1208 | 1202 | let kLp = value(getString(keyKLp)) | |
1209 | 1203 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1210 | 1204 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1229 | 1223 | ||
1230 | 1224 | @Callable(i) | |
1231 | 1225 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
1232 | - | let $ | |
1233 | - | let emitAmountEstimated = $ | |
1234 | - | let commonState = $ | |
1235 | - | let feeAmount = $ | |
1236 | - | let bonus = $ | |
1237 | - | let paymentInAmountAsset = $ | |
1226 | + | let $t04831848475 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
1227 | + | let emitAmountEstimated = $t04831848475._1 | |
1228 | + | let commonState = $t04831848475._2 | |
1229 | + | let feeAmount = $t04831848475._3 | |
1230 | + | let bonus = $t04831848475._4 | |
1231 | + | let paymentInAmountAsset = $t04831848475._5 | |
1238 | 1232 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
1239 | 1233 | } | |
1240 | 1234 | ||
1271 | 1265 | then { | |
1272 | 1266 | let userAddress = i.caller | |
1273 | 1267 | let txId = i.transactionId | |
1274 | - | let $ | |
1275 | - | if (($ | |
1268 | + | let $t04936049513 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
1269 | + | if (($t04936049513 == $t04936049513)) | |
1276 | 1270 | then { | |
1277 | - | let outInAmountAsset = $ | |
1278 | - | let bonus = $ | |
1279 | - | let feeAmount = $ | |
1280 | - | let commonState = $ | |
1281 | - | let amountEstimated = $ | |
1271 | + | let outInAmountAsset = $t04936049513._5 | |
1272 | + | let bonus = $t04936049513._4 | |
1273 | + | let feeAmount = $t04936049513._3 | |
1274 | + | let commonState = $t04936049513._2 | |
1275 | + | let amountEstimated = $t04936049513._1 | |
1282 | 1276 | let amount = if (if ((minOutAmount > 0)) | |
1283 | 1277 | then (minOutAmount > amountEstimated) | |
1284 | 1278 | else false) | |
1285 | 1279 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1286 | 1280 | else amountEstimated | |
1287 | - | let lsConf = match getLeaseProxyConfig(outAssetIdStr) { | |
1288 | - | case a: (Boolean, Int, Int, String, String, Int, String) => | |
1289 | - | a | |
1290 | - | case _ => | |
1291 | - | throw("error lease config") | |
1292 | - | } | |
1293 | 1281 | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
1294 | 1282 | if ((burnInv == burnInv)) | |
1295 | 1283 | then { | |
1300 | 1288 | let sendFee = if ((feeAmount > 0)) | |
1301 | 1289 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1302 | 1290 | else nil | |
1303 | - | let $ | |
1291 | + | let $t05008350330 = { | |
1304 | 1292 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1305 | 1293 | then 0 | |
1306 | 1294 | else feeAmount | |
1308 | 1296 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1309 | 1297 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1310 | 1298 | } | |
1311 | - | let amountAssetBalanceDelta = $ | |
1312 | - | let priceAssetBalanceDelta = $ | |
1313 | - | let $ | |
1314 | - | let refreshKLpActions = $ | |
1315 | - | let updatedKLp = $ | |
1299 | + | let amountAssetBalanceDelta = $t05008350330._1 | |
1300 | + | let priceAssetBalanceDelta = $t05008350330._2 | |
1301 | + | let $t05033350441 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1302 | + | let refreshKLpActions = $t05033350441._1 | |
1303 | + | let updatedKLp = $t05033350441._2 | |
1316 | 1304 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1317 | 1305 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1318 | 1306 | then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1333 | 1321 | ||
1334 | 1322 | @Callable(i) | |
1335 | 1323 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
1336 | - | let $ | |
1337 | - | let amountEstimated = $ | |
1338 | - | let commonState = $ | |
1339 | - | let feeAmount = $ | |
1340 | - | let bonus = $ | |
1341 | - | let outInAmountAsset = $ | |
1324 | + | let $t05071950875 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
1325 | + | let amountEstimated = $t05071950875._1 | |
1326 | + | let commonState = $t05071950875._2 | |
1327 | + | let feeAmount = $t05071950875._3 | |
1328 | + | let bonus = $t05071950875._4 | |
1329 | + | let outInAmountAsset = $t05071950875._5 | |
1342 | 1330 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
1343 | 1331 | } | |
1344 | 1332 | ||
1375 | 1363 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1376 | 1364 | if ((unstakeInv == unstakeInv)) | |
1377 | 1365 | then { | |
1378 | - | let $ | |
1379 | - | if (($ | |
1366 | + | let $t05178051931 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1367 | + | if (($t05178051931 == $t05178051931)) | |
1380 | 1368 | then { | |
1381 | - | let outInAmountAsset = $ | |
1382 | - | let bonus = $ | |
1383 | - | let feeAmount = $ | |
1384 | - | let commonState = $ | |
1385 | - | let amountEstimated = $ | |
1369 | + | let outInAmountAsset = $t05178051931._5 | |
1370 | + | let bonus = $t05178051931._4 | |
1371 | + | let feeAmount = $t05178051931._3 | |
1372 | + | let commonState = $t05178051931._2 | |
1373 | + | let amountEstimated = $t05178051931._1 | |
1386 | 1374 | let amount = if (if ((minOutAmount > 0)) | |
1387 | 1375 | then (minOutAmount > amountEstimated) | |
1388 | 1376 | else false) | |
1398 | 1386 | let sendFee = if ((feeAmount > 0)) | |
1399 | 1387 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1400 | 1388 | else nil | |
1401 | - | let $ | |
1389 | + | let $t05249652743 = { | |
1402 | 1390 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1403 | 1391 | then 0 | |
1404 | 1392 | else feeAmount | |
1406 | 1394 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1407 | 1395 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1408 | 1396 | } | |
1409 | - | let amountAssetBalanceDelta = $ | |
1410 | - | let priceAssetBalanceDelta = $ | |
1411 | - | let $ | |
1412 | - | let refreshKLpActions = $ | |
1413 | - | let updatedKLp = $ | |
1397 | + | let amountAssetBalanceDelta = $t05249652743._1 | |
1398 | + | let priceAssetBalanceDelta = $t05249652743._2 | |
1399 | + | let $t05274652854 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1400 | + | let refreshKLpActions = $t05274652854._1 | |
1401 | + | let updatedKLp = $t05274652854._2 | |
1414 | 1402 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1415 | 1403 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1416 | 1404 | then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1445 | 1433 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1446 | 1434 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1447 | 1435 | then { | |
1448 | - | let $ | |
1449 | - | let refreshKLpActions = $ | |
1450 | - | let updatedKLp = $ | |
1436 | + | let $t05382153903 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1437 | + | let refreshKLpActions = $t05382153903._1 | |
1438 | + | let updatedKLp = $t05382153903._2 | |
1451 | 1439 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1452 | 1440 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1453 | 1441 | then (state ++ refreshKLpActions) | |
1479 | 1467 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1480 | 1468 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1481 | 1469 | then { | |
1482 | - | let $ | |
1483 | - | let refreshKLpActions = $ | |
1484 | - | let updatedKLp = $ | |
1470 | + | let $t05485254933 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1471 | + | let refreshKLpActions = $t05485254933._1 | |
1472 | + | let updatedKLp = $t05485254933._2 | |
1485 | 1473 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1486 | 1474 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1487 | 1475 | then (state ++ refreshKLpActions) | |
1525 | 1513 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1526 | 1514 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1527 | 1515 | then { | |
1528 | - | let $ | |
1529 | - | let refreshKLpActions = $ | |
1530 | - | let updatedKLp = $ | |
1516 | + | let $t05605956140 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1517 | + | let refreshKLpActions = $t05605956140._1 | |
1518 | + | let updatedKLp = $t05605956140._2 | |
1531 | 1519 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1532 | 1520 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1533 | 1521 | then (state ++ refreshKLpActions) | |
1578 | 1566 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1579 | 1567 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1580 | 1568 | then { | |
1581 | - | let $ | |
1582 | - | let refreshKLpActions = $ | |
1583 | - | let updatedKLp = $ | |
1569 | + | let $t05743557516 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1570 | + | let refreshKLpActions = $t05743557516._1 | |
1571 | + | let updatedKLp = $t05743557516._2 | |
1584 | 1572 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1585 | 1573 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1586 | 1574 | then (state ++ refreshKLpActions) | |
1615 | 1603 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1616 | 1604 | then { | |
1617 | 1605 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1618 | - | let $ | |
1619 | - | let kLpUpdateActions = $ | |
1620 | - | let updatedKLp = $ | |
1606 | + | let $t05870358767 = refreshKLpInternal(0, 0, 0) | |
1607 | + | let kLpUpdateActions = $t05870358767._1 | |
1608 | + | let updatedKLp = $t05870358767._2 | |
1621 | 1609 | let actions = if ((kLp != updatedKLp)) | |
1622 | 1610 | then kLpUpdateActions | |
1623 | 1611 | else throwErr("nothing to refresh") | |
1792 | 1780 | match tx { | |
1793 | 1781 | case order: Order => | |
1794 | 1782 | let matcherPub = getMatcherPubOrFail() | |
1795 | - | let $ | |
1796 | - | let orderValid = $ | |
1797 | - | let orderValidInfo = $ | |
1783 | + | let $t06742967498 = validateMatcherOrderAllowed(order) | |
1784 | + | let orderValid = $t06742967498._1 | |
1785 | + | let orderValidInfo = $t06742967498._2 | |
1798 | 1786 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1799 | 1787 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1800 | 1788 | 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 getWithdrawAssetState (assetId,getAmount) = match getLeaseProxyConfig(assetId) { | |
434 | 434 | case a: (Boolean, Int, Int, String, String, Int, String) => | |
435 | 435 | let $t01651616625 = a | |
436 | 436 | let isLeasable = $t01651616625._1 | |
437 | 437 | let leasedRatio = $t01651616625._2 | |
438 | 438 | let minBalance = $t01651616625._3 | |
439 | 439 | let proxyAddress = $t01651616625._4 | |
440 | 440 | let proxyAssetId = $t01651616625._5 | |
441 | 441 | let proxyRateMul = $t01651616625._6 | |
442 | 442 | let stakingProfitAddress = $t01651616625._7 | |
443 | 443 | if (isLeasable) | |
444 | 444 | then { | |
445 | 445 | let newTotalCalcBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)]) | |
446 | 446 | if ((newTotalCalcBalance == newTotalCalcBalance)) | |
447 | 447 | then { | |
448 | 448 | let newAdditionalBalance = fraction(leasedRatio, newTotalCalcBalance, 100) | |
449 | 449 | if ((newAdditionalBalance == newAdditionalBalance)) | |
450 | 450 | then { | |
451 | 451 | let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)]) | |
452 | 452 | if ((withdrawAmount == withdrawAmount)) | |
453 | 453 | then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress)) | |
454 | 454 | else throw("Strict value is not equal to itself.") | |
455 | 455 | } | |
456 | 456 | else throw("Strict value is not equal to itself.") | |
457 | 457 | } | |
458 | 458 | else throw("Strict value is not equal to itself.") | |
459 | 459 | } | |
460 | 460 | else nil | |
461 | 461 | case _ => | |
462 | 462 | throwErr((("[" + assetId) + "] getWithdrawAssetState() error")) | |
463 | 463 | } | |
464 | 464 | ||
465 | 465 | ||
466 | 466 | func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
467 | 467 | let amtAssetAmtX18 = toX18(amAmt, amAssetDcm) | |
468 | 468 | let priceAssetAmtX18 = toX18(prAmt, prAssetDcm) | |
469 | 469 | calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
470 | 470 | } | |
471 | 471 | ||
472 | 472 | ||
473 | 473 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
474 | 474 | let cfg = getPoolConfig() | |
475 | 475 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
476 | 476 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
477 | 477 | let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt) | |
478 | 478 | let amAmtX18 = toX18(amAmt, amtAssetDcm) | |
479 | 479 | let prAmtX18 = toX18(prAmt, priceAssetDcm) | |
480 | 480 | let lpAmtX18 = toX18(lpAmt, scale8) | |
481 | 481 | let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18) | |
482 | 482 | let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18) | |
483 | 483 | [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18] | |
484 | 484 | } | |
485 | 485 | ||
486 | 486 | ||
487 | 487 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
488 | 488 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
489 | 489 | [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)] | |
490 | 490 | } | |
491 | 491 | ||
492 | 492 | ||
493 | 493 | func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
494 | 494 | let cfg = getPoolConfig() | |
495 | 495 | let lpAssetId = cfg[idxPoolLPAssetId] | |
496 | 496 | let amAssetId = cfg[idxAmtAssetId] | |
497 | 497 | let prAssetId = cfg[idxPriceAssetId] | |
498 | 498 | let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
499 | 499 | let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
500 | 500 | let poolStatus = cfg[idxPoolStatus] | |
501 | 501 | let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity | |
502 | 502 | if ((lpAssetId != pmtAssetId)) | |
503 | 503 | then throw("Invalid asset passed.") | |
504 | 504 | else { | |
505 | 505 | let amBalance = getAccBalance(amAssetId) | |
506 | 506 | let amBalanceX18 = toX18(amBalance, amAssetDcm) | |
507 | 507 | let prBalance = getAccBalance(prAssetId) | |
508 | 508 | let prBalanceX18 = toX18(prBalance, prAssetDcm) | |
509 | 509 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
510 | 510 | let curPrice = fromX18(curPriceX18, scale8) | |
511 | 511 | let pmtLpAmtX18 = toX18(pmtLpAmt, scale8) | |
512 | 512 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
513 | 513 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
514 | 514 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
515 | 515 | let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR) | |
516 | 516 | let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR) | |
517 | 517 | let AmAmtWithdrawState = getWithdrawAssetState(amAssetId, outAmAmt) | |
518 | 518 | if ((AmAmtWithdrawState == AmAmtWithdrawState)) | |
519 | 519 | then { | |
520 | 520 | let PrAmtWithdrawState = getWithdrawAssetState(prAssetId, outPrAmt) | |
521 | 521 | if ((PrAmtWithdrawState == PrAmtWithdrawState)) | |
522 | 522 | then { | |
523 | 523 | let state = if ((txId58 == "")) | |
524 | 524 | then nil | |
525 | 525 | else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES")) | |
526 | 526 | then unit | |
527 | 527 | else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES")) | |
528 | 528 | then unit | |
529 | 529 | 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)]) | |
530 | 530 | $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state) | |
531 | 531 | } | |
532 | 532 | else throw("Strict value is not equal to itself.") | |
533 | 533 | } | |
534 | 534 | else throw("Strict value is not equal to itself.") | |
535 | 535 | } | |
536 | 536 | } | |
537 | 537 | ||
538 | 538 | ||
539 | 539 | func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = { | |
540 | 540 | let cfg = getPoolConfig() | |
541 | 541 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
542 | 542 | let amAssetIdStr = cfg[idxAmtAssetId] | |
543 | 543 | let prAssetIdStr = cfg[idxPriceAssetId] | |
544 | 544 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
545 | 545 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
546 | 546 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
547 | 547 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
548 | 548 | let poolStatus = cfg[idxPoolStatus] | |
549 | 549 | let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
550 | 550 | let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES"))) | |
551 | 551 | let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES"))) | |
552 | 552 | if (if ((amAssetIdStr != inAmAssetIdStr)) | |
553 | 553 | then true | |
554 | 554 | else (prAssetIdStr != inPrAssetIdStr)) | |
555 | 555 | then throw("Invalid amt or price asset passed.") | |
556 | 556 | else { | |
557 | 557 | let amBalance = if (isEvaluate) | |
558 | 558 | then getAccBalance(amAssetIdStr) | |
559 | 559 | else (getAccBalance(amAssetIdStr) - inAmAssetAmt) | |
560 | 560 | let prBalance = if (isEvaluate) | |
561 | 561 | then getAccBalance(prAssetIdStr) | |
562 | 562 | else (getAccBalance(prAssetIdStr) - inPrAssetAmt) | |
563 | 563 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
564 | 564 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
565 | 565 | let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18) | |
566 | 566 | let amBalanceX18 = toX18(amBalance, amtAssetDcm) | |
567 | 567 | let prBalanceX18 = toX18(prBalance, priceAssetDcm) | |
568 | 568 | let res = if ((lpEmission == 0)) | |
569 | 569 | then { | |
570 | 570 | let curPriceX18 = zeroBigInt | |
571 | 571 | let slippageX18 = zeroBigInt | |
572 | 572 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
573 | 573 | $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
574 | 574 | } | |
575 | 575 | else { | |
576 | 576 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
577 | 577 | let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
578 | 578 | let slippageToleranceX18 = toX18(slippageTolerance, scale8) | |
579 | 579 | if (if ((curPriceX18 != zeroBigInt)) | |
580 | 580 | then (slippageX18 > slippageToleranceX18) | |
581 | 581 | else false) | |
582 | 582 | then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18))) | |
583 | 583 | else { | |
584 | 584 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
585 | 585 | let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
586 | 586 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
587 | 587 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
588 | 588 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
589 | 589 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
590 | 590 | let expAmtAssetAmtX18 = expectedAmts._1 | |
591 | 591 | let expPriceAssetAmtX18 = expectedAmts._2 | |
592 | 592 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR) | |
593 | 593 | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18) | |
594 | 594 | } | |
595 | 595 | } | |
596 | 596 | let calcLpAmt = res._1 | |
597 | 597 | let calcAmAssetPmt = res._2 | |
598 | 598 | let calcPrAssetPmt = res._3 | |
599 | 599 | let curPrice = fromX18(res._4, scale8) | |
600 | 600 | let slippageCalc = fromX18(res._5, scale8) | |
601 | 601 | if ((0 >= calcLpAmt)) | |
602 | 602 | then throw("Invalid calculations. LP calculated is less than zero.") | |
603 | 603 | else { | |
604 | 604 | let emitLpAmt = if (!(emitLp)) | |
605 | 605 | then 0 | |
606 | 606 | else calcLpAmt | |
607 | 607 | let amDiff = (inAmAssetAmt - calcAmAssetPmt) | |
608 | 608 | let prDiff = (inPrAssetAmt - calcPrAssetPmt) | |
609 | 609 | 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))] | |
610 | 610 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId) | |
611 | 611 | } | |
612 | 612 | } | |
613 | 613 | } | |
614 | 614 | ||
615 | 615 | ||
616 | 616 | func calcKLp (amountBalance,priceBalance,lpEmission) = { | |
617 | 617 | let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)) | |
618 | 618 | let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals)) | |
619 | 619 | let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission) | |
620 | 620 | if ((lpEmission == big0)) | |
621 | 621 | then big0 | |
622 | 622 | else updatedKLp | |
623 | 623 | } | |
624 | 624 | ||
625 | 625 | ||
626 | 626 | func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
627 | 627 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
628 | 628 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
629 | 629 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
630 | 630 | let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
631 | 631 | currentKLp | |
632 | 632 | } | |
633 | 633 | ||
634 | 634 | ||
635 | 635 | func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
636 | 636 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
637 | 637 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
638 | 638 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
639 | 639 | let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
640 | 640 | let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))] | |
641 | 641 | $Tuple2(actions, updatedKLp) | |
642 | 642 | } | |
643 | 643 | ||
644 | 644 | ||
645 | 645 | func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp)) | |
646 | 646 | then true | |
647 | 647 | else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " ")) | |
648 | 648 | ||
649 | 649 | ||
650 | 650 | func validateMatcherOrderAllowed (order) = { | |
651 | 651 | let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
652 | 652 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
653 | 653 | let amountAssetAmount = order.amount | |
654 | 654 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
655 | 655 | let $t02870728919 = if ((order.orderType == Buy)) | |
656 | 656 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
657 | 657 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
658 | 658 | let amountAssetBalanceDelta = $t02870728919._1 | |
659 | 659 | let priceAssetBalanceDelta = $t02870728919._2 | |
660 | 660 | if (if (if (isGlobalShutdown()) | |
661 | 661 | then true | |
662 | 662 | else (cfgPoolStatus == PoolMatcherDisabled)) | |
663 | 663 | then true | |
664 | 664 | else (cfgPoolStatus == PoolShutdown)) | |
665 | 665 | then throw("Exchange operations disabled") | |
666 | 666 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
667 | 667 | then true | |
668 | 668 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
669 | 669 | then throw("Wrong order assets.") | |
670 | 670 | else { | |
671 | 671 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
672 | 672 | let $t02935929459 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
673 | 673 | let unusedActions = $t02935929459._1 | |
674 | 674 | let kLpNew = $t02935929459._2 | |
675 | 675 | let isOrderValid = (kLpNew >= kLp) | |
676 | 676 | let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
677 | 677 | $Tuple2(isOrderValid, info) | |
678 | 678 | } | |
679 | 679 | } | |
680 | 680 | ||
681 | 681 | ||
682 | 682 | func commonGet (i) = if ((size(i.payments) != 1)) | |
683 | 683 | then throw("exactly 1 payment is expected") | |
684 | 684 | else { | |
685 | 685 | let pmt = value(i.payments[0]) | |
686 | 686 | let pmtAssetId = value(pmt.assetId) | |
687 | 687 | let pmtAmt = pmt.amount | |
688 | 688 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
689 | 689 | let outAmAmt = res._1 | |
690 | 690 | let outPrAmt = res._2 | |
691 | 691 | let poolStatus = parseIntValue(res._9) | |
692 | 692 | let state = res._10 | |
693 | 693 | if (if (isGlobalShutdown()) | |
694 | 694 | then true | |
695 | 695 | else (poolStatus == PoolShutdown)) | |
696 | 696 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
697 | 697 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
698 | 698 | } | |
699 | 699 | ||
700 | 700 | ||
701 | 701 | func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2)) | |
702 | 702 | then throw("exactly 2 payments are expected") | |
703 | 703 | else { | |
704 | 704 | let amAssetPmt = value(i.payments[0]) | |
705 | 705 | let prAssetPmt = value(i.payments[1]) | |
706 | 706 | let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp) | |
707 | 707 | let poolStatus = parseIntValue(estPut._8) | |
708 | 708 | if (if (if (isGlobalShutdown()) | |
709 | 709 | then true | |
710 | 710 | else (poolStatus == PoolPutDisabled)) | |
711 | 711 | then true | |
712 | 712 | else (poolStatus == PoolShutdown)) | |
713 | 713 | then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus))) | |
714 | 714 | else estPut | |
715 | 715 | } | |
716 | 716 | ||
717 | 717 | ||
718 | 718 | func emit (amount) = { | |
719 | 719 | let emitInv = invoke(factoryContract, "emit", [amount], nil) | |
720 | 720 | if ((emitInv == emitInv)) | |
721 | 721 | then { | |
722 | 722 | let emitInvLegacy = match emitInv { | |
723 | 723 | case legacyFactoryContract: Address => | |
724 | 724 | invoke(legacyFactoryContract, "emit", [amount], nil) | |
725 | 725 | case _ => | |
726 | 726 | unit | |
727 | 727 | } | |
728 | 728 | if ((emitInvLegacy == emitInvLegacy)) | |
729 | 729 | then amount | |
730 | 730 | else throw("Strict value is not equal to itself.") | |
731 | 731 | } | |
732 | 732 | else throw("Strict value is not equal to itself.") | |
733 | 733 | } | |
734 | 734 | ||
735 | 735 | ||
736 | 736 | func takeFee (amount,fee) = { | |
737 | 737 | let feeAmount = if ((fee == 0)) | |
738 | 738 | then 0 | |
739 | 739 | else fraction(amount, fee, scale8) | |
740 | 740 | $Tuple2((amount - feeAmount), feeAmount) | |
741 | 741 | } | |
742 | 742 | ||
743 | 743 | ||
744 | 744 | func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = { | |
745 | 745 | let isEval = (txId == unit) | |
746 | 746 | let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
747 | 747 | let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
748 | 748 | let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId)) | |
749 | 749 | then true | |
750 | 750 | else if ((paymentAssetId == cfgPriceAssetId)) | |
751 | 751 | then false | |
752 | 752 | else throwErr("invalid asset") | |
753 | 753 | let $t03257232865 = if (isEval) | |
754 | 754 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
755 | 755 | else if (paymentInAmountAsset) | |
756 | 756 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
757 | 757 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
758 | 758 | let amountBalanceOld = $t03257232865._1 | |
759 | 759 | let priceBalanceOld = $t03257232865._2 | |
760 | 760 | let $t03286933018 = if (paymentInAmountAsset) | |
761 | 761 | then $Tuple2(paymentAmountRaw, 0) | |
762 | 762 | else $Tuple2(0, paymentAmountRaw) | |
763 | 763 | let amountAssetAmountRaw = $t03286933018._1 | |
764 | 764 | let priceAssetAmountRaw = $t03286933018._2 | |
765 | 765 | let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1 | |
766 | 766 | let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1 | |
767 | 767 | let $t03315033214 = takeFee(paymentAmountRaw, inFee) | |
768 | 768 | let paymentAmount = $t03315033214._1 | |
769 | 769 | let feeAmount = $t03315033214._2 | |
770 | 770 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
771 | 771 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
772 | 772 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
773 | 773 | let priceNew = fromX18(priceNewX18, scale8) | |
774 | 774 | let paymentBalance = if (paymentInAmountAsset) | |
775 | 775 | then amountBalanceOld | |
776 | 776 | else priceBalanceOld | |
777 | 777 | let paymentBalanceBigInt = toBigInt(paymentBalance) | |
778 | 778 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
779 | 779 | let chechSupply = if ((supplyBigInt > big0)) | |
780 | 780 | then true | |
781 | 781 | else throwErr("initial deposit requires all coins") | |
782 | 782 | if ((chechSupply == chechSupply)) | |
783 | 783 | then { | |
784 | 784 | let depositBigInt = toBigInt(paymentAmount) | |
785 | 785 | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))]) | |
786 | 786 | let commonState = if (isEval) | |
787 | 787 | then nil | |
788 | 788 | 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))] | |
789 | 789 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
790 | 790 | let priceOld = fromX18(priceOldX18, scale8) | |
791 | 791 | let loss = { | |
792 | 792 | let $t03489535062 = if (paymentInAmountAsset) | |
793 | 793 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
794 | 794 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
795 | 795 | let amount = $t03489535062._1 | |
796 | 796 | let balance = $t03489535062._2 | |
797 | 797 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
798 | 798 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
799 | 799 | } | |
800 | 800 | $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset) | |
801 | 801 | } | |
802 | 802 | else throw("Strict value is not equal to itself.") | |
803 | 803 | } | |
804 | 804 | ||
805 | 805 | ||
806 | 806 | func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = { | |
807 | 807 | let isEval = (txId == unit) | |
808 | 808 | let cfg = getPoolConfig() | |
809 | 809 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
810 | 810 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
811 | 811 | let checks = [if ((paymentAssetId == cfgLpAssetId)) | |
812 | 812 | then true | |
813 | 813 | else throwErr("invalid lp asset")] | |
814 | 814 | if ((checks == checks)) | |
815 | 815 | then { | |
816 | 816 | let outInAmountAsset = if ((outAssetId == cfgAmountAssetId)) | |
817 | 817 | then true | |
818 | 818 | else if ((outAssetId == cfgPriceAssetId)) | |
819 | 819 | then false | |
820 | 820 | else throwErr("invalid asset") | |
821 | 821 | let balanceBigInt = if (outInAmountAsset) | |
822 | 822 | then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) | |
823 | 823 | else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) | |
824 | 824 | let outInAmountAssetDecimals = if (outInAmountAsset) | |
825 | 825 | then amtAssetDcm | |
826 | 826 | else priceAssetDcm | |
827 | 827 | let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
828 | 828 | let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
829 | 829 | let outBalance = if (outInAmountAsset) | |
830 | 830 | then amBalanceOld | |
831 | 831 | else prBalanceOld | |
832 | 832 | let outBalanceBigInt = toBigInt(outBalance) | |
833 | 833 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
834 | 834 | let redeemedBigInt = toBigInt(paymentAmount) | |
835 | 835 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
836 | 836 | let $t03714037196 = takeFee(amountRaw, outFee) | |
837 | 837 | let totalAmount = $t03714037196._1 | |
838 | 838 | let feeAmount = $t03714037196._2 | |
839 | 839 | let $t03720037426 = if (outInAmountAsset) | |
840 | 840 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
841 | 841 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
842 | 842 | let outAmAmount = $t03720037426._1 | |
843 | 843 | let outPrAmount = $t03720037426._2 | |
844 | 844 | let amBalanceNew = $t03720037426._3 | |
845 | 845 | let prBalanceNew = $t03720037426._4 | |
846 | 846 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
847 | 847 | let priceNew = fromX18(priceNewX18, scale8) | |
848 | 848 | let commonState = if (isEval) | |
849 | 849 | then nil | |
850 | 850 | 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)] | |
851 | 851 | let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals)) | |
852 | 852 | let priceOld = fromX18(priceOldX18, scale8) | |
853 | 853 | let loss = { | |
854 | 854 | let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2) | |
855 | 855 | fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset) | |
856 | 856 | } | |
857 | 857 | $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset) | |
858 | 858 | } | |
859 | 859 | else throw("Strict value is not equal to itself.") | |
860 | 860 | } | |
861 | 861 | ||
862 | 862 | ||
863 | 863 | func managerPublicKeyOrUnit () = match getString(mpk()) { | |
864 | 864 | case s: String => | |
865 | 865 | fromBase58String(s) | |
866 | 866 | case _: Unit => | |
867 | 867 | unit | |
868 | 868 | case _ => | |
869 | 869 | throw("Match error") | |
870 | 870 | } | |
871 | 871 | ||
872 | 872 | ||
873 | 873 | func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) { | |
874 | 874 | case s: String => | |
875 | 875 | fromBase58String(s) | |
876 | 876 | case _: Unit => | |
877 | 877 | unit | |
878 | 878 | case _ => | |
879 | 879 | throw("Match error") | |
880 | 880 | } | |
881 | 881 | ||
882 | 882 | ||
883 | 883 | func isManager (i) = match managerPublicKeyOrUnit() { | |
884 | 884 | case pk: ByteVector => | |
885 | 885 | (i.callerPublicKey == pk) | |
886 | 886 | case _: Unit => | |
887 | 887 | (i.caller == this) | |
888 | 888 | case _ => | |
889 | 889 | throw("Match error") | |
890 | 890 | } | |
891 | 891 | ||
892 | 892 | ||
893 | 893 | func mustManager (i) = { | |
894 | 894 | let pd = throw("Permission denied") | |
895 | 895 | match managerPublicKeyOrUnit() { | |
896 | 896 | case pk: ByteVector => | |
897 | 897 | if ((i.callerPublicKey == pk)) | |
898 | 898 | then true | |
899 | 899 | else pd | |
900 | 900 | case _: Unit => | |
901 | 901 | if ((i.caller == this)) | |
902 | 902 | then true | |
903 | 903 | else pd | |
904 | 904 | case _ => | |
905 | 905 | throw("Match error") | |
906 | 906 | } | |
907 | 907 | } | |
908 | 908 | ||
909 | 909 | ||
910 | 910 | @Callable(i) | |
911 | 911 | func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa()))) | |
912 | 912 | ||
913 | 913 | ||
914 | 914 | ||
915 | 915 | @Callable(i) | |
916 | 916 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
917 | 917 | let $t03931239617 = if ((isReverse == false)) | |
918 | 918 | then { | |
919 | 919 | let assetOut = getStringOrFail(this, pa()) | |
920 | 920 | let assetIn = getStringOrFail(this, aa()) | |
921 | 921 | $Tuple2(assetOut, assetIn) | |
922 | 922 | } | |
923 | 923 | else { | |
924 | 924 | let assetOut = getStringOrFail(this, aa()) | |
925 | 925 | let assetIn = getStringOrFail(this, pa()) | |
926 | 926 | $Tuple2(assetOut, assetIn) | |
927 | 927 | } | |
928 | 928 | let assetOut = $t03931239617._1 | |
929 | 929 | let assetIn = $t03931239617._2 | |
930 | 930 | let poolAssetInBalance = getAccBalance(assetIn) | |
931 | 931 | let poolAssetOutBalance = getAccBalance(assetOut) | |
932 | 932 | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
933 | 933 | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
934 | 934 | let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
935 | 935 | let checkK = if ((newK >= oldK)) | |
936 | 936 | then true | |
937 | 937 | else throw("new K is fewer error") | |
938 | 938 | if ((checkK == checkK)) | |
939 | 939 | then $Tuple2(nil, amountOut) | |
940 | 940 | else throw("Strict value is not equal to itself.") | |
941 | 941 | } | |
942 | 942 | ||
943 | 943 | ||
944 | 944 | ||
945 | 945 | @Callable(i) | |
946 | 946 | func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = { | |
947 | 947 | let swapContact = { | |
948 | 948 | let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil) | |
949 | 949 | if ($isInstanceOf(@, "String")) | |
950 | 950 | then @ | |
951 | 951 | else throw(($getType(@) + " couldn't be cast to String")) | |
952 | 952 | } | |
953 | 953 | let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
954 | 954 | then true | |
955 | 955 | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
956 | 956 | then true | |
957 | 957 | else throwErr("Permission denied")] | |
958 | 958 | if ((checks == checks)) | |
959 | 959 | then { | |
960 | 960 | let pmt = value(i.payments[0]) | |
961 | 961 | let assetIn = assetIdToString(pmt.assetId) | |
962 | 962 | let assetOut = if ((isReverse == false)) | |
963 | 963 | then getStringOrFail(this, pa()) | |
964 | 964 | else getStringOrFail(this, aa()) | |
965 | 965 | let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
966 | 966 | let poolAssetOutBalance = getAccBalance(assetOut) | |
967 | 967 | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
968 | 968 | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
969 | 969 | let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
970 | 970 | let checkK = if ((newK >= oldK)) | |
971 | 971 | then true | |
972 | 972 | else throw("new K is fewer error") | |
973 | 973 | if ((checkK == checkK)) | |
974 | 974 | then { | |
975 | 975 | let checkMin = if ((amountOut >= amountOutMin)) | |
976 | 976 | then true | |
977 | 977 | else throw("Exchange result is fewer coins than expected") | |
978 | 978 | if ((checkMin == checkMin)) | |
979 | 979 | then { | |
980 | - | let lsConf = match getLeaseProxyConfig(assetOut) { | |
981 | - | case a: (Boolean, Int, Int, String, String, Int, String) => | |
982 | - | a | |
983 | - | case _ => | |
984 | - | throw("error lease config") | |
985 | - | } | |
986 | 980 | let withdrawState = getWithdrawAssetState(assetOut, amountOut) | |
987 | 981 | if ((withdrawState == withdrawState)) | |
988 | 982 | then $Tuple2((withdrawState ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut) | |
989 | 983 | else throw("Strict value is not equal to itself.") | |
990 | 984 | } | |
991 | 985 | else throw("Strict value is not equal to itself.") | |
992 | 986 | } | |
993 | 987 | else throw("Strict value is not equal to itself.") | |
994 | 988 | } | |
995 | 989 | else throw("Strict value is not equal to itself.") | |
996 | 990 | } | |
997 | 991 | ||
998 | 992 | ||
999 | 993 | ||
1000 | 994 | @Callable(i) | |
1001 | 995 | func setManager (pendingManagerPublicKey) = { | |
1002 | 996 | let checkCaller = mustManager(i) | |
1003 | 997 | if ((checkCaller == checkCaller)) | |
1004 | 998 | then { | |
1005 | 999 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
1006 | 1000 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
1007 | 1001 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
1008 | 1002 | else throw("Strict value is not equal to itself.") | |
1009 | 1003 | } | |
1010 | 1004 | else throw("Strict value is not equal to itself.") | |
1011 | 1005 | } | |
1012 | 1006 | ||
1013 | 1007 | ||
1014 | 1008 | ||
1015 | 1009 | @Callable(i) | |
1016 | 1010 | func confirmManager () = { | |
1017 | 1011 | let pm = pendingManagerPublicKeyOrUnit() | |
1018 | 1012 | let hasPM = if (isDefined(pm)) | |
1019 | 1013 | then true | |
1020 | 1014 | else throw("No pending manager") | |
1021 | 1015 | if ((hasPM == hasPM)) | |
1022 | 1016 | then { | |
1023 | 1017 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
1024 | 1018 | then true | |
1025 | 1019 | else throw("You are not pending manager") | |
1026 | 1020 | if ((checkPM == checkPM)) | |
1027 | 1021 | then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())] | |
1028 | 1022 | else throw("Strict value is not equal to itself.") | |
1029 | 1023 | } | |
1030 | 1024 | else throw("Strict value is not equal to itself.") | |
1031 | 1025 | } | |
1032 | 1026 | ||
1033 | 1027 | ||
1034 | 1028 | ||
1035 | 1029 | @Callable(i) | |
1036 | 1030 | func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance)) | |
1037 | 1031 | then throw("Invalid slippageTolerance passed") | |
1038 | 1032 | else { | |
1039 | 1033 | let estPut = commonPut(i, slippageTolerance, true) | |
1040 | 1034 | let emitLpAmt = estPut._2 | |
1041 | 1035 | let lpAssetId = estPut._7 | |
1042 | 1036 | let state = estPut._9 | |
1043 | 1037 | let amDiff = estPut._10 | |
1044 | 1038 | let prDiff = estPut._11 | |
1045 | 1039 | let amId = estPut._12 | |
1046 | 1040 | let prId = estPut._13 | |
1047 | 1041 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1048 | 1042 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1049 | 1043 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1050 | 1044 | if ((currentKLp == currentKLp)) | |
1051 | 1045 | then { | |
1052 | 1046 | let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil) | |
1053 | 1047 | if ((emitInv == emitInv)) | |
1054 | 1048 | then { | |
1055 | 1049 | let emitInvLegacy = match emitInv { | |
1056 | 1050 | case legacyFactoryContract: Address => | |
1057 | 1051 | invoke(legacyFactoryContract, "emit", [emitLpAmt], nil) | |
1058 | 1052 | case _ => | |
1059 | 1053 | unit | |
1060 | 1054 | } | |
1061 | 1055 | if ((emitInvLegacy == emitInvLegacy)) | |
1062 | 1056 | then { | |
1063 | 1057 | let slippageAInv = if ((amDiff > 0)) | |
1064 | 1058 | then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)]) | |
1065 | 1059 | else nil | |
1066 | 1060 | if ((slippageAInv == slippageAInv)) | |
1067 | 1061 | then { | |
1068 | 1062 | let slippagePInv = if ((prDiff > 0)) | |
1069 | 1063 | then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)]) | |
1070 | 1064 | else nil | |
1071 | 1065 | if ((slippagePInv == slippagePInv)) | |
1072 | 1066 | then { | |
1073 | 1067 | let lpTransfer = if (shouldAutoStake) | |
1074 | 1068 | then { | |
1075 | 1069 | let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
1076 | 1070 | if ((slpStakeInv == slpStakeInv)) | |
1077 | 1071 | then nil | |
1078 | 1072 | else throw("Strict value is not equal to itself.") | |
1079 | 1073 | } | |
1080 | 1074 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1081 | - | let $ | |
1082 | - | if (($ | |
1075 | + | let $t04459045052 = refreshKLpInternal(0, 0, 0) | |
1076 | + | if (($t04459045052 == $t04459045052)) | |
1083 | 1077 | then { | |
1084 | - | let updatedKLp = $ | |
1085 | - | let refreshKLpActions = $ | |
1078 | + | let updatedKLp = $t04459045052._2 | |
1079 | + | let refreshKLpActions = $t04459045052._1 | |
1086 | 1080 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1087 | 1081 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1088 | 1082 | then { | |
1089 | 1083 | let reb = invoke(this, "rebalance", nil, nil) | |
1090 | 1084 | if ((reb == reb)) | |
1091 | 1085 | then ((state ++ lpTransfer) ++ refreshKLpActions) | |
1092 | 1086 | else throw("Strict value is not equal to itself.") | |
1093 | 1087 | } | |
1094 | 1088 | else throw("Strict value is not equal to itself.") | |
1095 | 1089 | } | |
1096 | 1090 | else throw("Strict value is not equal to itself.") | |
1097 | 1091 | } | |
1098 | 1092 | else throw("Strict value is not equal to itself.") | |
1099 | 1093 | } | |
1100 | 1094 | else throw("Strict value is not equal to itself.") | |
1101 | 1095 | } | |
1102 | 1096 | else throw("Strict value is not equal to itself.") | |
1103 | 1097 | } | |
1104 | 1098 | else throw("Strict value is not equal to itself.") | |
1105 | 1099 | } | |
1106 | 1100 | else throw("Strict value is not equal to itself.") | |
1107 | 1101 | } | |
1108 | 1102 | ||
1109 | 1103 | ||
1110 | 1104 | ||
1111 | 1105 | @Callable(i) | |
1112 | 1106 | func putForFree (maxSlippage) = if ((0 > maxSlippage)) | |
1113 | 1107 | then throw("Invalid value passed") | |
1114 | 1108 | else { | |
1115 | 1109 | let estPut = commonPut(i, maxSlippage, false) | |
1116 | 1110 | let state = estPut._9 | |
1117 | 1111 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1118 | 1112 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1119 | 1113 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1120 | 1114 | if ((currentKLp == currentKLp)) | |
1121 | 1115 | then { | |
1122 | - | let $ | |
1123 | - | let refreshKLpActions = $ | |
1124 | - | let updatedKLp = $ | |
1116 | + | let $t04566445729 = refreshKLpInternal(0, 0, 0) | |
1117 | + | let refreshKLpActions = $t04566445729._1 | |
1118 | + | let updatedKLp = $t04566445729._2 | |
1125 | 1119 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1126 | 1120 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1127 | 1121 | then (state ++ refreshKLpActions) | |
1128 | 1122 | else throw("Strict value is not equal to itself.") | |
1129 | 1123 | } | |
1130 | 1124 | else throw("Strict value is not equal to itself.") | |
1131 | 1125 | } | |
1132 | 1126 | ||
1133 | 1127 | ||
1134 | 1128 | ||
1135 | 1129 | @Callable(i) | |
1136 | 1130 | func putOneTkn (minOutAmount,autoStake) = { | |
1137 | 1131 | let isPoolOneTokenOperationsDisabled = { | |
1138 | 1132 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1139 | 1133 | if ($isInstanceOf(@, "Boolean")) | |
1140 | 1134 | then @ | |
1141 | 1135 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1142 | 1136 | } | |
1143 | 1137 | let isPutDisabled = if (if (if (isGlobalShutdown()) | |
1144 | 1138 | then true | |
1145 | 1139 | else (cfgPoolStatus == PoolPutDisabled)) | |
1146 | 1140 | then true | |
1147 | 1141 | else (cfgPoolStatus == PoolShutdown)) | |
1148 | 1142 | then true | |
1149 | 1143 | else isPoolOneTokenOperationsDisabled | |
1150 | 1144 | let checks = [if (if (!(isPutDisabled)) | |
1151 | 1145 | then true | |
1152 | 1146 | else isManager(i)) | |
1153 | 1147 | then true | |
1154 | 1148 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1155 | 1149 | then true | |
1156 | 1150 | else throwErr("exactly 1 payment are expected")] | |
1157 | 1151 | if ((checks == checks)) | |
1158 | 1152 | then { | |
1159 | 1153 | let payment = i.payments[0] | |
1160 | 1154 | let paymentAssetId = payment.assetId | |
1161 | 1155 | let paymentAmountRaw = payment.amount | |
1162 | 1156 | let currentKLp = if ((paymentAssetId == cfgAmountAssetId)) | |
1163 | 1157 | then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0)) | |
1164 | 1158 | else if ((paymentAssetId == cfgPriceAssetId)) | |
1165 | 1159 | then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0)) | |
1166 | 1160 | else throwErr("payment asset is not supported") | |
1167 | 1161 | if ((currentKLp == currentKLp)) | |
1168 | 1162 | then { | |
1169 | 1163 | let userAddress = i.caller | |
1170 | 1164 | let txId = i.transactionId | |
1171 | - | let $ | |
1172 | - | if (($ | |
1165 | + | let $t04691747069 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
1166 | + | if (($t04691747069 == $t04691747069)) | |
1173 | 1167 | then { | |
1174 | - | let paymentInAmountAsset = $ | |
1175 | - | let bonus = $ | |
1176 | - | let feeAmount = $ | |
1177 | - | let commonState = $ | |
1178 | - | let emitAmountEstimated = $ | |
1168 | + | let paymentInAmountAsset = $t04691747069._5 | |
1169 | + | let bonus = $t04691747069._4 | |
1170 | + | let feeAmount = $t04691747069._3 | |
1171 | + | let commonState = $t04691747069._2 | |
1172 | + | let emitAmountEstimated = $t04691747069._1 | |
1179 | 1173 | let emitAmount = if (if ((minOutAmount > 0)) | |
1180 | 1174 | then (minOutAmount > emitAmountEstimated) | |
1181 | 1175 | else false) | |
1182 | 1176 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1183 | 1177 | else emitAmountEstimated | |
1184 | 1178 | let emitInv = emit(emitAmount) | |
1185 | 1179 | if ((emitInv == emitInv)) | |
1186 | 1180 | then { | |
1187 | 1181 | let lpTransfer = if (autoStake) | |
1188 | 1182 | then { | |
1189 | 1183 | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
1190 | 1184 | if ((stakeInv == stakeInv)) | |
1191 | 1185 | then nil | |
1192 | 1186 | else throw("Strict value is not equal to itself.") | |
1193 | 1187 | } | |
1194 | 1188 | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
1195 | 1189 | let sendFee = if ((feeAmount > 0)) | |
1196 | 1190 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
1197 | 1191 | else nil | |
1198 | - | let $ | |
1192 | + | let $t04765547852 = if ((this == feeCollectorAddress)) | |
1199 | 1193 | then $Tuple2(0, 0) | |
1200 | 1194 | else if (paymentInAmountAsset) | |
1201 | 1195 | then $Tuple2(-(feeAmount), 0) | |
1202 | 1196 | else $Tuple2(0, -(feeAmount)) | |
1203 | - | let amountAssetBalanceDelta = $ | |
1204 | - | let priceAssetBalanceDelta = $ | |
1205 | - | let $ | |
1206 | - | let refreshKLpActions = $ | |
1207 | - | let updatedKLp = $ | |
1197 | + | let amountAssetBalanceDelta = $t04765547852._1 | |
1198 | + | let priceAssetBalanceDelta = $t04765547852._2 | |
1199 | + | let $t04785547963 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1200 | + | let refreshKLpActions = $t04785547963._1 | |
1201 | + | let updatedKLp = $t04785547963._2 | |
1208 | 1202 | let kLp = value(getString(keyKLp)) | |
1209 | 1203 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1210 | 1204 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1211 | 1205 | then { | |
1212 | 1206 | let reb = invoke(this, "rebalance", nil, nil) | |
1213 | 1207 | if ((reb == reb)) | |
1214 | 1208 | then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount) | |
1215 | 1209 | else throw("Strict value is not equal to itself.") | |
1216 | 1210 | } | |
1217 | 1211 | else throw("Strict value is not equal to itself.") | |
1218 | 1212 | } | |
1219 | 1213 | else throw("Strict value is not equal to itself.") | |
1220 | 1214 | } | |
1221 | 1215 | else throw("Strict value is not equal to itself.") | |
1222 | 1216 | } | |
1223 | 1217 | else throw("Strict value is not equal to itself.") | |
1224 | 1218 | } | |
1225 | 1219 | else throw("Strict value is not equal to itself.") | |
1226 | 1220 | } | |
1227 | 1221 | ||
1228 | 1222 | ||
1229 | 1223 | ||
1230 | 1224 | @Callable(i) | |
1231 | 1225 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
1232 | - | let $ | |
1233 | - | let emitAmountEstimated = $ | |
1234 | - | let commonState = $ | |
1235 | - | let feeAmount = $ | |
1236 | - | let bonus = $ | |
1237 | - | let paymentInAmountAsset = $ | |
1226 | + | let $t04831848475 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
1227 | + | let emitAmountEstimated = $t04831848475._1 | |
1228 | + | let commonState = $t04831848475._2 | |
1229 | + | let feeAmount = $t04831848475._3 | |
1230 | + | let bonus = $t04831848475._4 | |
1231 | + | let paymentInAmountAsset = $t04831848475._5 | |
1238 | 1232 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
1239 | 1233 | } | |
1240 | 1234 | ||
1241 | 1235 | ||
1242 | 1236 | ||
1243 | 1237 | @Callable(i) | |
1244 | 1238 | func getOneTkn (outAssetIdStr,minOutAmount) = { | |
1245 | 1239 | let isPoolOneTokenOperationsDisabled = { | |
1246 | 1240 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1247 | 1241 | if ($isInstanceOf(@, "Boolean")) | |
1248 | 1242 | then @ | |
1249 | 1243 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1250 | 1244 | } | |
1251 | 1245 | let isGetDisabled = if (if (isGlobalShutdown()) | |
1252 | 1246 | then true | |
1253 | 1247 | else (cfgPoolStatus == PoolShutdown)) | |
1254 | 1248 | then true | |
1255 | 1249 | else isPoolOneTokenOperationsDisabled | |
1256 | 1250 | let checks = [if (if (!(isGetDisabled)) | |
1257 | 1251 | then true | |
1258 | 1252 | else isManager(i)) | |
1259 | 1253 | then true | |
1260 | 1254 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1261 | 1255 | then true | |
1262 | 1256 | else throwErr("exactly 1 payment are expected")] | |
1263 | 1257 | if ((checks == checks)) | |
1264 | 1258 | then { | |
1265 | 1259 | let outAssetId = parseAssetId(outAssetIdStr) | |
1266 | 1260 | let payment = i.payments[0] | |
1267 | 1261 | let paymentAssetId = payment.assetId | |
1268 | 1262 | let paymentAmount = payment.amount | |
1269 | 1263 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1270 | 1264 | if ((currentKLp == currentKLp)) | |
1271 | 1265 | then { | |
1272 | 1266 | let userAddress = i.caller | |
1273 | 1267 | let txId = i.transactionId | |
1274 | - | let $ | |
1275 | - | if (($ | |
1268 | + | let $t04936049513 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
1269 | + | if (($t04936049513 == $t04936049513)) | |
1276 | 1270 | then { | |
1277 | - | let outInAmountAsset = $ | |
1278 | - | let bonus = $ | |
1279 | - | let feeAmount = $ | |
1280 | - | let commonState = $ | |
1281 | - | let amountEstimated = $ | |
1271 | + | let outInAmountAsset = $t04936049513._5 | |
1272 | + | let bonus = $t04936049513._4 | |
1273 | + | let feeAmount = $t04936049513._3 | |
1274 | + | let commonState = $t04936049513._2 | |
1275 | + | let amountEstimated = $t04936049513._1 | |
1282 | 1276 | let amount = if (if ((minOutAmount > 0)) | |
1283 | 1277 | then (minOutAmount > amountEstimated) | |
1284 | 1278 | else false) | |
1285 | 1279 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1286 | 1280 | else amountEstimated | |
1287 | - | let lsConf = match getLeaseProxyConfig(outAssetIdStr) { | |
1288 | - | case a: (Boolean, Int, Int, String, String, Int, String) => | |
1289 | - | a | |
1290 | - | case _ => | |
1291 | - | throw("error lease config") | |
1292 | - | } | |
1293 | 1281 | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
1294 | 1282 | if ((burnInv == burnInv)) | |
1295 | 1283 | then { | |
1296 | 1284 | let withdrawState = getWithdrawAssetState(outAssetIdStr, amount) | |
1297 | 1285 | if ((withdrawState == withdrawState)) | |
1298 | 1286 | then { | |
1299 | 1287 | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
1300 | 1288 | let sendFee = if ((feeAmount > 0)) | |
1301 | 1289 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1302 | 1290 | else nil | |
1303 | - | let $ | |
1291 | + | let $t05008350330 = { | |
1304 | 1292 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1305 | 1293 | then 0 | |
1306 | 1294 | else feeAmount | |
1307 | 1295 | if (outInAmountAsset) | |
1308 | 1296 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1309 | 1297 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1310 | 1298 | } | |
1311 | - | let amountAssetBalanceDelta = $ | |
1312 | - | let priceAssetBalanceDelta = $ | |
1313 | - | let $ | |
1314 | - | let refreshKLpActions = $ | |
1315 | - | let updatedKLp = $ | |
1299 | + | let amountAssetBalanceDelta = $t05008350330._1 | |
1300 | + | let priceAssetBalanceDelta = $t05008350330._2 | |
1301 | + | let $t05033350441 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1302 | + | let refreshKLpActions = $t05033350441._1 | |
1303 | + | let updatedKLp = $t05033350441._2 | |
1316 | 1304 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1317 | 1305 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1318 | 1306 | then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1319 | 1307 | else throw("Strict value is not equal to itself.") | |
1320 | 1308 | } | |
1321 | 1309 | else throw("Strict value is not equal to itself.") | |
1322 | 1310 | } | |
1323 | 1311 | else throw("Strict value is not equal to itself.") | |
1324 | 1312 | } | |
1325 | 1313 | else throw("Strict value is not equal to itself.") | |
1326 | 1314 | } | |
1327 | 1315 | else throw("Strict value is not equal to itself.") | |
1328 | 1316 | } | |
1329 | 1317 | else throw("Strict value is not equal to itself.") | |
1330 | 1318 | } | |
1331 | 1319 | ||
1332 | 1320 | ||
1333 | 1321 | ||
1334 | 1322 | @Callable(i) | |
1335 | 1323 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
1336 | - | let $ | |
1337 | - | let amountEstimated = $ | |
1338 | - | let commonState = $ | |
1339 | - | let feeAmount = $ | |
1340 | - | let bonus = $ | |
1341 | - | let outInAmountAsset = $ | |
1324 | + | let $t05071950875 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
1325 | + | let amountEstimated = $t05071950875._1 | |
1326 | + | let commonState = $t05071950875._2 | |
1327 | + | let feeAmount = $t05071950875._3 | |
1328 | + | let bonus = $t05071950875._4 | |
1329 | + | let outInAmountAsset = $t05071950875._5 | |
1342 | 1330 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
1343 | 1331 | } | |
1344 | 1332 | ||
1345 | 1333 | ||
1346 | 1334 | ||
1347 | 1335 | @Callable(i) | |
1348 | 1336 | func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = { | |
1349 | 1337 | let isPoolOneTokenOperationsDisabled = { | |
1350 | 1338 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1351 | 1339 | if ($isInstanceOf(@, "Boolean")) | |
1352 | 1340 | then @ | |
1353 | 1341 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1354 | 1342 | } | |
1355 | 1343 | let isGetDisabled = if (if (isGlobalShutdown()) | |
1356 | 1344 | then true | |
1357 | 1345 | else (cfgPoolStatus == PoolShutdown)) | |
1358 | 1346 | then true | |
1359 | 1347 | else isPoolOneTokenOperationsDisabled | |
1360 | 1348 | let checks = [if (if (!(isGetDisabled)) | |
1361 | 1349 | then true | |
1362 | 1350 | else isManager(i)) | |
1363 | 1351 | then true | |
1364 | 1352 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1365 | 1353 | then true | |
1366 | 1354 | else throwErr("no payments are expected")] | |
1367 | 1355 | if ((checks == checks)) | |
1368 | 1356 | then { | |
1369 | 1357 | let outAssetId = parseAssetId(outAssetIdStr) | |
1370 | 1358 | let userAddress = i.caller | |
1371 | 1359 | let txId = i.transactionId | |
1372 | 1360 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1373 | 1361 | if ((currentKLp == currentKLp)) | |
1374 | 1362 | then { | |
1375 | 1363 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1376 | 1364 | if ((unstakeInv == unstakeInv)) | |
1377 | 1365 | then { | |
1378 | - | let $ | |
1379 | - | if (($ | |
1366 | + | let $t05178051931 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1367 | + | if (($t05178051931 == $t05178051931)) | |
1380 | 1368 | then { | |
1381 | - | let outInAmountAsset = $ | |
1382 | - | let bonus = $ | |
1383 | - | let feeAmount = $ | |
1384 | - | let commonState = $ | |
1385 | - | let amountEstimated = $ | |
1369 | + | let outInAmountAsset = $t05178051931._5 | |
1370 | + | let bonus = $t05178051931._4 | |
1371 | + | let feeAmount = $t05178051931._3 | |
1372 | + | let commonState = $t05178051931._2 | |
1373 | + | let amountEstimated = $t05178051931._1 | |
1386 | 1374 | let amount = if (if ((minOutAmount > 0)) | |
1387 | 1375 | then (minOutAmount > amountEstimated) | |
1388 | 1376 | else false) | |
1389 | 1377 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1390 | 1378 | else amountEstimated | |
1391 | 1379 | let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1392 | 1380 | if ((burnInv == burnInv)) | |
1393 | 1381 | then { | |
1394 | 1382 | let withdrawState = getWithdrawAssetState(outAssetIdStr, amount) | |
1395 | 1383 | if ((withdrawState == withdrawState)) | |
1396 | 1384 | then { | |
1397 | 1385 | let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)] | |
1398 | 1386 | let sendFee = if ((feeAmount > 0)) | |
1399 | 1387 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1400 | 1388 | else nil | |
1401 | - | let $ | |
1389 | + | let $t05249652743 = { | |
1402 | 1390 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1403 | 1391 | then 0 | |
1404 | 1392 | else feeAmount | |
1405 | 1393 | if (outInAmountAsset) | |
1406 | 1394 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1407 | 1395 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1408 | 1396 | } | |
1409 | - | let amountAssetBalanceDelta = $ | |
1410 | - | let priceAssetBalanceDelta = $ | |
1411 | - | let $ | |
1412 | - | let refreshKLpActions = $ | |
1413 | - | let updatedKLp = $ | |
1397 | + | let amountAssetBalanceDelta = $t05249652743._1 | |
1398 | + | let priceAssetBalanceDelta = $t05249652743._2 | |
1399 | + | let $t05274652854 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1400 | + | let refreshKLpActions = $t05274652854._1 | |
1401 | + | let updatedKLp = $t05274652854._2 | |
1414 | 1402 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1415 | 1403 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1416 | 1404 | then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1417 | 1405 | else throw("Strict value is not equal to itself.") | |
1418 | 1406 | } | |
1419 | 1407 | else throw("Strict value is not equal to itself.") | |
1420 | 1408 | } | |
1421 | 1409 | else throw("Strict value is not equal to itself.") | |
1422 | 1410 | } | |
1423 | 1411 | else throw("Strict value is not equal to itself.") | |
1424 | 1412 | } | |
1425 | 1413 | else throw("Strict value is not equal to itself.") | |
1426 | 1414 | } | |
1427 | 1415 | else throw("Strict value is not equal to itself.") | |
1428 | 1416 | } | |
1429 | 1417 | else throw("Strict value is not equal to itself.") | |
1430 | 1418 | } | |
1431 | 1419 | ||
1432 | 1420 | ||
1433 | 1421 | ||
1434 | 1422 | @Callable(i) | |
1435 | 1423 | func get () = { | |
1436 | 1424 | let res = commonGet(i) | |
1437 | 1425 | let outAmtAmt = res._1 | |
1438 | 1426 | let outPrAmt = res._2 | |
1439 | 1427 | let pmtAmt = res._3 | |
1440 | 1428 | let pmtAssetId = res._4 | |
1441 | 1429 | let state = res._5 | |
1442 | 1430 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1443 | 1431 | if ((currentKLp == currentKLp)) | |
1444 | 1432 | then { | |
1445 | 1433 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1446 | 1434 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1447 | 1435 | then { | |
1448 | - | let $ | |
1449 | - | let refreshKLpActions = $ | |
1450 | - | let updatedKLp = $ | |
1436 | + | let $t05382153903 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1437 | + | let refreshKLpActions = $t05382153903._1 | |
1438 | + | let updatedKLp = $t05382153903._2 | |
1451 | 1439 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1452 | 1440 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1453 | 1441 | then (state ++ refreshKLpActions) | |
1454 | 1442 | else throw("Strict value is not equal to itself.") | |
1455 | 1443 | } | |
1456 | 1444 | else throw("Strict value is not equal to itself.") | |
1457 | 1445 | } | |
1458 | 1446 | else throw("Strict value is not equal to itself.") | |
1459 | 1447 | } | |
1460 | 1448 | ||
1461 | 1449 | ||
1462 | 1450 | ||
1463 | 1451 | @Callable(i) | |
1464 | 1452 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1465 | 1453 | let res = commonGet(i) | |
1466 | 1454 | let outAmAmt = res._1 | |
1467 | 1455 | let outPrAmt = res._2 | |
1468 | 1456 | let pmtAmt = res._3 | |
1469 | 1457 | let pmtAssetId = res._4 | |
1470 | 1458 | let state = res._5 | |
1471 | 1459 | if ((noLessThenAmtAsset > outAmAmt)) | |
1472 | 1460 | then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1473 | 1461 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1474 | 1462 | then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1475 | 1463 | else { | |
1476 | 1464 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1477 | 1465 | if ((currentKLp == currentKLp)) | |
1478 | 1466 | then { | |
1479 | 1467 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1480 | 1468 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1481 | 1469 | then { | |
1482 | - | let $ | |
1483 | - | let refreshKLpActions = $ | |
1484 | - | let updatedKLp = $ | |
1470 | + | let $t05485254933 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1471 | + | let refreshKLpActions = $t05485254933._1 | |
1472 | + | let updatedKLp = $t05485254933._2 | |
1485 | 1473 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1486 | 1474 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1487 | 1475 | then (state ++ refreshKLpActions) | |
1488 | 1476 | else throw("Strict value is not equal to itself.") | |
1489 | 1477 | } | |
1490 | 1478 | else throw("Strict value is not equal to itself.") | |
1491 | 1479 | } | |
1492 | 1480 | else throw("Strict value is not equal to itself.") | |
1493 | 1481 | } | |
1494 | 1482 | } | |
1495 | 1483 | ||
1496 | 1484 | ||
1497 | 1485 | ||
1498 | 1486 | @Callable(i) | |
1499 | 1487 | func unstakeAndGet (amount) = { | |
1500 | 1488 | let checkPayments = if ((size(i.payments) != 0)) | |
1501 | 1489 | then throw("No payments are expected") | |
1502 | 1490 | else true | |
1503 | 1491 | if ((checkPayments == checkPayments)) | |
1504 | 1492 | then { | |
1505 | 1493 | let cfg = getPoolConfig() | |
1506 | 1494 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1507 | 1495 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1508 | 1496 | if ((currentKLp == currentKLp)) | |
1509 | 1497 | then { | |
1510 | 1498 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1511 | 1499 | if ((unstakeInv == unstakeInv)) | |
1512 | 1500 | then { | |
1513 | 1501 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1514 | 1502 | let outAmAmt = res._1 | |
1515 | 1503 | let outPrAmt = res._2 | |
1516 | 1504 | let poolStatus = parseIntValue(res._9) | |
1517 | 1505 | let state = res._10 | |
1518 | 1506 | let checkPoolStatus = if (if (isGlobalShutdown()) | |
1519 | 1507 | then true | |
1520 | 1508 | else (poolStatus == PoolShutdown)) | |
1521 | 1509 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
1522 | 1510 | else true | |
1523 | 1511 | if ((checkPoolStatus == checkPoolStatus)) | |
1524 | 1512 | then { | |
1525 | 1513 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1526 | 1514 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1527 | 1515 | then { | |
1528 | - | let $ | |
1529 | - | let refreshKLpActions = $ | |
1530 | - | let updatedKLp = $ | |
1516 | + | let $t05605956140 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1517 | + | let refreshKLpActions = $t05605956140._1 | |
1518 | + | let updatedKLp = $t05605956140._2 | |
1531 | 1519 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1532 | 1520 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1533 | 1521 | then (state ++ refreshKLpActions) | |
1534 | 1522 | else throw("Strict value is not equal to itself.") | |
1535 | 1523 | } | |
1536 | 1524 | else throw("Strict value is not equal to itself.") | |
1537 | 1525 | } | |
1538 | 1526 | else throw("Strict value is not equal to itself.") | |
1539 | 1527 | } | |
1540 | 1528 | else throw("Strict value is not equal to itself.") | |
1541 | 1529 | } | |
1542 | 1530 | else throw("Strict value is not equal to itself.") | |
1543 | 1531 | } | |
1544 | 1532 | else throw("Strict value is not equal to itself.") | |
1545 | 1533 | } | |
1546 | 1534 | ||
1547 | 1535 | ||
1548 | 1536 | ||
1549 | 1537 | @Callable(i) | |
1550 | 1538 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1551 | 1539 | let isGetDisabled = if (isGlobalShutdown()) | |
1552 | 1540 | then true | |
1553 | 1541 | else (cfgPoolStatus == PoolShutdown) | |
1554 | 1542 | let checks = [if (!(isGetDisabled)) | |
1555 | 1543 | then true | |
1556 | 1544 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1557 | 1545 | then true | |
1558 | 1546 | else throw("no payments are expected")] | |
1559 | 1547 | if ((checks == checks)) | |
1560 | 1548 | then { | |
1561 | 1549 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1562 | 1550 | if ((currentKLp == currentKLp)) | |
1563 | 1551 | then { | |
1564 | 1552 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1565 | 1553 | if ((unstakeInv == unstakeInv)) | |
1566 | 1554 | then { | |
1567 | 1555 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1568 | 1556 | let outAmAmt = res._1 | |
1569 | 1557 | let outPrAmt = res._2 | |
1570 | 1558 | let state = res._10 | |
1571 | 1559 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1572 | 1560 | then true | |
1573 | 1561 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1574 | 1562 | then true | |
1575 | 1563 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1576 | 1564 | if ((checkAmounts == checkAmounts)) | |
1577 | 1565 | then { | |
1578 | 1566 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1579 | 1567 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1580 | 1568 | then { | |
1581 | - | let $ | |
1582 | - | let refreshKLpActions = $ | |
1583 | - | let updatedKLp = $ | |
1569 | + | let $t05743557516 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1570 | + | let refreshKLpActions = $t05743557516._1 | |
1571 | + | let updatedKLp = $t05743557516._2 | |
1584 | 1572 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1585 | 1573 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1586 | 1574 | then (state ++ refreshKLpActions) | |
1587 | 1575 | else throw("Strict value is not equal to itself.") | |
1588 | 1576 | } | |
1589 | 1577 | else throw("Strict value is not equal to itself.") | |
1590 | 1578 | } | |
1591 | 1579 | else throw("Strict value is not equal to itself.") | |
1592 | 1580 | } | |
1593 | 1581 | else throw("Strict value is not equal to itself.") | |
1594 | 1582 | } | |
1595 | 1583 | else throw("Strict value is not equal to itself.") | |
1596 | 1584 | } | |
1597 | 1585 | else throw("Strict value is not equal to itself.") | |
1598 | 1586 | } | |
1599 | 1587 | ||
1600 | 1588 | ||
1601 | 1589 | ||
1602 | 1590 | @Callable(i) | |
1603 | 1591 | func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract))) | |
1604 | 1592 | then throw("permissions denied") | |
1605 | 1593 | else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success") | |
1606 | 1594 | ||
1607 | 1595 | ||
1608 | 1596 | ||
1609 | 1597 | @Callable(i) | |
1610 | 1598 | func refreshKLp () = { | |
1611 | 1599 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0) | |
1612 | 1600 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay)) | |
1613 | 1601 | then unit | |
1614 | 1602 | else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1615 | 1603 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1616 | 1604 | then { | |
1617 | 1605 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1618 | - | let $ | |
1619 | - | let kLpUpdateActions = $ | |
1620 | - | let updatedKLp = $ | |
1606 | + | let $t05870358767 = refreshKLpInternal(0, 0, 0) | |
1607 | + | let kLpUpdateActions = $t05870358767._1 | |
1608 | + | let updatedKLp = $t05870358767._2 | |
1621 | 1609 | let actions = if ((kLp != updatedKLp)) | |
1622 | 1610 | then kLpUpdateActions | |
1623 | 1611 | else throwErr("nothing to refresh") | |
1624 | 1612 | $Tuple2(actions, toString(updatedKLp)) | |
1625 | 1613 | } | |
1626 | 1614 | else throw("Strict value is not equal to itself.") | |
1627 | 1615 | } | |
1628 | 1616 | ||
1629 | 1617 | ||
1630 | 1618 | ||
1631 | 1619 | @Callable(i) | |
1632 | 1620 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig()) | |
1633 | 1621 | ||
1634 | 1622 | ||
1635 | 1623 | ||
1636 | 1624 | @Callable(i) | |
1637 | 1625 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1638 | 1626 | ||
1639 | 1627 | ||
1640 | 1628 | ||
1641 | 1629 | @Callable(i) | |
1642 | 1630 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1643 | 1631 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
1644 | 1632 | $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])]) | |
1645 | 1633 | } | |
1646 | 1634 | ||
1647 | 1635 | ||
1648 | 1636 | ||
1649 | 1637 | @Callable(i) | |
1650 | 1638 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult))) | |
1651 | 1639 | ||
1652 | 1640 | ||
1653 | 1641 | ||
1654 | 1642 | @Callable(i) | |
1655 | 1643 | func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult)) | |
1656 | 1644 | ||
1657 | 1645 | ||
1658 | 1646 | ||
1659 | 1647 | @Callable(i) | |
1660 | 1648 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1661 | 1649 | ||
1662 | 1650 | ||
1663 | 1651 | ||
1664 | 1652 | @Callable(i) | |
1665 | 1653 | func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp)) | |
1666 | 1654 | ||
1667 | 1655 | ||
1668 | 1656 | ||
1669 | 1657 | @Callable(i) | |
1670 | 1658 | func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
1671 | 1659 | let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress)) | |
1672 | 1660 | $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10)) | |
1673 | 1661 | } | |
1674 | 1662 | ||
1675 | 1663 | ||
1676 | 1664 | ||
1677 | 1665 | @Callable(i) | |
1678 | 1666 | func statsREADONLY () = { | |
1679 | 1667 | let cfg = getPoolConfig() | |
1680 | 1668 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1681 | 1669 | let amtAssetId = cfg[idxAmtAssetId] | |
1682 | 1670 | let priceAssetId = cfg[idxPriceAssetId] | |
1683 | 1671 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
1684 | 1672 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
1685 | 1673 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1686 | 1674 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1687 | 1675 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1688 | 1676 | let accAmtAssetBalance = getAccBalance(amtAssetId) | |
1689 | 1677 | let accPriceAssetBalance = getAccBalance(priceAssetId) | |
1690 | 1678 | let pricesList = if ((poolLPBalance == 0)) | |
1691 | 1679 | then [zeroBigInt, zeroBigInt, zeroBigInt] | |
1692 | 1680 | else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance) | |
1693 | 1681 | let curPrice = 0 | |
1694 | 1682 | let lpAmtAssetShare = fromX18(pricesList[1], scale8) | |
1695 | 1683 | let lpPriceAssetShare = fromX18(pricesList[2], scale8) | |
1696 | 1684 | let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this)))) | |
1697 | 1685 | $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)) | |
1698 | 1686 | } | |
1699 | 1687 | ||
1700 | 1688 | ||
1701 | 1689 | ||
1702 | 1690 | @Callable(i) | |
1703 | 1691 | func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = { | |
1704 | 1692 | let cfg = getPoolConfig() | |
1705 | 1693 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1706 | 1694 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1707 | 1695 | let amAssetId = fromBase58String(amAssetIdStr) | |
1708 | 1696 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1709 | 1697 | let prAssetId = fromBase58String(prAssetIdStr) | |
1710 | 1698 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1711 | 1699 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1712 | 1700 | let poolStatus = cfg[idxPoolStatus] | |
1713 | 1701 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1714 | 1702 | let accAmtAssetBalance = getAccBalance(amAssetIdStr) | |
1715 | 1703 | let accPriceAssetBalance = getAccBalance(prAssetIdStr) | |
1716 | 1704 | let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm) | |
1717 | 1705 | let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm) | |
1718 | 1706 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1719 | 1707 | then zeroBigInt | |
1720 | 1708 | else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
1721 | 1709 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
1722 | 1710 | let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
1723 | 1711 | let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm) | |
1724 | 1712 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1725 | 1713 | let calcLpAmt = estPut._1 | |
1726 | 1714 | let curPriceCalc = estPut._3 | |
1727 | 1715 | let amBalance = estPut._4 | |
1728 | 1716 | let prBalance = estPut._5 | |
1729 | 1717 | let lpEmission = estPut._6 | |
1730 | 1718 | $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)) | |
1731 | 1719 | } | |
1732 | 1720 | ||
1733 | 1721 | ||
1734 | 1722 | ||
1735 | 1723 | @Callable(i) | |
1736 | 1724 | func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = { | |
1737 | 1725 | let cfg = getPoolConfig() | |
1738 | 1726 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1739 | 1727 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1740 | 1728 | let amAssetId = fromBase58String(amAssetIdStr) | |
1741 | 1729 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1742 | 1730 | let prAssetId = fromBase58String(prAssetIdStr) | |
1743 | 1731 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1744 | 1732 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1745 | 1733 | let poolStatus = cfg[idxPoolStatus] | |
1746 | 1734 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1747 | 1735 | let amBalanceRaw = getAccBalance(amAssetIdStr) | |
1748 | 1736 | let prBalanceRaw = getAccBalance(prAssetIdStr) | |
1749 | 1737 | let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm) | |
1750 | 1738 | let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm) | |
1751 | 1739 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1752 | 1740 | then zeroBigInt | |
1753 | 1741 | else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18) | |
1754 | 1742 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
1755 | 1743 | let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
1756 | 1744 | let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm) | |
1757 | 1745 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1758 | 1746 | let calcLpAmt = estPut._1 | |
1759 | 1747 | let curPriceCalc = estPut._3 | |
1760 | 1748 | let amBalance = estPut._4 | |
1761 | 1749 | let prBalance = estPut._5 | |
1762 | 1750 | let lpEmission = estPut._6 | |
1763 | 1751 | $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)) | |
1764 | 1752 | } | |
1765 | 1753 | ||
1766 | 1754 | ||
1767 | 1755 | ||
1768 | 1756 | @Callable(i) | |
1769 | 1757 | func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = { | |
1770 | 1758 | let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this) | |
1771 | 1759 | let outAmAmt = res._1 | |
1772 | 1760 | let outPrAmt = res._2 | |
1773 | 1761 | let amBalance = res._5 | |
1774 | 1762 | let prBalance = res._6 | |
1775 | 1763 | let lpEmission = res._7 | |
1776 | 1764 | let curPrice = res._8 | |
1777 | 1765 | let poolStatus = parseIntValue(res._9) | |
1778 | 1766 | $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)) | |
1779 | 1767 | } | |
1780 | 1768 | ||
1781 | 1769 | ||
1782 | 1770 | @Verifier(tx) | |
1783 | 1771 | func verify () = { | |
1784 | 1772 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1785 | 1773 | case pk: ByteVector => | |
1786 | 1774 | pk | |
1787 | 1775 | case _: Unit => | |
1788 | 1776 | tx.senderPublicKey | |
1789 | 1777 | case _ => | |
1790 | 1778 | throw("Match error") | |
1791 | 1779 | } | |
1792 | 1780 | match tx { | |
1793 | 1781 | case order: Order => | |
1794 | 1782 | let matcherPub = getMatcherPubOrFail() | |
1795 | - | let $ | |
1796 | - | let orderValid = $ | |
1797 | - | let orderValidInfo = $ | |
1783 | + | let $t06742967498 = validateMatcherOrderAllowed(order) | |
1784 | + | let orderValid = $t06742967498._1 | |
1785 | + | let orderValidInfo = $t06742967498._2 | |
1798 | 1786 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1799 | 1787 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1800 | 1788 | if (if (if (orderValid) | |
1801 | 1789 | then senderValid | |
1802 | 1790 | else false) | |
1803 | 1791 | then matcherValid | |
1804 | 1792 | else false) | |
1805 | 1793 | then true | |
1806 | 1794 | else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid) | |
1807 | 1795 | case s: SetScriptTransaction => | |
1808 | 1796 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
1809 | 1797 | then true | |
1810 | 1798 | else { | |
1811 | 1799 | let newHash = blake2b256(value(s.script)) | |
1812 | 1800 | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash()))) | |
1813 | 1801 | let currentHash = scriptHash(this) | |
1814 | 1802 | if ((allowedHash == newHash)) | |
1815 | 1803 | then (currentHash != newHash) | |
1816 | 1804 | else false | |
1817 | 1805 | } | |
1818 | 1806 | case _ => | |
1819 | 1807 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1820 | 1808 | } | |
1821 | 1809 | } | |
1822 | 1810 |
github/deemru/w8io/026f985 211.28 ms ◑