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