tx · GWpb91ZsRwiFqQLF3rWm2fPY9JjjZowahupDCSPYYkPp 3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh: -0.02500000 Waves 2023.02.23 12:47 [2462140] smart account 3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh > SELF 0.00000000 Waves
{ "type": 13, "id": "GWpb91ZsRwiFqQLF3rWm2fPY9JjjZowahupDCSPYYkPp", "fee": 2500000, "feeAssetId": null, "timestamp": 1677145706432, "version": 2, "chainId": 84, "sender": "3NAfzeA3URU6oCV6HvtAiNwqGXsTs87ZpHh", "senderPublicKey": "HiTi1JT7GQRqLNxg4yZhD1mV42y1Mv2AYvRx92JQRbwX", "proofs": [ "2SqF2ymoP5c7HgPnzbA1VFaBgb95QeFkiRRWaj9mxC3xq9FdSFxXE2kWrPLB3emJjKYQqqZbxEKQ6Z7C64z3bZ8d" ], "script": "base64:BgJYCAISBAoCAQQSBQoDCAEBEgUKAwgBARIDCgEIEgMKAQgSBAoCCAESBQoDCAEIEgUKAwgBCBIFCgMIAQgSABIDCgEBEgMKAQESBAoCAQESAwoBARIECgIBAXUABkVVTEVSOADWic+BAQAFTVVMVDYAwIQ9AAZNVUxUWDYJALYCAQDAhD0ABU1VTFQ4AIDC1y8ABk1VTFRYOAkAtgIBAIDC1y8AB01VTFRYMTAJALYCAQCAyK+gJQAGTVVMVDEyAICglKWNHQAHTVVMVFgxNgkAtgIBAICAhP6m3uERAAZNVUxUMTgJALYCAQCAgJC7utat8A0AA1NFUAICX18AB0xJU1RTRVACAToAEURFRkFVTFRTV0FQRkVFTjJXAIgnABFERUZBVUxUU1dBUEZFRVcyTgCgnAEAC0JSUFJPVEVDVEVEAKCNBgAHV0FWRVNJRAkA2QQBAgVXQVZFUwAJREFZTUlMTElTAIC4mSkBEmtleU5ldXRyaW5vQXNzZXRJZAACEW5ldXRyaW5vX2Fzc2V0X2lkAQ5rZXlOc2J0QXNzZXRJZAACDWJvbmRfYXNzZXRfaWQBDmtleVN1cm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vbWVGb3JQZXJpb2QJARdjYWxjVXNkbkluY29tZUZvclBlcmlvZAIFE25zYnRTdGFraW5nQ29udHJhY3QFB3RtcERheXMEA2FwcgkBB2NhbGNBcHIEBRNuc2J0U3Rha2luZ0NvbnRyYWN0BQd0bXBEYXlzBQ9pbmNvbWVGb3JQZXJpb2QFD25zYnRVc2RuUHJpY2VYNgkAlAoCBQNuaWwJAKwCAgIEJWRfXwkApAMBBQNhcHIAmfVX7Q==", "height": 2462140, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6bTZzmbsMRhpbhnkQDASWPq1FvQvJwEgmGGnTMyFcrk8 Next: 9ucoZspxY9njVCMc6WaBHNusJhhEvaEkSprzXFwuv9rP Diff:
Old | New | Differences | |
---|---|---|---|
20 | 20 | let MULT18 = toBigInt(1000000000000000000) | |
21 | 21 | ||
22 | 22 | let SEP = "__" | |
23 | + | ||
24 | + | let LISTSEP = ":" | |
23 | 25 | ||
24 | 26 | let DEFAULTSWAPFEEN2W = 5000 | |
25 | 27 | ||
61 | 63 | func basketAssetsKey () = "%s%s__common__basketAssets" | |
62 | 64 | ||
63 | 65 | ||
66 | + | func basketDKey () = "%s%s__common__basketD" | |
67 | + | ||
68 | + | ||
69 | + | func basketBKey () = "%s%s__common__basketB" | |
70 | + | ||
71 | + | ||
72 | + | func basketLogbDeltaKey () = "%s%s__common__basketLogbDelta" | |
73 | + | ||
74 | + | ||
75 | + | func basketWeightByAssetKey (assetId) = ("%s%s%s__common__weightByAsset__" + assetId) | |
76 | + | ||
77 | + | ||
64 | 78 | func keyPrice () = "price" | |
79 | + | ||
80 | + | ||
81 | + | func keyPriceByAsset (assetId) = ("%s%s%s__common__priceByAsset__" + assetId) | |
65 | 82 | ||
66 | 83 | ||
67 | 84 | func keyLockParamStartBlock (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "start"], SEP) | |
103 | 120 | func convertNeutrinoToWaves (amount,price) = fraction(amount, MULT8, price) | |
104 | 121 | ||
105 | 122 | ||
106 | - | func | |
123 | + | func convertTokenToUsd (amount,price) = fraction(amount, price, MULT8) | |
107 | 124 | ||
108 | 125 | ||
109 | 126 | func asAnyList (val) = match val { | |
328 | 345 | ||
329 | 346 | ||
330 | 347 | @Callable(i) | |
331 | - | func reverseSwapLimitREADONLY (lim, | |
348 | + | func reverseSwapLimitREADONLY (lim,isOutMulti) = { | |
332 | 349 | let BR = asInt(asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil))[nMetricIdxBR]) | |
333 | 350 | let gNsbt = if ((0 >= lim)) | |
334 | 351 | then 0 | |
335 | 352 | else { | |
336 | - | let aParamX8 = toBigInt(getIntOrFail(mathContract, if ( | |
337 | - | then | |
338 | - | else | |
339 | - | let bParamX16 = toBigInt(getIntOrFail(mathContract, if ( | |
340 | - | then | |
341 | - | else | |
342 | - | let limDivAX8 = if ( | |
343 | - | then fraction(toBigInt(lim), MULTX10, aParamX8) | |
344 | - | else fraction( | |
353 | + | let aParamX8 = toBigInt(getIntOrFail(mathContract, if (isOutMulti) | |
354 | + | then keyUsdnSwapAmountAParam() | |
355 | + | else keySwapAmountAParam())) | |
356 | + | let bParamX16 = toBigInt(getIntOrFail(mathContract, if (isOutMulti) | |
357 | + | then keyUsdnSwapAmountBParam() | |
358 | + | else keySwapAmountBParam())) | |
359 | + | let limDivAX8 = if (isOutMulti) | |
360 | + | then fraction(fraction(toBigInt(lim), MULTX10, aParamX8), MULTX6, toBigInt(BR)) | |
361 | + | else fraction(toBigInt(lim), MULTX10, aParamX8) | |
345 | 362 | let revBX16 = fraction(MULTX16, MULTX16, bParamX16) | |
346 | 363 | toInt(pow(limDivAX8, 8, revBX16, 16, 6, CEILING)) | |
347 | 364 | } | |
360 | 377 | let gnsbtFromSurfDiff = asInt(invoke(surfStakingContract, "gnsbtFromSurfSYSREADONLY", [additionalSurfToStakeOrZero], nil)) | |
361 | 378 | let gNsbtDiff = (gnsbtFromNsbtDiff + gnsbtFromSurfDiff) | |
362 | 379 | let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil)) | |
380 | + | let limitMaxTokenUsd = swapParamsTuple._1 | |
363 | 381 | let blcks2LmtReset = swapParamsTuple._3 | |
364 | 382 | let gnsbtAmt = swapParamsTuple._4 | |
365 | 383 | let gnsbtAmtTotal = swapParamsTuple._5 | |
366 | - | let limitMaxWaves = swapParamsTuple._6 | |
367 | 384 | let limitMaxUsdn = swapParamsTuple._7 | |
368 | 385 | let swapParamsTupleNEW = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, gNsbtDiff], nil)) | |
386 | + | let limitMaxTokenUsdNEW = swapParamsTupleNEW._1 | |
369 | 387 | let blcks2LmtResetNEW = swapParamsTupleNEW._3 | |
370 | 388 | let gnsbtAmtNEW = swapParamsTupleNEW._4 | |
371 | 389 | let gnsbtAmtTotalNEW = swapParamsTupleNEW._5 | |
372 | - | let limitMaxWavesNEW = swapParamsTupleNEW._6 | |
373 | 390 | let limitMaxUsdnNEW = swapParamsTupleNEW._7 | |
374 | 391 | let nsbtBalance = if ((userAddressStrOrEmpty != "")) | |
375 | 392 | then assetBalance(userAddressOrThis, nsbtAssetId) | |
415 | 432 | let votingPowerEtaNew = if ((vpEffectiveHeightNEW == 0)) | |
416 | 433 | then height | |
417 | 434 | else vpEffectiveHeightNEW | |
418 | - | $Tuple2(nil, [0, nsbtBalance, surfBalance, nsbtBalanceNew, surfBalanceNew, gnsbtAmtFromNsbt, gnsbtAmtFromSurf, gnsbtAmtFromNsbtNEW, gnsbtAmtFromSurfNEW, gnsbtFromNsbtTotal, gnsbtFromSurfTotal, gnsbtFromNsbtTotalNEW, gnsbtFromSurfTotalNEW, limitMaxUsdn, | |
435 | + | $Tuple2(nil, [0, nsbtBalance, surfBalance, nsbtBalanceNew, surfBalanceNew, gnsbtAmtFromNsbt, gnsbtAmtFromSurf, gnsbtAmtFromNsbtNEW, gnsbtAmtFromSurfNEW, gnsbtFromNsbtTotal, gnsbtFromSurfTotal, gnsbtFromNsbtTotalNEW, gnsbtFromSurfTotalNEW, limitMaxUsdn, limitMaxTokenUsd, limitMaxUsdnNEW, limitMaxTokenUsdNEW, blcks2LmtReset, blcks2LmtResetNEW, votingPower, votingPowerNew, votingPowerMax, votingPowerMaxNew, votingPowerEta, votingPowerEtaNew]) | |
419 | 436 | } | |
420 | 437 | ||
421 | 438 | ||
477 | 494 | let gNsbtCurrent = if ((userAddressStrOpt == "")) | |
478 | 495 | then 0 | |
479 | 496 | else asInt(asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOpt, 0], nil))._4) | |
480 | - | let limitWantedUsdn = if ((assetIdStr == "WAVES")) | |
481 | - | then convertWavesToNeutrino(limitWanted, getIntegerValue(controlContract, keyPrice())) | |
482 | - | else limitWanted | |
483 | - | let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWantedUsdn, (assetIdStr == "WAVES")], nil)) | |
497 | + | let price = valueOrErrorMessage(getInteger(controlContract, keyPriceByAsset(assetIdStr)), ("No price for asset " + assetIdStr)) | |
498 | + | let isOutMulti = (assetIdStr == neutrinoAssetIdString) | |
499 | + | let limitWantedUsdn = if (isOutMulti) | |
500 | + | then limitWanted | |
501 | + | else convertTokenToUsd(limitWanted, price) | |
502 | + | let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWantedUsdn, isOutMulti], nil)) | |
484 | 503 | let gNsbtDelta = (gNsbtNeeded - gNsbtCurrent) | |
485 | 504 | $Tuple2(nil, makeString(["%s%s", toString(gNsbtCurrent), toString(gNsbtDelta)], SEP)) | |
486 | 505 | } | |
492 | 511 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
493 | 512 | let price = asInt(neutrinoMetrics[nMetricIdxPrice]) | |
494 | 513 | let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil)) | |
514 | + | let limitMaxTokenInUsd = swapParamsTuple._1 | |
495 | 515 | let blcks2LmtReset = swapParamsTuple._3 | |
496 | - | let limitMaxWaves = swapParamsTuple._6 | |
497 | 516 | let limitMaxUsdn = swapParamsTuple._7 | |
498 | 517 | let assetId = fromBase58String(assetIdStr) | |
499 | 518 | let basketAssets = valueOrElse(getString(neutrinoContract, basketAssetsKey()), "WAVES") | |
504 | 523 | else throw(("Can't swap assetId=" + assetIdStr)) | |
505 | 524 | let withdrawTuple = asWithdrawResultSTRUCT(invoke(neutrinoContract, "calcWithdrawResultSYSREADONLY", [swapType, amount, price, assetIdStr], nil)) | |
506 | 525 | let outNetAmount = withdrawTuple._1 | |
507 | - | let outAssetId = withdrawTuple._2 | |
508 | 526 | let outSurfAmt = withdrawTuple._3 | |
509 | 527 | let inAmtToSurfPart = withdrawTuple._4 | |
510 | - | let unleaseAmt = withdrawTuple._5 | |
511 | 528 | let outFeeAmount = withdrawTuple._6 | |
512 | 529 | let outAmtGross = withdrawTuple._7 | |
513 | 530 | let withdrawPrice = withdrawTuple._8 | |
514 | - | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(outNetAmount), toString(outSurfAmt), toString(outFeeAmount), toString(withdrawPrice), toString(blcks2LmtReset), toString( | |
531 | + | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(outNetAmount), toString(outSurfAmt), toString(outFeeAmount), toString(withdrawPrice), toString(blcks2LmtReset), toString(limitMaxTokenInUsd), toString(limitMaxUsdn), toString(inAmtToSurfPart)], SEP)) | |
515 | 532 | } | |
516 | 533 | ||
517 | 534 | ||
521 | 538 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
522 | 539 | let price = asInt(neutrinoMetrics[nMetricIdxPrice]) | |
523 | 540 | let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil)) | |
541 | + | let limitMaxTokenInUsd = swapParamsTuple._1 | |
524 | 542 | let blcks2LmtReset = swapParamsTuple._3 | |
525 | - | let limitMaxWaves = swapParamsTuple._6 | |
526 | 543 | let limitMaxUsdn = swapParamsTuple._7 | |
527 | 544 | let assetId = fromBase58String(assetIdStr) | |
528 | 545 | let basketAssets = valueOrElse(getString(neutrinoContract, basketAssetsKey()), "WAVES") | |
532 | 549 | then "outMulti" | |
533 | 550 | else throw(("Can't swap assetId=" + assetIdStr)) | |
534 | 551 | let withdrawTuple = asWithdrawResultSTRUCT(invoke(neutrinoContract, "calcWithdrawResultSYSREADONLY", [swapType, amount, price, assetIdStr], nil)) | |
535 | - | let outNetAmount = withdrawTuple._1 | |
536 | - | let outAssetId = withdrawTuple._2 | |
537 | - | let outSurfAmt = withdrawTuple._3 | |
538 | - | let inAmtToSurfPart = withdrawTuple._4 | |
539 | - | let unleaseAmt = withdrawTuple._5 | |
540 | - | let outFeeAmount = withdrawTuple._6 | |
541 | - | let outAmtGross = withdrawTuple._7 | |
542 | - | let withdrawPrice = withdrawTuple._8 | |
543 | - | let withdrawBasket = withdrawTuple._9 | |
544 | - | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d%s", toString(outNetAmount), toString(outSurfAmt), toString(outFeeAmount), toString(withdrawPrice), toString(blcks2LmtReset), toString(limitMaxWaves), toString(limitMaxUsdn), toString(inAmtToSurfPart), withdrawBasket], SEP)) | |
552 | + | let outNeutrinoInfo = makeString([neutrinoAssetIdString, toString(withdrawTuple._8), toString(withdrawTuple._1), toString(withdrawTuple._6), "1000000"], LISTSEP) | |
553 | + | let withdrawBasket = if ((swapType == "outNeutrino")) | |
554 | + | then outNeutrinoInfo | |
555 | + | else withdrawTuple._9 | |
556 | + | $Tuple2(nil, makeString_2C(["%d%d%d%s", toString(blcks2LmtReset), toString(limitMaxTokenInUsd), toString(limitMaxUsdn), withdrawBasket], SEP)) | |
545 | 557 | } | |
546 | 558 | ||
547 | 559 | ||
550 | 562 | func basketInfoREADONLY () = { | |
551 | 563 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
552 | 564 | let basketInfo = asString(neutrinoMetrics[nMetricBasketInfo]) | |
553 | - | $Tuple2(nil, makeString(["%s", basketInfo], SEP)) | |
565 | + | let basket = split_4C(basketInfo, "_") | |
566 | + | func modify (acc,item) = { | |
567 | + | let parts = split(item, LISTSEP) | |
568 | + | let assetId = parts[0] | |
569 | + | let dlog6 = valueOrErrorMessage(getInteger(neutrinoContract, basketLogbDeltaKey()), "log(b, delta) key is undefined") | |
570 | + | let D6 = valueOrErrorMessage(getInteger(neutrinoContract, basketDKey()), "D key is undefined") | |
571 | + | let b6 = valueOrErrorMessage(getInteger(neutrinoContract, basketBKey()), "b key is undefined") | |
572 | + | let w6 = valueOrErrorMessage(getInteger(neutrinoContract, basketWeightByAssetKey(assetId)), (("Target weight for asset " + assetId) + " is undefined")) | |
573 | + | let p6 = ((dlog6 - w6) + parseIntValue(parts[1])) | |
574 | + | let d = (D6 - pow(b6, 6, p6, 6, 6, HALFUP)) | |
575 | + | (acc :+ makeString(((parts :+ toString(w6)) :+ toString(d)), LISTSEP)) | |
576 | + | } | |
577 | + | ||
578 | + | let b = { | |
579 | + | let $l = basket | |
580 | + | let $s = size($l) | |
581 | + | let $acc0 = nil | |
582 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
583 | + | then $a | |
584 | + | else modify($a, $l[$i]) | |
585 | + | ||
586 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
587 | + | then $a | |
588 | + | else throw("List size exceeds 10") | |
589 | + | ||
590 | + | $f0_2($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) | |
591 | + | } | |
592 | + | $Tuple2(nil, ("%s__" + makeString_2C(b, "_"))) | |
554 | 593 | } | |
555 | 594 | ||
556 | 595 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let EULER8 = 271828182 | |
5 | 5 | ||
6 | 6 | let MULT6 = 1000000 | |
7 | 7 | ||
8 | 8 | let MULTX6 = toBigInt(1000000) | |
9 | 9 | ||
10 | 10 | let MULT8 = 100000000 | |
11 | 11 | ||
12 | 12 | let MULTX8 = toBigInt(100000000) | |
13 | 13 | ||
14 | 14 | let MULTX10 = toBigInt(10000000000) | |
15 | 15 | ||
16 | 16 | let MULT12 = 1000000000000 | |
17 | 17 | ||
18 | 18 | let MULTX16 = toBigInt(10000000000000000) | |
19 | 19 | ||
20 | 20 | let MULT18 = toBigInt(1000000000000000000) | |
21 | 21 | ||
22 | 22 | let SEP = "__" | |
23 | + | ||
24 | + | let LISTSEP = ":" | |
23 | 25 | ||
24 | 26 | let DEFAULTSWAPFEEN2W = 5000 | |
25 | 27 | ||
26 | 28 | let DEFAULTSWAPFEEW2N = 20000 | |
27 | 29 | ||
28 | 30 | let BRPROTECTED = 100000 | |
29 | 31 | ||
30 | 32 | let WAVESID = fromBase58String("WAVES") | |
31 | 33 | ||
32 | 34 | let DAYMILLIS = 86400000 | |
33 | 35 | ||
34 | 36 | func keyNeutrinoAssetId () = "neutrino_asset_id" | |
35 | 37 | ||
36 | 38 | ||
37 | 39 | func keyNsbtAssetId () = "bond_asset_id" | |
38 | 40 | ||
39 | 41 | ||
40 | 42 | func keySurfAssetId () = "surf_asset_id" | |
41 | 43 | ||
42 | 44 | ||
43 | 45 | func keySwapAmountAParam () = "%s%s__config__swapAParam" | |
44 | 46 | ||
45 | 47 | ||
46 | 48 | func keySwapAmountBParam () = "%s%s__config__swapBParam" | |
47 | 49 | ||
48 | 50 | ||
49 | 51 | func keyUsdnSwapAmountAParam () = "%s%s__config__usdnSwapAParam" | |
50 | 52 | ||
51 | 53 | ||
52 | 54 | func keyUsdnSwapAmountBParam () = "%s%s__config__usdnSwapBParam" | |
53 | 55 | ||
54 | 56 | ||
55 | 57 | func keyNsbtLockContract () = "%s__nsbtLockContract" | |
56 | 58 | ||
57 | 59 | ||
58 | 60 | func keyMathContract () = "%s__mathContract" | |
59 | 61 | ||
60 | 62 | ||
61 | 63 | func basketAssetsKey () = "%s%s__common__basketAssets" | |
62 | 64 | ||
63 | 65 | ||
66 | + | func basketDKey () = "%s%s__common__basketD" | |
67 | + | ||
68 | + | ||
69 | + | func basketBKey () = "%s%s__common__basketB" | |
70 | + | ||
71 | + | ||
72 | + | func basketLogbDeltaKey () = "%s%s__common__basketLogbDelta" | |
73 | + | ||
74 | + | ||
75 | + | func basketWeightByAssetKey (assetId) = ("%s%s%s__common__weightByAsset__" + assetId) | |
76 | + | ||
77 | + | ||
64 | 78 | func keyPrice () = "price" | |
79 | + | ||
80 | + | ||
81 | + | func keyPriceByAsset (assetId) = ("%s%s%s__common__priceByAsset__" + assetId) | |
65 | 82 | ||
66 | 83 | ||
67 | 84 | func keyLockParamStartBlock (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "start"], SEP) | |
68 | 85 | ||
69 | 86 | ||
70 | 87 | func keyHalfLife () = "%s__halfLife" | |
71 | 88 | ||
72 | 89 | ||
73 | 90 | func keyMinLockAmount () = "%s__minLockAmount" | |
74 | 91 | ||
75 | 92 | ||
76 | 93 | func keyMinWavesForNsbtBuy () = "min_waves_nsbt_buy" | |
77 | 94 | ||
78 | 95 | ||
79 | 96 | func keyMinNsbtSell () = "min_nsbt_sell" | |
80 | 97 | ||
81 | 98 | ||
82 | 99 | func keyStatsDepositAmtByDay (timestamp) = makeString(["%s%s%d", "stats", "depositAmtByDay", toString(timestamp)], SEP) | |
83 | 100 | ||
84 | 101 | ||
85 | 102 | func toStartOfDay (timestamp) = ((timestamp / DAYMILLIS) * DAYMILLIS) | |
86 | 103 | ||
87 | 104 | ||
88 | 105 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
89 | 106 | ||
90 | 107 | ||
91 | 108 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
92 | 109 | ||
93 | 110 | ||
94 | 111 | func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
95 | 112 | ||
96 | 113 | ||
97 | 114 | func getIntOrElse (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
98 | 115 | ||
99 | 116 | ||
100 | 117 | func getStrOrElse (address,key,defaultVal) = valueOrElse(getString(address, key), defaultVal) | |
101 | 118 | ||
102 | 119 | ||
103 | 120 | func convertNeutrinoToWaves (amount,price) = fraction(amount, MULT8, price) | |
104 | 121 | ||
105 | 122 | ||
106 | - | func | |
123 | + | func convertTokenToUsd (amount,price) = fraction(amount, price, MULT8) | |
107 | 124 | ||
108 | 125 | ||
109 | 126 | func asAnyList (val) = match val { | |
110 | 127 | case valAnyList: List[Any] => | |
111 | 128 | valAnyList | |
112 | 129 | case _ => | |
113 | 130 | throw("fail to cast into List[Any]") | |
114 | 131 | } | |
115 | 132 | ||
116 | 133 | ||
117 | 134 | func asInt (val) = match val { | |
118 | 135 | case valInt: Int => | |
119 | 136 | valInt | |
120 | 137 | case _ => | |
121 | 138 | throw("fail to cast into Int") | |
122 | 139 | } | |
123 | 140 | ||
124 | 141 | ||
125 | 142 | func asString (val) = match val { | |
126 | 143 | case valStr: String => | |
127 | 144 | valStr | |
128 | 145 | case _ => | |
129 | 146 | throw("fail to cast into String") | |
130 | 147 | } | |
131 | 148 | ||
132 | 149 | ||
133 | 150 | func asTuple2Ints (val) = match val { | |
134 | 151 | case v: (Int, Int) => | |
135 | 152 | v | |
136 | 153 | case _ => | |
137 | 154 | throw("fail to cast into Tuple2 ints") | |
138 | 155 | } | |
139 | 156 | ||
140 | 157 | ||
141 | 158 | func asSwapParamsSTRUCT (val) = match val { | |
142 | 159 | case struct: (Int, Int, Int, Int, Int, Int, Int) => | |
143 | 160 | struct | |
144 | 161 | case _ => | |
145 | 162 | throw("fail to cast into SwapParamsSTRUCT") | |
146 | 163 | } | |
147 | 164 | ||
148 | 165 | ||
149 | 166 | func asWithdrawResultSTRUCT (val) = match val { | |
150 | 167 | case struct: (Int, Unit, Int, Int, Int, Int, Int, Int, String)|(Int, ByteVector, Int, Int, Int, Int, Int, Int, String) => | |
151 | 168 | struct | |
152 | 169 | case _ => | |
153 | 170 | throw("fail to cast into WithdrawResult") | |
154 | 171 | } | |
155 | 172 | ||
156 | 173 | ||
157 | 174 | func toTimestamp (start) = if ((0 > start)) | |
158 | 175 | then -1 | |
159 | 176 | else match blockInfoByHeight(start) { | |
160 | 177 | case block: BlockInfo => | |
161 | 178 | block.timestamp | |
162 | 179 | case _ => | |
163 | 180 | -1 | |
164 | 181 | } | |
165 | 182 | ||
166 | 183 | ||
167 | 184 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult)) | |
168 | 185 | ||
169 | 186 | ||
170 | 187 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18)) | |
171 | 188 | ||
172 | 189 | ||
173 | 190 | let nMetricIdxPrice = 0 | |
174 | 191 | ||
175 | 192 | let nMetricIdxUsdnLockedBalance = 1 | |
176 | 193 | ||
177 | 194 | let nMetricIdxWavesLockedBalance = 2 | |
178 | 195 | ||
179 | 196 | let nMetricIdxReserve = 3 | |
180 | 197 | ||
181 | 198 | let nMetricIdxReserveInUsdn = 4 | |
182 | 199 | ||
183 | 200 | let nMetricIdxUsdnSupply = 5 | |
184 | 201 | ||
185 | 202 | let nMetricIdxSurplus = 6 | |
186 | 203 | ||
187 | 204 | let nMetricIdxSurplusPercent = 7 | |
188 | 205 | ||
189 | 206 | let nMetricIdxBR = 8 | |
190 | 207 | ||
191 | 208 | let nMetricIdxNsbtSupply = 9 | |
192 | 209 | ||
193 | 210 | let nMetricIdxMaxNsbtSupply = 10 | |
194 | 211 | ||
195 | 212 | let nMetricIdxSurfSupply = 11 | |
196 | 213 | ||
197 | 214 | let nMetricUsdnUsdtPeg = 12 | |
198 | 215 | ||
199 | 216 | let nMetricCurrentPriceAdj = 13 | |
200 | 217 | ||
201 | 218 | let nMetricBasketInfo = 14 | |
202 | 219 | ||
203 | 220 | let nMetricWeightedPrice = 15 | |
204 | 221 | ||
205 | 222 | let nMetricTotalReservesUsd = 16 | |
206 | 223 | ||
207 | 224 | let IdxControlCfgNeutrinoDapp = 1 | |
208 | 225 | ||
209 | 226 | let IdxControlCfgAuctionDapp = 2 | |
210 | 227 | ||
211 | 228 | let IdxControlCfgRpdDapp = 3 | |
212 | 229 | ||
213 | 230 | let IdxControlCfgMathDapp = 4 | |
214 | 231 | ||
215 | 232 | let IdxControlCfgLiquidationDapp = 5 | |
216 | 233 | ||
217 | 234 | let IdxControlCfgRestDapp = 6 | |
218 | 235 | ||
219 | 236 | let IdxControlCfgNodeRegistryDapp = 7 | |
220 | 237 | ||
221 | 238 | let IdxControlCfgNsbtStakingDapp = 8 | |
222 | 239 | ||
223 | 240 | let IdxControlCfgMediatorDapp = 9 | |
224 | 241 | ||
225 | 242 | let IdxControlCfgSurfStakingDapp = 10 | |
226 | 243 | ||
227 | 244 | let IdxControlCfgGnsbtControllerDapp = 11 | |
228 | 245 | ||
229 | 246 | let bFuncIdxSurf = 0 | |
230 | 247 | ||
231 | 248 | let bFuncIdxWaves = 1 | |
232 | 249 | ||
233 | 250 | let bFuncIdxUsdn = 2 | |
234 | 251 | ||
235 | 252 | let bFuncIdxReserveStart = 3 | |
236 | 253 | ||
237 | 254 | let bFuncIdxSupplyStart = 4 | |
238 | 255 | ||
239 | 256 | let bFuncIdxBRStart = 5 | |
240 | 257 | ||
241 | 258 | let bFuncIdxReserveEnd = 6 | |
242 | 259 | ||
243 | 260 | let bFuncIdxSupplyEnd = 7 | |
244 | 261 | ||
245 | 262 | let bFuncIdxBREnd = 8 | |
246 | 263 | ||
247 | 264 | let bFuncIdxRest = 9 | |
248 | 265 | ||
249 | 266 | let bFuncIdxWavesPrice = 10 | |
250 | 267 | ||
251 | 268 | func keyControlAddress () = "%s%s__config__controlAddress" | |
252 | 269 | ||
253 | 270 | ||
254 | 271 | func keyControlCfg () = "%s__controlConfig" | |
255 | 272 | ||
256 | 273 | ||
257 | 274 | func readControlCfgOrFail (control) = split_4C(getStringOrFail(control, keyControlCfg()), SEP) | |
258 | 275 | ||
259 | 276 | ||
260 | 277 | func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx))) | |
261 | 278 | ||
262 | 279 | ||
263 | 280 | let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx")) | |
264 | 281 | ||
265 | 282 | let controlCfg = readControlCfgOrFail(controlContract) | |
266 | 283 | ||
267 | 284 | let mathContract = getContractAddressOrFail(controlCfg, IdxControlCfgMathDapp) | |
268 | 285 | ||
269 | 286 | let neutrinoContract = getContractAddressOrFail(controlCfg, IdxControlCfgNeutrinoDapp) | |
270 | 287 | ||
271 | 288 | let auctionContract = getContractAddressOrFail(controlCfg, IdxControlCfgAuctionDapp) | |
272 | 289 | ||
273 | 290 | let liquidationContract = getContractAddressOrFail(controlCfg, IdxControlCfgLiquidationDapp) | |
274 | 291 | ||
275 | 292 | let rpdContract = getContractAddressOrFail(controlCfg, IdxControlCfgRpdDapp) | |
276 | 293 | ||
277 | 294 | let nsbtStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgNsbtStakingDapp) | |
278 | 295 | ||
279 | 296 | let surfStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgSurfStakingDapp) | |
280 | 297 | ||
281 | 298 | let gnsbtControllerContract = getContractAddressOrFail(controlCfg, IdxControlCfgGnsbtControllerDapp) | |
282 | 299 | ||
283 | 300 | let neutrinoAssetIdString = getStringOrFail(neutrinoContract, keyNeutrinoAssetId()) | |
284 | 301 | ||
285 | 302 | let neutrinoAssetId = fromBase58String(neutrinoAssetIdString) | |
286 | 303 | ||
287 | 304 | let nsbtAssetIdStr = getStringValue(neutrinoContract, keyNsbtAssetId()) | |
288 | 305 | ||
289 | 306 | let nsbtAssetId = fromBase58String(nsbtAssetIdStr) | |
290 | 307 | ||
291 | 308 | let surfAssetIdStr = getStringValue(auctionContract, keySurfAssetId()) | |
292 | 309 | ||
293 | 310 | let surfAssetId = fromBase58String(surfAssetIdStr) | |
294 | 311 | ||
295 | 312 | func readUsdnIncomeForDay (stakingAcc,startOfDayTimestamp,neutrinoMetrics) = { | |
296 | 313 | let amtByDayKEY = keyStatsDepositAmtByDay(startOfDayTimestamp) | |
297 | 314 | let incomeStr = getStrOrElse(stakingAcc, amtByDayKEY, "%s%s__0__0") | |
298 | 315 | let incomeArray = split(incomeStr, SEP) | |
299 | 316 | let wavesAmt = parseIntValue(incomeArray[1]) | |
300 | 317 | let usdnAmt = parseIntValue(incomeArray[2]) | |
301 | 318 | let currentPrice = asInt(neutrinoMetrics[nMetricIdxPrice]) | |
302 | 319 | let wavesAsUsdnAmt = fraction(wavesAmt, currentPrice, MULT8) | |
303 | 320 | (wavesAsUsdnAmt + usdnAmt) | |
304 | 321 | } | |
305 | 322 | ||
306 | 323 | ||
307 | 324 | func calcUsdnIncomeForPeriod (stakingAcc,days) = { | |
308 | 325 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
309 | 326 | let currStartOfDay = toStartOfDay(lastBlock.timestamp) | |
310 | 327 | let startTimestamp = (currStartOfDay - (DAYMILLIS * (days + 1))) | |
311 | 328 | let endTimestamp = (currStartOfDay - DAYMILLIS) | |
312 | 329 | let startUsdnAmtTMP = readUsdnIncomeForDay(stakingAcc, startTimestamp, neutrinoMetrics) | |
313 | 330 | let endUsdnAmt = readUsdnIncomeForDay(stakingAcc, endTimestamp, neutrinoMetrics) | |
314 | 331 | let startUsdnAmt = if ((startUsdnAmtTMP == 0)) | |
315 | 332 | then endUsdnAmt | |
316 | 333 | else startUsdnAmtTMP | |
317 | 334 | (endUsdnAmt - startUsdnAmt) | |
318 | 335 | } | |
319 | 336 | ||
320 | 337 | ||
321 | 338 | func calcApr (stakingAcc,periodInDays,incomeForPeriod,stakingAssetPriceToUsdnX6) = { | |
322 | 339 | let totalStaked = getIntOrElse(stakingAcc, "%s%s__stats__activeTotalLocked", 1) | |
323 | 340 | let totalStakedInUsdn = fraction(totalStaked, stakingAssetPriceToUsdnX6, MULT6) | |
324 | 341 | if ((0 > incomeForPeriod)) | |
325 | 342 | then 0 | |
326 | 343 | else fraction((incomeForPeriod * MULT6), 365, (totalStakedInUsdn * periodInDays)) | |
327 | 344 | } | |
328 | 345 | ||
329 | 346 | ||
330 | 347 | @Callable(i) | |
331 | - | func reverseSwapLimitREADONLY (lim, | |
348 | + | func reverseSwapLimitREADONLY (lim,isOutMulti) = { | |
332 | 349 | let BR = asInt(asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil))[nMetricIdxBR]) | |
333 | 350 | let gNsbt = if ((0 >= lim)) | |
334 | 351 | then 0 | |
335 | 352 | else { | |
336 | - | let aParamX8 = toBigInt(getIntOrFail(mathContract, if ( | |
337 | - | then | |
338 | - | else | |
339 | - | let bParamX16 = toBigInt(getIntOrFail(mathContract, if ( | |
340 | - | then | |
341 | - | else | |
342 | - | let limDivAX8 = if ( | |
343 | - | then fraction(toBigInt(lim), MULTX10, aParamX8) | |
344 | - | else fraction( | |
353 | + | let aParamX8 = toBigInt(getIntOrFail(mathContract, if (isOutMulti) | |
354 | + | then keyUsdnSwapAmountAParam() | |
355 | + | else keySwapAmountAParam())) | |
356 | + | let bParamX16 = toBigInt(getIntOrFail(mathContract, if (isOutMulti) | |
357 | + | then keyUsdnSwapAmountBParam() | |
358 | + | else keySwapAmountBParam())) | |
359 | + | let limDivAX8 = if (isOutMulti) | |
360 | + | then fraction(fraction(toBigInt(lim), MULTX10, aParamX8), MULTX6, toBigInt(BR)) | |
361 | + | else fraction(toBigInt(lim), MULTX10, aParamX8) | |
345 | 362 | let revBX16 = fraction(MULTX16, MULTX16, bParamX16) | |
346 | 363 | toInt(pow(limDivAX8, 8, revBX16, 16, 6, CEILING)) | |
347 | 364 | } | |
348 | 365 | $Tuple2(nil, gNsbt) | |
349 | 366 | } | |
350 | 367 | ||
351 | 368 | ||
352 | 369 | ||
353 | 370 | @Callable(i) | |
354 | 371 | func gnsbtInfoINTERNAL (userAddressStrOrEmpty,additionalNsbtToStakeOrZero,additionalSurfToStakeOrZero) = { | |
355 | 372 | let userAddressOrThis = if ((userAddressStrOrEmpty != "")) | |
356 | 373 | then addressFromStringValue(userAddressStrOrEmpty) | |
357 | 374 | else this | |
358 | 375 | let currentPrice = getIntegerValue(controlContract, keyPrice()) | |
359 | 376 | let gnsbtFromNsbtDiff = additionalNsbtToStakeOrZero | |
360 | 377 | let gnsbtFromSurfDiff = asInt(invoke(surfStakingContract, "gnsbtFromSurfSYSREADONLY", [additionalSurfToStakeOrZero], nil)) | |
361 | 378 | let gNsbtDiff = (gnsbtFromNsbtDiff + gnsbtFromSurfDiff) | |
362 | 379 | let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil)) | |
380 | + | let limitMaxTokenUsd = swapParamsTuple._1 | |
363 | 381 | let blcks2LmtReset = swapParamsTuple._3 | |
364 | 382 | let gnsbtAmt = swapParamsTuple._4 | |
365 | 383 | let gnsbtAmtTotal = swapParamsTuple._5 | |
366 | - | let limitMaxWaves = swapParamsTuple._6 | |
367 | 384 | let limitMaxUsdn = swapParamsTuple._7 | |
368 | 385 | let swapParamsTupleNEW = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, gNsbtDiff], nil)) | |
386 | + | let limitMaxTokenUsdNEW = swapParamsTupleNEW._1 | |
369 | 387 | let blcks2LmtResetNEW = swapParamsTupleNEW._3 | |
370 | 388 | let gnsbtAmtNEW = swapParamsTupleNEW._4 | |
371 | 389 | let gnsbtAmtTotalNEW = swapParamsTupleNEW._5 | |
372 | - | let limitMaxWavesNEW = swapParamsTupleNEW._6 | |
373 | 390 | let limitMaxUsdnNEW = swapParamsTupleNEW._7 | |
374 | 391 | let nsbtBalance = if ((userAddressStrOrEmpty != "")) | |
375 | 392 | then assetBalance(userAddressOrThis, nsbtAssetId) | |
376 | 393 | else 0 | |
377 | 394 | let surfBalance = if ((userAddressStrOrEmpty != "")) | |
378 | 395 | then assetBalance(userAddressOrThis, surfAssetId) | |
379 | 396 | else 0 | |
380 | 397 | let nsbtBalanceDiff = if ((additionalNsbtToStakeOrZero >= 0)) | |
381 | 398 | then additionalNsbtToStakeOrZero | |
382 | 399 | else { | |
383 | 400 | let nsbtUnstakingData = asAnyList(invoke(nsbtStakingContract, "nsbtUnstakingSYSREADONLY", [userAddressStrOrEmpty, (-1 * additionalNsbtToStakeOrZero)], nil)) | |
384 | 401 | let nsbtReceiveAmount = asInt(nsbtUnstakingData[2]) | |
385 | 402 | let result = -(nsbtReceiveAmount) | |
386 | 403 | result | |
387 | 404 | } | |
388 | 405 | let nsbtBalanceNew = (nsbtBalance - nsbtBalanceDiff) | |
389 | 406 | let surfBalanceNew = (surfBalance - additionalSurfToStakeOrZero) | |
390 | 407 | let gnsbtData = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", [userAddressStrOrEmpty, additionalNsbtToStakeOrZero, additionalSurfToStakeOrZero], nil)) | |
391 | 408 | let gnsbtUser = asInt(gnsbtData[0]) | |
392 | 409 | let gnsbtTotal = asInt(gnsbtData[1]) | |
393 | 410 | let nsbtData = asAnyList(gnsbtData[2]) | |
394 | 411 | let surfData = asAnyList(gnsbtData[3]) | |
395 | 412 | let vpEffectiveHeight = asInt(gnsbtData[4]) | |
396 | 413 | let vpEffectiveHeightNEW = asInt(gnsbtData[5]) | |
397 | 414 | let gnsbtAmtFromNsbt = asInt(nsbtData[2]) | |
398 | 415 | let gnsbtAmtFromSurf = asInt(surfData[2]) | |
399 | 416 | let gnsbtAmtFromNsbtNEW = (gnsbtAmtFromNsbt + gnsbtFromNsbtDiff) | |
400 | 417 | let gnsbtAmtFromSurfNEW = (gnsbtAmtFromSurf + gnsbtFromSurfDiff) | |
401 | 418 | let gnsbtFromNsbtTotal = asInt(nsbtData[3]) | |
402 | 419 | let gnsbtFromSurfTotal = asInt(surfData[3]) | |
403 | 420 | let gnsbtFromSurfActiveTotal = 0 | |
404 | 421 | let gnsbtFromSurfFrozenTotal = gnsbtFromSurfTotal | |
405 | 422 | let gnsbtFromNsbtTotalNEW = (gnsbtFromNsbtTotal + gnsbtFromNsbtDiff) | |
406 | 423 | let gnsbtFromSurfTotalNEW = (gnsbtFromSurfTotal + gnsbtFromSurfDiff) | |
407 | 424 | let gnsbtFromSurfFrozenTotalNEW = gnsbtFromSurfTotalNEW | |
408 | 425 | let votingPower = fraction(gnsbtAmtFromNsbt, MULT8, (gnsbtFromNsbtTotal + gnsbtFromSurfActiveTotal)) | |
409 | 426 | let votingPowerNew = fraction(gnsbtAmtFromNsbtNEW, MULT8, (gnsbtFromNsbtTotalNEW + gnsbtFromSurfActiveTotal)) | |
410 | 427 | let votingPowerMax = fraction((gnsbtAmtFromNsbt + gnsbtAmtFromSurf), MULT8, ((gnsbtFromNsbtTotal + gnsbtFromSurfActiveTotal) + gnsbtFromSurfFrozenTotal)) | |
411 | 428 | let votingPowerMaxNew = fraction((gnsbtAmtFromNsbtNEW + gnsbtAmtFromSurfNEW), MULT8, ((gnsbtFromNsbtTotalNEW + gnsbtFromSurfActiveTotal) + gnsbtFromSurfFrozenTotalNEW)) | |
412 | 429 | let votingPowerEta = if ((vpEffectiveHeight == 0)) | |
413 | 430 | then height | |
414 | 431 | else vpEffectiveHeight | |
415 | 432 | let votingPowerEtaNew = if ((vpEffectiveHeightNEW == 0)) | |
416 | 433 | then height | |
417 | 434 | else vpEffectiveHeightNEW | |
418 | - | $Tuple2(nil, [0, nsbtBalance, surfBalance, nsbtBalanceNew, surfBalanceNew, gnsbtAmtFromNsbt, gnsbtAmtFromSurf, gnsbtAmtFromNsbtNEW, gnsbtAmtFromSurfNEW, gnsbtFromNsbtTotal, gnsbtFromSurfTotal, gnsbtFromNsbtTotalNEW, gnsbtFromSurfTotalNEW, limitMaxUsdn, | |
435 | + | $Tuple2(nil, [0, nsbtBalance, surfBalance, nsbtBalanceNew, surfBalanceNew, gnsbtAmtFromNsbt, gnsbtAmtFromSurf, gnsbtAmtFromNsbtNEW, gnsbtAmtFromSurfNEW, gnsbtFromNsbtTotal, gnsbtFromSurfTotal, gnsbtFromNsbtTotalNEW, gnsbtFromSurfTotalNEW, limitMaxUsdn, limitMaxTokenUsd, limitMaxUsdnNEW, limitMaxTokenUsdNEW, blcks2LmtReset, blcks2LmtResetNEW, votingPower, votingPowerNew, votingPowerMax, votingPowerMaxNew, votingPowerEta, votingPowerEtaNew]) | |
419 | 436 | } | |
420 | 437 | ||
421 | 438 | ||
422 | 439 | ||
423 | 440 | @Callable(i) | |
424 | 441 | func gnsbtInfoREADONLY (userAddressStrOrEmpty,additionalNsbtToStakeOrZero,additionalSurfToStakeOrZero) = { | |
425 | 442 | let gnsbtInfoDATA = asAnyList(invoke(this, "gnsbtInfoINTERNAL", [userAddressStrOrEmpty, additionalNsbtToStakeOrZero, additionalSurfToStakeOrZero], nil)) | |
426 | 443 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d", toString(asInt(gnsbtInfoDATA[1])), toString(asInt(gnsbtInfoDATA[2])), toString(asInt(gnsbtInfoDATA[3])), toString(asInt(gnsbtInfoDATA[4])), toString(asInt(gnsbtInfoDATA[5])), toString(asInt(gnsbtInfoDATA[6])), toString(asInt(gnsbtInfoDATA[7])), toString(asInt(gnsbtInfoDATA[8])), toString(asInt(gnsbtInfoDATA[9])), toString(asInt(gnsbtInfoDATA[10])), toString(asInt(gnsbtInfoDATA[11])), toString(asInt(gnsbtInfoDATA[12])), toString(asInt(gnsbtInfoDATA[13])), toString(asInt(gnsbtInfoDATA[14])), toString(asInt(gnsbtInfoDATA[15])), toString(asInt(gnsbtInfoDATA[16])), toString(asInt(gnsbtInfoDATA[17])), toString(asInt(gnsbtInfoDATA[18])), toString(asInt(gnsbtInfoDATA[19])), toString(asInt(gnsbtInfoDATA[20])), toString(asInt(gnsbtInfoDATA[21])), toString(asInt(gnsbtInfoDATA[22])), toString(asInt(gnsbtInfoDATA[23])), toString(asInt(gnsbtInfoDATA[24]))], SEP)) | |
427 | 444 | } | |
428 | 445 | ||
429 | 446 | ||
430 | 447 | ||
431 | 448 | @Callable(i) | |
432 | 449 | func gnsbtEffectiveREADONLY (userAddressStrOrEmpty) = { | |
433 | 450 | let gnsbtData = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", [userAddressStrOrEmpty, 0, 0], nil)) | |
434 | 451 | let nsbtData = asAnyList(gnsbtData[2]) | |
435 | 452 | let userFromNsbt = asInt(nsbtData[2]) | |
436 | 453 | let totalFromNsbt = asInt(nsbtData[3]) | |
437 | 454 | let userMatureFromSurf = asInt(gnsbtData[9]) | |
438 | 455 | let totalMatureFromSurf = asInt(gnsbtData[6]) | |
439 | 456 | $Tuple2(nil, makeString(["%d%d", toString((totalFromNsbt + totalMatureFromSurf)), toString((userFromNsbt + userMatureFromSurf))], SEP)) | |
440 | 457 | } | |
441 | 458 | ||
442 | 459 | ||
443 | 460 | ||
444 | 461 | @Callable(i) | |
445 | 462 | func rewardInfoREADONLY (userAddressStrOrEmpty) = { | |
446 | 463 | let rewardsData = asAnyList(invoke(gnsbtControllerContract, "gnsbtRewardsSYSREADONLY", [userAddressStrOrEmpty], nil)) | |
447 | 464 | let usdnRewards = asString(invoke(rpdContract, "unclaimedRewardsREADONLY", [userAddressStrOrEmpty], nil)) | |
448 | 465 | $Tuple2(nil, makeString(["%s%s%s", asString(rewardsData[0]), asString(rewardsData[1]), usdnRewards], SEP)) | |
449 | 466 | } | |
450 | 467 | ||
451 | 468 | ||
452 | 469 | ||
453 | 470 | @Callable(i) | |
454 | 471 | func mergeNsbtREADONLY (userAddressMandatory,newAmount) = { | |
455 | 472 | let nsbtData = asAnyList(invoke(nsbtStakingContract, "nsbtStakingSYSREADONLY", [userAddressMandatory, newAmount], nil)) | |
456 | 473 | let amount0 = asInt(nsbtData[0]) | |
457 | 474 | let startHeight = if ((0 >= amount0)) | |
458 | 475 | then -1 | |
459 | 476 | else asInt(nsbtData[2]) | |
460 | 477 | let startTimestamp = toTimestamp(startHeight) | |
461 | 478 | let startHeightNew = if ((0 >= newAmount)) | |
462 | 479 | then startHeight | |
463 | 480 | else if ((0 >= amount0)) | |
464 | 481 | then height | |
465 | 482 | else { | |
466 | 483 | let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife()) | |
467 | 484 | asInt(invoke(mathContract, "mergeStakesREADONLY", [amount0, startHeight, newAmount, height, halfLife], nil)) | |
468 | 485 | } | |
469 | 486 | let startTimestampNew = toTimestamp(startHeightNew) | |
470 | 487 | $Tuple2(nil, makeString(["%d%d%d%d", toString(startHeight), toString(startTimestamp), toString(startHeightNew), toString(startTimestampNew)], SEP)) | |
471 | 488 | } | |
472 | 489 | ||
473 | 490 | ||
474 | 491 | ||
475 | 492 | @Callable(i) | |
476 | 493 | func swapLimitCalculatorREADONLY (userAddressStrOpt,limitWanted,assetIdStr) = { | |
477 | 494 | let gNsbtCurrent = if ((userAddressStrOpt == "")) | |
478 | 495 | then 0 | |
479 | 496 | else asInt(asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOpt, 0], nil))._4) | |
480 | - | let limitWantedUsdn = if ((assetIdStr == "WAVES")) | |
481 | - | then convertWavesToNeutrino(limitWanted, getIntegerValue(controlContract, keyPrice())) | |
482 | - | else limitWanted | |
483 | - | let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWantedUsdn, (assetIdStr == "WAVES")], nil)) | |
497 | + | let price = valueOrErrorMessage(getInteger(controlContract, keyPriceByAsset(assetIdStr)), ("No price for asset " + assetIdStr)) | |
498 | + | let isOutMulti = (assetIdStr == neutrinoAssetIdString) | |
499 | + | let limitWantedUsdn = if (isOutMulti) | |
500 | + | then limitWanted | |
501 | + | else convertTokenToUsd(limitWanted, price) | |
502 | + | let gNsbtNeeded = asInt(invoke(this, "reverseSwapLimitREADONLY", [limitWantedUsdn, isOutMulti], nil)) | |
484 | 503 | let gNsbtDelta = (gNsbtNeeded - gNsbtCurrent) | |
485 | 504 | $Tuple2(nil, makeString(["%s%s", toString(gNsbtCurrent), toString(gNsbtDelta)], SEP)) | |
486 | 505 | } | |
487 | 506 | ||
488 | 507 | ||
489 | 508 | ||
490 | 509 | @Callable(i) | |
491 | 510 | func swapInfoREADONLY (userAddressStrOrEmpty,amount,assetIdStr) = { | |
492 | 511 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
493 | 512 | let price = asInt(neutrinoMetrics[nMetricIdxPrice]) | |
494 | 513 | let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil)) | |
514 | + | let limitMaxTokenInUsd = swapParamsTuple._1 | |
495 | 515 | let blcks2LmtReset = swapParamsTuple._3 | |
496 | - | let limitMaxWaves = swapParamsTuple._6 | |
497 | 516 | let limitMaxUsdn = swapParamsTuple._7 | |
498 | 517 | let assetId = fromBase58String(assetIdStr) | |
499 | 518 | let basketAssets = valueOrElse(getString(neutrinoContract, basketAssetsKey()), "WAVES") | |
500 | 519 | let swapType = if (contains(basketAssets, assetIdStr)) | |
501 | 520 | then "outNeutrino" | |
502 | 521 | else if ((assetId == neutrinoAssetId)) | |
503 | 522 | then "outMulti" | |
504 | 523 | else throw(("Can't swap assetId=" + assetIdStr)) | |
505 | 524 | let withdrawTuple = asWithdrawResultSTRUCT(invoke(neutrinoContract, "calcWithdrawResultSYSREADONLY", [swapType, amount, price, assetIdStr], nil)) | |
506 | 525 | let outNetAmount = withdrawTuple._1 | |
507 | - | let outAssetId = withdrawTuple._2 | |
508 | 526 | let outSurfAmt = withdrawTuple._3 | |
509 | 527 | let inAmtToSurfPart = withdrawTuple._4 | |
510 | - | let unleaseAmt = withdrawTuple._5 | |
511 | 528 | let outFeeAmount = withdrawTuple._6 | |
512 | 529 | let outAmtGross = withdrawTuple._7 | |
513 | 530 | let withdrawPrice = withdrawTuple._8 | |
514 | - | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(outNetAmount), toString(outSurfAmt), toString(outFeeAmount), toString(withdrawPrice), toString(blcks2LmtReset), toString( | |
531 | + | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(outNetAmount), toString(outSurfAmt), toString(outFeeAmount), toString(withdrawPrice), toString(blcks2LmtReset), toString(limitMaxTokenInUsd), toString(limitMaxUsdn), toString(inAmtToSurfPart)], SEP)) | |
515 | 532 | } | |
516 | 533 | ||
517 | 534 | ||
518 | 535 | ||
519 | 536 | @Callable(i) | |
520 | 537 | func swapInfoV2READONLY (userAddressStrOrEmpty,amount,assetIdStr) = { | |
521 | 538 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
522 | 539 | let price = asInt(neutrinoMetrics[nMetricIdxPrice]) | |
523 | 540 | let swapParamsTuple = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStrOrEmpty, 0], nil)) | |
541 | + | let limitMaxTokenInUsd = swapParamsTuple._1 | |
524 | 542 | let blcks2LmtReset = swapParamsTuple._3 | |
525 | - | let limitMaxWaves = swapParamsTuple._6 | |
526 | 543 | let limitMaxUsdn = swapParamsTuple._7 | |
527 | 544 | let assetId = fromBase58String(assetIdStr) | |
528 | 545 | let basketAssets = valueOrElse(getString(neutrinoContract, basketAssetsKey()), "WAVES") | |
529 | 546 | let swapType = if (contains(basketAssets, assetIdStr)) | |
530 | 547 | then "outNeutrino" | |
531 | 548 | else if ((assetId == neutrinoAssetId)) | |
532 | 549 | then "outMulti" | |
533 | 550 | else throw(("Can't swap assetId=" + assetIdStr)) | |
534 | 551 | let withdrawTuple = asWithdrawResultSTRUCT(invoke(neutrinoContract, "calcWithdrawResultSYSREADONLY", [swapType, amount, price, assetIdStr], nil)) | |
535 | - | let outNetAmount = withdrawTuple._1 | |
536 | - | let outAssetId = withdrawTuple._2 | |
537 | - | let outSurfAmt = withdrawTuple._3 | |
538 | - | let inAmtToSurfPart = withdrawTuple._4 | |
539 | - | let unleaseAmt = withdrawTuple._5 | |
540 | - | let outFeeAmount = withdrawTuple._6 | |
541 | - | let outAmtGross = withdrawTuple._7 | |
542 | - | let withdrawPrice = withdrawTuple._8 | |
543 | - | let withdrawBasket = withdrawTuple._9 | |
544 | - | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d%s", toString(outNetAmount), toString(outSurfAmt), toString(outFeeAmount), toString(withdrawPrice), toString(blcks2LmtReset), toString(limitMaxWaves), toString(limitMaxUsdn), toString(inAmtToSurfPart), withdrawBasket], SEP)) | |
552 | + | let outNeutrinoInfo = makeString([neutrinoAssetIdString, toString(withdrawTuple._8), toString(withdrawTuple._1), toString(withdrawTuple._6), "1000000"], LISTSEP) | |
553 | + | let withdrawBasket = if ((swapType == "outNeutrino")) | |
554 | + | then outNeutrinoInfo | |
555 | + | else withdrawTuple._9 | |
556 | + | $Tuple2(nil, makeString_2C(["%d%d%d%s", toString(blcks2LmtReset), toString(limitMaxTokenInUsd), toString(limitMaxUsdn), withdrawBasket], SEP)) | |
545 | 557 | } | |
546 | 558 | ||
547 | 559 | ||
548 | 560 | ||
549 | 561 | @Callable(i) | |
550 | 562 | func basketInfoREADONLY () = { | |
551 | 563 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
552 | 564 | let basketInfo = asString(neutrinoMetrics[nMetricBasketInfo]) | |
553 | - | $Tuple2(nil, makeString(["%s", basketInfo], SEP)) | |
565 | + | let basket = split_4C(basketInfo, "_") | |
566 | + | func modify (acc,item) = { | |
567 | + | let parts = split(item, LISTSEP) | |
568 | + | let assetId = parts[0] | |
569 | + | let dlog6 = valueOrErrorMessage(getInteger(neutrinoContract, basketLogbDeltaKey()), "log(b, delta) key is undefined") | |
570 | + | let D6 = valueOrErrorMessage(getInteger(neutrinoContract, basketDKey()), "D key is undefined") | |
571 | + | let b6 = valueOrErrorMessage(getInteger(neutrinoContract, basketBKey()), "b key is undefined") | |
572 | + | let w6 = valueOrErrorMessage(getInteger(neutrinoContract, basketWeightByAssetKey(assetId)), (("Target weight for asset " + assetId) + " is undefined")) | |
573 | + | let p6 = ((dlog6 - w6) + parseIntValue(parts[1])) | |
574 | + | let d = (D6 - pow(b6, 6, p6, 6, 6, HALFUP)) | |
575 | + | (acc :+ makeString(((parts :+ toString(w6)) :+ toString(d)), LISTSEP)) | |
576 | + | } | |
577 | + | ||
578 | + | let b = { | |
579 | + | let $l = basket | |
580 | + | let $s = size($l) | |
581 | + | let $acc0 = nil | |
582 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
583 | + | then $a | |
584 | + | else modify($a, $l[$i]) | |
585 | + | ||
586 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
587 | + | then $a | |
588 | + | else throw("List size exceeds 10") | |
589 | + | ||
590 | + | $f0_2($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) | |
591 | + | } | |
592 | + | $Tuple2(nil, ("%s__" + makeString_2C(b, "_"))) | |
554 | 593 | } | |
555 | 594 | ||
556 | 595 | ||
557 | 596 | ||
558 | 597 | @Callable(i) | |
559 | 598 | func usdnStakingAprREADONLY (days) = { | |
560 | 599 | let tmpDays = 1 | |
561 | 600 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
562 | 601 | let currentPrice = asInt(neutrinoMetrics[nMetricIdxPrice]) | |
563 | 602 | let wavesIncome = (0 * MULT8) | |
564 | 603 | let incomeForPeriod = fraction(wavesIncome, currentPrice, MULT8) | |
565 | 604 | let apr = calcApr(rpdContract, tmpDays, incomeForPeriod, MULT6) | |
566 | 605 | $Tuple2(nil, ("%d__" + toString(apr))) | |
567 | 606 | } | |
568 | 607 | ||
569 | 608 | ||
570 | 609 | ||
571 | 610 | @Callable(i) | |
572 | 611 | func surfStakingAprREADONLY (days) = { | |
573 | 612 | let tmpDays = 3 | |
574 | 613 | let incomeForPeriod = calcUsdnIncomeForPeriod(surfStakingContract, tmpDays) | |
575 | 614 | let surfPriceToUsdnX6 = 86400 | |
576 | 615 | let apr = calcApr(surfStakingContract, tmpDays, incomeForPeriod, surfPriceToUsdnX6) | |
577 | 616 | $Tuple2(nil, ("%d__" + toString(apr))) | |
578 | 617 | } | |
579 | 618 | ||
580 | 619 | ||
581 | 620 | ||
582 | 621 | @Callable(i) | |
583 | 622 | func surfStakingAprV2READONLY (days,surfUsdnPriceX6) = { | |
584 | 623 | let tmpDays = 3 | |
585 | 624 | let incomeForPeriod = calcUsdnIncomeForPeriod(surfStakingContract, tmpDays) | |
586 | 625 | let apr = calcApr(surfStakingContract, tmpDays, incomeForPeriod, surfUsdnPriceX6) | |
587 | 626 | $Tuple2(nil, ("%d__" + toString(apr))) | |
588 | 627 | } | |
589 | 628 | ||
590 | 629 | ||
591 | 630 | ||
592 | 631 | @Callable(i) | |
593 | 632 | func nsbtStakingAprREADONLY (days) = { | |
594 | 633 | let tmpDays = 3 | |
595 | 634 | let nsbtPriceToUsdnX6 = 8000000 | |
596 | 635 | let incomeForPeriod = calcUsdnIncomeForPeriod(nsbtStakingContract, tmpDays) | |
597 | 636 | let apr = calcApr(nsbtStakingContract, tmpDays, incomeForPeriod, nsbtPriceToUsdnX6) | |
598 | 637 | $Tuple2(nil, ("%d__" + toString(apr))) | |
599 | 638 | } | |
600 | 639 | ||
601 | 640 | ||
602 | 641 | ||
603 | 642 | @Callable(i) | |
604 | 643 | func nsbtStakingAprV2READONLY (days,nsbtUsdnPriceX6) = { | |
605 | 644 | let tmpDays = 3 | |
606 | 645 | let incomeForPeriod = calcUsdnIncomeForPeriod(nsbtStakingContract, tmpDays) | |
607 | 646 | let apr = calcApr(nsbtStakingContract, tmpDays, incomeForPeriod, nsbtUsdnPriceX6) | |
608 | 647 | $Tuple2(nil, ("%d__" + toString(apr))) | |
609 | 648 | } | |
610 | 649 | ||
611 | 650 |
github/deemru/w8io/026f985 70.70 ms ◑