tx · HrUNq8fAZmz84rG89pdDkgQ1Q7ng9kB4imWr4FPrDzNR 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT: -0.04200000 Waves 2023.10.16 18:12 [2801335] smart account 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT > SELF 0.00000000 Waves
{ "type": 13, "id": "HrUNq8fAZmz84rG89pdDkgQ1Q7ng9kB4imWr4FPrDzNR", "fee": 4200000, "feeAssetId": null, "timestamp": 1697469104964, "version": 2, "chainId": 84, "sender": "3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT", "senderPublicKey": "D1BL65meykxFZTCuq7jq9HSGLLnWvQamQPUNrguW5w39", "proofs": [ "HuwMroEMJ7XijGCtVbjoNggB422bdBRCck8zEkMew2VnPgDxiVPWgTQgCAeVqaBDoR3UKYet12214yjSZWr6qSg" ], "script": "base64:BgLnLQgCEgUKAwEEARIHCgUBBAEIARIDCgEIEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIAEgQKAggBEgQKAggBEgQKAgEBEgMKAQESBQoDAQEBEgUKAwEIARIECgIBCBIECgIBCBIECgIICBIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgRiaWczIgRiaWc0IgpzbGlwcGFnZTREIgt3YXZlc1N0cmluZyIKYW1wSW5pdGlhbCIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFzSWQiDWlkeElQc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mFRAgpCeXRlVmVjdG9yBAJnQQUCYVEFAmdBAwkAAQIFAmFRAgRVbml0CAUCaUEPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IEAmFRBQJpQQMJAAECBQJhUQIFT3JkZXIEAmZqBQJhUQQCaUQJAQJibAAEAmlFAwkBAmdIAAkAlAoCBgIACQECZmkBBQJmagQCYUsIBQJpRQJfMQQCYUwIBQJpRQJfMgQCYU0JAPQDAwgFAmZqCWJvZHlCeXRlcwkAkQMCCAUCZmoGcHJvb2ZzAAAIBQJmag9zZW5kZXJQdWJsaWNLZXkEAmFOCQD0AwMIBQJmaglib2R5Qnl0ZXMJAJEDAggFAmZqBnByb29mcwABBQJpRAMDAwUCYUsFAmFNBwUCYU4HBgkBAmFKBAUCYUsFAmFMBQJhTQUCYU4DCQABAgUCYVECFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJhVgUCYVEDCQD0AwMIBQJpQQlib2R5Qnl0ZXMJAJEDAggFAmlBBnByb29mcwAABQJpQwYEAmlGCQD2AwEJAQV2YWx1ZQEIBQJhVgZzY3JpcHQEAmlHCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYVUJAQJhRgAEAmlICQDxBwEFBHRoaXMDCQAAAgUCaUcFAmlGCQECIT0CBQJpSAUCaUYHCQD0AwMIBQJpQQlib2R5Qnl0ZXMJAJEDAggFAmlBBnByb29mcwAABQJpQ1Wa7u0=", "height": 2801335, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: JFbdagHpBNy3qRjSWLENLoGQgGKW4W16TfJTNB2LHPQ Next: JE4VCLxAAGMMytb8XvE6qdxJqUwyExphP8WupXH7WsLD Diff:
Old | New | Differences | |
---|---|---|---|
229 | 229 | else throw(($getType(@) + " couldn't be cast to Int")) | |
230 | 230 | } | |
231 | 231 | ||
232 | + | func keyAddressWhitelisted (address) = makeString(["%s%s", "whitelisted", toString(address)], SEP) | |
233 | + | ||
234 | + | ||
235 | + | func isAddressWhitelisted (address) = valueOrElse(getBoolean(fca, keyAddressWhitelisted(address)), false) | |
236 | + | ||
237 | + | ||
232 | 238 | let A = strf(this, amp()) | |
233 | 239 | ||
234 | 240 | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
263 | 269 | ||
264 | 270 | let poolConfigParsed = parsePoolConfig(gpc()) | |
265 | 271 | ||
266 | - | let $ | |
272 | + | let $t088369022 = poolConfigParsed | |
267 | 273 | ||
268 | - | let cfgPoolAddress = $ | |
274 | + | let cfgPoolAddress = $t088369022._1 | |
269 | 275 | ||
270 | - | let cfgPoolStatus = $ | |
276 | + | let cfgPoolStatus = $t088369022._2 | |
271 | 277 | ||
272 | - | let cfgLpAssetId = $ | |
278 | + | let cfgLpAssetId = $t088369022._3 | |
273 | 279 | ||
274 | - | let cfgAmountAssetId = $ | |
280 | + | let cfgAmountAssetId = $t088369022._4 | |
275 | 281 | ||
276 | - | let cfgPriceAssetId = $ | |
282 | + | let cfgPriceAssetId = $t088369022._5 | |
277 | 283 | ||
278 | - | let cfgAmountAssetDecimals = $ | |
284 | + | let cfgAmountAssetDecimals = $t088369022._6 | |
279 | 285 | ||
280 | - | let cfgPriceAssetDecimals = $ | |
286 | + | let cfgPriceAssetDecimals = $t088369022._7 | |
281 | 287 | ||
282 | 288 | func gfc () = split(strf(fca, fcfg()), SEP) | |
283 | 289 | ||
398 | 404 | } | |
399 | 405 | ||
400 | 406 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | |
401 | - | let $ | |
407 | + | let $t01352713575 = { | |
402 | 408 | let $l = arr | |
403 | 409 | let $s = size($l) | |
404 | 410 | let $acc0 = $Tuple2(s, false) | |
412 | 418 | ||
413 | 419 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17) | |
414 | 420 | } | |
415 | - | let d = $ | |
416 | - | let found = $ | |
421 | + | let d = $t01352713575._1 | |
422 | + | let found = $t01352713575._2 | |
417 | 423 | if (found) | |
418 | 424 | then d | |
419 | 425 | else throw(("D calculation error, D = " + toString(d))) | |
464 | 470 | let priceDcm = cfgPriceAssetDecimals | |
465 | 471 | let sts = toString(cfgPoolStatus) | |
466 | 472 | let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity | |
467 | - | let amBalance = if (isEval) | |
468 | - | then getAccBalance(amIdStr) | |
469 | - | else if (if (isOneAsset) | |
470 | - | then (pmtId == amIdStr) | |
471 | - | else false) | |
472 | - | then (getAccBalance(amIdStr) - pmtAmt) | |
473 | - | else if (isOneAsset) | |
473 | + | let checkAssets = [if (if ((inAmId == parseAssetId(amIdStr))) | |
474 | + | then (inPrId == parseAssetId(prIdStr)) | |
475 | + | else false) | |
476 | + | then true | |
477 | + | else throwErr("Invalid amt or price asset passed.")] | |
478 | + | if ((checkAssets == checkAssets)) | |
479 | + | then { | |
480 | + | let amBalance = if (isEval) | |
474 | 481 | then getAccBalance(amIdStr) | |
475 | - | else ( | |
476 | - | | |
477 | - | | |
478 | - | | |
479 | - | | |
480 | - | | |
481 | - | | |
482 | - | | |
482 | + | else if (if (isOneAsset) | |
483 | + | then (pmtId == amIdStr) | |
484 | + | else false) | |
485 | + | then (getAccBalance(amIdStr) - pmtAmt) | |
486 | + | else if (isOneAsset) | |
487 | + | then getAccBalance(amIdStr) | |
488 | + | else (getAccBalance(amIdStr) - inAmAmt) | |
489 | + | let prBalance = if (isEval) | |
483 | 490 | then getAccBalance(prIdStr) | |
484 | - | else ( | |
485 | - | | |
486 | - | | |
487 | - | | |
488 | - | | |
489 | - | | |
490 | - | | |
491 | - | let | |
492 | - | | |
493 | - | let | |
494 | - | let | |
495 | - | | |
496 | - | | |
497 | - | if (( | |
491 | + | else if (if (isOneAsset) | |
492 | + | then (pmtId == prIdStr) | |
493 | + | else false) | |
494 | + | then (getAccBalance(prIdStr) - pmtAmt) | |
495 | + | else if (isOneAsset) | |
496 | + | then getAccBalance(prIdStr) | |
497 | + | else (getAccBalance(prIdStr) - inPrAmt) | |
498 | + | let inAmAssetAmtX18 = t1(inAmAmt, amtDcm) | |
499 | + | let inPrAssetAmtX18 = t1(inPrAmt, priceDcm) | |
500 | + | let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18) | |
501 | + | let amBalanceX18 = t1(amBalance, amtDcm) | |
502 | + | let prBalanceX18 = t1(prBalance, priceDcm) | |
503 | + | let D0 = getD([amBalanceX18, prBalanceX18]) | |
504 | + | let r = if ((lpEm == 0)) | |
498 | 505 | then { | |
499 | - | let curPriceX18 = zeroBigInt | |
500 | - | let slippageX18 = zeroBigInt | |
501 | - | let lpAmtX18 = D1 | |
502 | - | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
503 | - | } | |
504 | - | else throw("Strict value is not equal to itself.") | |
505 | - | } | |
506 | - | else { | |
507 | - | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
508 | - | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
509 | - | let slippageX18 = t1(slippage, scale8) | |
510 | - | if (if (if (validateSlippage) | |
511 | - | then (curPriceX18 != zeroBigInt) | |
512 | - | else false) | |
513 | - | then (slippageRealX18 > slippageX18) | |
514 | - | else false) | |
515 | - | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
516 | - | else { | |
517 | - | let lpEmissionX18 = t1(lpEm, scale8) | |
518 | - | let prViaAmX18 = fraction(inAmAssetAmtX18, cpbir(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
519 | - | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, cpbir(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
520 | - | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
521 | - | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
522 | - | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
523 | - | let expAmtAssetAmtX18 = expectedAmts._1 | |
524 | - | let expPriceAssetAmtX18 = expectedAmts._2 | |
525 | - | let D1 = getD([(amBalanceX18 + expAmtAssetAmtX18), (prBalanceX18 + expPriceAssetAmtX18)]) | |
506 | + | let D1 = getD([(amBalanceX18 + inAmAssetAmtX18), (prBalanceX18 + inPrAssetAmtX18)]) | |
526 | 507 | let checkD = if ((D1 > D0)) | |
527 | 508 | then true | |
528 | 509 | else throw("D1 should be greater than D0") | |
529 | 510 | if ((checkD == checkD)) | |
530 | 511 | then { | |
531 | - | let lpAmtX18 = fraction(lpEmissionX18, (D1 - D0), D0) | |
532 | - | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceDcm, CEILING), curPriceX18, slippageX18) | |
512 | + | let curPriceX18 = zeroBigInt | |
513 | + | let slippageX18 = zeroBigInt | |
514 | + | let lpAmtX18 = D1 | |
515 | + | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
533 | 516 | } | |
534 | 517 | else throw("Strict value is not equal to itself.") | |
535 | 518 | } | |
519 | + | else { | |
520 | + | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
521 | + | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
522 | + | let slippageX18 = t1(slippage, scale8) | |
523 | + | if (if (if (validateSlippage) | |
524 | + | then (curPriceX18 != zeroBigInt) | |
525 | + | else false) | |
526 | + | then (slippageRealX18 > slippageX18) | |
527 | + | else false) | |
528 | + | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
529 | + | else { | |
530 | + | let lpEmissionX18 = t1(lpEm, scale8) | |
531 | + | let prViaAmX18 = fraction(inAmAssetAmtX18, cpbir(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
532 | + | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, cpbir(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
533 | + | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
534 | + | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
535 | + | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
536 | + | let expAmtAssetAmtX18 = expectedAmts._1 | |
537 | + | let expPriceAssetAmtX18 = expectedAmts._2 | |
538 | + | let D1 = getD([(amBalanceX18 + expAmtAssetAmtX18), (prBalanceX18 + expPriceAssetAmtX18)]) | |
539 | + | let checkD = if ((D1 > D0)) | |
540 | + | then true | |
541 | + | else throw("D1 should be greater than D0") | |
542 | + | if ((checkD == checkD)) | |
543 | + | then { | |
544 | + | let lpAmtX18 = fraction(lpEmissionX18, (D1 - D0), D0) | |
545 | + | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceDcm, CEILING), curPriceX18, slippageX18) | |
546 | + | } | |
547 | + | else throw("Strict value is not equal to itself.") | |
548 | + | } | |
549 | + | } | |
550 | + | let calcLpAmt = r._1 | |
551 | + | let calcAmAssetPmt = r._2 | |
552 | + | let calcPrAssetPmt = r._3 | |
553 | + | let curPrice = f1(r._4, scale8) | |
554 | + | let slippageCalc = f1(r._5, scale8) | |
555 | + | if ((0 >= calcLpAmt)) | |
556 | + | then throw("LP <= 0") | |
557 | + | else { | |
558 | + | let emitLpAmt = if (!(emitLp)) | |
559 | + | then 0 | |
560 | + | else calcLpAmt | |
561 | + | let amDiff = (inAmAmt - calcAmAssetPmt) | |
562 | + | let prDiff = (inPrAmt - calcPrAssetPmt) | |
563 | + | let $t02149821843 = if (if (isOneAsset) | |
564 | + | then (pmtId == amIdStr) | |
565 | + | else false) | |
566 | + | then $Tuple2(pmtAmt, 0) | |
567 | + | else if (if (isOneAsset) | |
568 | + | then (pmtId == prIdStr) | |
569 | + | else false) | |
570 | + | then $Tuple2(0, pmtAmt) | |
571 | + | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
572 | + | let writeAmAmt = $t02149821843._1 | |
573 | + | let writePrAmt = $t02149821843._2 | |
574 | + | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
575 | + | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
576 | + | } | |
536 | 577 | } | |
537 | - | let calcLpAmt = r._1 | |
538 | - | let calcAmAssetPmt = r._2 | |
539 | - | let calcPrAssetPmt = r._3 | |
540 | - | let curPrice = f1(r._4, scale8) | |
541 | - | let slippageCalc = f1(r._5, scale8) | |
542 | - | if ((0 >= calcLpAmt)) | |
543 | - | then throw("LP <= 0") | |
544 | - | else { | |
545 | - | let emitLpAmt = if (!(emitLp)) | |
546 | - | then 0 | |
547 | - | else calcLpAmt | |
548 | - | let amDiff = (inAmAmt - calcAmAssetPmt) | |
549 | - | let prDiff = (inPrAmt - calcPrAssetPmt) | |
550 | - | let $t02110921454 = if (if (isOneAsset) | |
551 | - | then (pmtId == amIdStr) | |
552 | - | else false) | |
553 | - | then $Tuple2(pmtAmt, 0) | |
554 | - | else if (if (isOneAsset) | |
555 | - | then (pmtId == prIdStr) | |
556 | - | else false) | |
557 | - | then $Tuple2(0, pmtAmt) | |
558 | - | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
559 | - | let writeAmAmt = $t02110921454._1 | |
560 | - | let writePrAmt = $t02110921454._2 | |
561 | - | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
562 | - | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
563 | - | } | |
578 | + | else throw("Strict value is not equal to itself.") | |
564 | 579 | } | |
565 | 580 | ||
566 | 581 | ||
576 | 591 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
577 | 592 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
578 | 593 | func calc (acc,cur) = { | |
579 | - | let $ | |
580 | - | let y = $ | |
581 | - | let found = $ | |
594 | + | let $t02303823058 = acc | |
595 | + | let y = $t02303823058._1 | |
596 | + | let found = $t02303823058._2 | |
582 | 597 | if ((found != unit)) | |
583 | 598 | then acc | |
584 | 599 | else { | |
591 | 606 | } | |
592 | 607 | ||
593 | 608 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
594 | - | let $ | |
609 | + | let $t02336523412 = { | |
595 | 610 | let $l = arr | |
596 | 611 | let $s = size($l) | |
597 | 612 | let $acc0 = $Tuple2(D, unit) | |
605 | 620 | ||
606 | 621 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
607 | 622 | } | |
608 | - | let y = $ | |
609 | - | let found = $ | |
623 | + | let y = $t02336523412._1 | |
624 | + | let found = $t02336523412._2 | |
610 | 625 | if ((found != unit)) | |
611 | 626 | then y | |
612 | 627 | else throw(("Y calculation error, Y = " + toString(y))) | |
650 | 665 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
651 | 666 | let amountAssetAmount = order.amount | |
652 | 667 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
653 | - | let $ | |
668 | + | let $t02561025822 = if ((order.orderType == Buy)) | |
654 | 669 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
655 | 670 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
656 | - | let amountAssetBalanceDelta = $ | |
657 | - | let priceAssetBalanceDelta = $ | |
671 | + | let amountAssetBalanceDelta = $t02561025822._1 | |
672 | + | let priceAssetBalanceDelta = $t02561025822._2 | |
658 | 673 | if (if (if (igs()) | |
659 | 674 | then true | |
660 | 675 | else (cfgPoolStatus == PoolMatcherDis)) | |
667 | 682 | then throw("Wr assets") | |
668 | 683 | else { | |
669 | 684 | let dLp = parseBigIntValue(valueOrElse(getString(this, keyDLp), "0")) | |
670 | - | let $ | |
671 | - | let unusedActions = $ | |
672 | - | let dLpNew = $ | |
685 | + | let $t02616426264 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
686 | + | let unusedActions = $t02616426264._1 | |
687 | + | let dLpNew = $t02616426264._2 | |
673 | 688 | let isOrderValid = (dLpNew >= dLp) | |
674 | 689 | let info = makeString(["dLp=", toString(dLp), " dLpNew=", toString(dLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
675 | 690 | $Tuple2(isOrderValid, info) | |
688 | 703 | let outPrAmt = r._2 | |
689 | 704 | let sts = parseIntValue(r._9) | |
690 | 705 | let state = r._10 | |
691 | - | if (if (igs()) | |
692 | - | then true | |
693 | - | else (sts == PoolShutdown)) | |
706 | + | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
707 | + | then if (igs()) | |
708 | + | then true | |
709 | + | else (cfgPoolStatus == PoolShutdown) | |
710 | + | else false | |
711 | + | if (isGetDisabled) | |
694 | 712 | then throw(("Admin blocked: " + toString(sts))) | |
695 | 713 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
696 | 714 | } | |
699 | 717 | func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
700 | 718 | let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId) | |
701 | 719 | let sts = parseIntValue(r._8) | |
702 | - | if (if (if (igs()) | |
703 | - | then true | |
704 | - | else (sts == PoolPutDis)) | |
705 | - | then true | |
706 | - | else (sts == PoolShutdown)) | |
720 | + | let isPutDisabled = if (!(isAddressWhitelisted(addressFromStringValue(caller)))) | |
721 | + | then if (if (igs()) | |
722 | + | then true | |
723 | + | else (cfgPoolStatus == PoolShutdown)) | |
724 | + | then true | |
725 | + | else (cfgPoolStatus == PoolPutDis) | |
726 | + | else false | |
727 | + | if (isPutDisabled) | |
707 | 728 | then throw(("Blocked:" + toString(sts))) | |
708 | 729 | else r | |
709 | 730 | } | |
723 | 744 | then { | |
724 | 745 | let amBalance = getAccBalance(amId) | |
725 | 746 | let prBalance = getAccBalance(prId) | |
726 | - | let $ | |
747 | + | let $t02912329585 = if ((txId == "")) | |
727 | 748 | then $Tuple2(amBalance, prBalance) | |
728 | 749 | else if ((pmtAssetId == amId)) | |
729 | 750 | then if ((pmtAmtRaw > amBalance)) | |
734 | 755 | then throw("invalid payment amount") | |
735 | 756 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
736 | 757 | else throw("wrong pmtAssetId") | |
737 | - | let amBalanceOld = $ | |
738 | - | let prBalanceOld = $ | |
739 | - | let $ | |
758 | + | let amBalanceOld = $t02912329585._1 | |
759 | + | let prBalanceOld = $t02912329585._2 | |
760 | + | let $t02959129767 = if ((pmtAssetId == amId)) | |
740 | 761 | then $Tuple2(pmtAmtRaw, 0) | |
741 | 762 | else if ((pmtAssetId == prId)) | |
742 | 763 | then $Tuple2(0, pmtAmtRaw) | |
743 | 764 | else throw("invalid payment") | |
744 | - | let amAmountRaw = $ | |
745 | - | let prAmountRaw = $ | |
746 | - | let $ | |
765 | + | let amAmountRaw = $t02959129767._1 | |
766 | + | let prAmountRaw = $t02959129767._2 | |
767 | + | let $t02977130025 = if (withTakeFee) | |
747 | 768 | then $Tuple3(takeFee(amAmountRaw, inFee)._1, takeFee(prAmountRaw, inFee)._1, takeFee(pmtAmtRaw, inFee)._2) | |
748 | 769 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
749 | - | let amAmount = $ | |
750 | - | let prAmount = $ | |
751 | - | let feeAmount = $ | |
770 | + | let amAmount = $t02977130025._1 | |
771 | + | let prAmount = $t02977130025._2 | |
772 | + | let feeAmount = $t02977130025._3 | |
752 | 773 | let amBalanceNew = (amBalanceOld + amAmount) | |
753 | 774 | let prBalanceNew = (prBalanceOld + prAmount) | |
754 | 775 | let D0 = getD([t1(amBalanceOld, cfgAmountAssetDecimals), t1(prBalanceOld, cfgPriceAssetDecimals)]) | |
796 | 817 | else { | |
797 | 818 | let amBalance = getAccBalance(amId) | |
798 | 819 | let prBalance = getAccBalance(prId) | |
799 | - | let $ | |
820 | + | let $t03213732248 = { | |
800 | 821 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
801 | 822 | if ($isInstanceOf(@, "(Int, Int)")) | |
802 | 823 | then @ | |
803 | 824 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
804 | 825 | } | |
805 | - | if (($ | |
826 | + | if (($t03213732248 == $t03213732248)) | |
806 | 827 | then { | |
807 | - | let feeAmount = $ | |
808 | - | let totalGet = $ | |
828 | + | let feeAmount = $t03213732248._2 | |
829 | + | let totalGet = $t03213732248._1 | |
809 | 830 | let totalAmount = if (if ((minOutAmount > 0)) | |
810 | 831 | then (minOutAmount > totalGet) | |
811 | 832 | else false) | |
812 | 833 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
813 | 834 | else totalGet | |
814 | - | let $ | |
835 | + | let $t03243832745 = if ((outAssetId == amId)) | |
815 | 836 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
816 | 837 | else if ((outAssetId == prId)) | |
817 | 838 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
818 | 839 | else throw("invalid out asset id") | |
819 | - | let outAm = $ | |
820 | - | let outPr = $ | |
821 | - | let amBalanceNew = $ | |
822 | - | let prBalanceNew = $ | |
840 | + | let outAm = $t03243832745._1 | |
841 | + | let outPr = $t03243832745._2 | |
842 | + | let amBalanceNew = $t03243832745._3 | |
843 | + | let prBalanceNew = $t03243832745._4 | |
823 | 844 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
824 | 845 | let curPr = f1(curPrX18, scale8) | |
825 | 846 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
834 | 855 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
835 | 856 | if ((burn == burn)) | |
836 | 857 | then { | |
837 | - | let $ | |
858 | + | let $t03353033880 = { | |
838 | 859 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
839 | 860 | then 0 | |
840 | 861 | else feeAmount | |
845 | 866 | then $Tuple2(-((totalGet + feeAmountForCalc)), 0) | |
846 | 867 | else $Tuple2(0, -((totalGet + feeAmountForCalc))) | |
847 | 868 | } | |
848 | - | let amountAssetBalanceDelta = $ | |
849 | - | let priceAssetBalanceDelta = $ | |
850 | - | let $ | |
851 | - | let refreshDLpActions = $ | |
852 | - | let updatedDLp = $ | |
869 | + | let amountAssetBalanceDelta = $t03353033880._1 | |
870 | + | let priceAssetBalanceDelta = $t03353033880._2 | |
871 | + | let $t03388333991 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
872 | + | let refreshDLpActions = $t03388333991._1 | |
873 | + | let updatedDLp = $t03388333991._2 | |
853 | 874 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
854 | 875 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
855 | 876 | then $Tuple2((state ++ refreshDLpActions), totalAmount) | |
921 | 942 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
922 | 943 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
923 | 944 | func calc (acc,cur) = { | |
924 | - | let $ | |
925 | - | let y = $ | |
926 | - | let found = $ | |
945 | + | let $t03547835498 = acc | |
946 | + | let y = $t03547835498._1 | |
947 | + | let found = $t03547835498._2 | |
927 | 948 | if ((found != unit)) | |
928 | 949 | then acc | |
929 | 950 | else { | |
936 | 957 | } | |
937 | 958 | ||
938 | 959 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
939 | - | let $ | |
960 | + | let $t03582935876 = { | |
940 | 961 | let $l = arr | |
941 | 962 | let $s = size($l) | |
942 | 963 | let $acc0 = $Tuple2(D, unit) | |
950 | 971 | ||
951 | 972 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
952 | 973 | } | |
953 | - | let y = $ | |
954 | - | let found = $ | |
974 | + | let y = $t03582935876._1 | |
975 | + | let found = $t03582935876._2 | |
955 | 976 | if ((found != unit)) | |
956 | 977 | then y | |
957 | 978 | else throw(("Y calculation error, Y = " + toString(y))) | |
963 | 984 | ||
964 | 985 | @Callable(i) | |
965 | 986 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
966 | - | let $ | |
987 | + | let $t03622836652 = if ((isReverse == false)) | |
967 | 988 | then { | |
968 | 989 | let assetOut = strf(this, pa()) | |
969 | 990 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, aa()))) + toBigInt(cleanAmountIn)) | |
974 | 995 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, pa()))) + toBigInt(cleanAmountIn)) | |
975 | 996 | $Tuple2(assetOut, poolAmountInBalance) | |
976 | 997 | } | |
977 | - | let assetOut = $ | |
978 | - | let poolAmountInBalance = $ | |
998 | + | let assetOut = $t03622836652._1 | |
999 | + | let poolAmountInBalance = $t03622836652._2 | |
979 | 1000 | let poolConfig = gpc() | |
980 | 1001 | let amId = poolConfig[idxAmAsId] | |
981 | 1002 | let prId = poolConfig[idxPrAsId] | |
1012 | 1033 | then @ | |
1013 | 1034 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1014 | 1035 | } | |
1015 | - | let isSwapDisabled = if (if (igs()) | |
1016 | - | then true | |
1017 | - | else (cfgPoolStatus == PoolShutdown)) | |
1018 | - | then true | |
1019 | - | else isPoolSwapDisabled | |
1036 | + | let isSwapDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1037 | + | then if (if (igs()) | |
1038 | + | then true | |
1039 | + | else (cfgPoolStatus == PoolShutdown)) | |
1040 | + | then true | |
1041 | + | else isPoolSwapDisabled | |
1042 | + | else false | |
1020 | 1043 | let checks = [if (if (!(isSwapDisabled)) | |
1021 | 1044 | then true | |
1022 | 1045 | else isManager(i)) | |
1030 | 1053 | then { | |
1031 | 1054 | let pmt = value(i.payments[0]) | |
1032 | 1055 | let assetIn = assetIdToString(pmt.assetId) | |
1033 | - | let $ | |
1056 | + | let $t03842438818 = if ((isReverse == false)) | |
1034 | 1057 | then { | |
1035 | 1058 | let assetOut = strf(this, pa()) | |
1036 | 1059 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1041 | 1064 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1042 | 1065 | $Tuple2(assetOut, poolAmountInBalance) | |
1043 | 1066 | } | |
1044 | - | let assetOut = $ | |
1045 | - | let poolAmountInBalance = $ | |
1067 | + | let assetOut = $t03842438818._1 | |
1068 | + | let poolAmountInBalance = $t03842438818._2 | |
1046 | 1069 | let poolConfig = gpc() | |
1047 | 1070 | let amId = poolConfig[idxAmAsId] | |
1048 | 1071 | let prId = poolConfig[idxPrAsId] | |
1158 | 1181 | else throw("Strict value is not equal to itself.") | |
1159 | 1182 | } | |
1160 | 1183 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1161 | - | let $ | |
1162 | - | let refreshDLpActions = $ | |
1163 | - | let updatedDLp = $ | |
1184 | + | let $t04327343415 = refreshDLpInternal(0, 0, 0) | |
1185 | + | let refreshDLpActions = $t04327343415._1 | |
1186 | + | let updatedDLp = $t04327343415._2 | |
1164 | 1187 | let check = if ((updatedDLp >= currentDLp)) | |
1165 | 1188 | then true | |
1166 | 1189 | else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(amDiff), toString(prDiff)], " ")) | |
1201 | 1224 | then @ | |
1202 | 1225 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1203 | 1226 | } | |
1204 | - | let isPutDisabled = if (if (if (igs()) | |
1205 | - | then true | |
1206 | - | else (cfgPoolStatus == PoolPutDis)) | |
1207 | - | then true | |
1208 | - | else (cfgPoolStatus == PoolShutdown)) | |
1209 | - | then true | |
1210 | - | else isPoolOneTokenOperationsDisabled | |
1227 | + | let isPutDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1228 | + | then if (if (if (igs()) | |
1229 | + | then true | |
1230 | + | else (cfgPoolStatus == PoolPutDis)) | |
1231 | + | then true | |
1232 | + | else (cfgPoolStatus == PoolShutdown)) | |
1233 | + | then true | |
1234 | + | else isPoolOneTokenOperationsDisabled | |
1235 | + | else false | |
1211 | 1236 | let checks = [if (if (!(isPutDisabled)) | |
1212 | 1237 | then true | |
1213 | 1238 | else isManager(i)) | |
1233 | 1258 | else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0)) | |
1234 | 1259 | if ((currentDLp == currentDLp)) | |
1235 | 1260 | then { | |
1236 | - | let $ | |
1237 | - | if (($ | |
1261 | + | let $t04509345251 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
1262 | + | if (($t04509345251 == $t04509345251)) | |
1238 | 1263 | then { | |
1239 | - | let feeAmount = $ | |
1240 | - | let state = $ | |
1241 | - | let estimLP = $ | |
1264 | + | let feeAmount = $t04509345251._3 | |
1265 | + | let state = $t04509345251._2 | |
1266 | + | let estimLP = $t04509345251._1 | |
1242 | 1267 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
1243 | 1268 | then (minOutAmount > estimLP) | |
1244 | 1269 | else false) | |
1266 | 1291 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1267 | 1292 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1268 | 1293 | else nil | |
1269 | - | let $ | |
1294 | + | let $t04613646485 = if ((this == feeCollectorAddress)) | |
1270 | 1295 | then $Tuple2(0, 0) | |
1271 | 1296 | else { | |
1272 | 1297 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1276 | 1301 | then $Tuple2(-(feeAmount), 0) | |
1277 | 1302 | else $Tuple2(0, -(feeAmount)) | |
1278 | 1303 | } | |
1279 | - | let amountAssetBalanceDelta = $ | |
1280 | - | let priceAssetBalanceDelta = $ | |
1281 | - | let $ | |
1282 | - | let refreshDLpActions = $ | |
1283 | - | let updatedDLp = $ | |
1304 | + | let amountAssetBalanceDelta = $t04613646485._1 | |
1305 | + | let priceAssetBalanceDelta = $t04613646485._2 | |
1306 | + | let $t04648846596 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1307 | + | let refreshDLpActions = $t04648846596._1 | |
1308 | + | let updatedDLp = $t04648846596._2 | |
1284 | 1309 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1285 | 1310 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1286 | 1311 | then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1312 | 1337 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1313 | 1338 | if ((currentDLp == currentDLp)) | |
1314 | 1339 | then { | |
1315 | - | let $ | |
1316 | - | let refreshDLpActions = $ | |
1317 | - | let updatedDLp = $ | |
1340 | + | let $t04762647691 = refreshDLpInternal(0, 0, 0) | |
1341 | + | let refreshDLpActions = $t04762647691._1 | |
1342 | + | let updatedDLp = $t04762647691._2 | |
1318 | 1343 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1319 | 1344 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1320 | 1345 | then (state ++ refreshDLpActions) | |
1339 | 1364 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1340 | 1365 | if ((b == b)) | |
1341 | 1366 | then { | |
1342 | - | let $ | |
1343 | - | let refreshDLpActions = $ | |
1344 | - | let updatedDLp = $ | |
1367 | + | let $t04886448946 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1368 | + | let refreshDLpActions = $t04886448946._1 | |
1369 | + | let updatedDLp = $t04886448946._2 | |
1345 | 1370 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1346 | 1371 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1347 | 1372 | then (state ++ refreshDLpActions) | |
1362 | 1387 | then @ | |
1363 | 1388 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1364 | 1389 | } | |
1365 | - | let isGetDisabled = if (if (igs()) | |
1366 | - | then true | |
1367 | - | else (cfgPoolStatus == PoolShutdown)) | |
1368 | - | then true | |
1369 | - | else isPoolOneTokenOperationsDisabled | |
1390 | + | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1391 | + | then if (if (igs()) | |
1392 | + | then true | |
1393 | + | else (cfgPoolStatus == PoolShutdown)) | |
1394 | + | then true | |
1395 | + | else isPoolOneTokenOperationsDisabled | |
1396 | + | else false | |
1370 | 1397 | let checks = [if (if (!(isGetDisabled)) | |
1371 | 1398 | then true | |
1372 | 1399 | else isManager(i)) | |
1376 | 1403 | else throwErr("exactly 1 payment are expected")] | |
1377 | 1404 | if ((checks == checks)) | |
1378 | 1405 | then { | |
1379 | - | let $ | |
1380 | - | let state = $ | |
1381 | - | let totalAmount = $ | |
1406 | + | let $t04960149756 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1407 | + | let state = $t04960149756._1 | |
1408 | + | let totalAmount = $t04960149756._2 | |
1382 | 1409 | $Tuple2(state, totalAmount) | |
1383 | 1410 | } | |
1384 | 1411 | else throw("Strict value is not equal to itself.") | |
1395 | 1422 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1396 | 1423 | then { | |
1397 | 1424 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1398 | - | let $ | |
1399 | - | let dLpUpdateActions = $ | |
1400 | - | let updatedDLp = $ | |
1425 | + | let $t05028050344 = refreshDLpInternal(0, 0, 0) | |
1426 | + | let dLpUpdateActions = $t05028050344._1 | |
1427 | + | let updatedDLp = $t05028050344._2 | |
1401 | 1428 | let actions = if ((dLp != updatedDLp)) | |
1402 | 1429 | then dLpUpdateActions | |
1403 | 1430 | else throwErr("nothing to refresh") | |
1425 | 1452 | let newY = getYD(xp, index, D1) | |
1426 | 1453 | let dy = (xp[index] - newY) | |
1427 | 1454 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1428 | - | let $ | |
1429 | - | let totalGet = $ | |
1430 | - | let feeAmount = $ | |
1455 | + | let $t05135451409 = takeFee(totalGetRaw, outFee) | |
1456 | + | let totalGet = $t05135451409._1 | |
1457 | + | let feeAmount = $t05135451409._2 | |
1431 | 1458 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1432 | 1459 | } | |
1433 | 1460 | ||
1440 | 1467 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1441 | 1468 | let amBalance = getAccBalance(amId) | |
1442 | 1469 | let prBalance = getAccBalance(prId) | |
1443 | - | let $ | |
1470 | + | let $t05178451899 = { | |
1444 | 1471 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1445 | 1472 | if ($isInstanceOf(@, "(Int, Int)")) | |
1446 | 1473 | then @ | |
1447 | 1474 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1448 | 1475 | } | |
1449 | - | let totalGet = $ | |
1450 | - | let feeAmount = $ | |
1476 | + | let totalGet = $t05178451899._1 | |
1477 | + | let feeAmount = $t05178451899._2 | |
1451 | 1478 | let r = ego("", lpId, lpAssetAmount, this) | |
1452 | 1479 | let outAmAmt = r._1 | |
1453 | 1480 | let outPrAmt = r._2 | |
1481 | 1508 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1482 | 1509 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1483 | 1510 | then { | |
1484 | - | let $ | |
1485 | - | let refreshDLpActions = $ | |
1486 | - | let updatedDLp = $ | |
1511 | + | let $t05306553146 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1512 | + | let refreshDLpActions = $t05306553146._1 | |
1513 | + | let updatedDLp = $t05306553146._2 | |
1487 | 1514 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1488 | 1515 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1489 | 1516 | then (state ++ refreshDLpActions) | |
1518 | 1545 | let outPrAmt = r._2 | |
1519 | 1546 | let sts = parseIntValue(r._9) | |
1520 | 1547 | let state = r._10 | |
1521 | - | let v = if (if (igs()) | |
1522 | - | then true | |
1523 | - | else (sts == PoolShutdown)) | |
1548 | + | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1549 | + | then if (igs()) | |
1550 | + | then true | |
1551 | + | else (cfgPoolStatus == PoolShutdown) | |
1552 | + | else false | |
1553 | + | let v = if (isGetDisabled) | |
1524 | 1554 | then throw(("Blocked: " + toString(sts))) | |
1525 | 1555 | else true | |
1526 | 1556 | if ((v == v)) | |
1528 | 1558 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1529 | 1559 | if ((burnA == burnA)) | |
1530 | 1560 | then { | |
1531 | - | let $ | |
1532 | - | let refreshDLpActions = $ | |
1533 | - | let updatedDLp = $ | |
1561 | + | let $t05425654337 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1562 | + | let refreshDLpActions = $t05425654337._1 | |
1563 | + | let updatedDLp = $t05425654337._2 | |
1534 | 1564 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1535 | 1565 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1536 | 1566 | then (state ++ refreshDLpActions) | |
1551 | 1581 | ||
1552 | 1582 | @Callable(i) | |
1553 | 1583 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1554 | - | let isGetDisabled = if (igs()) | |
1555 | - | then true | |
1556 | - | else (cfgPoolStatus == PoolShutdown) | |
1584 | + | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1585 | + | then if (igs()) | |
1586 | + | then true | |
1587 | + | else (cfgPoolStatus == PoolShutdown) | |
1588 | + | else false | |
1557 | 1589 | let checks = [if (!(isGetDisabled)) | |
1558 | 1590 | then true | |
1559 | 1591 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1581 | 1613 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1582 | 1614 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1583 | 1615 | then { | |
1584 | - | let $ | |
1585 | - | let refreshDLpActions = $ | |
1586 | - | let updatedDLp = $ | |
1616 | + | let $t05562555706 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1617 | + | let refreshDLpActions = $t05562555706._1 | |
1618 | + | let updatedDLp = $t05562555706._2 | |
1587 | 1619 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1588 | 1620 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1589 | 1621 | then (state ++ refreshDLpActions) | |
1610 | 1642 | then @ | |
1611 | 1643 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1612 | 1644 | } | |
1613 | - | let isGetDisabled = if (if (igs()) | |
1614 | - | then true | |
1615 | - | else (cfgPoolStatus == PoolShutdown)) | |
1616 | - | then true | |
1617 | - | else isPoolOneTokenOperationsDisabled | |
1645 | + | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1646 | + | then if (if (igs()) | |
1647 | + | then true | |
1648 | + | else (cfgPoolStatus == PoolShutdown)) | |
1649 | + | then true | |
1650 | + | else isPoolOneTokenOperationsDisabled | |
1651 | + | else false | |
1618 | 1652 | let checks = [if (if (!(isGetDisabled)) | |
1619 | 1653 | then true | |
1620 | 1654 | else isManager(i)) | |
1632 | 1666 | let unstakeInv = invoke(staking, "unstakeINTERNAL", [lpAssetId, unstakeAmount, userAddress.bytes, lpAssetRecipientAddress.bytes], nil) | |
1633 | 1667 | if ((unstakeInv == unstakeInv)) | |
1634 | 1668 | then { | |
1635 | - | let $ | |
1636 | - | let state = $ | |
1637 | - | let totalAmount = $ | |
1669 | + | let $t05676556953 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1670 | + | let state = $t05676556953._1 | |
1671 | + | let totalAmount = $t05676556953._2 | |
1638 | 1672 | $Tuple2(state, totalAmount) | |
1639 | 1673 | } | |
1640 | 1674 | else throw("Strict value is not equal to itself.") | |
1646 | 1680 | ||
1647 | 1681 | @Callable(i) | |
1648 | 1682 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1649 | - | let $ | |
1650 | - | let lpAmount = $ | |
1651 | - | let state = $ | |
1652 | - | let feeAmount = $ | |
1653 | - | let bonus = $ | |
1683 | + | let $t05708157184 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1684 | + | let lpAmount = $t05708157184._1 | |
1685 | + | let state = $t05708157184._2 | |
1686 | + | let feeAmount = $t05708157184._3 | |
1687 | + | let bonus = $t05708157184._4 | |
1654 | 1688 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1655 | 1689 | } | |
1656 | 1690 | ||
1658 | 1692 | ||
1659 | 1693 | @Callable(i) | |
1660 | 1694 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1661 | - | let $ | |
1662 | - | let lpAmount = $ | |
1663 | - | let state = $ | |
1664 | - | let feeAmount = $ | |
1665 | - | let bonus = $ | |
1695 | + | let $t05733257436 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1696 | + | let lpAmount = $t05733257436._1 | |
1697 | + | let state = $t05733257436._2 | |
1698 | + | let feeAmount = $t05733257436._3 | |
1699 | + | let bonus = $t05733257436._4 | |
1666 | 1700 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1667 | 1701 | } | |
1668 | 1702 | ||
1724 | 1758 | @Callable(i) | |
1725 | 1759 | func changeAmp () = { | |
1726 | 1760 | let cfg = invoke(fca, "getChangeAmpConfigREADONLY", [toString(this)], nil) | |
1727 | - | let $ | |
1761 | + | let $t05991660115 = match cfg { | |
1728 | 1762 | case list: List[Any] => | |
1729 | 1763 | $Tuple3({ | |
1730 | 1764 | let @ = list[0] | |
1745 | 1779 | case _ => | |
1746 | 1780 | throwErr("invalid entry type") | |
1747 | 1781 | } | |
1748 | - | let delay = $ | |
1749 | - | let delta = $ | |
1750 | - | let target = $ | |
1782 | + | let delay = $t05991660115._1 | |
1783 | + | let delta = $t05991660115._2 | |
1784 | + | let target = $t05991660115._3 | |
1751 | 1785 | let curAmp = parseIntValue(getStringValue(amp())) | |
1752 | 1786 | let newAmpRaw = (curAmp + delta) | |
1753 | 1787 | let newAmp = if ((0 > delta)) | |
1783 | 1817 | match tx { | |
1784 | 1818 | case order: Order => | |
1785 | 1819 | let matcherPub = mp() | |
1786 | - | let $ | |
1820 | + | let $t06104861165 = if (skipOrderValidation()) | |
1787 | 1821 | then $Tuple2(true, "") | |
1788 | 1822 | else validateMatcherOrderAllowed(order) | |
1789 | - | let orderValid = $ | |
1790 | - | let orderValidInfo = $ | |
1823 | + | let orderValid = $t06104861165._1 | |
1824 | + | let orderValidInfo = $t06104861165._2 | |
1791 | 1825 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1792 | 1826 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1793 | 1827 | if (if (if (orderValid) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let scale8 = 100000000 | |
5 | 5 | ||
6 | 6 | let scale8BigInt = toBigInt(100000000) | |
7 | 7 | ||
8 | 8 | let scale18 = toBigInt(1000000000000000000) | |
9 | 9 | ||
10 | 10 | let zeroBigInt = toBigInt(0) | |
11 | 11 | ||
12 | 12 | let big0 = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big1 = toBigInt(1) | |
15 | 15 | ||
16 | 16 | let big2 = toBigInt(2) | |
17 | 17 | ||
18 | 18 | let big3 = toBigInt(3) | |
19 | 19 | ||
20 | 20 | let big4 = toBigInt(4) | |
21 | 21 | ||
22 | 22 | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
23 | 23 | ||
24 | 24 | let wavesString = "WAVES" | |
25 | 25 | ||
26 | 26 | let ampInitial = 50 | |
27 | 27 | ||
28 | 28 | let Amult = "100" | |
29 | 29 | ||
30 | 30 | let Dconv = "1" | |
31 | 31 | ||
32 | 32 | let SEP = "__" | |
33 | 33 | ||
34 | 34 | let EMPTY = "" | |
35 | 35 | ||
36 | 36 | let PoolActive = 1 | |
37 | 37 | ||
38 | 38 | let PoolPutDis = 2 | |
39 | 39 | ||
40 | 40 | let PoolMatcherDis = 3 | |
41 | 41 | ||
42 | 42 | let PoolShutdown = 4 | |
43 | 43 | ||
44 | 44 | let idxPoolAddress = 1 | |
45 | 45 | ||
46 | 46 | let idxPoolSt = 2 | |
47 | 47 | ||
48 | 48 | let idxLPAsId = 3 | |
49 | 49 | ||
50 | 50 | let idxAmAsId = 4 | |
51 | 51 | ||
52 | 52 | let idxPrAsId = 5 | |
53 | 53 | ||
54 | 54 | let idxAmtAsDcm = 6 | |
55 | 55 | ||
56 | 56 | let idxPriceAsDcm = 7 | |
57 | 57 | ||
58 | 58 | let idxIAmtAsId = 8 | |
59 | 59 | ||
60 | 60 | let idxIPriceAsId = 9 | |
61 | 61 | ||
62 | 62 | let idxFactStakCntr = 1 | |
63 | 63 | ||
64 | 64 | let idxFactoryRestCntr = 6 | |
65 | 65 | ||
66 | 66 | let idxFactSlippCntr = 7 | |
67 | 67 | ||
68 | 68 | let idxFactGwxRewCntr = 10 | |
69 | 69 | ||
70 | 70 | let feeDefault = fraction(10, scale8, 10000) | |
71 | 71 | ||
72 | 72 | func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func t1BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func t2 (origVal,origScaleMult) = fraction(origVal, scale18, toBigInt(origScaleMult)) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func f2 (val,resultScaleMult) = fraction(val, toBigInt(resultScaleMult), scale18) | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func abs (val) = if ((zeroBigInt > val)) | |
94 | 94 | then -(val) | |
95 | 95 | else val | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func absBigInt (val) = if ((zeroBigInt > val)) | |
99 | 99 | then -(val) | |
100 | 100 | else val | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func fc () = "%s__factoryContract" | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func pl () = "%s%s__price__last" | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP) | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId) | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func aa () = "%s__amountAsset" | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func pa () = "%s__priceAsset" | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func amp () = "%s__amp" | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func keyAmpHistory (heightBlocks) = ("%s%d__amp__" + toString(heightBlocks)) | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func keyChangeAmpLastCall () = "%s__changeAmpLastCall" | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | let keyFee = "%s__fee" | |
140 | 140 | ||
141 | 141 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
142 | 142 | ||
143 | 143 | let keyDLp = makeString(["%s", "dLp"], SEP) | |
144 | 144 | ||
145 | 145 | let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP) | |
146 | 146 | ||
147 | 147 | let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP) | |
148 | 148 | ||
149 | 149 | let dLpRefreshDelayDefault = 30 | |
150 | 150 | ||
151 | 151 | let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault) | |
152 | 152 | ||
153 | 153 | func fcfg () = "%s__factoryConfig" | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func mtpk () = "%s%s__matcher__publicKey" | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | func aps () = "%s__shutdown" | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash" | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func keyFeeCollectorAddress () = "%s__feeCollectorAddress" | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress) | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func addressFromStringOrThis (addressString) = match addressFromString(addressString) { | |
181 | 181 | case a: Address => | |
182 | 182 | a | |
183 | 183 | case _ => | |
184 | 184 | this | |
185 | 185 | } | |
186 | 186 | ||
187 | 187 | ||
188 | 188 | func getManagerVaultAddressOrThis () = { | |
189 | 189 | let factoryAddress = match getString(fc()) { | |
190 | 190 | case fca: String => | |
191 | 191 | addressFromStringOrThis(fca) | |
192 | 192 | case _ => | |
193 | 193 | this | |
194 | 194 | } | |
195 | 195 | match getString(factoryAddress, keyManagerVaultAddress()) { | |
196 | 196 | case s: String => | |
197 | 197 | addressFromStringOrThis(s) | |
198 | 198 | case _ => | |
199 | 199 | this | |
200 | 200 | } | |
201 | 201 | } | |
202 | 202 | ||
203 | 203 | ||
204 | 204 | func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " ")) | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ") | |
214 | 214 | ||
215 | 215 | ||
216 | 216 | let fca = addressFromStringValue(strf(this, fc())) | |
217 | 217 | ||
218 | 218 | let inFee = { | |
219 | 219 | let @ = invoke(fca, "getInFeeREADONLY", [toString(this)], nil) | |
220 | 220 | if ($isInstanceOf(@, "Int")) | |
221 | 221 | then @ | |
222 | 222 | else throw(($getType(@) + " couldn't be cast to Int")) | |
223 | 223 | } | |
224 | 224 | ||
225 | 225 | let outFee = { | |
226 | 226 | let @ = invoke(fca, "getOutFeeREADONLY", [toString(this)], nil) | |
227 | 227 | if ($isInstanceOf(@, "Int")) | |
228 | 228 | then @ | |
229 | 229 | else throw(($getType(@) + " couldn't be cast to Int")) | |
230 | 230 | } | |
231 | 231 | ||
232 | + | func keyAddressWhitelisted (address) = makeString(["%s%s", "whitelisted", toString(address)], SEP) | |
233 | + | ||
234 | + | ||
235 | + | func isAddressWhitelisted (address) = valueOrElse(getBoolean(fca, keyAddressWhitelisted(address)), false) | |
236 | + | ||
237 | + | ||
232 | 238 | let A = strf(this, amp()) | |
233 | 239 | ||
234 | 240 | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
235 | 241 | ||
236 | 242 | ||
237 | 243 | func mp () = fromBase58String(strf(fca, mtpk())) | |
238 | 244 | ||
239 | 245 | ||
240 | 246 | let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress())) | |
241 | 247 | ||
242 | 248 | func gpc () = { | |
243 | 249 | let amtAs = strf(this, aa()) | |
244 | 250 | let priceAs = strf(this, pa()) | |
245 | 251 | let iPriceAs = intf(fca, mba(priceAs)) | |
246 | 252 | let iAmtAs = intf(fca, mba(amtAs)) | |
247 | 253 | split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP) | |
248 | 254 | } | |
249 | 255 | ||
250 | 256 | ||
251 | 257 | func parseAssetId (input) = if ((input == wavesString)) | |
252 | 258 | then unit | |
253 | 259 | else fromBase58String(input) | |
254 | 260 | ||
255 | 261 | ||
256 | 262 | func assetIdToString (input) = if ((input == unit)) | |
257 | 263 | then wavesString | |
258 | 264 | else toBase58String(value(input)) | |
259 | 265 | ||
260 | 266 | ||
261 | 267 | func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolSt]), fromBase58String(poolConfig[idxLPAsId]), parseAssetId(poolConfig[idxAmAsId]), parseAssetId(poolConfig[idxPrAsId]), parseIntValue(poolConfig[idxAmtAsDcm]), parseIntValue(poolConfig[idxPriceAsDcm])) | |
262 | 268 | ||
263 | 269 | ||
264 | 270 | let poolConfigParsed = parsePoolConfig(gpc()) | |
265 | 271 | ||
266 | - | let $ | |
272 | + | let $t088369022 = poolConfigParsed | |
267 | 273 | ||
268 | - | let cfgPoolAddress = $ | |
274 | + | let cfgPoolAddress = $t088369022._1 | |
269 | 275 | ||
270 | - | let cfgPoolStatus = $ | |
276 | + | let cfgPoolStatus = $t088369022._2 | |
271 | 277 | ||
272 | - | let cfgLpAssetId = $ | |
278 | + | let cfgLpAssetId = $t088369022._3 | |
273 | 279 | ||
274 | - | let cfgAmountAssetId = $ | |
280 | + | let cfgAmountAssetId = $t088369022._4 | |
275 | 281 | ||
276 | - | let cfgPriceAssetId = $ | |
282 | + | let cfgPriceAssetId = $t088369022._5 | |
277 | 283 | ||
278 | - | let cfgAmountAssetDecimals = $ | |
284 | + | let cfgAmountAssetDecimals = $t088369022._6 | |
279 | 285 | ||
280 | - | let cfgPriceAssetDecimals = $ | |
286 | + | let cfgPriceAssetDecimals = $t088369022._7 | |
281 | 287 | ||
282 | 288 | func gfc () = split(strf(fca, fcfg()), SEP) | |
283 | 289 | ||
284 | 290 | ||
285 | 291 | let factoryConfig = gfc() | |
286 | 292 | ||
287 | 293 | let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address") | |
288 | 294 | ||
289 | 295 | let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address") | |
290 | 296 | ||
291 | 297 | let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address") | |
292 | 298 | ||
293 | 299 | let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address") | |
294 | 300 | ||
295 | 301 | func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slipByUser,slippageReal,txHeight,txTimestamp,slipageAmAmt,slipagePrAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slipByUser), toString(slippageReal), toString(txHeight), toString(txTimestamp), toString(slipageAmAmt), toString(slipagePrAmt)], SEP) | |
296 | 302 | ||
297 | 303 | ||
298 | 304 | 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) | |
299 | 305 | ||
300 | 306 | ||
301 | 307 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
302 | 308 | then wavesBalance(this).available | |
303 | 309 | else assetBalance(this, fromBase58String(assetId)) | |
304 | 310 | ||
305 | 311 | ||
306 | 312 | func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
307 | 313 | ||
308 | 314 | ||
309 | 315 | func cpbir (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
310 | 316 | ||
311 | 317 | ||
312 | 318 | func vad (A1,A2,slippage) = { | |
313 | 319 | let diff = fraction((A1 - A2), scale8BigInt, A2) | |
314 | 320 | let pass = ((slippage - abs(diff)) > zeroBigInt) | |
315 | 321 | if (!(pass)) | |
316 | 322 | then throw(("Big slpg: " + toString(diff))) | |
317 | 323 | else $Tuple2(pass, min([A1, A2])) | |
318 | 324 | } | |
319 | 325 | ||
320 | 326 | ||
321 | 327 | func vd (D1,D0,slpg) = { | |
322 | 328 | let diff = fraction(D0, scale8BigInt, D1) | |
323 | 329 | let fail = (slpg > diff) | |
324 | 330 | if (if (fail) | |
325 | 331 | then true | |
326 | 332 | else (D0 > D1)) | |
327 | 333 | then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg))) | |
328 | 334 | else fail | |
329 | 335 | } | |
330 | 336 | ||
331 | 337 | ||
332 | 338 | func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
333 | 339 | let amtAsAmtX18 = t1(amAmt, amAssetDcm) | |
334 | 340 | let prAsAmtX18 = t1(prAmt, prAssetDcm) | |
335 | 341 | cpbi(prAsAmtX18, amtAsAmtX18) | |
336 | 342 | } | |
337 | 343 | ||
338 | 344 | ||
339 | 345 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
340 | 346 | let amtAsDcm = cfgAmountAssetDecimals | |
341 | 347 | let prAsDcm = cfgPriceAssetDecimals | |
342 | 348 | let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt) | |
343 | 349 | let amAmtX18 = t1(amAmt, amtAsDcm) | |
344 | 350 | let prAmtX18 = t1(prAmt, prAsDcm) | |
345 | 351 | let lpAmtX18 = t1(lpAmt, scale8) | |
346 | 352 | let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18) | |
347 | 353 | let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18) | |
348 | 354 | [priceX18, lpPrInAmAsX18, lpPrInPrAsX18] | |
349 | 355 | } | |
350 | 356 | ||
351 | 357 | ||
352 | 358 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
353 | 359 | let p = calcPrices(amAmt, prAmt, lpAmt) | |
354 | 360 | [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)] | |
355 | 361 | } | |
356 | 362 | ||
357 | 363 | ||
358 | 364 | func takeFee (amount,fee) = { | |
359 | 365 | let feeAmount = if ((fee == 0)) | |
360 | 366 | then 0 | |
361 | 367 | else fraction(amount, fee, scale8) | |
362 | 368 | $Tuple2((amount - feeAmount), feeAmount) | |
363 | 369 | } | |
364 | 370 | ||
365 | 371 | ||
366 | 372 | func getD (xp) = { | |
367 | 373 | let xp0 = xp[0] | |
368 | 374 | let xp1 = xp[1] | |
369 | 375 | let s = (xp0 + xp1) | |
370 | 376 | if ((s == big0)) | |
371 | 377 | then big0 | |
372 | 378 | else { | |
373 | 379 | let a = parseIntValue(A) | |
374 | 380 | let ann = (a * 2) | |
375 | 381 | let p = fraction(xp0, xp1, big1) | |
376 | 382 | let xp0_xp1_n_n = fraction(p, big4, big1) | |
377 | 383 | let ann_s = fraction(toBigInt(ann), s, big1) | |
378 | 384 | let ann_1 = toBigInt((ann - 1)) | |
379 | 385 | func calcDNext (d) = { | |
380 | 386 | let dd = fraction(d, d, big1) | |
381 | 387 | let ddd = fraction(dd, d, big1) | |
382 | 388 | let dp = fraction(ddd, big1, xp0_xp1_n_n) | |
383 | 389 | fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1))) | |
384 | 390 | } | |
385 | 391 | ||
386 | 392 | func calc (acc,i) = if (acc._2) | |
387 | 393 | then acc | |
388 | 394 | else { | |
389 | 395 | let d = acc._1 | |
390 | 396 | let dNext = calcDNext(d) | |
391 | 397 | let dDiffRaw = (dNext - value(d)) | |
392 | 398 | let dDiff = if ((big0 > dDiffRaw)) | |
393 | 399 | then -(dDiffRaw) | |
394 | 400 | else dDiffRaw | |
395 | 401 | if ((big1 >= dDiff)) | |
396 | 402 | then $Tuple2(dNext, true) | |
397 | 403 | else $Tuple2(dNext, false) | |
398 | 404 | } | |
399 | 405 | ||
400 | 406 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | |
401 | - | let $ | |
407 | + | let $t01352713575 = { | |
402 | 408 | let $l = arr | |
403 | 409 | let $s = size($l) | |
404 | 410 | let $acc0 = $Tuple2(s, false) | |
405 | 411 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
406 | 412 | then $a | |
407 | 413 | else calc($a, $l[$i]) | |
408 | 414 | ||
409 | 415 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
410 | 416 | then $a | |
411 | 417 | else throw("List size exceeds 17") | |
412 | 418 | ||
413 | 419 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17) | |
414 | 420 | } | |
415 | - | let d = $ | |
416 | - | let found = $ | |
421 | + | let d = $t01352713575._1 | |
422 | + | let found = $t01352713575._2 | |
417 | 423 | if (found) | |
418 | 424 | then d | |
419 | 425 | else throw(("D calculation error, D = " + toString(d))) | |
420 | 426 | } | |
421 | 427 | } | |
422 | 428 | ||
423 | 429 | ||
424 | 430 | func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
425 | 431 | let lpId = cfgLpAssetId | |
426 | 432 | let amId = toBase58String(value(cfgAmountAssetId)) | |
427 | 433 | let prId = toBase58String(value(cfgPriceAssetId)) | |
428 | 434 | let amDcm = cfgAmountAssetDecimals | |
429 | 435 | let prDcm = cfgPriceAssetDecimals | |
430 | 436 | let sts = toString(cfgPoolStatus) | |
431 | 437 | let lpEmiss = valueOrErrorMessage(assetInfo(lpId), "Wrong LP id").quantity | |
432 | 438 | if ((toBase58String(lpId) != pmtAssetId)) | |
433 | 439 | then throw("Wrong pmt asset") | |
434 | 440 | else { | |
435 | 441 | let amBalance = getAccBalance(amId) | |
436 | 442 | let amBalanceX18 = t1(amBalance, amDcm) | |
437 | 443 | let prBalance = getAccBalance(prId) | |
438 | 444 | let prBalanceX18 = t1(prBalance, prDcm) | |
439 | 445 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
440 | 446 | let curPrice = f1(curPriceX18, scale8) | |
441 | 447 | let pmtLpAmtX18 = t1(pmtLpAmt, scale8) | |
442 | 448 | let lpEmissX18 = t1(lpEmiss, scale8) | |
443 | 449 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18) | |
444 | 450 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18) | |
445 | 451 | let outAmAmt = fromX18Round(outAmAmtX18, amDcm, FLOOR) | |
446 | 452 | let outPrAmt = fromX18Round(outPrAmtX18, prDcm, FLOOR) | |
447 | 453 | let state = if ((txId58 == "")) | |
448 | 454 | then nil | |
449 | 455 | else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES")) | |
450 | 456 | then unit | |
451 | 457 | else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES")) | |
452 | 458 | then unit | |
453 | 459 | else fromBase58String(prId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)] | |
454 | 460 | $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state) | |
455 | 461 | } | |
456 | 462 | } | |
457 | 463 | ||
458 | 464 | ||
459 | 465 | func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
460 | 466 | let lpId = cfgLpAssetId | |
461 | 467 | let amIdStr = toBase58String(value(cfgAmountAssetId)) | |
462 | 468 | let prIdStr = toBase58String(value(cfgPriceAssetId)) | |
463 | 469 | let amtDcm = cfgAmountAssetDecimals | |
464 | 470 | let priceDcm = cfgPriceAssetDecimals | |
465 | 471 | let sts = toString(cfgPoolStatus) | |
466 | 472 | let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity | |
467 | - | let amBalance = if (isEval) | |
468 | - | then getAccBalance(amIdStr) | |
469 | - | else if (if (isOneAsset) | |
470 | - | then (pmtId == amIdStr) | |
471 | - | else false) | |
472 | - | then (getAccBalance(amIdStr) - pmtAmt) | |
473 | - | else if (isOneAsset) | |
473 | + | let checkAssets = [if (if ((inAmId == parseAssetId(amIdStr))) | |
474 | + | then (inPrId == parseAssetId(prIdStr)) | |
475 | + | else false) | |
476 | + | then true | |
477 | + | else throwErr("Invalid amt or price asset passed.")] | |
478 | + | if ((checkAssets == checkAssets)) | |
479 | + | then { | |
480 | + | let amBalance = if (isEval) | |
474 | 481 | then getAccBalance(amIdStr) | |
475 | - | else ( | |
476 | - | | |
477 | - | | |
478 | - | | |
479 | - | | |
480 | - | | |
481 | - | | |
482 | - | | |
482 | + | else if (if (isOneAsset) | |
483 | + | then (pmtId == amIdStr) | |
484 | + | else false) | |
485 | + | then (getAccBalance(amIdStr) - pmtAmt) | |
486 | + | else if (isOneAsset) | |
487 | + | then getAccBalance(amIdStr) | |
488 | + | else (getAccBalance(amIdStr) - inAmAmt) | |
489 | + | let prBalance = if (isEval) | |
483 | 490 | then getAccBalance(prIdStr) | |
484 | - | else ( | |
485 | - | | |
486 | - | | |
487 | - | | |
488 | - | | |
489 | - | | |
490 | - | | |
491 | - | let | |
492 | - | | |
493 | - | let | |
494 | - | let | |
495 | - | | |
496 | - | | |
497 | - | if (( | |
491 | + | else if (if (isOneAsset) | |
492 | + | then (pmtId == prIdStr) | |
493 | + | else false) | |
494 | + | then (getAccBalance(prIdStr) - pmtAmt) | |
495 | + | else if (isOneAsset) | |
496 | + | then getAccBalance(prIdStr) | |
497 | + | else (getAccBalance(prIdStr) - inPrAmt) | |
498 | + | let inAmAssetAmtX18 = t1(inAmAmt, amtDcm) | |
499 | + | let inPrAssetAmtX18 = t1(inPrAmt, priceDcm) | |
500 | + | let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18) | |
501 | + | let amBalanceX18 = t1(amBalance, amtDcm) | |
502 | + | let prBalanceX18 = t1(prBalance, priceDcm) | |
503 | + | let D0 = getD([amBalanceX18, prBalanceX18]) | |
504 | + | let r = if ((lpEm == 0)) | |
498 | 505 | then { | |
499 | - | let curPriceX18 = zeroBigInt | |
500 | - | let slippageX18 = zeroBigInt | |
501 | - | let lpAmtX18 = D1 | |
502 | - | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
503 | - | } | |
504 | - | else throw("Strict value is not equal to itself.") | |
505 | - | } | |
506 | - | else { | |
507 | - | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
508 | - | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
509 | - | let slippageX18 = t1(slippage, scale8) | |
510 | - | if (if (if (validateSlippage) | |
511 | - | then (curPriceX18 != zeroBigInt) | |
512 | - | else false) | |
513 | - | then (slippageRealX18 > slippageX18) | |
514 | - | else false) | |
515 | - | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
516 | - | else { | |
517 | - | let lpEmissionX18 = t1(lpEm, scale8) | |
518 | - | let prViaAmX18 = fraction(inAmAssetAmtX18, cpbir(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
519 | - | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, cpbir(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
520 | - | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
521 | - | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
522 | - | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
523 | - | let expAmtAssetAmtX18 = expectedAmts._1 | |
524 | - | let expPriceAssetAmtX18 = expectedAmts._2 | |
525 | - | let D1 = getD([(amBalanceX18 + expAmtAssetAmtX18), (prBalanceX18 + expPriceAssetAmtX18)]) | |
506 | + | let D1 = getD([(amBalanceX18 + inAmAssetAmtX18), (prBalanceX18 + inPrAssetAmtX18)]) | |
526 | 507 | let checkD = if ((D1 > D0)) | |
527 | 508 | then true | |
528 | 509 | else throw("D1 should be greater than D0") | |
529 | 510 | if ((checkD == checkD)) | |
530 | 511 | then { | |
531 | - | let lpAmtX18 = fraction(lpEmissionX18, (D1 - D0), D0) | |
532 | - | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceDcm, CEILING), curPriceX18, slippageX18) | |
512 | + | let curPriceX18 = zeroBigInt | |
513 | + | let slippageX18 = zeroBigInt | |
514 | + | let lpAmtX18 = D1 | |
515 | + | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
533 | 516 | } | |
534 | 517 | else throw("Strict value is not equal to itself.") | |
535 | 518 | } | |
519 | + | else { | |
520 | + | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
521 | + | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
522 | + | let slippageX18 = t1(slippage, scale8) | |
523 | + | if (if (if (validateSlippage) | |
524 | + | then (curPriceX18 != zeroBigInt) | |
525 | + | else false) | |
526 | + | then (slippageRealX18 > slippageX18) | |
527 | + | else false) | |
528 | + | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
529 | + | else { | |
530 | + | let lpEmissionX18 = t1(lpEm, scale8) | |
531 | + | let prViaAmX18 = fraction(inAmAssetAmtX18, cpbir(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
532 | + | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, cpbir(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
533 | + | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
534 | + | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
535 | + | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
536 | + | let expAmtAssetAmtX18 = expectedAmts._1 | |
537 | + | let expPriceAssetAmtX18 = expectedAmts._2 | |
538 | + | let D1 = getD([(amBalanceX18 + expAmtAssetAmtX18), (prBalanceX18 + expPriceAssetAmtX18)]) | |
539 | + | let checkD = if ((D1 > D0)) | |
540 | + | then true | |
541 | + | else throw("D1 should be greater than D0") | |
542 | + | if ((checkD == checkD)) | |
543 | + | then { | |
544 | + | let lpAmtX18 = fraction(lpEmissionX18, (D1 - D0), D0) | |
545 | + | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceDcm, CEILING), curPriceX18, slippageX18) | |
546 | + | } | |
547 | + | else throw("Strict value is not equal to itself.") | |
548 | + | } | |
549 | + | } | |
550 | + | let calcLpAmt = r._1 | |
551 | + | let calcAmAssetPmt = r._2 | |
552 | + | let calcPrAssetPmt = r._3 | |
553 | + | let curPrice = f1(r._4, scale8) | |
554 | + | let slippageCalc = f1(r._5, scale8) | |
555 | + | if ((0 >= calcLpAmt)) | |
556 | + | then throw("LP <= 0") | |
557 | + | else { | |
558 | + | let emitLpAmt = if (!(emitLp)) | |
559 | + | then 0 | |
560 | + | else calcLpAmt | |
561 | + | let amDiff = (inAmAmt - calcAmAssetPmt) | |
562 | + | let prDiff = (inPrAmt - calcPrAssetPmt) | |
563 | + | let $t02149821843 = if (if (isOneAsset) | |
564 | + | then (pmtId == amIdStr) | |
565 | + | else false) | |
566 | + | then $Tuple2(pmtAmt, 0) | |
567 | + | else if (if (isOneAsset) | |
568 | + | then (pmtId == prIdStr) | |
569 | + | else false) | |
570 | + | then $Tuple2(0, pmtAmt) | |
571 | + | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
572 | + | let writeAmAmt = $t02149821843._1 | |
573 | + | let writePrAmt = $t02149821843._2 | |
574 | + | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
575 | + | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
576 | + | } | |
536 | 577 | } | |
537 | - | let calcLpAmt = r._1 | |
538 | - | let calcAmAssetPmt = r._2 | |
539 | - | let calcPrAssetPmt = r._3 | |
540 | - | let curPrice = f1(r._4, scale8) | |
541 | - | let slippageCalc = f1(r._5, scale8) | |
542 | - | if ((0 >= calcLpAmt)) | |
543 | - | then throw("LP <= 0") | |
544 | - | else { | |
545 | - | let emitLpAmt = if (!(emitLp)) | |
546 | - | then 0 | |
547 | - | else calcLpAmt | |
548 | - | let amDiff = (inAmAmt - calcAmAssetPmt) | |
549 | - | let prDiff = (inPrAmt - calcPrAssetPmt) | |
550 | - | let $t02110921454 = if (if (isOneAsset) | |
551 | - | then (pmtId == amIdStr) | |
552 | - | else false) | |
553 | - | then $Tuple2(pmtAmt, 0) | |
554 | - | else if (if (isOneAsset) | |
555 | - | then (pmtId == prIdStr) | |
556 | - | else false) | |
557 | - | then $Tuple2(0, pmtAmt) | |
558 | - | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
559 | - | let writeAmAmt = $t02110921454._1 | |
560 | - | let writePrAmt = $t02110921454._2 | |
561 | - | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
562 | - | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
563 | - | } | |
578 | + | else throw("Strict value is not equal to itself.") | |
564 | 579 | } | |
565 | 580 | ||
566 | 581 | ||
567 | 582 | func getYD (xp,i,D) = { | |
568 | 583 | let n = big2 | |
569 | 584 | let x = xp[if ((i == 0)) | |
570 | 585 | then 1 | |
571 | 586 | else 0] | |
572 | 587 | let aPrecision = parseBigIntValue(Amult) | |
573 | 588 | let a = (parseBigIntValue(A) * aPrecision) | |
574 | 589 | let s = x | |
575 | 590 | let ann = (a * n) | |
576 | 591 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
577 | 592 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
578 | 593 | func calc (acc,cur) = { | |
579 | - | let $ | |
580 | - | let y = $ | |
581 | - | let found = $ | |
594 | + | let $t02303823058 = acc | |
595 | + | let y = $t02303823058._1 | |
596 | + | let found = $t02303823058._2 | |
582 | 597 | if ((found != unit)) | |
583 | 598 | then acc | |
584 | 599 | else { | |
585 | 600 | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
586 | 601 | let yDiff = absBigInt((yNext - value(y))) | |
587 | 602 | if ((big1 >= yDiff)) | |
588 | 603 | then $Tuple2(yNext, cur) | |
589 | 604 | else $Tuple2(yNext, unit) | |
590 | 605 | } | |
591 | 606 | } | |
592 | 607 | ||
593 | 608 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
594 | - | let $ | |
609 | + | let $t02336523412 = { | |
595 | 610 | let $l = arr | |
596 | 611 | let $s = size($l) | |
597 | 612 | let $acc0 = $Tuple2(D, unit) | |
598 | 613 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
599 | 614 | then $a | |
600 | 615 | else calc($a, $l[$i]) | |
601 | 616 | ||
602 | 617 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
603 | 618 | then $a | |
604 | 619 | else throw("List size exceeds 15") | |
605 | 620 | ||
606 | 621 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
607 | 622 | } | |
608 | - | let y = $ | |
609 | - | let found = $ | |
623 | + | let y = $t02336523412._1 | |
624 | + | let found = $t02336523412._2 | |
610 | 625 | if ((found != unit)) | |
611 | 626 | then y | |
612 | 627 | else throw(("Y calculation error, Y = " + toString(y))) | |
613 | 628 | } | |
614 | 629 | ||
615 | 630 | ||
616 | 631 | func calcDLp (amountBalance,priceBalance,lpEmission) = { | |
617 | 632 | let updatedDLp = fraction(getD([t1BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)), t1BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))]), scale18, lpEmission) | |
618 | 633 | if ((lpEmission == big0)) | |
619 | 634 | then big0 | |
620 | 635 | else updatedDLp | |
621 | 636 | } | |
622 | 637 | ||
623 | 638 | ||
624 | 639 | func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
625 | 640 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
626 | 641 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
627 | 642 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
628 | 643 | let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
629 | 644 | currentDLp | |
630 | 645 | } | |
631 | 646 | ||
632 | 647 | ||
633 | 648 | func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
634 | 649 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
635 | 650 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
636 | 651 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
637 | 652 | let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
638 | 653 | let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))] | |
639 | 654 | $Tuple2(actions, updatedDLp) | |
640 | 655 | } | |
641 | 656 | ||
642 | 657 | ||
643 | 658 | func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp)) | |
644 | 659 | then true | |
645 | 660 | else throwErr("updated DLp lower than current DLp") | |
646 | 661 | ||
647 | 662 | ||
648 | 663 | func validateMatcherOrderAllowed (order) = { | |
649 | 664 | let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
650 | 665 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
651 | 666 | let amountAssetAmount = order.amount | |
652 | 667 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
653 | - | let $ | |
668 | + | let $t02561025822 = if ((order.orderType == Buy)) | |
654 | 669 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
655 | 670 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
656 | - | let amountAssetBalanceDelta = $ | |
657 | - | let priceAssetBalanceDelta = $ | |
671 | + | let amountAssetBalanceDelta = $t02561025822._1 | |
672 | + | let priceAssetBalanceDelta = $t02561025822._2 | |
658 | 673 | if (if (if (igs()) | |
659 | 674 | then true | |
660 | 675 | else (cfgPoolStatus == PoolMatcherDis)) | |
661 | 676 | then true | |
662 | 677 | else (cfgPoolStatus == PoolShutdown)) | |
663 | 678 | then throw("Admin blocked") | |
664 | 679 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
665 | 680 | then true | |
666 | 681 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
667 | 682 | then throw("Wr assets") | |
668 | 683 | else { | |
669 | 684 | let dLp = parseBigIntValue(valueOrElse(getString(this, keyDLp), "0")) | |
670 | - | let $ | |
671 | - | let unusedActions = $ | |
672 | - | let dLpNew = $ | |
685 | + | let $t02616426264 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
686 | + | let unusedActions = $t02616426264._1 | |
687 | + | let dLpNew = $t02616426264._2 | |
673 | 688 | let isOrderValid = (dLpNew >= dLp) | |
674 | 689 | let info = makeString(["dLp=", toString(dLp), " dLpNew=", toString(dLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
675 | 690 | $Tuple2(isOrderValid, info) | |
676 | 691 | } | |
677 | 692 | } | |
678 | 693 | ||
679 | 694 | ||
680 | 695 | func cg (i) = if ((size(i.payments) != 1)) | |
681 | 696 | then throw("1 pmnt exp") | |
682 | 697 | else { | |
683 | 698 | let pmt = value(i.payments[0]) | |
684 | 699 | let pmtAssetId = value(pmt.assetId) | |
685 | 700 | let pmtAmt = pmt.amount | |
686 | 701 | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
687 | 702 | let outAmAmt = r._1 | |
688 | 703 | let outPrAmt = r._2 | |
689 | 704 | let sts = parseIntValue(r._9) | |
690 | 705 | let state = r._10 | |
691 | - | if (if (igs()) | |
692 | - | then true | |
693 | - | else (sts == PoolShutdown)) | |
706 | + | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
707 | + | then if (igs()) | |
708 | + | then true | |
709 | + | else (cfgPoolStatus == PoolShutdown) | |
710 | + | else false | |
711 | + | if (isGetDisabled) | |
694 | 712 | then throw(("Admin blocked: " + toString(sts))) | |
695 | 713 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
696 | 714 | } | |
697 | 715 | ||
698 | 716 | ||
699 | 717 | func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
700 | 718 | let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId) | |
701 | 719 | let sts = parseIntValue(r._8) | |
702 | - | if (if (if (igs()) | |
703 | - | then true | |
704 | - | else (sts == PoolPutDis)) | |
705 | - | then true | |
706 | - | else (sts == PoolShutdown)) | |
720 | + | let isPutDisabled = if (!(isAddressWhitelisted(addressFromStringValue(caller)))) | |
721 | + | then if (if (igs()) | |
722 | + | then true | |
723 | + | else (cfgPoolStatus == PoolShutdown)) | |
724 | + | then true | |
725 | + | else (cfgPoolStatus == PoolPutDis) | |
726 | + | else false | |
727 | + | if (isPutDisabled) | |
707 | 728 | then throw(("Blocked:" + toString(sts))) | |
708 | 729 | else r | |
709 | 730 | } | |
710 | 731 | ||
711 | 732 | ||
712 | 733 | func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = { | |
713 | 734 | let amId = toBase58String(value(cfgAmountAssetId)) | |
714 | 735 | let prId = toBase58String(value(cfgPriceAssetId)) | |
715 | 736 | let lpId = cfgLpAssetId | |
716 | 737 | let amtDcm = cfgAmountAssetDecimals | |
717 | 738 | let priceDcm = cfgPriceAssetDecimals | |
718 | 739 | let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(lpId), "invalid lp asset").quantity) | |
719 | 740 | let chechEmission = if ((lpAssetEmission > big0)) | |
720 | 741 | then true | |
721 | 742 | else throw("initial deposit requires all coins") | |
722 | 743 | if ((chechEmission == chechEmission)) | |
723 | 744 | then { | |
724 | 745 | let amBalance = getAccBalance(amId) | |
725 | 746 | let prBalance = getAccBalance(prId) | |
726 | - | let $ | |
747 | + | let $t02912329585 = if ((txId == "")) | |
727 | 748 | then $Tuple2(amBalance, prBalance) | |
728 | 749 | else if ((pmtAssetId == amId)) | |
729 | 750 | then if ((pmtAmtRaw > amBalance)) | |
730 | 751 | then throw("invalid payment amount") | |
731 | 752 | else $Tuple2((amBalance - pmtAmtRaw), prBalance) | |
732 | 753 | else if ((pmtAssetId == prId)) | |
733 | 754 | then if ((pmtAmtRaw > prBalance)) | |
734 | 755 | then throw("invalid payment amount") | |
735 | 756 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
736 | 757 | else throw("wrong pmtAssetId") | |
737 | - | let amBalanceOld = $ | |
738 | - | let prBalanceOld = $ | |
739 | - | let $ | |
758 | + | let amBalanceOld = $t02912329585._1 | |
759 | + | let prBalanceOld = $t02912329585._2 | |
760 | + | let $t02959129767 = if ((pmtAssetId == amId)) | |
740 | 761 | then $Tuple2(pmtAmtRaw, 0) | |
741 | 762 | else if ((pmtAssetId == prId)) | |
742 | 763 | then $Tuple2(0, pmtAmtRaw) | |
743 | 764 | else throw("invalid payment") | |
744 | - | let amAmountRaw = $ | |
745 | - | let prAmountRaw = $ | |
746 | - | let $ | |
765 | + | let amAmountRaw = $t02959129767._1 | |
766 | + | let prAmountRaw = $t02959129767._2 | |
767 | + | let $t02977130025 = if (withTakeFee) | |
747 | 768 | then $Tuple3(takeFee(amAmountRaw, inFee)._1, takeFee(prAmountRaw, inFee)._1, takeFee(pmtAmtRaw, inFee)._2) | |
748 | 769 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
749 | - | let amAmount = $ | |
750 | - | let prAmount = $ | |
751 | - | let feeAmount = $ | |
770 | + | let amAmount = $t02977130025._1 | |
771 | + | let prAmount = $t02977130025._2 | |
772 | + | let feeAmount = $t02977130025._3 | |
752 | 773 | let amBalanceNew = (amBalanceOld + amAmount) | |
753 | 774 | let prBalanceNew = (prBalanceOld + prAmount) | |
754 | 775 | let D0 = getD([t1(amBalanceOld, cfgAmountAssetDecimals), t1(prBalanceOld, cfgPriceAssetDecimals)]) | |
755 | 776 | let D1 = getD([t1(amBalanceNew, cfgAmountAssetDecimals), t1(prBalanceNew, cfgPriceAssetDecimals)]) | |
756 | 777 | let checkD = if ((D1 > D0)) | |
757 | 778 | then true | |
758 | 779 | else throw() | |
759 | 780 | if ((checkD == checkD)) | |
760 | 781 | then { | |
761 | 782 | let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0, FLOOR) | |
762 | 783 | let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8) | |
763 | 784 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId), dataPutActionInfo(amAmountRaw, prAmountRaw, toInt(lpAmount), curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
764 | 785 | let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld) | |
765 | 786 | let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8)) | |
766 | 787 | let priceAssetPart = (pmtAmtRaw - amountAssetPart) | |
767 | 788 | let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld)) | |
768 | 789 | let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth)) | |
769 | 790 | $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus) | |
770 | 791 | } | |
771 | 792 | else throw("Strict value is not equal to itself.") | |
772 | 793 | } | |
773 | 794 | else throw("Strict value is not equal to itself.") | |
774 | 795 | } | |
775 | 796 | ||
776 | 797 | ||
777 | 798 | func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = { | |
778 | 799 | let lpId = toBase58String(value(cfgLpAssetId)) | |
779 | 800 | let amId = toBase58String(value(cfgAmountAssetId)) | |
780 | 801 | let prId = toBase58String(value(cfgPriceAssetId)) | |
781 | 802 | let amDecimals = cfgAmountAssetDecimals | |
782 | 803 | let prDecimals = cfgPriceAssetDecimals | |
783 | 804 | let poolStatus = cfgPoolStatus | |
784 | 805 | let userAddress = if ((caller == restContract)) | |
785 | 806 | then originCaller | |
786 | 807 | else caller | |
787 | 808 | let pmt = value(payments[0]) | |
788 | 809 | let pmtAssetId = value(pmt.assetId) | |
789 | 810 | let pmtAmt = pmt.amount | |
790 | 811 | let currentDLp = calcCurrentDLp(big0, big0, big0) | |
791 | 812 | if ((currentDLp == currentDLp)) | |
792 | 813 | then { | |
793 | 814 | let txId58 = toBase58String(transactionId) | |
794 | 815 | if ((lpId != toBase58String(pmtAssetId))) | |
795 | 816 | then throw("Wrong LP") | |
796 | 817 | else { | |
797 | 818 | let amBalance = getAccBalance(amId) | |
798 | 819 | let prBalance = getAccBalance(prId) | |
799 | - | let $ | |
820 | + | let $t03213732248 = { | |
800 | 821 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
801 | 822 | if ($isInstanceOf(@, "(Int, Int)")) | |
802 | 823 | then @ | |
803 | 824 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
804 | 825 | } | |
805 | - | if (($ | |
826 | + | if (($t03213732248 == $t03213732248)) | |
806 | 827 | then { | |
807 | - | let feeAmount = $ | |
808 | - | let totalGet = $ | |
828 | + | let feeAmount = $t03213732248._2 | |
829 | + | let totalGet = $t03213732248._1 | |
809 | 830 | let totalAmount = if (if ((minOutAmount > 0)) | |
810 | 831 | then (minOutAmount > totalGet) | |
811 | 832 | else false) | |
812 | 833 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
813 | 834 | else totalGet | |
814 | - | let $ | |
835 | + | let $t03243832745 = if ((outAssetId == amId)) | |
815 | 836 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
816 | 837 | else if ((outAssetId == prId)) | |
817 | 838 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
818 | 839 | else throw("invalid out asset id") | |
819 | - | let outAm = $ | |
820 | - | let outPr = $ | |
821 | - | let amBalanceNew = $ | |
822 | - | let prBalanceNew = $ | |
840 | + | let outAm = $t03243832745._1 | |
841 | + | let outPr = $t03243832745._2 | |
842 | + | let amBalanceNew = $t03243832745._3 | |
843 | + | let prBalanceNew = $t03243832745._4 | |
823 | 844 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
824 | 845 | let curPr = f1(curPrX18, scale8) | |
825 | 846 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
826 | 847 | then unit | |
827 | 848 | else fromBase58String(outAssetId) | |
828 | 849 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
829 | 850 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
830 | 851 | else nil | |
831 | 852 | let state = ([ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] ++ sendFeeToMatcher) | |
832 | 853 | if ((state == state)) | |
833 | 854 | then { | |
834 | 855 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
835 | 856 | if ((burn == burn)) | |
836 | 857 | then { | |
837 | - | let $ | |
858 | + | let $t03353033880 = { | |
838 | 859 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
839 | 860 | then 0 | |
840 | 861 | else feeAmount | |
841 | 862 | let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId)) | |
842 | 863 | then true | |
843 | 864 | else false | |
844 | 865 | if (outInAmountAsset) | |
845 | 866 | then $Tuple2(-((totalGet + feeAmountForCalc)), 0) | |
846 | 867 | else $Tuple2(0, -((totalGet + feeAmountForCalc))) | |
847 | 868 | } | |
848 | - | let amountAssetBalanceDelta = $ | |
849 | - | let priceAssetBalanceDelta = $ | |
850 | - | let $ | |
851 | - | let refreshDLpActions = $ | |
852 | - | let updatedDLp = $ | |
869 | + | let amountAssetBalanceDelta = $t03353033880._1 | |
870 | + | let priceAssetBalanceDelta = $t03353033880._2 | |
871 | + | let $t03388333991 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
872 | + | let refreshDLpActions = $t03388333991._1 | |
873 | + | let updatedDLp = $t03388333991._2 | |
853 | 874 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
854 | 875 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
855 | 876 | then $Tuple2((state ++ refreshDLpActions), totalAmount) | |
856 | 877 | else throw("Strict value is not equal to itself.") | |
857 | 878 | } | |
858 | 879 | else throw("Strict value is not equal to itself.") | |
859 | 880 | } | |
860 | 881 | else throw("Strict value is not equal to itself.") | |
861 | 882 | } | |
862 | 883 | else throw("Strict value is not equal to itself.") | |
863 | 884 | } | |
864 | 885 | } | |
865 | 886 | else throw("Strict value is not equal to itself.") | |
866 | 887 | } | |
867 | 888 | ||
868 | 889 | ||
869 | 890 | func managerPublicKeyOrUnit () = { | |
870 | 891 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
871 | 892 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
872 | 893 | case s: String => | |
873 | 894 | fromBase58String(s) | |
874 | 895 | case _: Unit => | |
875 | 896 | unit | |
876 | 897 | case _ => | |
877 | 898 | throw("Match error") | |
878 | 899 | } | |
879 | 900 | } | |
880 | 901 | ||
881 | 902 | ||
882 | 903 | let pd = throw("Permission denied") | |
883 | 904 | ||
884 | 905 | func isManager (i) = match managerPublicKeyOrUnit() { | |
885 | 906 | case pk: ByteVector => | |
886 | 907 | (i.callerPublicKey == pk) | |
887 | 908 | case _: Unit => | |
888 | 909 | (i.caller == this) | |
889 | 910 | case _ => | |
890 | 911 | throw("Match error") | |
891 | 912 | } | |
892 | 913 | ||
893 | 914 | ||
894 | 915 | func mustManager (i) = match managerPublicKeyOrUnit() { | |
895 | 916 | case pk: ByteVector => | |
896 | 917 | if ((i.callerPublicKey == pk)) | |
897 | 918 | then true | |
898 | 919 | else pd | |
899 | 920 | case _: Unit => | |
900 | 921 | if ((i.caller == this)) | |
901 | 922 | then true | |
902 | 923 | else pd | |
903 | 924 | case _ => | |
904 | 925 | throw("Match error") | |
905 | 926 | } | |
906 | 927 | ||
907 | 928 | ||
908 | 929 | func getY (isReverse,D,poolAmountInBalance) = { | |
909 | 930 | let poolConfig = gpc() | |
910 | 931 | let amId = poolConfig[idxAmAsId] | |
911 | 932 | let prId = poolConfig[idxPrAsId] | |
912 | 933 | let n = big2 | |
913 | 934 | let aPrecision = parseBigIntValue(Amult) | |
914 | 935 | let a = (parseBigIntValue(A) * aPrecision) | |
915 | 936 | let xp = if ((isReverse == false)) | |
916 | 937 | then [(toBigInt(getAccBalance(amId)) + poolAmountInBalance), toBigInt(getAccBalance(prId))] | |
917 | 938 | else [(toBigInt(getAccBalance(prId)) + poolAmountInBalance), toBigInt(getAccBalance(amId))] | |
918 | 939 | let x = xp[0] | |
919 | 940 | let s = x | |
920 | 941 | let ann = (a * n) | |
921 | 942 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
922 | 943 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
923 | 944 | func calc (acc,cur) = { | |
924 | - | let $ | |
925 | - | let y = $ | |
926 | - | let found = $ | |
945 | + | let $t03547835498 = acc | |
946 | + | let y = $t03547835498._1 | |
947 | + | let found = $t03547835498._2 | |
927 | 948 | if ((found != unit)) | |
928 | 949 | then acc | |
929 | 950 | else { | |
930 | 951 | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
931 | 952 | let yDiff = absBigInt((yNext - value(y))) | |
932 | 953 | if ((big1 >= yDiff)) | |
933 | 954 | then $Tuple2(yNext, cur) | |
934 | 955 | else $Tuple2(yNext, unit) | |
935 | 956 | } | |
936 | 957 | } | |
937 | 958 | ||
938 | 959 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
939 | - | let $ | |
960 | + | let $t03582935876 = { | |
940 | 961 | let $l = arr | |
941 | 962 | let $s = size($l) | |
942 | 963 | let $acc0 = $Tuple2(D, unit) | |
943 | 964 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
944 | 965 | then $a | |
945 | 966 | else calc($a, $l[$i]) | |
946 | 967 | ||
947 | 968 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
948 | 969 | then $a | |
949 | 970 | else throw("List size exceeds 15") | |
950 | 971 | ||
951 | 972 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
952 | 973 | } | |
953 | - | let y = $ | |
954 | - | let found = $ | |
974 | + | let y = $t03582935876._1 | |
975 | + | let found = $t03582935876._2 | |
955 | 976 | if ((found != unit)) | |
956 | 977 | then y | |
957 | 978 | else throw(("Y calculation error, Y = " + toString(y))) | |
958 | 979 | } | |
959 | 980 | ||
960 | 981 | ||
961 | 982 | func skipOrderValidation () = valueOrElse(getBoolean(fca, keySkipOrderValidation(toString(this))), false) | |
962 | 983 | ||
963 | 984 | ||
964 | 985 | @Callable(i) | |
965 | 986 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
966 | - | let $ | |
987 | + | let $t03622836652 = if ((isReverse == false)) | |
967 | 988 | then { | |
968 | 989 | let assetOut = strf(this, pa()) | |
969 | 990 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, aa()))) + toBigInt(cleanAmountIn)) | |
970 | 991 | $Tuple2(assetOut, poolAmountInBalance) | |
971 | 992 | } | |
972 | 993 | else { | |
973 | 994 | let assetOut = strf(this, aa()) | |
974 | 995 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, pa()))) + toBigInt(cleanAmountIn)) | |
975 | 996 | $Tuple2(assetOut, poolAmountInBalance) | |
976 | 997 | } | |
977 | - | let assetOut = $ | |
978 | - | let poolAmountInBalance = $ | |
998 | + | let assetOut = $t03622836652._1 | |
999 | + | let poolAmountInBalance = $t03622836652._2 | |
979 | 1000 | let poolConfig = gpc() | |
980 | 1001 | let amId = poolConfig[idxAmAsId] | |
981 | 1002 | let prId = poolConfig[idxPrAsId] | |
982 | 1003 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
983 | 1004 | let D = getD(xp) | |
984 | 1005 | let y = getY(isReverse, D, toBigInt(cleanAmountIn)) | |
985 | 1006 | let dy = ((toBigInt(getAccBalance(assetOut)) - y) - toBigInt(1)) | |
986 | 1007 | let totalGetRaw = max([0, toInt(dy)]) | |
987 | 1008 | let newXp = if ((isReverse == false)) | |
988 | 1009 | then [((toBigInt(getAccBalance(amId)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)), (toBigInt(getAccBalance(prId)) - dy)] | |
989 | 1010 | else [(toBigInt(getAccBalance(amId)) - dy), ((toBigInt(getAccBalance(prId)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount))] | |
990 | 1011 | let newD = getD(newXp) | |
991 | 1012 | let checkD = if ((newD >= D)) | |
992 | 1013 | then true | |
993 | 1014 | else throw(makeString(["new D is fewer error", toString(D), toString(newD)], "__")) | |
994 | 1015 | if ((checkD == checkD)) | |
995 | 1016 | then $Tuple2(nil, totalGetRaw) | |
996 | 1017 | else throw("Strict value is not equal to itself.") | |
997 | 1018 | } | |
998 | 1019 | ||
999 | 1020 | ||
1000 | 1021 | ||
1001 | 1022 | @Callable(i) | |
1002 | 1023 | func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = { | |
1003 | 1024 | let swapContact = { | |
1004 | 1025 | let @ = invoke(fca, "getSwapContractREADONLY", nil, nil) | |
1005 | 1026 | if ($isInstanceOf(@, "String")) | |
1006 | 1027 | then @ | |
1007 | 1028 | else throw(($getType(@) + " couldn't be cast to String")) | |
1008 | 1029 | } | |
1009 | 1030 | let isPoolSwapDisabled = { | |
1010 | 1031 | let @ = invoke(fca, "isPoolSwapDisabledREADONLY", [toString(this)], nil) | |
1011 | 1032 | if ($isInstanceOf(@, "Boolean")) | |
1012 | 1033 | then @ | |
1013 | 1034 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1014 | 1035 | } | |
1015 | - | let isSwapDisabled = if (if (igs()) | |
1016 | - | then true | |
1017 | - | else (cfgPoolStatus == PoolShutdown)) | |
1018 | - | then true | |
1019 | - | else isPoolSwapDisabled | |
1036 | + | let isSwapDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1037 | + | then if (if (igs()) | |
1038 | + | then true | |
1039 | + | else (cfgPoolStatus == PoolShutdown)) | |
1040 | + | then true | |
1041 | + | else isPoolSwapDisabled | |
1042 | + | else false | |
1020 | 1043 | let checks = [if (if (!(isSwapDisabled)) | |
1021 | 1044 | then true | |
1022 | 1045 | else isManager(i)) | |
1023 | 1046 | then true | |
1024 | 1047 | else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
1025 | 1048 | then true | |
1026 | 1049 | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
1027 | 1050 | then true | |
1028 | 1051 | else throwErr("Permission denied")] | |
1029 | 1052 | if ((checks == checks)) | |
1030 | 1053 | then { | |
1031 | 1054 | let pmt = value(i.payments[0]) | |
1032 | 1055 | let assetIn = assetIdToString(pmt.assetId) | |
1033 | - | let $ | |
1056 | + | let $t03842438818 = if ((isReverse == false)) | |
1034 | 1057 | then { | |
1035 | 1058 | let assetOut = strf(this, pa()) | |
1036 | 1059 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1037 | 1060 | $Tuple2(assetOut, poolAmountInBalance) | |
1038 | 1061 | } | |
1039 | 1062 | else { | |
1040 | 1063 | let assetOut = strf(this, aa()) | |
1041 | 1064 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1042 | 1065 | $Tuple2(assetOut, poolAmountInBalance) | |
1043 | 1066 | } | |
1044 | - | let assetOut = $ | |
1045 | - | let poolAmountInBalance = $ | |
1067 | + | let assetOut = $t03842438818._1 | |
1068 | + | let poolAmountInBalance = $t03842438818._2 | |
1046 | 1069 | let poolConfig = gpc() | |
1047 | 1070 | let amId = poolConfig[idxAmAsId] | |
1048 | 1071 | let prId = poolConfig[idxPrAsId] | |
1049 | 1072 | let xp = if ((isReverse == false)) | |
1050 | 1073 | then [(toBigInt(getAccBalance(amId)) - toBigInt(value(i.payments[0]).amount)), toBigInt(getAccBalance(prId))] | |
1051 | 1074 | else [toBigInt(getAccBalance(amId)), (toBigInt(getAccBalance(prId)) - toBigInt(value(i.payments[0]).amount))] | |
1052 | 1075 | let D = getD(xp) | |
1053 | 1076 | let y = getY(isReverse, D, toBigInt(0)) | |
1054 | 1077 | let dy = ((toBigInt(getAccBalance(assetOut)) - y) - toBigInt(1)) | |
1055 | 1078 | let totalGetRaw = max([0, toInt(dy)]) | |
1056 | 1079 | let checkMin = if ((totalGetRaw >= amountOutMin)) | |
1057 | 1080 | then true | |
1058 | 1081 | else throw("Exchange result is fewer coins than expected") | |
1059 | 1082 | if ((checkMin == checkMin)) | |
1060 | 1083 | then { | |
1061 | 1084 | let newXp = if ((isReverse == false)) | |
1062 | 1085 | then [(toBigInt(getAccBalance(amId)) + toBigInt(feePoolAmount)), (toBigInt(getAccBalance(prId)) - dy)] | |
1063 | 1086 | else [(toBigInt(getAccBalance(amId)) - dy), (toBigInt(getAccBalance(prId)) + toBigInt(feePoolAmount))] | |
1064 | 1087 | let newD = getD(newXp) | |
1065 | 1088 | let checkD = if ((newD >= D)) | |
1066 | 1089 | then true | |
1067 | 1090 | else throw("new D is fewer error") | |
1068 | 1091 | if ((checkD == checkD)) | |
1069 | 1092 | then { | |
1070 | 1093 | let amountAssetBalanceDelta = if (isReverse) | |
1071 | 1094 | then -(totalGetRaw) | |
1072 | 1095 | else feePoolAmount | |
1073 | 1096 | let priceAssetBalanceDelta = if (isReverse) | |
1074 | 1097 | then feePoolAmount | |
1075 | 1098 | else -(totalGetRaw) | |
1076 | 1099 | let refreshDLpActions = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1 | |
1077 | 1100 | if ((refreshDLpActions == refreshDLpActions)) | |
1078 | 1101 | then $Tuple2([ScriptTransfer(addressFromStringValue(addressTo), totalGetRaw, parseAssetId(assetOut))], totalGetRaw) | |
1079 | 1102 | else throw("Strict value is not equal to itself.") | |
1080 | 1103 | } | |
1081 | 1104 | else throw("Strict value is not equal to itself.") | |
1082 | 1105 | } | |
1083 | 1106 | else throw("Strict value is not equal to itself.") | |
1084 | 1107 | } | |
1085 | 1108 | else throw("Strict value is not equal to itself.") | |
1086 | 1109 | } | |
1087 | 1110 | ||
1088 | 1111 | ||
1089 | 1112 | ||
1090 | 1113 | @Callable(i) | |
1091 | 1114 | func constructor (fc) = { | |
1092 | 1115 | let c = mustManager(i) | |
1093 | 1116 | if ((c == c)) | |
1094 | 1117 | then [StringEntry(fc(), fc)] | |
1095 | 1118 | else throw("Strict value is not equal to itself.") | |
1096 | 1119 | } | |
1097 | 1120 | ||
1098 | 1121 | ||
1099 | 1122 | ||
1100 | 1123 | @Callable(i) | |
1101 | 1124 | func put (slip,autoStake) = { | |
1102 | 1125 | let factCfg = gfc() | |
1103 | 1126 | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
1104 | 1127 | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
1105 | 1128 | if ((0 > slip)) | |
1106 | 1129 | then throw("Wrong slippage") | |
1107 | 1130 | else if ((size(i.payments) != 2)) | |
1108 | 1131 | then throw("2 pmnts expd") | |
1109 | 1132 | else { | |
1110 | 1133 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1111 | 1134 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1112 | 1135 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amAssetPmt) | |
1113 | 1136 | if ((amountAssetBalance == amountAssetBalance)) | |
1114 | 1137 | then { | |
1115 | 1138 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - prAssetPmt) | |
1116 | 1139 | if ((priceAssetBalance == priceAssetBalance)) | |
1117 | 1140 | then { | |
1118 | 1141 | let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity) | |
1119 | 1142 | if ((lpAssetEmission == lpAssetEmission)) | |
1120 | 1143 | then { | |
1121 | 1144 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1122 | 1145 | if ((currentDLp == currentDLp)) | |
1123 | 1146 | then { | |
1124 | 1147 | let e = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], slip, true, false, true, 0, "") | |
1125 | 1148 | let emitLpAmt = e._2 | |
1126 | 1149 | let lpAssetId = e._7 | |
1127 | 1150 | let state = e._9 | |
1128 | 1151 | let amDiff = e._10 | |
1129 | 1152 | let prDiff = e._11 | |
1130 | 1153 | let amId = e._12 | |
1131 | 1154 | let prId = e._13 | |
1132 | 1155 | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
1133 | 1156 | if ((r == r)) | |
1134 | 1157 | then { | |
1135 | 1158 | let el = match r { | |
1136 | 1159 | case legacy: Address => | |
1137 | 1160 | invoke(legacy, "emit", [emitLpAmt], nil) | |
1138 | 1161 | case _ => | |
1139 | 1162 | unit | |
1140 | 1163 | } | |
1141 | 1164 | if ((el == el)) | |
1142 | 1165 | then { | |
1143 | 1166 | let sa = if ((amDiff > 0)) | |
1144 | 1167 | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
1145 | 1168 | else nil | |
1146 | 1169 | if ((sa == sa)) | |
1147 | 1170 | then { | |
1148 | 1171 | let sp = if ((prDiff > 0)) | |
1149 | 1172 | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
1150 | 1173 | else nil | |
1151 | 1174 | if ((sp == sp)) | |
1152 | 1175 | then { | |
1153 | 1176 | let lpTrnsfr = if (autoStake) | |
1154 | 1177 | then { | |
1155 | 1178 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
1156 | 1179 | if ((ss == ss)) | |
1157 | 1180 | then nil | |
1158 | 1181 | else throw("Strict value is not equal to itself.") | |
1159 | 1182 | } | |
1160 | 1183 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1161 | - | let $ | |
1162 | - | let refreshDLpActions = $ | |
1163 | - | let updatedDLp = $ | |
1184 | + | let $t04327343415 = refreshDLpInternal(0, 0, 0) | |
1185 | + | let refreshDLpActions = $t04327343415._1 | |
1186 | + | let updatedDLp = $t04327343415._2 | |
1164 | 1187 | let check = if ((updatedDLp >= currentDLp)) | |
1165 | 1188 | then true | |
1166 | 1189 | else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(amDiff), toString(prDiff)], " ")) | |
1167 | 1190 | if ((check == check)) | |
1168 | 1191 | then { | |
1169 | 1192 | let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity | |
1170 | 1193 | if ((lpAssetEmissionAfter == lpAssetEmissionAfter)) | |
1171 | 1194 | then ((state ++ lpTrnsfr) ++ refreshDLpActions) | |
1172 | 1195 | else throw("Strict value is not equal to itself.") | |
1173 | 1196 | } | |
1174 | 1197 | else throw("Strict value is not equal to itself.") | |
1175 | 1198 | } | |
1176 | 1199 | else throw("Strict value is not equal to itself.") | |
1177 | 1200 | } | |
1178 | 1201 | else throw("Strict value is not equal to itself.") | |
1179 | 1202 | } | |
1180 | 1203 | else throw("Strict value is not equal to itself.") | |
1181 | 1204 | } | |
1182 | 1205 | else throw("Strict value is not equal to itself.") | |
1183 | 1206 | } | |
1184 | 1207 | else throw("Strict value is not equal to itself.") | |
1185 | 1208 | } | |
1186 | 1209 | else throw("Strict value is not equal to itself.") | |
1187 | 1210 | } | |
1188 | 1211 | else throw("Strict value is not equal to itself.") | |
1189 | 1212 | } | |
1190 | 1213 | else throw("Strict value is not equal to itself.") | |
1191 | 1214 | } | |
1192 | 1215 | } | |
1193 | 1216 | ||
1194 | 1217 | ||
1195 | 1218 | ||
1196 | 1219 | @Callable(i) | |
1197 | 1220 | func putOneTknV2 (minOutAmount,autoStake) = { | |
1198 | 1221 | let isPoolOneTokenOperationsDisabled = { | |
1199 | 1222 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1200 | 1223 | if ($isInstanceOf(@, "Boolean")) | |
1201 | 1224 | then @ | |
1202 | 1225 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1203 | 1226 | } | |
1204 | - | let isPutDisabled = if (if (if (igs()) | |
1205 | - | then true | |
1206 | - | else (cfgPoolStatus == PoolPutDis)) | |
1207 | - | then true | |
1208 | - | else (cfgPoolStatus == PoolShutdown)) | |
1209 | - | then true | |
1210 | - | else isPoolOneTokenOperationsDisabled | |
1227 | + | let isPutDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1228 | + | then if (if (if (igs()) | |
1229 | + | then true | |
1230 | + | else (cfgPoolStatus == PoolPutDis)) | |
1231 | + | then true | |
1232 | + | else (cfgPoolStatus == PoolShutdown)) | |
1233 | + | then true | |
1234 | + | else isPoolOneTokenOperationsDisabled | |
1235 | + | else false | |
1211 | 1236 | let checks = [if (if (!(isPutDisabled)) | |
1212 | 1237 | then true | |
1213 | 1238 | else isManager(i)) | |
1214 | 1239 | then true | |
1215 | 1240 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1216 | 1241 | then true | |
1217 | 1242 | else throwErr("exactly 1 payment are expected")] | |
1218 | 1243 | if ((checks == checks)) | |
1219 | 1244 | then { | |
1220 | 1245 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1221 | 1246 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1222 | 1247 | let lpId = cfgLpAssetId | |
1223 | 1248 | let amDecimals = cfgAmountAssetDecimals | |
1224 | 1249 | let prDecimals = cfgPriceAssetDecimals | |
1225 | 1250 | let userAddress = if ((i.caller == this)) | |
1226 | 1251 | then i.originCaller | |
1227 | 1252 | else i.caller | |
1228 | 1253 | let pmt = value(i.payments[0]) | |
1229 | 1254 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
1230 | 1255 | let pmtAmt = pmt.amount | |
1231 | 1256 | let currentDLp = if ((pmt.assetId == cfgAmountAssetId)) | |
1232 | 1257 | then calcCurrentDLp(toBigInt(pmtAmt), toBigInt(0), toBigInt(0)) | |
1233 | 1258 | else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0)) | |
1234 | 1259 | if ((currentDLp == currentDLp)) | |
1235 | 1260 | then { | |
1236 | - | let $ | |
1237 | - | if (($ | |
1261 | + | let $t04509345251 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
1262 | + | if (($t04509345251 == $t04509345251)) | |
1238 | 1263 | then { | |
1239 | - | let feeAmount = $ | |
1240 | - | let state = $ | |
1241 | - | let estimLP = $ | |
1264 | + | let feeAmount = $t04509345251._3 | |
1265 | + | let state = $t04509345251._2 | |
1266 | + | let estimLP = $t04509345251._1 | |
1242 | 1267 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
1243 | 1268 | then (minOutAmount > estimLP) | |
1244 | 1269 | else false) | |
1245 | 1270 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1246 | 1271 | else estimLP | |
1247 | 1272 | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
1248 | 1273 | if ((e == e)) | |
1249 | 1274 | then { | |
1250 | 1275 | let el = match e { | |
1251 | 1276 | case legacy: Address => | |
1252 | 1277 | invoke(legacy, "emit", [emitLpAmt], nil) | |
1253 | 1278 | case _ => | |
1254 | 1279 | unit | |
1255 | 1280 | } | |
1256 | 1281 | if ((el == el)) | |
1257 | 1282 | then { | |
1258 | 1283 | let lpTrnsfr = if (autoStake) | |
1259 | 1284 | then { | |
1260 | 1285 | let ss = invoke(stakingContract, "stakeFor", [toString(i.caller)], [AttachedPayment(lpId, emitLpAmt)]) | |
1261 | 1286 | if ((ss == ss)) | |
1262 | 1287 | then nil | |
1263 | 1288 | else throw("Strict value is not equal to itself.") | |
1264 | 1289 | } | |
1265 | 1290 | else [ScriptTransfer(i.caller, emitLpAmt, lpId)] | |
1266 | 1291 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1267 | 1292 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1268 | 1293 | else nil | |
1269 | - | let $ | |
1294 | + | let $t04613646485 = if ((this == feeCollectorAddress)) | |
1270 | 1295 | then $Tuple2(0, 0) | |
1271 | 1296 | else { | |
1272 | 1297 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1273 | 1298 | then true | |
1274 | 1299 | else false | |
1275 | 1300 | if (paymentInAmountAsset) | |
1276 | 1301 | then $Tuple2(-(feeAmount), 0) | |
1277 | 1302 | else $Tuple2(0, -(feeAmount)) | |
1278 | 1303 | } | |
1279 | - | let amountAssetBalanceDelta = $ | |
1280 | - | let priceAssetBalanceDelta = $ | |
1281 | - | let $ | |
1282 | - | let refreshDLpActions = $ | |
1283 | - | let updatedDLp = $ | |
1304 | + | let amountAssetBalanceDelta = $t04613646485._1 | |
1305 | + | let priceAssetBalanceDelta = $t04613646485._2 | |
1306 | + | let $t04648846596 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1307 | + | let refreshDLpActions = $t04648846596._1 | |
1308 | + | let updatedDLp = $t04648846596._2 | |
1284 | 1309 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1285 | 1310 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1286 | 1311 | then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1287 | 1312 | else throw("Strict value is not equal to itself.") | |
1288 | 1313 | } | |
1289 | 1314 | else throw("Strict value is not equal to itself.") | |
1290 | 1315 | } | |
1291 | 1316 | else throw("Strict value is not equal to itself.") | |
1292 | 1317 | } | |
1293 | 1318 | else throw("Strict value is not equal to itself.") | |
1294 | 1319 | } | |
1295 | 1320 | else throw("Strict value is not equal to itself.") | |
1296 | 1321 | } | |
1297 | 1322 | else throw("Strict value is not equal to itself.") | |
1298 | 1323 | } | |
1299 | 1324 | ||
1300 | 1325 | ||
1301 | 1326 | ||
1302 | 1327 | @Callable(i) | |
1303 | 1328 | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
1304 | 1329 | then throw("Wrong slpg") | |
1305 | 1330 | else if ((size(i.payments) != 2)) | |
1306 | 1331 | then throw("2 pmnts expd") | |
1307 | 1332 | else { | |
1308 | 1333 | let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, true, 0, "") | |
1309 | 1334 | let state = estPut._9 | |
1310 | 1335 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1311 | 1336 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1312 | 1337 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1313 | 1338 | if ((currentDLp == currentDLp)) | |
1314 | 1339 | then { | |
1315 | - | let $ | |
1316 | - | let refreshDLpActions = $ | |
1317 | - | let updatedDLp = $ | |
1340 | + | let $t04762647691 = refreshDLpInternal(0, 0, 0) | |
1341 | + | let refreshDLpActions = $t04762647691._1 | |
1342 | + | let updatedDLp = $t04762647691._2 | |
1318 | 1343 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1319 | 1344 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1320 | 1345 | then (state ++ refreshDLpActions) | |
1321 | 1346 | else throw("Strict value is not equal to itself.") | |
1322 | 1347 | } | |
1323 | 1348 | else throw("Strict value is not equal to itself.") | |
1324 | 1349 | } | |
1325 | 1350 | ||
1326 | 1351 | ||
1327 | 1352 | ||
1328 | 1353 | @Callable(i) | |
1329 | 1354 | func get () = { | |
1330 | 1355 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1331 | 1356 | if ((currentDLp == currentDLp)) | |
1332 | 1357 | then { | |
1333 | 1358 | let r = cg(i) | |
1334 | 1359 | let outAmtAmt = r._1 | |
1335 | 1360 | let outPrAmt = r._2 | |
1336 | 1361 | let pmtAmt = r._3 | |
1337 | 1362 | let pmtAssetId = r._4 | |
1338 | 1363 | let state = r._5 | |
1339 | 1364 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1340 | 1365 | if ((b == b)) | |
1341 | 1366 | then { | |
1342 | - | let $ | |
1343 | - | let refreshDLpActions = $ | |
1344 | - | let updatedDLp = $ | |
1367 | + | let $t04886448946 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1368 | + | let refreshDLpActions = $t04886448946._1 | |
1369 | + | let updatedDLp = $t04886448946._2 | |
1345 | 1370 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1346 | 1371 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1347 | 1372 | then (state ++ refreshDLpActions) | |
1348 | 1373 | else throw("Strict value is not equal to itself.") | |
1349 | 1374 | } | |
1350 | 1375 | else throw("Strict value is not equal to itself.") | |
1351 | 1376 | } | |
1352 | 1377 | else throw("Strict value is not equal to itself.") | |
1353 | 1378 | } | |
1354 | 1379 | ||
1355 | 1380 | ||
1356 | 1381 | ||
1357 | 1382 | @Callable(i) | |
1358 | 1383 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1359 | 1384 | let isPoolOneTokenOperationsDisabled = { | |
1360 | 1385 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1361 | 1386 | if ($isInstanceOf(@, "Boolean")) | |
1362 | 1387 | then @ | |
1363 | 1388 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1364 | 1389 | } | |
1365 | - | let isGetDisabled = if (if (igs()) | |
1366 | - | then true | |
1367 | - | else (cfgPoolStatus == PoolShutdown)) | |
1368 | - | then true | |
1369 | - | else isPoolOneTokenOperationsDisabled | |
1390 | + | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1391 | + | then if (if (igs()) | |
1392 | + | then true | |
1393 | + | else (cfgPoolStatus == PoolShutdown)) | |
1394 | + | then true | |
1395 | + | else isPoolOneTokenOperationsDisabled | |
1396 | + | else false | |
1370 | 1397 | let checks = [if (if (!(isGetDisabled)) | |
1371 | 1398 | then true | |
1372 | 1399 | else isManager(i)) | |
1373 | 1400 | then true | |
1374 | 1401 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1375 | 1402 | then true | |
1376 | 1403 | else throwErr("exactly 1 payment are expected")] | |
1377 | 1404 | if ((checks == checks)) | |
1378 | 1405 | then { | |
1379 | - | let $ | |
1380 | - | let state = $ | |
1381 | - | let totalAmount = $ | |
1406 | + | let $t04960149756 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1407 | + | let state = $t04960149756._1 | |
1408 | + | let totalAmount = $t04960149756._2 | |
1382 | 1409 | $Tuple2(state, totalAmount) | |
1383 | 1410 | } | |
1384 | 1411 | else throw("Strict value is not equal to itself.") | |
1385 | 1412 | } | |
1386 | 1413 | ||
1387 | 1414 | ||
1388 | 1415 | ||
1389 | 1416 | @Callable(i) | |
1390 | 1417 | func refreshDLp () = { | |
1391 | 1418 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0) | |
1392 | 1419 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay)) | |
1393 | 1420 | then unit | |
1394 | 1421 | else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1395 | 1422 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1396 | 1423 | then { | |
1397 | 1424 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1398 | - | let $ | |
1399 | - | let dLpUpdateActions = $ | |
1400 | - | let updatedDLp = $ | |
1425 | + | let $t05028050344 = refreshDLpInternal(0, 0, 0) | |
1426 | + | let dLpUpdateActions = $t05028050344._1 | |
1427 | + | let updatedDLp = $t05028050344._2 | |
1401 | 1428 | let actions = if ((dLp != updatedDLp)) | |
1402 | 1429 | then dLpUpdateActions | |
1403 | 1430 | else throwErr("nothing to refresh") | |
1404 | 1431 | $Tuple2(actions, toString(updatedDLp)) | |
1405 | 1432 | } | |
1406 | 1433 | else throw("Strict value is not equal to itself.") | |
1407 | 1434 | } | |
1408 | 1435 | ||
1409 | 1436 | ||
1410 | 1437 | ||
1411 | 1438 | @Callable(i) | |
1412 | 1439 | func getOneTknV2READONLY (outAssetId,lpAssetAmount) = { | |
1413 | 1440 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1414 | 1441 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1415 | 1442 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1416 | 1443 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
1417 | 1444 | let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity) | |
1418 | 1445 | let D0 = getD(xp) | |
1419 | 1446 | let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission)) | |
1420 | 1447 | let index = if ((outAssetId == amId)) | |
1421 | 1448 | then 0 | |
1422 | 1449 | else if ((outAssetId == prId)) | |
1423 | 1450 | then 1 | |
1424 | 1451 | else throw("invalid out asset id") | |
1425 | 1452 | let newY = getYD(xp, index, D1) | |
1426 | 1453 | let dy = (xp[index] - newY) | |
1427 | 1454 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1428 | - | let $ | |
1429 | - | let totalGet = $ | |
1430 | - | let feeAmount = $ | |
1455 | + | let $t05135451409 = takeFee(totalGetRaw, outFee) | |
1456 | + | let totalGet = $t05135451409._1 | |
1457 | + | let feeAmount = $t05135451409._2 | |
1431 | 1458 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1432 | 1459 | } | |
1433 | 1460 | ||
1434 | 1461 | ||
1435 | 1462 | ||
1436 | 1463 | @Callable(i) | |
1437 | 1464 | func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = { | |
1438 | 1465 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1439 | 1466 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1440 | 1467 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1441 | 1468 | let amBalance = getAccBalance(amId) | |
1442 | 1469 | let prBalance = getAccBalance(prId) | |
1443 | - | let $ | |
1470 | + | let $t05178451899 = { | |
1444 | 1471 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1445 | 1472 | if ($isInstanceOf(@, "(Int, Int)")) | |
1446 | 1473 | then @ | |
1447 | 1474 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1448 | 1475 | } | |
1449 | - | let totalGet = $ | |
1450 | - | let feeAmount = $ | |
1476 | + | let totalGet = $t05178451899._1 | |
1477 | + | let feeAmount = $t05178451899._2 | |
1451 | 1478 | let r = ego("", lpId, lpAssetAmount, this) | |
1452 | 1479 | let outAmAmt = r._1 | |
1453 | 1480 | let outPrAmt = r._2 | |
1454 | 1481 | let sumOfGetAssets = (outAmAmt + outPrAmt) | |
1455 | 1482 | let bonus = if ((sumOfGetAssets == 0)) | |
1456 | 1483 | then if ((totalGet == 0)) | |
1457 | 1484 | then 0 | |
1458 | 1485 | else throw("bonus calculation error") | |
1459 | 1486 | else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets) | |
1460 | 1487 | $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus)) | |
1461 | 1488 | } | |
1462 | 1489 | ||
1463 | 1490 | ||
1464 | 1491 | ||
1465 | 1492 | @Callable(i) | |
1466 | 1493 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1467 | 1494 | let r = cg(i) | |
1468 | 1495 | let outAmAmt = r._1 | |
1469 | 1496 | let outPrAmt = r._2 | |
1470 | 1497 | let pmtAmt = r._3 | |
1471 | 1498 | let pmtAssetId = r._4 | |
1472 | 1499 | let state = r._5 | |
1473 | 1500 | if ((noLessThenAmtAsset > outAmAmt)) | |
1474 | 1501 | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1475 | 1502 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1476 | 1503 | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1477 | 1504 | else { | |
1478 | 1505 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1479 | 1506 | if ((currentDLp == currentDLp)) | |
1480 | 1507 | then { | |
1481 | 1508 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1482 | 1509 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1483 | 1510 | then { | |
1484 | - | let $ | |
1485 | - | let refreshDLpActions = $ | |
1486 | - | let updatedDLp = $ | |
1511 | + | let $t05306553146 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1512 | + | let refreshDLpActions = $t05306553146._1 | |
1513 | + | let updatedDLp = $t05306553146._2 | |
1487 | 1514 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1488 | 1515 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1489 | 1516 | then (state ++ refreshDLpActions) | |
1490 | 1517 | else throw("Strict value is not equal to itself.") | |
1491 | 1518 | } | |
1492 | 1519 | else throw("Strict value is not equal to itself.") | |
1493 | 1520 | } | |
1494 | 1521 | else throw("Strict value is not equal to itself.") | |
1495 | 1522 | } | |
1496 | 1523 | } | |
1497 | 1524 | ||
1498 | 1525 | ||
1499 | 1526 | ||
1500 | 1527 | @Callable(i) | |
1501 | 1528 | func unstakeAndGet (amount) = { | |
1502 | 1529 | let checkPayments = if ((size(i.payments) != 0)) | |
1503 | 1530 | then throw("No pmnts expd") | |
1504 | 1531 | else true | |
1505 | 1532 | if ((checkPayments == checkPayments)) | |
1506 | 1533 | then { | |
1507 | 1534 | let factoryCfg = gfc() | |
1508 | 1535 | let lpAssetId = cfgLpAssetId | |
1509 | 1536 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1510 | 1537 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1511 | 1538 | if ((currentDLp == currentDLp)) | |
1512 | 1539 | then { | |
1513 | 1540 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1514 | 1541 | if ((unstakeInv == unstakeInv)) | |
1515 | 1542 | then { | |
1516 | 1543 | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1517 | 1544 | let outAmAmt = r._1 | |
1518 | 1545 | let outPrAmt = r._2 | |
1519 | 1546 | let sts = parseIntValue(r._9) | |
1520 | 1547 | let state = r._10 | |
1521 | - | let v = if (if (igs()) | |
1522 | - | then true | |
1523 | - | else (sts == PoolShutdown)) | |
1548 | + | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1549 | + | then if (igs()) | |
1550 | + | then true | |
1551 | + | else (cfgPoolStatus == PoolShutdown) | |
1552 | + | else false | |
1553 | + | let v = if (isGetDisabled) | |
1524 | 1554 | then throw(("Blocked: " + toString(sts))) | |
1525 | 1555 | else true | |
1526 | 1556 | if ((v == v)) | |
1527 | 1557 | then { | |
1528 | 1558 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1529 | 1559 | if ((burnA == burnA)) | |
1530 | 1560 | then { | |
1531 | - | let $ | |
1532 | - | let refreshDLpActions = $ | |
1533 | - | let updatedDLp = $ | |
1561 | + | let $t05425654337 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1562 | + | let refreshDLpActions = $t05425654337._1 | |
1563 | + | let updatedDLp = $t05425654337._2 | |
1534 | 1564 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1535 | 1565 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1536 | 1566 | then (state ++ refreshDLpActions) | |
1537 | 1567 | else throw("Strict value is not equal to itself.") | |
1538 | 1568 | } | |
1539 | 1569 | else throw("Strict value is not equal to itself.") | |
1540 | 1570 | } | |
1541 | 1571 | else throw("Strict value is not equal to itself.") | |
1542 | 1572 | } | |
1543 | 1573 | else throw("Strict value is not equal to itself.") | |
1544 | 1574 | } | |
1545 | 1575 | else throw("Strict value is not equal to itself.") | |
1546 | 1576 | } | |
1547 | 1577 | else throw("Strict value is not equal to itself.") | |
1548 | 1578 | } | |
1549 | 1579 | ||
1550 | 1580 | ||
1551 | 1581 | ||
1552 | 1582 | @Callable(i) | |
1553 | 1583 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1554 | - | let isGetDisabled = if (igs()) | |
1555 | - | then true | |
1556 | - | else (cfgPoolStatus == PoolShutdown) | |
1584 | + | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1585 | + | then if (igs()) | |
1586 | + | then true | |
1587 | + | else (cfgPoolStatus == PoolShutdown) | |
1588 | + | else false | |
1557 | 1589 | let checks = [if (!(isGetDisabled)) | |
1558 | 1590 | then true | |
1559 | 1591 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1560 | 1592 | then true | |
1561 | 1593 | else throw("no payments are expected")] | |
1562 | 1594 | if ((checks == checks)) | |
1563 | 1595 | then { | |
1564 | 1596 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1565 | 1597 | if ((currentDLp == currentDLp)) | |
1566 | 1598 | then { | |
1567 | 1599 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1568 | 1600 | if ((unstakeInv == unstakeInv)) | |
1569 | 1601 | then { | |
1570 | 1602 | let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1571 | 1603 | let outAmAmt = res._1 | |
1572 | 1604 | let outPrAmt = res._2 | |
1573 | 1605 | let state = res._10 | |
1574 | 1606 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1575 | 1607 | then true | |
1576 | 1608 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1577 | 1609 | then true | |
1578 | 1610 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1579 | 1611 | if ((checkAmounts == checkAmounts)) | |
1580 | 1612 | then { | |
1581 | 1613 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1582 | 1614 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1583 | 1615 | then { | |
1584 | - | let $ | |
1585 | - | let refreshDLpActions = $ | |
1586 | - | let updatedDLp = $ | |
1616 | + | let $t05562555706 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1617 | + | let refreshDLpActions = $t05562555706._1 | |
1618 | + | let updatedDLp = $t05562555706._2 | |
1587 | 1619 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1588 | 1620 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1589 | 1621 | then (state ++ refreshDLpActions) | |
1590 | 1622 | else throw("Strict value is not equal to itself.") | |
1591 | 1623 | } | |
1592 | 1624 | else throw("Strict value is not equal to itself.") | |
1593 | 1625 | } | |
1594 | 1626 | else throw("Strict value is not equal to itself.") | |
1595 | 1627 | } | |
1596 | 1628 | else throw("Strict value is not equal to itself.") | |
1597 | 1629 | } | |
1598 | 1630 | else throw("Strict value is not equal to itself.") | |
1599 | 1631 | } | |
1600 | 1632 | else throw("Strict value is not equal to itself.") | |
1601 | 1633 | } | |
1602 | 1634 | ||
1603 | 1635 | ||
1604 | 1636 | ||
1605 | 1637 | @Callable(i) | |
1606 | 1638 | func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = { | |
1607 | 1639 | let isPoolOneTokenOperationsDisabled = { | |
1608 | 1640 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1609 | 1641 | if ($isInstanceOf(@, "Boolean")) | |
1610 | 1642 | then @ | |
1611 | 1643 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1612 | 1644 | } | |
1613 | - | let isGetDisabled = if (if (igs()) | |
1614 | - | then true | |
1615 | - | else (cfgPoolStatus == PoolShutdown)) | |
1616 | - | then true | |
1617 | - | else isPoolOneTokenOperationsDisabled | |
1645 | + | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1646 | + | then if (if (igs()) | |
1647 | + | then true | |
1648 | + | else (cfgPoolStatus == PoolShutdown)) | |
1649 | + | then true | |
1650 | + | else isPoolOneTokenOperationsDisabled | |
1651 | + | else false | |
1618 | 1652 | let checks = [if (if (!(isGetDisabled)) | |
1619 | 1653 | then true | |
1620 | 1654 | else isManager(i)) | |
1621 | 1655 | then true | |
1622 | 1656 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1623 | 1657 | then true | |
1624 | 1658 | else throwErr("no payments are expected")] | |
1625 | 1659 | if ((checks == checks)) | |
1626 | 1660 | then { | |
1627 | 1661 | let factoryCfg = gfc() | |
1628 | 1662 | let lpAssetId = cfgLpAssetId | |
1629 | 1663 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1630 | 1664 | let userAddress = i.caller | |
1631 | 1665 | let lpAssetRecipientAddress = this | |
1632 | 1666 | let unstakeInv = invoke(staking, "unstakeINTERNAL", [lpAssetId, unstakeAmount, userAddress.bytes, lpAssetRecipientAddress.bytes], nil) | |
1633 | 1667 | if ((unstakeInv == unstakeInv)) | |
1634 | 1668 | then { | |
1635 | - | let $ | |
1636 | - | let state = $ | |
1637 | - | let totalAmount = $ | |
1669 | + | let $t05676556953 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1670 | + | let state = $t05676556953._1 | |
1671 | + | let totalAmount = $t05676556953._2 | |
1638 | 1672 | $Tuple2(state, totalAmount) | |
1639 | 1673 | } | |
1640 | 1674 | else throw("Strict value is not equal to itself.") | |
1641 | 1675 | } | |
1642 | 1676 | else throw("Strict value is not equal to itself.") | |
1643 | 1677 | } | |
1644 | 1678 | ||
1645 | 1679 | ||
1646 | 1680 | ||
1647 | 1681 | @Callable(i) | |
1648 | 1682 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1649 | - | let $ | |
1650 | - | let lpAmount = $ | |
1651 | - | let state = $ | |
1652 | - | let feeAmount = $ | |
1653 | - | let bonus = $ | |
1683 | + | let $t05708157184 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1684 | + | let lpAmount = $t05708157184._1 | |
1685 | + | let state = $t05708157184._2 | |
1686 | + | let feeAmount = $t05708157184._3 | |
1687 | + | let bonus = $t05708157184._4 | |
1654 | 1688 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1655 | 1689 | } | |
1656 | 1690 | ||
1657 | 1691 | ||
1658 | 1692 | ||
1659 | 1693 | @Callable(i) | |
1660 | 1694 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1661 | - | let $ | |
1662 | - | let lpAmount = $ | |
1663 | - | let state = $ | |
1664 | - | let feeAmount = $ | |
1665 | - | let bonus = $ | |
1695 | + | let $t05733257436 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1696 | + | let lpAmount = $t05733257436._1 | |
1697 | + | let state = $t05733257436._2 | |
1698 | + | let feeAmount = $t05733257436._3 | |
1699 | + | let bonus = $t05733257436._4 | |
1666 | 1700 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1667 | 1701 | } | |
1668 | 1702 | ||
1669 | 1703 | ||
1670 | 1704 | ||
1671 | 1705 | @Callable(i) | |
1672 | 1706 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1673 | 1707 | then throw("denied") | |
1674 | 1708 | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr), StringEntry(amp(), toString(ampInitial)), StringEntry(keyAmpHistory(height), toString(ampInitial))], "success") | |
1675 | 1709 | ||
1676 | 1710 | ||
1677 | 1711 | ||
1678 | 1712 | @Callable(i) | |
1679 | 1713 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
1680 | 1714 | ||
1681 | 1715 | ||
1682 | 1716 | ||
1683 | 1717 | @Callable(i) | |
1684 | 1718 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1685 | 1719 | ||
1686 | 1720 | ||
1687 | 1721 | ||
1688 | 1722 | @Callable(i) | |
1689 | 1723 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1690 | 1724 | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
1691 | 1725 | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
1692 | 1726 | } | |
1693 | 1727 | ||
1694 | 1728 | ||
1695 | 1729 | ||
1696 | 1730 | @Callable(i) | |
1697 | 1731 | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
1698 | 1732 | ||
1699 | 1733 | ||
1700 | 1734 | ||
1701 | 1735 | @Callable(i) | |
1702 | 1736 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
1703 | 1737 | ||
1704 | 1738 | ||
1705 | 1739 | ||
1706 | 1740 | @Callable(i) | |
1707 | 1741 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1708 | 1742 | ||
1709 | 1743 | ||
1710 | 1744 | ||
1711 | 1745 | @Callable(i) | |
1712 | 1746 | func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, true, false, 0, "")) | |
1713 | 1747 | ||
1714 | 1748 | ||
1715 | 1749 | ||
1716 | 1750 | @Callable(i) | |
1717 | 1751 | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
1718 | 1752 | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
1719 | 1753 | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
1720 | 1754 | } | |
1721 | 1755 | ||
1722 | 1756 | ||
1723 | 1757 | ||
1724 | 1758 | @Callable(i) | |
1725 | 1759 | func changeAmp () = { | |
1726 | 1760 | let cfg = invoke(fca, "getChangeAmpConfigREADONLY", [toString(this)], nil) | |
1727 | - | let $ | |
1761 | + | let $t05991660115 = match cfg { | |
1728 | 1762 | case list: List[Any] => | |
1729 | 1763 | $Tuple3({ | |
1730 | 1764 | let @ = list[0] | |
1731 | 1765 | if ($isInstanceOf(@, "Int")) | |
1732 | 1766 | then @ | |
1733 | 1767 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1734 | 1768 | }, { | |
1735 | 1769 | let @ = list[1] | |
1736 | 1770 | if ($isInstanceOf(@, "Int")) | |
1737 | 1771 | then @ | |
1738 | 1772 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1739 | 1773 | }, { | |
1740 | 1774 | let @ = list[2] | |
1741 | 1775 | if ($isInstanceOf(@, "Int")) | |
1742 | 1776 | then @ | |
1743 | 1777 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1744 | 1778 | }) | |
1745 | 1779 | case _ => | |
1746 | 1780 | throwErr("invalid entry type") | |
1747 | 1781 | } | |
1748 | - | let delay = $ | |
1749 | - | let delta = $ | |
1750 | - | let target = $ | |
1782 | + | let delay = $t05991660115._1 | |
1783 | + | let delta = $t05991660115._2 | |
1784 | + | let target = $t05991660115._3 | |
1751 | 1785 | let curAmp = parseIntValue(getStringValue(amp())) | |
1752 | 1786 | let newAmpRaw = (curAmp + delta) | |
1753 | 1787 | let newAmp = if ((0 > delta)) | |
1754 | 1788 | then if ((target > newAmpRaw)) | |
1755 | 1789 | then target | |
1756 | 1790 | else newAmpRaw | |
1757 | 1791 | else if ((newAmpRaw > target)) | |
1758 | 1792 | then target | |
1759 | 1793 | else newAmpRaw | |
1760 | 1794 | let lastCall = valueOrElse(getInteger(keyChangeAmpLastCall()), 0) | |
1761 | 1795 | let wait = (lastCall + delay) | |
1762 | 1796 | let checks = [if ((height > wait)) | |
1763 | 1797 | then true | |
1764 | 1798 | else throwErr("try again in few blocks"), if ((curAmp != newAmp)) | |
1765 | 1799 | then true | |
1766 | 1800 | else throwErr("already reached target")] | |
1767 | 1801 | if ((checks == checks)) | |
1768 | 1802 | then [IntegerEntry(keyChangeAmpLastCall(), height), StringEntry(amp(), toString(newAmp)), StringEntry(keyAmpHistory(height), toString(newAmp))] | |
1769 | 1803 | else throw("Strict value is not equal to itself.") | |
1770 | 1804 | } | |
1771 | 1805 | ||
1772 | 1806 | ||
1773 | 1807 | @Verifier(tx) | |
1774 | 1808 | func verify () = { | |
1775 | 1809 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1776 | 1810 | case pk: ByteVector => | |
1777 | 1811 | pk | |
1778 | 1812 | case _: Unit => | |
1779 | 1813 | tx.senderPublicKey | |
1780 | 1814 | case _ => | |
1781 | 1815 | throw("Match error") | |
1782 | 1816 | } | |
1783 | 1817 | match tx { | |
1784 | 1818 | case order: Order => | |
1785 | 1819 | let matcherPub = mp() | |
1786 | - | let $ | |
1820 | + | let $t06104861165 = if (skipOrderValidation()) | |
1787 | 1821 | then $Tuple2(true, "") | |
1788 | 1822 | else validateMatcherOrderAllowed(order) | |
1789 | - | let orderValid = $ | |
1790 | - | let orderValidInfo = $ | |
1823 | + | let orderValid = $t06104861165._1 | |
1824 | + | let orderValidInfo = $t06104861165._2 | |
1791 | 1825 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1792 | 1826 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1793 | 1827 | if (if (if (orderValid) | |
1794 | 1828 | then senderValid | |
1795 | 1829 | else false) | |
1796 | 1830 | then matcherValid | |
1797 | 1831 | else false) | |
1798 | 1832 | then true | |
1799 | 1833 | else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid) | |
1800 | 1834 | case s: SetScriptTransaction => | |
1801 | 1835 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
1802 | 1836 | then true | |
1803 | 1837 | else { | |
1804 | 1838 | let newHash = blake2b256(value(s.script)) | |
1805 | 1839 | let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash()))) | |
1806 | 1840 | let currentHash = scriptHash(this) | |
1807 | 1841 | if ((allowedHash == newHash)) | |
1808 | 1842 | then (currentHash != newHash) | |
1809 | 1843 | else false | |
1810 | 1844 | } | |
1811 | 1845 | case _ => | |
1812 | 1846 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1813 | 1847 | } | |
1814 | 1848 | } | |
1815 | 1849 |
github/deemru/w8io/026f985 256.67 ms ◑