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