tx · GEaeM9fCm1rGRt7K8hVLSwgYbyDeW8CePU4TeMpfMnsh 3N1b5y6ncRc2X5Mq5ogeT2FpBYANX2ShrjD: -0.05000000 Waves 2022.08.30 13:28 [2207062] smart account 3N1b5y6ncRc2X5Mq5ogeT2FpBYANX2ShrjD > SELF 0.00000000 Waves
{ "type": 13, "id": "GEaeM9fCm1rGRt7K8hVLSwgYbyDeW8CePU4TeMpfMnsh", "fee": 5000000, "feeAssetId": null, "timestamp": 1661855294110, "version": 2, "chainId": 84, "sender": "3N1b5y6ncRc2X5Mq5ogeT2FpBYANX2ShrjD", "senderPublicKey": "DYg41vAWoC1qYkgSYQAH1gjWznvc2vreaYUfoHmjcQVt", "proofs": [ "58ptarXdF2ZCGgua7cVD1VSzVXaj9GBYZ6M9ZDgaaYehXVJBcfdmSUmMRxaT6hwv7cSuyCZQ5NCiMydgZzKEfy2v", "4pMFzhkzRw1g6eQs6JRyZ1qdJCtqGRP5RCBVjWYR2bYu7fSK1JTQEEyALYDEMeBUp5ZAmc3DW9GfaEspsg5CpJ2T" ], "script": "base64:BgJXCAISBAoCEQESBQoDCAEEEgQKAgEEEgMKAQESBgoECAgBCBIECgIIARIECgIRARIFCgMBCAgSBQoDCAEBEgASABIECgIRBBIECgIBARIAEgASABIDCgEBXAAJUFJFQ0lTSU9OAMCEPQAFTUFYX0EAwIQ9AAxNQVhfQV9DSEFOR0UACgANTUlOX1JBTVBfVElNRQkAaQIAgKMFADwAB3ZlcnNpb24CBTIuMC4wAAhrVmVyc2lvbgIHdmVyc2lvbgAHa0Fzc2V0cwIJYXNzZXRfaWRzAA1rQXNzZXRCYWxhbmNlAghfYmFsYW5jZQAHa0FjdGl2ZQIGYWN0aXZlAAZrQ2F1c2UCDnNodXRkb3duX2NhdXNlAA1rU2hhcmVBc3NldElkAg5zaGFyZV9hc3NldF9pZAARa1NoYXJlQXNzZXRTdXBwbHkCEnNoYXJlX2Fzc2V0X3N1cHBseQAEa0ZlZQIKY29tbWlzc2lvbg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9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAgUMYWRtaW5QdWJLZXkzAAEAAAkAZwIJAGQCCQBkAgUSYWRtaW5QdWJLZXkxU2lnbmVkBRJhZG1pblB1YktleTJTaWduZWQFEmFkbWluUHViS2V5M1NpZ25lZAACBAckbWF0Y2gwBQJ0eAMJAAECBQckbWF0Y2gwAhdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgQDaW52BQckbWF0Y2gwBBNjYWxsVGFrZUludG9BY2NvdW50AwkAAAIIBQNpbnYEZEFwcAUEdGhpcwkAAAIIBQNpbnYIZnVuY3Rpb24CGXRha2VJbnRvQWNjb3VudEV4dHJhRnVuZHMHBA1zaWduZWRCeUFkbWluAwMDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQxhZG1pblB1YktleTEGCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQxhZG1pblB1YktleTIGCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQxhZG1pblB1YktleTMGCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABRFhZG1pblB1YktleUludm9rZQMDBRNjYWxsVGFrZUludG9BY2NvdW50BQ1zaWduZWRCeUFkbWluBwYFE211bHRpU2lnbmVkQnlBZG1pbnMFE211bHRpU2lnbmVkQnlBZG1pbnMF5F9j", "height": 2207062, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3TKVtwjQqAUdiMcEdopszTpRJfT4huFU7sycchqExLZa Next: none Diff:
Old | New | Differences | |
---|---|---|---|
8 | 8 | let MAX_A_CHANGE = 10 | |
9 | 9 | ||
10 | 10 | let MIN_RAMP_TIME = (86400 / 60) | |
11 | + | ||
12 | + | let version = "2.0.0" | |
13 | + | ||
14 | + | let kVersion = "version" | |
11 | 15 | ||
12 | 16 | let kAssets = "asset_ids" | |
13 | 17 | ||
22 | 26 | let kShareAssetSupply = "share_asset_supply" | |
23 | 27 | ||
24 | 28 | let kFee = "commission" | |
29 | + | ||
30 | + | let kDAppThresholdCoef = "dAppThresholdCoef" | |
25 | 31 | ||
26 | 32 | let kUSDNAddress = "staking_usdnnsbt_address" | |
27 | 33 | ||
87 | 93 | ||
88 | 94 | let farmingAddress = Address(getBase58FromOracle(kFarmingAddress)) | |
89 | 95 | ||
90 | - | let capMoneyBoxAddress = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
91 | - | ||
92 | 96 | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
93 | 97 | ||
94 | 98 | let stakingAssets = [toBase58String(USDN)] | |
121 | 125 | ||
122 | 126 | let future_A_time = valueOrElse(getInteger(this, "future_A_time"), 0) | |
123 | 127 | ||
128 | + | let iter14 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
129 | + | ||
130 | + | let iter15 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | |
131 | + | ||
124 | 132 | let assetIds = split(getStringValue(this, kAssets), ",") | |
125 | 133 | ||
126 | 134 | let nCoins = size(assetIds) | |
139 | 147 | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
140 | 148 | then unit | |
141 | 149 | else throw("Only admin can call this function") | |
150 | + | ||
151 | + | ||
152 | + | func isSelfCall (i) = if ((this == i.caller)) | |
153 | + | then unit | |
154 | + | else throw("Only contract itself can call this function") | |
142 | 155 | ||
143 | 156 | ||
144 | 157 | let big2 = toBigInt(2) | |
253 | 266 | else D_P | |
254 | 267 | ||
255 | 268 | let D_P = { | |
256 | - | let $l = | |
269 | + | let $l = iter14 | |
257 | 270 | let $s = size($l) | |
258 | 271 | let $acc0 = Dprev | |
259 | 272 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
276 | 289 | else $Tuple2(D, false) | |
277 | 290 | } | |
278 | 291 | ||
279 | - | let $ | |
280 | - | let $l = | |
292 | + | let $t066456711 = { | |
293 | + | let $l = iter14 | |
281 | 294 | let $s = size($l) | |
282 | 295 | let $acc0 = $Tuple2(toBigInt(S), false) | |
283 | 296 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
290 | 303 | ||
291 | 304 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
292 | 305 | } | |
293 | - | let D = $ | |
294 | - | let finished = $ | |
306 | + | let D = $t066456711._1 | |
307 | + | let finished = $t066456711._2 | |
295 | 308 | if ((finished == false)) | |
296 | 309 | then throw(("get_D() not finished with " + toString(D))) | |
297 | 310 | else toInt(D) | |
317 | 330 | let D = get_D(xp_, amp) | |
318 | 331 | let Ann = (amp * nCoins) | |
319 | 332 | func S_c (acc,i) = { | |
320 | - | let $ | |
321 | - | let S_ = $ | |
322 | - | let c = $ | |
333 | + | let $t072827299 = acc | |
334 | + | let S_ = $t072827299._1 | |
335 | + | let c = $t072827299._2 | |
323 | 336 | let x_ = if ((in == i)) | |
324 | 337 | then x | |
325 | 338 | else xp_[i] | |
330 | 343 | else $Tuple2(S_, c) | |
331 | 344 | } | |
332 | 345 | ||
333 | - | let $ | |
334 | - | let $l = | |
346 | + | let $t075077562 = { | |
347 | + | let $l = iter14 | |
335 | 348 | let $s = size($l) | |
336 | 349 | let $acc0 = $Tuple2(0, toBigInt(D)) | |
337 | 350 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
344 | 357 | ||
345 | 358 | $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) | |
346 | 359 | } | |
347 | - | let S_ = $ | |
348 | - | let c_ = $ | |
360 | + | let S_ = $t075077562._1 | |
361 | + | let c_ = $t075077562._2 | |
349 | 362 | let c = fraction(c_, toBigInt(D), toBigInt((Ann * nCoins))) | |
350 | 363 | let bD = toBigInt(((S_ + (D / Ann)) - D)) | |
351 | 364 | func y_proc (acc,_i) = if ((acc._2 == true)) | |
362 | 375 | else $Tuple2(y, false) | |
363 | 376 | } | |
364 | 377 | ||
365 | - | let $ | |
366 | - | let $l = | |
378 | + | let $t080448111 = { | |
379 | + | let $l = iter15 | |
367 | 380 | let $s = size($l) | |
368 | 381 | let $acc0 = $Tuple2(toBigInt(D), false) | |
369 | 382 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
376 | 389 | ||
377 | 390 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16) | |
378 | 391 | } | |
379 | - | let y = $ | |
380 | - | let finished = $ | |
392 | + | let y = $t080448111._1 | |
393 | + | let finished = $t080448111._2 | |
381 | 394 | if ((finished == false)) | |
382 | 395 | then throw(("getY() not finished with " + toString(y))) | |
383 | 396 | else toInt(y) | |
391 | 404 | else { | |
392 | 405 | let Ann = (A_ * nCoins) | |
393 | 406 | func S_c (acc,i) = { | |
394 | - | let $ | |
395 | - | let S_ = $ | |
396 | - | let c = $ | |
407 | + | let $t084908507 = acc | |
408 | + | let S_ = $t084908507._1 | |
409 | + | let c = $t084908507._2 | |
397 | 410 | let x_ = if (if ((in != i)) | |
398 | 411 | then (nCoins > i) | |
399 | 412 | else false) | |
406 | 419 | else $Tuple2(S_, c) | |
407 | 420 | } | |
408 | 421 | ||
409 | - | let $ | |
410 | - | let $l = | |
422 | + | let $t087278782 = { | |
423 | + | let $l = iter14 | |
411 | 424 | let $s = size($l) | |
412 | 425 | let $acc0 = $Tuple2(0, toBigInt(D)) | |
413 | 426 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
420 | 433 | ||
421 | 434 | $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) | |
422 | 435 | } | |
423 | - | let S_ = $ | |
424 | - | let c_ = $ | |
436 | + | let S_ = $t087278782._1 | |
437 | + | let c_ = $t087278782._2 | |
425 | 438 | let c = fraction(c_, toBigInt(D), toBigInt((Ann * nCoins))) | |
426 | 439 | let bD = toBigInt(((S_ + (D / Ann)) - D)) | |
427 | 440 | func y_D_proc (acc,i) = if ((acc._2 == true)) | |
438 | 451 | else $Tuple2(y, false) | |
439 | 452 | } | |
440 | 453 | ||
441 | - | let $ | |
442 | - | let $l = | |
454 | + | let $t092659334 = { | |
455 | + | let $l = iter15 | |
443 | 456 | let $s = size($l) | |
444 | 457 | let $acc0 = $Tuple2(toBigInt(D), false) | |
445 | 458 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
452 | 465 | ||
453 | 466 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16) | |
454 | 467 | } | |
455 | - | let y = $ | |
456 | - | let finished = $ | |
468 | + | let y = $t092659334._1 | |
469 | + | let finished = $t092659334._2 | |
457 | 470 | if ((finished == false)) | |
458 | 471 | then throw(("get_y_D() not finished with " + toString(y))) | |
459 | 472 | else toInt(y) | |
470 | 483 | let new_y = get_y_D(amp, i, xp, D1) | |
471 | 484 | let dy_0 = (xp[i] - new_y) | |
472 | 485 | func xp_reduced_proc (acc,xp_j) = { | |
473 | - | let $ | |
474 | - | let xp_reduced = $ | |
475 | - | let index = $ | |
486 | + | let $t0997510004 = acc | |
487 | + | let xp_reduced = $t0997510004._1 | |
488 | + | let index = $t0997510004._2 | |
476 | 489 | let dx_expected = if ((index == i)) | |
477 | 490 | then (fraction(xp_j, D1, D0) - new_y) | |
478 | 491 | else (xp_j - fraction(xp_j, D1, D0)) | |
479 | 492 | $Tuple2((xp_reduced :+ (xp_j - fraction(_fee, dx_expected, feeScale6))), (index + 1)) | |
480 | 493 | } | |
481 | 494 | ||
482 | - | let $ | |
495 | + | let $t01026610330 = { | |
483 | 496 | let $l = xp | |
484 | 497 | let $s = size($l) | |
485 | 498 | let $acc0 = $Tuple2(nil, 0) | |
493 | 506 | ||
494 | 507 | $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) | |
495 | 508 | } | |
496 | - | let xp_reduced = $ | |
497 | - | let index = $ | |
509 | + | let xp_reduced = $t01026610330._1 | |
510 | + | let index = $t01026610330._2 | |
498 | 511 | let xp_reduced_i = xp_reduced[i] | |
499 | 512 | let dy = ((xp_reduced_i - get_y_D(amp, i, xp_reduced, D1)) - 1) | |
500 | 513 | $Tuple2(dy, (dy_0 - dy)) | |
518 | 531 | ||
519 | 532 | func calcStakingParams (stake,amount,assetId) = if (stake) | |
520 | 533 | then { | |
521 | - | let $ | |
522 | - | let call = $ | |
523 | - | let stakingAddr = $ | |
534 | + | let $t01089410960 = calcStakingFuncAndAddres(stake, assetId) | |
535 | + | let call = $t01089410960._1 | |
536 | + | let stakingAddr = $t01089410960._2 | |
524 | 537 | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
525 | 538 | } | |
526 | 539 | else { | |
527 | - | let $ | |
528 | - | let call = $ | |
529 | - | let stakingAddr = $ | |
540 | + | let $t01104611112 = calcStakingFuncAndAddres(stake, assetId) | |
541 | + | let call = $t01104611112._1 | |
542 | + | let stakingAddr = $t01104611112._2 | |
530 | 543 | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
531 | 544 | } | |
532 | 545 | ||
533 | 546 | ||
534 | 547 | func stake (amount,assetIdString) = if (containsElement(stakingAssets, assetIdString)) | |
535 | 548 | then { | |
536 | - | let $ | |
537 | - | let call = $ | |
538 | - | let addr = $ | |
539 | - | let params = $ | |
540 | - | let payments = $ | |
549 | + | let $t01129911401 = calcStakingParams(true, amount, fromBase58String(assetIdString)) | |
550 | + | let call = $t01129911401._1 | |
551 | + | let addr = $t01129911401._2 | |
552 | + | let params = $t01129911401._3 | |
553 | + | let payments = $t01129911401._4 | |
541 | 554 | invoke(addr, call, params, payments) | |
542 | 555 | } | |
543 | 556 | else 0 | |
545 | 558 | ||
546 | 559 | func unstake (amount,assetIdString) = if (containsElement(stakingAssets, assetIdString)) | |
547 | 560 | then { | |
548 | - | let $ | |
549 | - | let call = $ | |
550 | - | let addr = $ | |
551 | - | let params = $ | |
552 | - | let payments = $ | |
561 | + | let $t01158611689 = calcStakingParams(false, amount, fromBase58String(assetIdString)) | |
562 | + | let call = $t01158611689._1 | |
563 | + | let addr = $t01158611689._2 | |
564 | + | let params = $t01158611689._3 | |
565 | + | let payments = $t01158611689._4 | |
553 | 566 | invoke(addr, call, params, payments) | |
554 | 567 | } | |
555 | 568 | else 0 | |
578 | 591 | func checkSuspicious () = { | |
579 | 592 | let contractBalances = _xp() | |
580 | 593 | func checkBalance (acc,assetId) = { | |
581 | - | let $ | |
582 | - | let suspicious = $ | |
583 | - | let i = $ | |
594 | + | let $t01230012325 = acc | |
595 | + | let suspicious = $t01230012325._1 | |
596 | + | let i = $t01230012325._2 | |
584 | 597 | if (suspicious) | |
585 | 598 | then $Tuple2(suspicious, i) | |
586 | 599 | else { | |
627 | 640 | } | |
628 | 641 | ||
629 | 642 | ||
643 | + | func checkDAppThreshold (newBalances) = { | |
644 | + | let dAppThresholdCoef = valueOrErrorMessage(getInteger(this, kDAppThresholdCoef), "No dAppThresholdCoef key") | |
645 | + | let thresholdScale = 10000 | |
646 | + | func iterAllBalances (acc,tokenBalance) = { | |
647 | + | let $t01330413345 = acc | |
648 | + | let thresholdError = $t01330413345._1 | |
649 | + | let cutedBalances = $t01330413345._2 | |
650 | + | func iterCutedBalances (checkRatio,checkedBalance) = { | |
651 | + | let ratio = fraction(tokenBalance, thresholdScale, checkedBalance) | |
652 | + | if (if ((ratio > (dAppThresholdCoef * thresholdScale))) | |
653 | + | then true | |
654 | + | else (fraction(1, thresholdScale, dAppThresholdCoef) > ratio)) | |
655 | + | then throw("New balance in assets of the DApp is less than threshold") | |
656 | + | else false | |
657 | + | } | |
658 | + | ||
659 | + | $Tuple2({ | |
660 | + | let $l = cutedBalances | |
661 | + | let $s = size($l) | |
662 | + | let $acc0 = thresholdError | |
663 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
664 | + | then $a | |
665 | + | else iterCutedBalances($a, $l[$i]) | |
666 | + | ||
667 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
668 | + | then $a | |
669 | + | else throw("List size exceeds 15") | |
670 | + | ||
671 | + | $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) | |
672 | + | }, removeByIndex(cutedBalances, 0)) | |
673 | + | } | |
674 | + | ||
675 | + | let $t01386713970 = { | |
676 | + | let $l = newBalances | |
677 | + | let $s = size($l) | |
678 | + | let $acc0 = $Tuple2(false, removeByIndex(newBalances, 0)) | |
679 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
680 | + | then $a | |
681 | + | else iterAllBalances($a, $l[$i]) | |
682 | + | ||
683 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
684 | + | then $a | |
685 | + | else throw("List size exceeds 15") | |
686 | + | ||
687 | + | $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) | |
688 | + | } | |
689 | + | let thresholdError = $t01386713970._1 | |
690 | + | let b = $t01386713970._2 | |
691 | + | thresholdError | |
692 | + | } | |
693 | + | ||
694 | + | ||
630 | 695 | @Callable(msg) | |
631 | 696 | func D (xp,amp) = { | |
632 | 697 | let D = get_D_internal(xp, amp) | |
643 | 708 | let shareDescription = ("ShareToken of SwopFi protocol for MultiStable USD pool at address " + toString(this)) | |
644 | 709 | let issueToken = Issue(shareName, shareDescription, 0, 6, true) | |
645 | 710 | let tokenId = calculateAssetId(issueToken) | |
646 | - | let baseEntry = [StringEntry(kAssets, coins), IntegerEntry("initial_A", _A), IntegerEntry("future_A", _A), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_flat")), StringEntry(kShareAssetId, toBase58String(tokenId)), IntegerEntry(kShareAssetSupply, 0), BooleanEntry(kActive, true), issueToken] | |
711 | + | let baseEntry = [StringEntry(kVersion, version), StringEntry(kAssets, coins), IntegerEntry("initial_A", _A), IntegerEntry("future_A", _A), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_flat")), StringEntry(kShareAssetId, toBase58String(tokenId)), IntegerEntry(kShareAssetSupply, 0), BooleanEntry(kActive, true), IntegerEntry(kDAppThresholdCoef, 15), issueToken] | |
647 | 712 | if (firstHarvest) | |
648 | 713 | then (baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
649 | 714 | else baseEntry | |
696 | 761 | else { | |
697 | 762 | let paymentsSize = size(payments) | |
698 | 763 | func parsePayments (acc,assetId) = { | |
699 | - | let $ | |
700 | - | let newBalances = $ | |
701 | - | let i = $ | |
702 | - | let j = $ | |
764 | + | let $t01641516444 = acc | |
765 | + | let newBalances = $t01641516444._1 | |
766 | + | let i = $t01641516444._2 | |
767 | + | let j = $t01641516444._3 | |
703 | 768 | if (if ((paymentsSize > j)) | |
704 | 769 | then (getStrAssetId(payments[j].assetId) == assetId) | |
705 | 770 | else false) | |
712 | 777 | else $Tuple3((newBalances :+ xp[i]), (i + 1), j) | |
713 | 778 | } | |
714 | 779 | ||
715 | - | let $ | |
780 | + | let $t01675016836 = { | |
716 | 781 | let $l = assetIds | |
717 | 782 | let $s = size($l) | |
718 | 783 | let $acc0 = $Tuple3(nil, 0, 0) | |
726 | 791 | ||
727 | 792 | $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) | |
728 | 793 | } | |
729 | - | let newBalances = $ | |
730 | - | let k = $ | |
731 | - | let parsedPayments = $ | |
794 | + | let newBalances = $t01675016836._1 | |
795 | + | let k = $t01675016836._2 | |
796 | + | let parsedPayments = $t01675016836._3 | |
732 | 797 | if (((paymentsSize - 1) > parsedPayments)) | |
733 | 798 | then throw("Incorect payments order") | |
734 | - | else { | |
735 | - | let D1 = getDMem(newBalances, amp) | |
736 | - | if (assert((D1 > D0))) | |
737 | - | then throw("D1 > D0") | |
738 | - | else { | |
739 | - | let feeDiscount = calculateFeeDiscount(msg.caller) | |
740 | - | func calcScriptActions (acc,newBalance) = { | |
741 | - | let $t01616516206 = acc | |
742 | - | let invBalances = $t01616516206._1 | |
743 | - | let scriptActions = $t01616516206._2 | |
744 | - | let i = $t01616516206._3 | |
745 | - | if ((shareSupply > 0)) | |
746 | - | then { | |
747 | - | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
748 | - | let fees = { | |
749 | - | let idealBalance = fraction(D1, xp[i], D0) | |
750 | - | let difference = if ((idealBalance > newBalance)) | |
751 | - | then (idealBalance - newBalance) | |
752 | - | else (newBalance - idealBalance) | |
753 | - | fraction(_fee, difference, feeScale6) | |
799 | + | else if (checkDAppThreshold(newBalances)) | |
800 | + | then throw() | |
801 | + | else { | |
802 | + | let D1 = getDMem(newBalances, amp) | |
803 | + | if (assert((D1 > D0))) | |
804 | + | then throw("D1 > D0") | |
805 | + | else { | |
806 | + | let feeDiscount = calculateFeeDiscount(msg.caller) | |
807 | + | func calcScriptActions (acc,newBalance) = { | |
808 | + | let $t01724117282 = acc | |
809 | + | let invBalances = $t01724117282._1 | |
810 | + | let scriptActions = $t01724117282._2 | |
811 | + | let i = $t01724117282._3 | |
812 | + | if ((shareSupply > 0)) | |
813 | + | then { | |
814 | + | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
815 | + | let fees = { | |
816 | + | let idealBalance = fraction(D1, xp[i], D0) | |
817 | + | let difference = if ((idealBalance > newBalance)) | |
818 | + | then (idealBalance - newBalance) | |
819 | + | else (newBalance - idealBalance) | |
820 | + | fraction(_fee, difference, feeScale6) | |
821 | + | } | |
822 | + | let governanceFees = fraction(fees, feeGovernance, feeScale6) | |
823 | + | let finalBalance = (newBalance - governanceFees) | |
824 | + | let invariantBalance = (newBalance - fees) | |
825 | + | let us = unstake(governanceFees, assetIds[i]) | |
826 | + | if ((us == us)) | |
827 | + | then $Tuple3((invBalances :+ invariantBalance), (scriptActions ++ [ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(assetIds[i])), IntegerEntry((assetIds[i] + kAssetBalance), finalBalance)]), (i + 1)) | |
828 | + | else throw("Strict value is not equal to itself.") | |
754 | 829 | } | |
755 | - | let governanceFees = fraction(fees, feeGovernance, feeScale6) | |
756 | - | let finalBalance = (newBalance - governanceFees) | |
757 | - | let invariantBalance = (newBalance - fees) | |
758 | - | let us = unstake(fees, assetIds[i]) | |
759 | - | if ((us == us)) | |
760 | - | then $Tuple3((invBalances :+ invariantBalance), (scriptActions ++ [ScriptTransfer(capMoneyBoxAddress, (fees - governanceFees), fromBase58String(assetIds[i])), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(assetIds[i])), IntegerEntry((assetIds[i] + kAssetBalance), finalBalance)]), (i + 1)) | |
761 | - | else throw("Strict value is not equal to itself.") | |
762 | - | } | |
763 | - | else $Tuple3((invBalances :+ newBalance), (scriptActions :+ IntegerEntry((assetIds[i] + kAssetBalance), newBalance)), (i + 1)) | |
830 | + | else $Tuple3((invBalances :+ newBalance), (scriptActions :+ IntegerEntry((assetIds[i] + kAssetBalance), newBalance)), (i + 1)) | |
831 | + | } | |
832 | + | ||
833 | + | let $t01850618594 = { | |
834 | + | let $l = newBalances | |
835 | + | let $s = size($l) | |
836 | + | let $acc0 = $Tuple3(nil, nil, 0) | |
837 | + | func $f1_1 ($a,$i) = if (($i >= $s)) | |
838 | + | then $a | |
839 | + | else calcScriptActions($a, $l[$i]) | |
840 | + | ||
841 | + | func $f1_2 ($a,$i) = if (($i >= $s)) | |
842 | + | then $a | |
843 | + | else throw("List size exceeds 15") | |
844 | + | ||
845 | + | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
846 | + | } | |
847 | + | let invBalances = $t01850618594._1 | |
848 | + | let scriptActions = $t01850618594._2 | |
849 | + | let D2 = getDMem(invBalances, amp) | |
850 | + | let mint_amount = if ((shareSupply == 0)) | |
851 | + | then D1 | |
852 | + | else fraction(shareSupply, (D2 - D0), D0) | |
853 | + | if (assert((mint_amount >= minMintAmount))) | |
854 | + | then throw("Slippage screwed you") | |
855 | + | else if (stakeFarming) | |
856 | + | then { | |
857 | + | let re = invoke(this, "reissueShare", [mint_amount], nil) | |
858 | + | if ((re == re)) | |
859 | + | then { | |
860 | + | let s = invoke(farmingAddress, "lockShareTokens", [toString(this)], [AttachedPayment(shareAssetId, mint_amount)]) | |
861 | + | if ((s == s)) | |
862 | + | then (scriptActions :+ IntegerEntry(kShareAssetSupply, (shareSupply + mint_amount))) | |
863 | + | else throw("Strict value is not equal to itself.") | |
864 | + | } | |
865 | + | else throw("Strict value is not equal to itself.") | |
866 | + | } | |
867 | + | else (scriptActions ++ [Reissue(shareAssetId, mint_amount, true), ScriptTransfer(msg.caller, mint_amount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareSupply + mint_amount))]) | |
764 | 868 | } | |
765 | - | ||
766 | - | let $t01754317631 = { | |
767 | - | let $l = newBalances | |
768 | - | let $s = size($l) | |
769 | - | let $acc0 = $Tuple3(nil, nil, 0) | |
770 | - | func $f1_1 ($a,$i) = if (($i >= $s)) | |
771 | - | then $a | |
772 | - | else calcScriptActions($a, $l[$i]) | |
773 | - | ||
774 | - | func $f1_2 ($a,$i) = if (($i >= $s)) | |
775 | - | then $a | |
776 | - | else throw("List size exceeds 15") | |
777 | - | ||
778 | - | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
779 | - | } | |
780 | - | let invBalances = $t01754317631._1 | |
781 | - | let scriptActions = $t01754317631._2 | |
782 | - | let D2 = getDMem(invBalances, amp) | |
783 | - | let mint_amount = if ((shareSupply == 0)) | |
784 | - | then D1 | |
785 | - | else fraction(shareSupply, (D2 - D0), D0) | |
786 | - | if (assert((mint_amount >= minMintAmount))) | |
787 | - | then throw("Slippage screwed you") | |
788 | - | else if (stakeFarming) | |
789 | - | then { | |
790 | - | let re = Reissue(shareAssetId, mint_amount, true) | |
791 | - | if ((re == re)) | |
792 | - | then { | |
793 | - | let s = invoke(farmingAddress, "lockShareTokens", [toString(msg.caller)], [AttachedPayment(shareAssetId, mint_amount)]) | |
794 | - | if ((s == s)) | |
795 | - | then scriptActions | |
796 | - | else throw("Strict value is not equal to itself.") | |
797 | - | } | |
798 | - | else throw("Strict value is not equal to itself.") | |
799 | - | } | |
800 | - | else (scriptActions ++ [Reissue(shareAssetId, mint_amount, true), ScriptTransfer(msg.caller, mint_amount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareSupply + mint_amount))]) | |
801 | - | } | |
802 | - | } | |
869 | + | } | |
803 | 870 | } | |
804 | 871 | } | |
805 | 872 | }) | |
873 | + | ||
874 | + | ||
875 | + | ||
876 | + | @Callable(msg) | |
877 | + | func reissueShare (amount) = valueOrElse(isSelfCall(msg), [Reissue(shareAssetId, amount, true)]) | |
806 | 878 | ||
807 | 879 | ||
808 | 880 | ||
842 | 914 | let feeDiscount = calculateFeeDiscount(msg.caller) | |
843 | 915 | let _fee = fraction(_dy, fraction(fee, feeDiscount, feeScale6, CEILING), feeScale6) | |
844 | 916 | let dy = (_dy - _fee) | |
917 | + | let governanceFees = fraction(_fee, feeGovernance, feeScale6) | |
845 | 918 | if (assert((dy >= min_dy))) | |
846 | 919 | then throw("Exchange resulted in fewer coins than expected") | |
847 | 920 | else { | |
848 | - | let governanceFees = fraction(_fee, feeGovernance, feeScale6) | |
849 | - | let s = stake(payment.amount, getStrAssetId(payment.assetId)) | |
850 | - | if ((s == s)) | |
851 | - | then { | |
852 | - | let us = unstake((dy + _fee), tokenOut) | |
853 | - | if ((us == us)) | |
854 | - | then $Tuple2([IntegerEntry((tokenIn + kAssetBalance), x), IntegerEntry((tokenOut + kAssetBalance), ((xp[toIndex] - dy) - governanceFees)), ScriptTransfer(msg.caller, dy, tokenOutB58), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58), ScriptTransfer(moneyBoxAddress, (_fee - governanceFees), tokenOutB58)], $Tuple2(dy, tokenOutB58)) | |
921 | + | func makeNewBalances (acc,tokenBalance) = { | |
922 | + | let $t02129321319 = acc | |
923 | + | let newBalances = $t02129321319._1 | |
924 | + | let i = $t02129321319._2 | |
925 | + | if ((i == fromIndex)) | |
926 | + | then $Tuple2((newBalances :+ (tokenBalance + dx)), (i + 1)) | |
927 | + | else if ((i == toIndex)) | |
928 | + | then $Tuple2((newBalances :+ (tokenBalance + dy)), (i + 1)) | |
929 | + | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
930 | + | } | |
931 | + | ||
932 | + | let $t02157021631 = { | |
933 | + | let $l = xp | |
934 | + | let $s = size($l) | |
935 | + | let $acc0 = $Tuple2(nil, 0) | |
936 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
937 | + | then $a | |
938 | + | else makeNewBalances($a, $l[$i]) | |
939 | + | ||
940 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
941 | + | then $a | |
942 | + | else throw("List size exceeds 15") | |
943 | + | ||
944 | + | $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) | |
945 | + | } | |
946 | + | let newBalances = $t02157021631._1 | |
947 | + | let i = $t02157021631._2 | |
948 | + | if (checkDAppThreshold(newBalances)) | |
949 | + | then throw() | |
950 | + | else { | |
951 | + | let s = stake(payment.amount, getStrAssetId(payment.assetId)) | |
952 | + | if ((s == s)) | |
953 | + | then { | |
954 | + | let us = unstake((dy + governanceFees), tokenOut) | |
955 | + | if ((us == us)) | |
956 | + | then $Tuple2([IntegerEntry((tokenIn + kAssetBalance), x), IntegerEntry((tokenOut + kAssetBalance), ((xp[toIndex] - dy) - governanceFees)), ScriptTransfer(msg.caller, dy, tokenOutB58), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58)], $Tuple2(dy, tokenOutB58)) | |
957 | + | else throw("Strict value is not equal to itself.") | |
958 | + | } | |
855 | 959 | else throw("Strict value is not equal to itself.") | |
856 | 960 | } | |
857 | - | else throw("Strict value is not equal to itself.") | |
858 | 961 | } | |
859 | 962 | } | |
860 | 963 | }) | |
877 | 980 | let _amount = payment.amount | |
878 | 981 | let total_supply = shareSupply | |
879 | 982 | let unlock = if ((unlockAmount > 0)) | |
880 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString( | |
983 | + | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
881 | 984 | else 0 | |
882 | 985 | if ((unlock == unlock)) | |
883 | 986 | then { | |
884 | 987 | let withdrawAmount = (_amount + unlockAmount) | |
885 | 988 | func calcScriptActions (acc,balance) = { | |
886 | - | let $ | |
887 | - | let scriptActions = $ | |
888 | - | let i = $ | |
989 | + | let $t02296522993 = acc | |
990 | + | let scriptActions = $t02296522993._1 | |
991 | + | let i = $t02296522993._2 | |
889 | 992 | let wAmount = fraction(balance, withdrawAmount, total_supply) | |
890 | 993 | if (assert((wAmount >= minAmounts[i]))) | |
891 | 994 | then throw("Withdrawal resulted in fewer coins than expected") | |
897 | 1000 | } | |
898 | 1001 | } | |
899 | 1002 | ||
900 | - | let $ | |
1003 | + | let $t02348323551 = { | |
901 | 1004 | let $l = _xp() | |
902 | 1005 | let $s = size($l) | |
903 | 1006 | let $acc0 = $Tuple2(nil, 0) | |
911 | 1014 | ||
912 | 1015 | $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) | |
913 | 1016 | } | |
914 | - | let scriptActions = $ | |
915 | - | let i = $ | |
1017 | + | let scriptActions = $t02348323551._1 | |
1018 | + | let i = $t02348323551._2 | |
916 | 1019 | (scriptActions ++ [Burn(shareAssetId, withdrawAmount), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))]) | |
917 | 1020 | } | |
918 | 1021 | else throw("Strict value is not equal to itself.") | |
923 | 1026 | ||
924 | 1027 | ||
925 | 1028 | @Callable(msg) | |
926 | - | func calcWithdrawOneCoin (_tokenAmount,i) = $Tuple2(nil, _calcWithdrawOneCoin(_xp(), _tokenAmount, i, msg.caller)._1) | |
1029 | + | func calcWithdrawOneCoin (tokenAmount,tokenOut,user) = { | |
1030 | + | let i = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
1031 | + | $Tuple2(nil, _calcWithdrawOneCoin(_xp(), tokenAmount, i, Address(fromBase58String(user)))._1) | |
1032 | + | } | |
927 | 1033 | ||
928 | 1034 | ||
929 | 1035 | ||
940 | 1046 | if ((tokenIn != shareAssetId)) | |
941 | 1047 | then throw("unknown token") | |
942 | 1048 | else { | |
943 | - | let | |
1049 | + | let outIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
944 | 1050 | let _tokenAmount = payment.amount | |
945 | 1051 | let unlock = if ((unlockAmount > 0)) | |
946 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString( | |
1052 | + | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
947 | 1053 | else 0 | |
948 | 1054 | if ((unlock == unlock)) | |
949 | 1055 | then { | |
950 | 1056 | let withdrawAmount = (_tokenAmount + unlockAmount) | |
951 | 1057 | let xp = _xp() | |
952 | - | let $ | |
953 | - | let dy = $ | |
954 | - | let dy_fee = $ | |
1058 | + | let $t02478224863 = _calcWithdrawOneCoin(xp, withdrawAmount, outIndex, msg.caller) | |
1059 | + | let dy = $t02478224863._1 | |
1060 | + | let dy_fee = $t02478224863._2 | |
955 | 1061 | if (assert((dy >= minAmount))) | |
956 | 1062 | then throw("Not enough coins removed") | |
957 | 1063 | else { | |
958 | 1064 | let governanceFees = fraction(dy_fee, feeGovernance, feeScale6) | |
959 | - | let dy_and_fee = (dy + dy_fee) | |
960 | - | let us = unstake(dy_and_fee, tokenOut) | |
961 | - | if ((us == us)) | |
962 | - | then [ScriptTransfer(msg.caller, dy, fromBase58String(tokenOut)), IntegerEntry((assetIds[i] + kAssetBalance), (xp[i] - dy_and_fee)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(tokenOut)), ScriptTransfer(capMoneyBoxAddress, (dy_fee - governanceFees), fromBase58String(tokenOut)), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))] | |
963 | - | else throw("Strict value is not equal to itself.") | |
1065 | + | let dy_and_fee = (dy + governanceFees) | |
1066 | + | func makeNewBalances (acc,tokenBalance) = { | |
1067 | + | let $t02512925155 = acc | |
1068 | + | let newBalances = $t02512925155._1 | |
1069 | + | let i = $t02512925155._2 | |
1070 | + | if ((i == outIndex)) | |
1071 | + | then $Tuple2((newBalances :+ (tokenBalance - dy_and_fee)), (i + 1)) | |
1072 | + | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
1073 | + | } | |
1074 | + | ||
1075 | + | let $t02532225383 = { | |
1076 | + | let $l = xp | |
1077 | + | let $s = size($l) | |
1078 | + | let $acc0 = $Tuple2(nil, 0) | |
1079 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1080 | + | then $a | |
1081 | + | else makeNewBalances($a, $l[$i]) | |
1082 | + | ||
1083 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1084 | + | then $a | |
1085 | + | else throw("List size exceeds 15") | |
1086 | + | ||
1087 | + | $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) | |
1088 | + | } | |
1089 | + | let newBalances = $t02532225383._1 | |
1090 | + | let i = $t02532225383._2 | |
1091 | + | if (checkDAppThreshold(newBalances)) | |
1092 | + | then throw() | |
1093 | + | else { | |
1094 | + | let us = unstake(dy_and_fee, tokenOut) | |
1095 | + | if ((us == us)) | |
1096 | + | then [ScriptTransfer(msg.caller, dy, fromBase58String(tokenOut)), IntegerEntry((assetIds[i] + kAssetBalance), (xp[i] - dy_and_fee)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(tokenOut)), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))] | |
1097 | + | else throw("Strict value is not equal to itself.") | |
1098 | + | } | |
964 | 1099 | } | |
965 | 1100 | } | |
966 | 1101 | else throw("Strict value is not equal to itself.") | |
989 | 1124 | let balances = _xp() | |
990 | 1125 | let D0 = getDMem(balances, amp) | |
991 | 1126 | func calcNewBalances (acc,balance) = { | |
992 | - | let $ | |
993 | - | let newBalances = $ | |
994 | - | let i = $ | |
1127 | + | let $t02624626272 = acc | |
1128 | + | let newBalances = $t02624626272._1 | |
1129 | + | let i = $t02624626272._2 | |
995 | 1130 | let newBalance = (balance + (if (deposit) | |
996 | 1131 | then amounts[i] | |
997 | 1132 | else -(amounts[i]))) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let PRECISION = 1000000 | |
5 | 5 | ||
6 | 6 | let MAX_A = 1000000 | |
7 | 7 | ||
8 | 8 | let MAX_A_CHANGE = 10 | |
9 | 9 | ||
10 | 10 | let MIN_RAMP_TIME = (86400 / 60) | |
11 | + | ||
12 | + | let version = "2.0.0" | |
13 | + | ||
14 | + | let kVersion = "version" | |
11 | 15 | ||
12 | 16 | let kAssets = "asset_ids" | |
13 | 17 | ||
14 | 18 | let kAssetBalance = "_balance" | |
15 | 19 | ||
16 | 20 | let kActive = "active" | |
17 | 21 | ||
18 | 22 | let kCause = "shutdown_cause" | |
19 | 23 | ||
20 | 24 | let kShareAssetId = "share_asset_id" | |
21 | 25 | ||
22 | 26 | let kShareAssetSupply = "share_asset_supply" | |
23 | 27 | ||
24 | 28 | let kFee = "commission" | |
29 | + | ||
30 | + | let kDAppThresholdCoef = "dAppThresholdCoef" | |
25 | 31 | ||
26 | 32 | let kUSDNAddress = "staking_usdnnsbt_address" | |
27 | 33 | ||
28 | 34 | let kDiscounts = "discounts" | |
29 | 35 | ||
30 | 36 | let kDiscountValues = "discount_values" | |
31 | 37 | ||
32 | 38 | let kUserSwopInGov = "_SWOP_amount" | |
33 | 39 | ||
34 | 40 | let kFirstHarvest = "first_harvest" | |
35 | 41 | ||
36 | 42 | let kFirstHarvestHeight = "first_harvest_height" | |
37 | 43 | ||
38 | 44 | let kShareLimit = "share_limit_on_first_harvest" | |
39 | 45 | ||
40 | 46 | let kBasePeriod = "base_period" | |
41 | 47 | ||
42 | 48 | let kPeriodLength = "period_length" | |
43 | 49 | ||
44 | 50 | let kStartHeight = "start_height" | |
45 | 51 | ||
46 | 52 | let kAdminPubKey1 = "admin_pub_1" | |
47 | 53 | ||
48 | 54 | let kAdminPubKey2 = "admin_pub_2" | |
49 | 55 | ||
50 | 56 | let kAdminPubKey3 = "admin_pub_3" | |
51 | 57 | ||
52 | 58 | let kAdminInvokePubKey = "admin_invoke_pub" | |
53 | 59 | ||
54 | 60 | let kMoneyBoxAddress = "money_box_address" | |
55 | 61 | ||
56 | 62 | let kGovAddress = "governance_address" | |
57 | 63 | ||
58 | 64 | let kVotingAddress = "voting_address" | |
59 | 65 | ||
60 | 66 | let kFarmingAddress = "farming_address" | |
61 | 67 | ||
62 | 68 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
63 | 69 | ||
64 | 70 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
65 | 71 | case string: String => | |
66 | 72 | fromBase58String(string) | |
67 | 73 | case nothing => | |
68 | 74 | throw((key + "is empty")) | |
69 | 75 | } | |
70 | 76 | ||
71 | 77 | ||
72 | 78 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
73 | 79 | ||
74 | 80 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
75 | 81 | ||
76 | 82 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
77 | 83 | ||
78 | 84 | let adminPubKeyInvoke = getBase58FromOracle(kAdminInvokePubKey) | |
79 | 85 | ||
80 | 86 | let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress)) | |
81 | 87 | ||
82 | 88 | let govAddress = Address(getBase58FromOracle(kGovAddress)) | |
83 | 89 | ||
84 | 90 | let stakingUSDNAddress = Address(getBase58FromOracle(kUSDNAddress)) | |
85 | 91 | ||
86 | 92 | let votingAddress = Address(getBase58FromOracle(kVotingAddress)) | |
87 | 93 | ||
88 | 94 | let farmingAddress = Address(getBase58FromOracle(kFarmingAddress)) | |
89 | 95 | ||
90 | - | let capMoneyBoxAddress = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
91 | - | ||
92 | 96 | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
93 | 97 | ||
94 | 98 | let stakingAssets = [toBase58String(USDN)] | |
95 | 99 | ||
96 | 100 | let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod") | |
97 | 101 | ||
98 | 102 | let startHeight = valueOrErrorMessage(getInteger(votingAddress, kStartHeight), "Empty kStartHeight") | |
99 | 103 | ||
100 | 104 | let periodLength = valueOrErrorMessage(getInteger(votingAddress, kPeriodLength), "Empty kPeriodLength") | |
101 | 105 | ||
102 | 106 | let firstHarvestEndPeriod = ((basePeriod + ((height - startHeight) / periodLength)) + 3) | |
103 | 107 | ||
104 | 108 | let active = getBooleanValue(this, kActive) | |
105 | 109 | ||
106 | 110 | let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId)) | |
107 | 111 | ||
108 | 112 | let shareSupply = getIntegerValue(this, kShareAssetSupply) | |
109 | 113 | ||
110 | 114 | let feeScale6 = 1000000 | |
111 | 115 | ||
112 | 116 | let fee = getIntegerValue(this, kFee) | |
113 | 117 | ||
114 | 118 | let feeGovernance = fraction(40, feeScale6, 100) | |
115 | 119 | ||
116 | 120 | let initial_A = getIntegerValue(this, "initial_A") | |
117 | 121 | ||
118 | 122 | let future_A = getIntegerValue(this, "future_A") | |
119 | 123 | ||
120 | 124 | let initial_A_time = valueOrElse(getInteger(this, "initial_A_time"), 0) | |
121 | 125 | ||
122 | 126 | let future_A_time = valueOrElse(getInteger(this, "future_A_time"), 0) | |
123 | 127 | ||
128 | + | let iter14 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
129 | + | ||
130 | + | let iter15 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | |
131 | + | ||
124 | 132 | let assetIds = split(getStringValue(this, kAssets), ",") | |
125 | 133 | ||
126 | 134 | let nCoins = size(assetIds) | |
127 | 135 | ||
128 | 136 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
129 | 137 | ||
130 | 138 | ||
131 | 139 | func throwIsActive () = throw("DApp is already active") | |
132 | 140 | ||
133 | 141 | ||
134 | 142 | func isActive () = if (active) | |
135 | 143 | then unit | |
136 | 144 | else throw("DApp is inactive at this moment") | |
137 | 145 | ||
138 | 146 | ||
139 | 147 | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
140 | 148 | then unit | |
141 | 149 | else throw("Only admin can call this function") | |
150 | + | ||
151 | + | ||
152 | + | func isSelfCall (i) = if ((this == i.caller)) | |
153 | + | then unit | |
154 | + | else throw("Only contract itself can call this function") | |
142 | 155 | ||
143 | 156 | ||
144 | 157 | let big2 = toBigInt(2) | |
145 | 158 | ||
146 | 159 | let blockTimestamp = height | |
147 | 160 | ||
148 | 161 | func assert (a) = if (a) | |
149 | 162 | then false | |
150 | 163 | else true | |
151 | 164 | ||
152 | 165 | ||
153 | 166 | func calculateFeeDiscount (userAddr) = { | |
154 | 167 | let swopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserSwopInGov)), 0) | |
155 | 168 | let discountValues = split(getStringValue(oracle, kDiscountValues), ",") | |
156 | 169 | let discounts = split(getStringValue(oracle, kDiscounts), ",") | |
157 | 170 | if (if ((swopAmount >= parseIntValue(discountValues[0]))) | |
158 | 171 | then (parseIntValue(discountValues[1]) > swopAmount) | |
159 | 172 | else false) | |
160 | 173 | then (feeScale6 - parseIntValue(discounts[0])) | |
161 | 174 | else if (if ((swopAmount >= parseIntValue(discountValues[1]))) | |
162 | 175 | then (parseIntValue(discountValues[2]) > swopAmount) | |
163 | 176 | else false) | |
164 | 177 | then (feeScale6 - parseIntValue(discounts[1])) | |
165 | 178 | else if (if ((swopAmount >= parseIntValue(discountValues[2]))) | |
166 | 179 | then (parseIntValue(discountValues[3]) > swopAmount) | |
167 | 180 | else false) | |
168 | 181 | then (feeScale6 - parseIntValue(discounts[2])) | |
169 | 182 | else if (if ((swopAmount >= parseIntValue(discountValues[3]))) | |
170 | 183 | then (parseIntValue(discountValues[4]) > swopAmount) | |
171 | 184 | else false) | |
172 | 185 | then (feeScale6 - parseIntValue(discounts[3])) | |
173 | 186 | else if ((swopAmount >= parseIntValue(discountValues[4]))) | |
174 | 187 | then (feeScale6 - parseIntValue(discounts[4])) | |
175 | 188 | else feeScale6 | |
176 | 189 | } | |
177 | 190 | ||
178 | 191 | ||
179 | 192 | func _A () = { | |
180 | 193 | let t1 = future_A_time | |
181 | 194 | let A1 = future_A | |
182 | 195 | if ((t1 > blockTimestamp)) | |
183 | 196 | then { | |
184 | 197 | let A0 = initial_A | |
185 | 198 | let t0 = initial_A_time | |
186 | 199 | if ((A1 > A0)) | |
187 | 200 | then (A0 + (((A1 - A0) * (blockTimestamp - t0)) / (t1 - t0))) | |
188 | 201 | else (A0 - (((A0 - A1) * (blockTimestamp - t0)) / (t1 - t0))) | |
189 | 202 | } | |
190 | 203 | else A1 | |
191 | 204 | } | |
192 | 205 | ||
193 | 206 | ||
194 | 207 | func _xp () = { | |
195 | 208 | func assetBalances (acc,assetId) = (acc :+ valueOrElse(getInteger(this, (assetId + kAssetBalance)), 0)) | |
196 | 209 | ||
197 | 210 | let $l = assetIds | |
198 | 211 | let $s = size($l) | |
199 | 212 | let $acc0 = nil | |
200 | 213 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
201 | 214 | then $a | |
202 | 215 | else assetBalances($a, $l[$i]) | |
203 | 216 | ||
204 | 217 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
205 | 218 | then $a | |
206 | 219 | else throw("List size exceeds 15") | |
207 | 220 | ||
208 | 221 | $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) | |
209 | 222 | } | |
210 | 223 | ||
211 | 224 | ||
212 | 225 | func _xp_mem (xp) = xp | |
213 | 226 | ||
214 | 227 | ||
215 | 228 | func sumList (acc,element) = (acc + element) | |
216 | 229 | ||
217 | 230 | ||
218 | 231 | func get_D (xp,amp) = { | |
219 | 232 | let @ = invoke(this, "D", [xp, amp], nil) | |
220 | 233 | if ($isInstanceOf(@, "Int")) | |
221 | 234 | then @ | |
222 | 235 | else throw(($getType(invoke(this, "D", [xp, amp], nil)) + " couldn't be cast to Int")) | |
223 | 236 | } | |
224 | 237 | ||
225 | 238 | ||
226 | 239 | func get_D_internal (xp,amp) = { | |
227 | 240 | let S = { | |
228 | 241 | let $l = xp | |
229 | 242 | let $s = size($l) | |
230 | 243 | let $acc0 = 0 | |
231 | 244 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
232 | 245 | then $a | |
233 | 246 | else sumList($a, $l[$i]) | |
234 | 247 | ||
235 | 248 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
236 | 249 | then $a | |
237 | 250 | else throw("List size exceeds 15") | |
238 | 251 | ||
239 | 252 | $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) | |
240 | 253 | } | |
241 | 254 | if ((S == 0)) | |
242 | 255 | then 0 | |
243 | 256 | else { | |
244 | 257 | let Ann = (amp * nCoins) | |
245 | 258 | let AnnS = (toBigInt(Ann) * toBigInt(S)) | |
246 | 259 | let Ann1 = toBigInt((Ann - 1)) | |
247 | 260 | func Dproc (acc,i) = if ((acc._2 == true)) | |
248 | 261 | then acc | |
249 | 262 | else { | |
250 | 263 | let Dprev = acc._1 | |
251 | 264 | func D_PProc (D_P,i) = if ((nCoins > i)) | |
252 | 265 | then ((D_P * Dprev) / (toBigInt(xp[i]) * toBigInt(nCoins))) | |
253 | 266 | else D_P | |
254 | 267 | ||
255 | 268 | let D_P = { | |
256 | - | let $l = | |
269 | + | let $l = iter14 | |
257 | 270 | let $s = size($l) | |
258 | 271 | let $acc0 = Dprev | |
259 | 272 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
260 | 273 | then $a | |
261 | 274 | else D_PProc($a, $l[$i]) | |
262 | 275 | ||
263 | 276 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
264 | 277 | then $a | |
265 | 278 | else throw("List size exceeds 15") | |
266 | 279 | ||
267 | 280 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
268 | 281 | } | |
269 | 282 | let D = fraction((AnnS + (toBigInt(nCoins) * D_P)), Dprev, ((Ann1 * Dprev) + (toBigInt((nCoins + 1)) * D_P))) | |
270 | 283 | if ((D > Dprev)) | |
271 | 284 | then if ((1 >= toInt((D - Dprev)))) | |
272 | 285 | then $Tuple2(D, true) | |
273 | 286 | else $Tuple2(D, false) | |
274 | 287 | else if ((1 >= toInt((Dprev - D)))) | |
275 | 288 | then $Tuple2(D, true) | |
276 | 289 | else $Tuple2(D, false) | |
277 | 290 | } | |
278 | 291 | ||
279 | - | let $ | |
280 | - | let $l = | |
292 | + | let $t066456711 = { | |
293 | + | let $l = iter14 | |
281 | 294 | let $s = size($l) | |
282 | 295 | let $acc0 = $Tuple2(toBigInt(S), false) | |
283 | 296 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
284 | 297 | then $a | |
285 | 298 | else Dproc($a, $l[$i]) | |
286 | 299 | ||
287 | 300 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
288 | 301 | then $a | |
289 | 302 | else throw("List size exceeds 15") | |
290 | 303 | ||
291 | 304 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
292 | 305 | } | |
293 | - | let D = $ | |
294 | - | let finished = $ | |
306 | + | let D = $t066456711._1 | |
307 | + | let finished = $t066456711._2 | |
295 | 308 | if ((finished == false)) | |
296 | 309 | then throw(("get_D() not finished with " + toString(D))) | |
297 | 310 | else toInt(D) | |
298 | 311 | } | |
299 | 312 | } | |
300 | 313 | ||
301 | 314 | ||
302 | 315 | func getDMem (xp,amp) = get_D(_xp_mem(xp), amp) | |
303 | 316 | ||
304 | 317 | ||
305 | 318 | func getY (in,out,x,xp_) = if (assert((in != out))) | |
306 | 319 | then throw("same coin") | |
307 | 320 | else if (assert(if ((out >= 0)) | |
308 | 321 | then (in >= 0) | |
309 | 322 | else false)) | |
310 | 323 | then throw("below zero") | |
311 | 324 | else if (assert(if ((nCoins > out)) | |
312 | 325 | then (nCoins > in) | |
313 | 326 | else false)) | |
314 | 327 | then throw("above N_COINS") | |
315 | 328 | else { | |
316 | 329 | let amp = _A() | |
317 | 330 | let D = get_D(xp_, amp) | |
318 | 331 | let Ann = (amp * nCoins) | |
319 | 332 | func S_c (acc,i) = { | |
320 | - | let $ | |
321 | - | let S_ = $ | |
322 | - | let c = $ | |
333 | + | let $t072827299 = acc | |
334 | + | let S_ = $t072827299._1 | |
335 | + | let c = $t072827299._2 | |
323 | 336 | let x_ = if ((in == i)) | |
324 | 337 | then x | |
325 | 338 | else xp_[i] | |
326 | 339 | if (if ((i != out)) | |
327 | 340 | then (nCoins > i) | |
328 | 341 | else false) | |
329 | 342 | then $Tuple2((S_ + x_), fraction(c, toBigInt(D), toBigInt((x_ * nCoins)))) | |
330 | 343 | else $Tuple2(S_, c) | |
331 | 344 | } | |
332 | 345 | ||
333 | - | let $ | |
334 | - | let $l = | |
346 | + | let $t075077562 = { | |
347 | + | let $l = iter14 | |
335 | 348 | let $s = size($l) | |
336 | 349 | let $acc0 = $Tuple2(0, toBigInt(D)) | |
337 | 350 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
338 | 351 | then $a | |
339 | 352 | else S_c($a, $l[$i]) | |
340 | 353 | ||
341 | 354 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
342 | 355 | then $a | |
343 | 356 | else throw("List size exceeds 15") | |
344 | 357 | ||
345 | 358 | $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) | |
346 | 359 | } | |
347 | - | let S_ = $ | |
348 | - | let c_ = $ | |
360 | + | let S_ = $t075077562._1 | |
361 | + | let c_ = $t075077562._2 | |
349 | 362 | let c = fraction(c_, toBigInt(D), toBigInt((Ann * nCoins))) | |
350 | 363 | let bD = toBigInt(((S_ + (D / Ann)) - D)) | |
351 | 364 | func y_proc (acc,_i) = if ((acc._2 == true)) | |
352 | 365 | then acc | |
353 | 366 | else { | |
354 | 367 | let y_prev = acc._1 | |
355 | 368 | let y = (((y_prev * y_prev) + c) / ((big2 * y_prev) + bD)) | |
356 | 369 | if ((y > y_prev)) | |
357 | 370 | then if ((1 >= toInt((y - y_prev)))) | |
358 | 371 | then $Tuple2(y, true) | |
359 | 372 | else $Tuple2(y, false) | |
360 | 373 | else if ((1 >= toInt((y_prev - y)))) | |
361 | 374 | then $Tuple2(y, true) | |
362 | 375 | else $Tuple2(y, false) | |
363 | 376 | } | |
364 | 377 | ||
365 | - | let $ | |
366 | - | let $l = | |
378 | + | let $t080448111 = { | |
379 | + | let $l = iter15 | |
367 | 380 | let $s = size($l) | |
368 | 381 | let $acc0 = $Tuple2(toBigInt(D), false) | |
369 | 382 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
370 | 383 | then $a | |
371 | 384 | else y_proc($a, $l[$i]) | |
372 | 385 | ||
373 | 386 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
374 | 387 | then $a | |
375 | 388 | else throw("List size exceeds 16") | |
376 | 389 | ||
377 | 390 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16) | |
378 | 391 | } | |
379 | - | let y = $ | |
380 | - | let finished = $ | |
392 | + | let y = $t080448111._1 | |
393 | + | let finished = $t080448111._2 | |
381 | 394 | if ((finished == false)) | |
382 | 395 | then throw(("getY() not finished with " + toString(y))) | |
383 | 396 | else toInt(y) | |
384 | 397 | } | |
385 | 398 | ||
386 | 399 | ||
387 | 400 | func get_y_D (A_,in,xp,D) = if (assert((in >= 0))) | |
388 | 401 | then throw("i below zero") | |
389 | 402 | else if (assert((nCoins > in))) | |
390 | 403 | then throw("i above N_COINS") | |
391 | 404 | else { | |
392 | 405 | let Ann = (A_ * nCoins) | |
393 | 406 | func S_c (acc,i) = { | |
394 | - | let $ | |
395 | - | let S_ = $ | |
396 | - | let c = $ | |
407 | + | let $t084908507 = acc | |
408 | + | let S_ = $t084908507._1 | |
409 | + | let c = $t084908507._2 | |
397 | 410 | let x_ = if (if ((in != i)) | |
398 | 411 | then (nCoins > i) | |
399 | 412 | else false) | |
400 | 413 | then xp[i] | |
401 | 414 | else 0 | |
402 | 415 | if (if ((nCoins > i)) | |
403 | 416 | then (in != i) | |
404 | 417 | else false) | |
405 | 418 | then $Tuple2((S_ + x_), fraction(c, toBigInt(D), toBigInt((x_ * nCoins)))) | |
406 | 419 | else $Tuple2(S_, c) | |
407 | 420 | } | |
408 | 421 | ||
409 | - | let $ | |
410 | - | let $l = | |
422 | + | let $t087278782 = { | |
423 | + | let $l = iter14 | |
411 | 424 | let $s = size($l) | |
412 | 425 | let $acc0 = $Tuple2(0, toBigInt(D)) | |
413 | 426 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
414 | 427 | then $a | |
415 | 428 | else S_c($a, $l[$i]) | |
416 | 429 | ||
417 | 430 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
418 | 431 | then $a | |
419 | 432 | else throw("List size exceeds 15") | |
420 | 433 | ||
421 | 434 | $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) | |
422 | 435 | } | |
423 | - | let S_ = $ | |
424 | - | let c_ = $ | |
436 | + | let S_ = $t087278782._1 | |
437 | + | let c_ = $t087278782._2 | |
425 | 438 | let c = fraction(c_, toBigInt(D), toBigInt((Ann * nCoins))) | |
426 | 439 | let bD = toBigInt(((S_ + (D / Ann)) - D)) | |
427 | 440 | func y_D_proc (acc,i) = if ((acc._2 == true)) | |
428 | 441 | then acc | |
429 | 442 | else { | |
430 | 443 | let y_prev = acc._1 | |
431 | 444 | let y = (((y_prev * y_prev) + c) / ((big2 * y_prev) + bD)) | |
432 | 445 | if ((y > y_prev)) | |
433 | 446 | then if ((1 >= toInt((y - y_prev)))) | |
434 | 447 | then $Tuple2(y, true) | |
435 | 448 | else $Tuple2(y, false) | |
436 | 449 | else if ((1 >= toInt((y_prev - y)))) | |
437 | 450 | then $Tuple2(y, true) | |
438 | 451 | else $Tuple2(y, false) | |
439 | 452 | } | |
440 | 453 | ||
441 | - | let $ | |
442 | - | let $l = | |
454 | + | let $t092659334 = { | |
455 | + | let $l = iter15 | |
443 | 456 | let $s = size($l) | |
444 | 457 | let $acc0 = $Tuple2(toBigInt(D), false) | |
445 | 458 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
446 | 459 | then $a | |
447 | 460 | else y_D_proc($a, $l[$i]) | |
448 | 461 | ||
449 | 462 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
450 | 463 | then $a | |
451 | 464 | else throw("List size exceeds 16") | |
452 | 465 | ||
453 | 466 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16) | |
454 | 467 | } | |
455 | - | let y = $ | |
456 | - | let finished = $ | |
468 | + | let y = $t092659334._1 | |
469 | + | let finished = $t092659334._2 | |
457 | 470 | if ((finished == false)) | |
458 | 471 | then throw(("get_y_D() not finished with " + toString(y))) | |
459 | 472 | else toInt(y) | |
460 | 473 | } | |
461 | 474 | ||
462 | 475 | ||
463 | 476 | func _calcWithdrawOneCoin (xp,_token_amount,i,caller) = { | |
464 | 477 | let feeDiscount = calculateFeeDiscount(caller) | |
465 | 478 | let amp = _A() | |
466 | 479 | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
467 | 480 | let total_supply = shareSupply | |
468 | 481 | let D0 = get_D(xp, amp) | |
469 | 482 | let D1 = (D0 - fraction(_token_amount, D0, total_supply)) | |
470 | 483 | let new_y = get_y_D(amp, i, xp, D1) | |
471 | 484 | let dy_0 = (xp[i] - new_y) | |
472 | 485 | func xp_reduced_proc (acc,xp_j) = { | |
473 | - | let $ | |
474 | - | let xp_reduced = $ | |
475 | - | let index = $ | |
486 | + | let $t0997510004 = acc | |
487 | + | let xp_reduced = $t0997510004._1 | |
488 | + | let index = $t0997510004._2 | |
476 | 489 | let dx_expected = if ((index == i)) | |
477 | 490 | then (fraction(xp_j, D1, D0) - new_y) | |
478 | 491 | else (xp_j - fraction(xp_j, D1, D0)) | |
479 | 492 | $Tuple2((xp_reduced :+ (xp_j - fraction(_fee, dx_expected, feeScale6))), (index + 1)) | |
480 | 493 | } | |
481 | 494 | ||
482 | - | let $ | |
495 | + | let $t01026610330 = { | |
483 | 496 | let $l = xp | |
484 | 497 | let $s = size($l) | |
485 | 498 | let $acc0 = $Tuple2(nil, 0) | |
486 | 499 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
487 | 500 | then $a | |
488 | 501 | else xp_reduced_proc($a, $l[$i]) | |
489 | 502 | ||
490 | 503 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
491 | 504 | then $a | |
492 | 505 | else throw("List size exceeds 15") | |
493 | 506 | ||
494 | 507 | $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) | |
495 | 508 | } | |
496 | - | let xp_reduced = $ | |
497 | - | let index = $ | |
509 | + | let xp_reduced = $t01026610330._1 | |
510 | + | let index = $t01026610330._2 | |
498 | 511 | let xp_reduced_i = xp_reduced[i] | |
499 | 512 | let dy = ((xp_reduced_i - get_y_D(amp, i, xp_reduced, D1)) - 1) | |
500 | 513 | $Tuple2(dy, (dy_0 - dy)) | |
501 | 514 | } | |
502 | 515 | ||
503 | 516 | ||
504 | 517 | func getStrAssetId (assetId) = match assetId { | |
505 | 518 | case id: ByteVector => | |
506 | 519 | toBase58String(id) | |
507 | 520 | case waves: Unit => | |
508 | 521 | "WAVES" | |
509 | 522 | case _ => | |
510 | 523 | throw("Match error") | |
511 | 524 | } | |
512 | 525 | ||
513 | 526 | ||
514 | 527 | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
515 | 528 | then $Tuple2("lockNeutrino", stakingUSDNAddress) | |
516 | 529 | else $Tuple2("unlockNeutrino", stakingUSDNAddress) | |
517 | 530 | ||
518 | 531 | ||
519 | 532 | func calcStakingParams (stake,amount,assetId) = if (stake) | |
520 | 533 | then { | |
521 | - | let $ | |
522 | - | let call = $ | |
523 | - | let stakingAddr = $ | |
534 | + | let $t01089410960 = calcStakingFuncAndAddres(stake, assetId) | |
535 | + | let call = $t01089410960._1 | |
536 | + | let stakingAddr = $t01089410960._2 | |
524 | 537 | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
525 | 538 | } | |
526 | 539 | else { | |
527 | - | let $ | |
528 | - | let call = $ | |
529 | - | let stakingAddr = $ | |
540 | + | let $t01104611112 = calcStakingFuncAndAddres(stake, assetId) | |
541 | + | let call = $t01104611112._1 | |
542 | + | let stakingAddr = $t01104611112._2 | |
530 | 543 | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
531 | 544 | } | |
532 | 545 | ||
533 | 546 | ||
534 | 547 | func stake (amount,assetIdString) = if (containsElement(stakingAssets, assetIdString)) | |
535 | 548 | then { | |
536 | - | let $ | |
537 | - | let call = $ | |
538 | - | let addr = $ | |
539 | - | let params = $ | |
540 | - | let payments = $ | |
549 | + | let $t01129911401 = calcStakingParams(true, amount, fromBase58String(assetIdString)) | |
550 | + | let call = $t01129911401._1 | |
551 | + | let addr = $t01129911401._2 | |
552 | + | let params = $t01129911401._3 | |
553 | + | let payments = $t01129911401._4 | |
541 | 554 | invoke(addr, call, params, payments) | |
542 | 555 | } | |
543 | 556 | else 0 | |
544 | 557 | ||
545 | 558 | ||
546 | 559 | func unstake (amount,assetIdString) = if (containsElement(stakingAssets, assetIdString)) | |
547 | 560 | then { | |
548 | - | let $ | |
549 | - | let call = $ | |
550 | - | let addr = $ | |
551 | - | let params = $ | |
552 | - | let payments = $ | |
561 | + | let $t01158611689 = calcStakingParams(false, amount, fromBase58String(assetIdString)) | |
562 | + | let call = $t01158611689._1 | |
563 | + | let addr = $t01158611689._2 | |
564 | + | let params = $t01158611689._3 | |
565 | + | let payments = $t01158611689._4 | |
553 | 566 | invoke(addr, call, params, payments) | |
554 | 567 | } | |
555 | 568 | else 0 | |
556 | 569 | ||
557 | 570 | ||
558 | 571 | func stakedAmount (assetId) = { | |
559 | 572 | let stakedAmountCalculated = match assetId { | |
560 | 573 | case aId: ByteVector => | |
561 | 574 | if ((aId == USDN)) | |
562 | 575 | then getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(aId)) + "_") + toString(this))) | |
563 | 576 | else 0 | |
564 | 577 | case _: Unit => | |
565 | 578 | 0 | |
566 | 579 | case _ => | |
567 | 580 | throw("Match error") | |
568 | 581 | } | |
569 | 582 | match stakedAmountCalculated { | |
570 | 583 | case i: Int => | |
571 | 584 | i | |
572 | 585 | case _ => | |
573 | 586 | 0 | |
574 | 587 | } | |
575 | 588 | } | |
576 | 589 | ||
577 | 590 | ||
578 | 591 | func checkSuspicious () = { | |
579 | 592 | let contractBalances = _xp() | |
580 | 593 | func checkBalance (acc,assetId) = { | |
581 | - | let $ | |
582 | - | let suspicious = $ | |
583 | - | let i = $ | |
594 | + | let $t01230012325 = acc | |
595 | + | let suspicious = $t01230012325._1 | |
596 | + | let i = $t01230012325._2 | |
584 | 597 | if (suspicious) | |
585 | 598 | then $Tuple2(suspicious, i) | |
586 | 599 | else { | |
587 | 600 | let aBalance = (assetBalance(this, fromBase58String(assetId)) + stakedAmount(fromBase58String(assetId))) | |
588 | 601 | if ((contractBalances[i] > aBalance)) | |
589 | 602 | then $Tuple2(true, i) | |
590 | 603 | else $Tuple2(false, (i + 1)) | |
591 | 604 | } | |
592 | 605 | } | |
593 | 606 | ||
594 | 607 | let $l = assetIds | |
595 | 608 | let $s = size($l) | |
596 | 609 | let $acc0 = $Tuple2(false, 0) | |
597 | 610 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
598 | 611 | then $a | |
599 | 612 | else checkBalance($a, $l[$i]) | |
600 | 613 | ||
601 | 614 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
602 | 615 | then $a | |
603 | 616 | else throw("List size exceeds 15") | |
604 | 617 | ||
605 | 618 | $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) | |
606 | 619 | } | |
607 | 620 | ||
608 | 621 | ||
609 | 622 | func suspendSuspicious (i) = suspend(("Suspicious state with asset: " + assetIds[i])) | |
610 | 623 | ||
611 | 624 | ||
612 | 625 | func returnPayments (caller,payments) = { | |
613 | 626 | func parsePayments (acc,payment) = (acc :+ ScriptTransfer(caller, payment.amount, payment.assetId)) | |
614 | 627 | ||
615 | 628 | let $l = payments | |
616 | 629 | let $s = size($l) | |
617 | 630 | let $acc0 = nil | |
618 | 631 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
619 | 632 | then $a | |
620 | 633 | else parsePayments($a, $l[$i]) | |
621 | 634 | ||
622 | 635 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
623 | 636 | then $a | |
624 | 637 | else throw("List size exceeds 15") | |
625 | 638 | ||
626 | 639 | $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) | |
627 | 640 | } | |
628 | 641 | ||
629 | 642 | ||
643 | + | func checkDAppThreshold (newBalances) = { | |
644 | + | let dAppThresholdCoef = valueOrErrorMessage(getInteger(this, kDAppThresholdCoef), "No dAppThresholdCoef key") | |
645 | + | let thresholdScale = 10000 | |
646 | + | func iterAllBalances (acc,tokenBalance) = { | |
647 | + | let $t01330413345 = acc | |
648 | + | let thresholdError = $t01330413345._1 | |
649 | + | let cutedBalances = $t01330413345._2 | |
650 | + | func iterCutedBalances (checkRatio,checkedBalance) = { | |
651 | + | let ratio = fraction(tokenBalance, thresholdScale, checkedBalance) | |
652 | + | if (if ((ratio > (dAppThresholdCoef * thresholdScale))) | |
653 | + | then true | |
654 | + | else (fraction(1, thresholdScale, dAppThresholdCoef) > ratio)) | |
655 | + | then throw("New balance in assets of the DApp is less than threshold") | |
656 | + | else false | |
657 | + | } | |
658 | + | ||
659 | + | $Tuple2({ | |
660 | + | let $l = cutedBalances | |
661 | + | let $s = size($l) | |
662 | + | let $acc0 = thresholdError | |
663 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
664 | + | then $a | |
665 | + | else iterCutedBalances($a, $l[$i]) | |
666 | + | ||
667 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
668 | + | then $a | |
669 | + | else throw("List size exceeds 15") | |
670 | + | ||
671 | + | $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) | |
672 | + | }, removeByIndex(cutedBalances, 0)) | |
673 | + | } | |
674 | + | ||
675 | + | let $t01386713970 = { | |
676 | + | let $l = newBalances | |
677 | + | let $s = size($l) | |
678 | + | let $acc0 = $Tuple2(false, removeByIndex(newBalances, 0)) | |
679 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
680 | + | then $a | |
681 | + | else iterAllBalances($a, $l[$i]) | |
682 | + | ||
683 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
684 | + | then $a | |
685 | + | else throw("List size exceeds 15") | |
686 | + | ||
687 | + | $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) | |
688 | + | } | |
689 | + | let thresholdError = $t01386713970._1 | |
690 | + | let b = $t01386713970._2 | |
691 | + | thresholdError | |
692 | + | } | |
693 | + | ||
694 | + | ||
630 | 695 | @Callable(msg) | |
631 | 696 | func D (xp,amp) = { | |
632 | 697 | let D = get_D_internal(xp, amp) | |
633 | 698 | $Tuple2([IntegerEntry("D", D)], D) | |
634 | 699 | } | |
635 | 700 | ||
636 | 701 | ||
637 | 702 | ||
638 | 703 | @Callable(msg) | |
639 | 704 | func init (coins,_A,firstHarvest) = if (!(isDataStorageUntouched(this))) | |
640 | 705 | then throw("Already initialized") | |
641 | 706 | else { | |
642 | 707 | let shareName = "s_Multi_USD" | |
643 | 708 | let shareDescription = ("ShareToken of SwopFi protocol for MultiStable USD pool at address " + toString(this)) | |
644 | 709 | let issueToken = Issue(shareName, shareDescription, 0, 6, true) | |
645 | 710 | let tokenId = calculateAssetId(issueToken) | |
646 | - | let baseEntry = [StringEntry(kAssets, coins), IntegerEntry("initial_A", _A), IntegerEntry("future_A", _A), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_flat")), StringEntry(kShareAssetId, toBase58String(tokenId)), IntegerEntry(kShareAssetSupply, 0), BooleanEntry(kActive, true), issueToken] | |
711 | + | let baseEntry = [StringEntry(kVersion, version), StringEntry(kAssets, coins), IntegerEntry("initial_A", _A), IntegerEntry("future_A", _A), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_flat")), StringEntry(kShareAssetId, toBase58String(tokenId)), IntegerEntry(kShareAssetSupply, 0), BooleanEntry(kActive, true), IntegerEntry(kDAppThresholdCoef, 15), issueToken] | |
647 | 712 | if (firstHarvest) | |
648 | 713 | then (baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
649 | 714 | else baseEntry | |
650 | 715 | } | |
651 | 716 | ||
652 | 717 | ||
653 | 718 | ||
654 | 719 | @Callable(msg) | |
655 | 720 | func addLiquidity (minMintAmount,stakeFarming) = valueOrElse(isActive(), { | |
656 | 721 | let amp = _A() | |
657 | 722 | let xp = _xp() | |
658 | 723 | let D0 = if ((shareSupply == 0)) | |
659 | 724 | then 0 | |
660 | 725 | else getDMem(xp, amp) | |
661 | 726 | let payments = msg.payments | |
662 | 727 | let n = size(payments) | |
663 | 728 | func validPayments (n) = if ((n > nCoins)) | |
664 | 729 | then throw(("payments size > " + toString(nCoins))) | |
665 | 730 | else if ((1 > n)) | |
666 | 731 | then throw("payments size < 1") | |
667 | 732 | else if (if ((shareSupply == 0)) | |
668 | 733 | then (nCoins != n) | |
669 | 734 | else false) | |
670 | 735 | then throw("initial deposit requires all coins") | |
671 | 736 | else { | |
672 | 737 | func paymantValid (acc,payment) = if (containsElement(assetIds, getStrAssetId(payment.assetId))) | |
673 | 738 | then true | |
674 | 739 | else throw("Invalid asset in payment") | |
675 | 740 | ||
676 | 741 | let $l = payments | |
677 | 742 | let $s = size($l) | |
678 | 743 | let $acc0 = false | |
679 | 744 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
680 | 745 | then $a | |
681 | 746 | else paymantValid($a, $l[$i]) | |
682 | 747 | ||
683 | 748 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
684 | 749 | then $a | |
685 | 750 | else throw("List size exceeds 15") | |
686 | 751 | ||
687 | 752 | $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) | |
688 | 753 | } | |
689 | 754 | ||
690 | 755 | if (!(validPayments(n))) | |
691 | 756 | then throw() | |
692 | 757 | else { | |
693 | 758 | let suspicious = checkSuspicious() | |
694 | 759 | if (suspicious._1) | |
695 | 760 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, payments)) | |
696 | 761 | else { | |
697 | 762 | let paymentsSize = size(payments) | |
698 | 763 | func parsePayments (acc,assetId) = { | |
699 | - | let $ | |
700 | - | let newBalances = $ | |
701 | - | let i = $ | |
702 | - | let j = $ | |
764 | + | let $t01641516444 = acc | |
765 | + | let newBalances = $t01641516444._1 | |
766 | + | let i = $t01641516444._2 | |
767 | + | let j = $t01641516444._3 | |
703 | 768 | if (if ((paymentsSize > j)) | |
704 | 769 | then (getStrAssetId(payments[j].assetId) == assetId) | |
705 | 770 | else false) | |
706 | 771 | then { | |
707 | 772 | let s = stake(payments[j].amount, getStrAssetId(payments[j].assetId)) | |
708 | 773 | if ((s == s)) | |
709 | 774 | then $Tuple3((newBalances :+ (xp[i] + payments[j].amount)), (i + 1), (j + 1)) | |
710 | 775 | else throw("Strict value is not equal to itself.") | |
711 | 776 | } | |
712 | 777 | else $Tuple3((newBalances :+ xp[i]), (i + 1), j) | |
713 | 778 | } | |
714 | 779 | ||
715 | - | let $ | |
780 | + | let $t01675016836 = { | |
716 | 781 | let $l = assetIds | |
717 | 782 | let $s = size($l) | |
718 | 783 | let $acc0 = $Tuple3(nil, 0, 0) | |
719 | 784 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
720 | 785 | then $a | |
721 | 786 | else parsePayments($a, $l[$i]) | |
722 | 787 | ||
723 | 788 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
724 | 789 | then $a | |
725 | 790 | else throw("List size exceeds 15") | |
726 | 791 | ||
727 | 792 | $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) | |
728 | 793 | } | |
729 | - | let newBalances = $ | |
730 | - | let k = $ | |
731 | - | let parsedPayments = $ | |
794 | + | let newBalances = $t01675016836._1 | |
795 | + | let k = $t01675016836._2 | |
796 | + | let parsedPayments = $t01675016836._3 | |
732 | 797 | if (((paymentsSize - 1) > parsedPayments)) | |
733 | 798 | then throw("Incorect payments order") | |
734 | - | else { | |
735 | - | let D1 = getDMem(newBalances, amp) | |
736 | - | if (assert((D1 > D0))) | |
737 | - | then throw("D1 > D0") | |
738 | - | else { | |
739 | - | let feeDiscount = calculateFeeDiscount(msg.caller) | |
740 | - | func calcScriptActions (acc,newBalance) = { | |
741 | - | let $t01616516206 = acc | |
742 | - | let invBalances = $t01616516206._1 | |
743 | - | let scriptActions = $t01616516206._2 | |
744 | - | let i = $t01616516206._3 | |
745 | - | if ((shareSupply > 0)) | |
746 | - | then { | |
747 | - | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
748 | - | let fees = { | |
749 | - | let idealBalance = fraction(D1, xp[i], D0) | |
750 | - | let difference = if ((idealBalance > newBalance)) | |
751 | - | then (idealBalance - newBalance) | |
752 | - | else (newBalance - idealBalance) | |
753 | - | fraction(_fee, difference, feeScale6) | |
799 | + | else if (checkDAppThreshold(newBalances)) | |
800 | + | then throw() | |
801 | + | else { | |
802 | + | let D1 = getDMem(newBalances, amp) | |
803 | + | if (assert((D1 > D0))) | |
804 | + | then throw("D1 > D0") | |
805 | + | else { | |
806 | + | let feeDiscount = calculateFeeDiscount(msg.caller) | |
807 | + | func calcScriptActions (acc,newBalance) = { | |
808 | + | let $t01724117282 = acc | |
809 | + | let invBalances = $t01724117282._1 | |
810 | + | let scriptActions = $t01724117282._2 | |
811 | + | let i = $t01724117282._3 | |
812 | + | if ((shareSupply > 0)) | |
813 | + | then { | |
814 | + | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
815 | + | let fees = { | |
816 | + | let idealBalance = fraction(D1, xp[i], D0) | |
817 | + | let difference = if ((idealBalance > newBalance)) | |
818 | + | then (idealBalance - newBalance) | |
819 | + | else (newBalance - idealBalance) | |
820 | + | fraction(_fee, difference, feeScale6) | |
821 | + | } | |
822 | + | let governanceFees = fraction(fees, feeGovernance, feeScale6) | |
823 | + | let finalBalance = (newBalance - governanceFees) | |
824 | + | let invariantBalance = (newBalance - fees) | |
825 | + | let us = unstake(governanceFees, assetIds[i]) | |
826 | + | if ((us == us)) | |
827 | + | then $Tuple3((invBalances :+ invariantBalance), (scriptActions ++ [ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(assetIds[i])), IntegerEntry((assetIds[i] + kAssetBalance), finalBalance)]), (i + 1)) | |
828 | + | else throw("Strict value is not equal to itself.") | |
754 | 829 | } | |
755 | - | let governanceFees = fraction(fees, feeGovernance, feeScale6) | |
756 | - | let finalBalance = (newBalance - governanceFees) | |
757 | - | let invariantBalance = (newBalance - fees) | |
758 | - | let us = unstake(fees, assetIds[i]) | |
759 | - | if ((us == us)) | |
760 | - | then $Tuple3((invBalances :+ invariantBalance), (scriptActions ++ [ScriptTransfer(capMoneyBoxAddress, (fees - governanceFees), fromBase58String(assetIds[i])), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(assetIds[i])), IntegerEntry((assetIds[i] + kAssetBalance), finalBalance)]), (i + 1)) | |
761 | - | else throw("Strict value is not equal to itself.") | |
762 | - | } | |
763 | - | else $Tuple3((invBalances :+ newBalance), (scriptActions :+ IntegerEntry((assetIds[i] + kAssetBalance), newBalance)), (i + 1)) | |
830 | + | else $Tuple3((invBalances :+ newBalance), (scriptActions :+ IntegerEntry((assetIds[i] + kAssetBalance), newBalance)), (i + 1)) | |
831 | + | } | |
832 | + | ||
833 | + | let $t01850618594 = { | |
834 | + | let $l = newBalances | |
835 | + | let $s = size($l) | |
836 | + | let $acc0 = $Tuple3(nil, nil, 0) | |
837 | + | func $f1_1 ($a,$i) = if (($i >= $s)) | |
838 | + | then $a | |
839 | + | else calcScriptActions($a, $l[$i]) | |
840 | + | ||
841 | + | func $f1_2 ($a,$i) = if (($i >= $s)) | |
842 | + | then $a | |
843 | + | else throw("List size exceeds 15") | |
844 | + | ||
845 | + | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
846 | + | } | |
847 | + | let invBalances = $t01850618594._1 | |
848 | + | let scriptActions = $t01850618594._2 | |
849 | + | let D2 = getDMem(invBalances, amp) | |
850 | + | let mint_amount = if ((shareSupply == 0)) | |
851 | + | then D1 | |
852 | + | else fraction(shareSupply, (D2 - D0), D0) | |
853 | + | if (assert((mint_amount >= minMintAmount))) | |
854 | + | then throw("Slippage screwed you") | |
855 | + | else if (stakeFarming) | |
856 | + | then { | |
857 | + | let re = invoke(this, "reissueShare", [mint_amount], nil) | |
858 | + | if ((re == re)) | |
859 | + | then { | |
860 | + | let s = invoke(farmingAddress, "lockShareTokens", [toString(this)], [AttachedPayment(shareAssetId, mint_amount)]) | |
861 | + | if ((s == s)) | |
862 | + | then (scriptActions :+ IntegerEntry(kShareAssetSupply, (shareSupply + mint_amount))) | |
863 | + | else throw("Strict value is not equal to itself.") | |
864 | + | } | |
865 | + | else throw("Strict value is not equal to itself.") | |
866 | + | } | |
867 | + | else (scriptActions ++ [Reissue(shareAssetId, mint_amount, true), ScriptTransfer(msg.caller, mint_amount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareSupply + mint_amount))]) | |
764 | 868 | } | |
765 | - | ||
766 | - | let $t01754317631 = { | |
767 | - | let $l = newBalances | |
768 | - | let $s = size($l) | |
769 | - | let $acc0 = $Tuple3(nil, nil, 0) | |
770 | - | func $f1_1 ($a,$i) = if (($i >= $s)) | |
771 | - | then $a | |
772 | - | else calcScriptActions($a, $l[$i]) | |
773 | - | ||
774 | - | func $f1_2 ($a,$i) = if (($i >= $s)) | |
775 | - | then $a | |
776 | - | else throw("List size exceeds 15") | |
777 | - | ||
778 | - | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
779 | - | } | |
780 | - | let invBalances = $t01754317631._1 | |
781 | - | let scriptActions = $t01754317631._2 | |
782 | - | let D2 = getDMem(invBalances, amp) | |
783 | - | let mint_amount = if ((shareSupply == 0)) | |
784 | - | then D1 | |
785 | - | else fraction(shareSupply, (D2 - D0), D0) | |
786 | - | if (assert((mint_amount >= minMintAmount))) | |
787 | - | then throw("Slippage screwed you") | |
788 | - | else if (stakeFarming) | |
789 | - | then { | |
790 | - | let re = Reissue(shareAssetId, mint_amount, true) | |
791 | - | if ((re == re)) | |
792 | - | then { | |
793 | - | let s = invoke(farmingAddress, "lockShareTokens", [toString(msg.caller)], [AttachedPayment(shareAssetId, mint_amount)]) | |
794 | - | if ((s == s)) | |
795 | - | then scriptActions | |
796 | - | else throw("Strict value is not equal to itself.") | |
797 | - | } | |
798 | - | else throw("Strict value is not equal to itself.") | |
799 | - | } | |
800 | - | else (scriptActions ++ [Reissue(shareAssetId, mint_amount, true), ScriptTransfer(msg.caller, mint_amount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareSupply + mint_amount))]) | |
801 | - | } | |
802 | - | } | |
869 | + | } | |
803 | 870 | } | |
804 | 871 | } | |
805 | 872 | }) | |
873 | + | ||
874 | + | ||
875 | + | ||
876 | + | @Callable(msg) | |
877 | + | func reissueShare (amount) = valueOrElse(isSelfCall(msg), [Reissue(shareAssetId, amount, true)]) | |
806 | 878 | ||
807 | 879 | ||
808 | 880 | ||
809 | 881 | @Callable(msg) | |
810 | 882 | func getDy (assetFrom,assetTo,dx,userAddress) = { | |
811 | 883 | let xp = _xp() | |
812 | 884 | let fromIndex = valueOrErrorMessage(indexOf(assetIds, assetFrom), "unknown token in") | |
813 | 885 | let toIndex = valueOrErrorMessage(indexOf(assetIds, assetTo), "unknown token out") | |
814 | 886 | let x = (xp[fromIndex] + dx) | |
815 | 887 | let y = getY(fromIndex, toIndex, x, xp) | |
816 | 888 | let dy = ((xp[toIndex] - y) - 1) | |
817 | 889 | let feeDiscount = calculateFeeDiscount(Address(fromBase58String(userAddress))) | |
818 | 890 | let _fee = fraction(fraction(fee, feeDiscount, feeScale6, CEILING), dy, feeScale6) | |
819 | 891 | $Tuple2(nil, (dy - _fee)) | |
820 | 892 | } | |
821 | 893 | ||
822 | 894 | ||
823 | 895 | ||
824 | 896 | @Callable(msg) | |
825 | 897 | func exchange (tokenOut,min_dy) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
826 | 898 | then throw("size(payments) != 1") | |
827 | 899 | else { | |
828 | 900 | let suspicious = checkSuspicious() | |
829 | 901 | if (suspicious._1) | |
830 | 902 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
831 | 903 | else { | |
832 | 904 | let payment = msg.payments[0] | |
833 | 905 | let tokenIn = getStrAssetId(payment.assetId) | |
834 | 906 | let tokenOutB58 = fromBase58String(tokenOut) | |
835 | 907 | let dx = payment.amount | |
836 | 908 | let fromIndex = valueOrErrorMessage(indexOf(assetIds, tokenIn), "unknown token in") | |
837 | 909 | let toIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
838 | 910 | let xp = _xp() | |
839 | 911 | let x = (xp[fromIndex] + dx) | |
840 | 912 | let y = getY(fromIndex, toIndex, x, xp) | |
841 | 913 | let _dy = ((xp[toIndex] - y) - 1) | |
842 | 914 | let feeDiscount = calculateFeeDiscount(msg.caller) | |
843 | 915 | let _fee = fraction(_dy, fraction(fee, feeDiscount, feeScale6, CEILING), feeScale6) | |
844 | 916 | let dy = (_dy - _fee) | |
917 | + | let governanceFees = fraction(_fee, feeGovernance, feeScale6) | |
845 | 918 | if (assert((dy >= min_dy))) | |
846 | 919 | then throw("Exchange resulted in fewer coins than expected") | |
847 | 920 | else { | |
848 | - | let governanceFees = fraction(_fee, feeGovernance, feeScale6) | |
849 | - | let s = stake(payment.amount, getStrAssetId(payment.assetId)) | |
850 | - | if ((s == s)) | |
851 | - | then { | |
852 | - | let us = unstake((dy + _fee), tokenOut) | |
853 | - | if ((us == us)) | |
854 | - | then $Tuple2([IntegerEntry((tokenIn + kAssetBalance), x), IntegerEntry((tokenOut + kAssetBalance), ((xp[toIndex] - dy) - governanceFees)), ScriptTransfer(msg.caller, dy, tokenOutB58), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58), ScriptTransfer(moneyBoxAddress, (_fee - governanceFees), tokenOutB58)], $Tuple2(dy, tokenOutB58)) | |
921 | + | func makeNewBalances (acc,tokenBalance) = { | |
922 | + | let $t02129321319 = acc | |
923 | + | let newBalances = $t02129321319._1 | |
924 | + | let i = $t02129321319._2 | |
925 | + | if ((i == fromIndex)) | |
926 | + | then $Tuple2((newBalances :+ (tokenBalance + dx)), (i + 1)) | |
927 | + | else if ((i == toIndex)) | |
928 | + | then $Tuple2((newBalances :+ (tokenBalance + dy)), (i + 1)) | |
929 | + | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
930 | + | } | |
931 | + | ||
932 | + | let $t02157021631 = { | |
933 | + | let $l = xp | |
934 | + | let $s = size($l) | |
935 | + | let $acc0 = $Tuple2(nil, 0) | |
936 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
937 | + | then $a | |
938 | + | else makeNewBalances($a, $l[$i]) | |
939 | + | ||
940 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
941 | + | then $a | |
942 | + | else throw("List size exceeds 15") | |
943 | + | ||
944 | + | $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) | |
945 | + | } | |
946 | + | let newBalances = $t02157021631._1 | |
947 | + | let i = $t02157021631._2 | |
948 | + | if (checkDAppThreshold(newBalances)) | |
949 | + | then throw() | |
950 | + | else { | |
951 | + | let s = stake(payment.amount, getStrAssetId(payment.assetId)) | |
952 | + | if ((s == s)) | |
953 | + | then { | |
954 | + | let us = unstake((dy + governanceFees), tokenOut) | |
955 | + | if ((us == us)) | |
956 | + | then $Tuple2([IntegerEntry((tokenIn + kAssetBalance), x), IntegerEntry((tokenOut + kAssetBalance), ((xp[toIndex] - dy) - governanceFees)), ScriptTransfer(msg.caller, dy, tokenOutB58), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58)], $Tuple2(dy, tokenOutB58)) | |
957 | + | else throw("Strict value is not equal to itself.") | |
958 | + | } | |
855 | 959 | else throw("Strict value is not equal to itself.") | |
856 | 960 | } | |
857 | - | else throw("Strict value is not equal to itself.") | |
858 | 961 | } | |
859 | 962 | } | |
860 | 963 | }) | |
861 | 964 | ||
862 | 965 | ||
863 | 966 | ||
864 | 967 | @Callable(msg) | |
865 | 968 | func withdraw (minAmounts,unlockAmount) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
866 | 969 | then throw("size(payments) != 1") | |
867 | 970 | else { | |
868 | 971 | let suspicious = checkSuspicious() | |
869 | 972 | if (suspicious._1) | |
870 | 973 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
871 | 974 | else { | |
872 | 975 | let payment = msg.payments[0] | |
873 | 976 | let tokenIn = payment.assetId | |
874 | 977 | if ((tokenIn != shareAssetId)) | |
875 | 978 | then throw("unknown token") | |
876 | 979 | else { | |
877 | 980 | let _amount = payment.amount | |
878 | 981 | let total_supply = shareSupply | |
879 | 982 | let unlock = if ((unlockAmount > 0)) | |
880 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString( | |
983 | + | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
881 | 984 | else 0 | |
882 | 985 | if ((unlock == unlock)) | |
883 | 986 | then { | |
884 | 987 | let withdrawAmount = (_amount + unlockAmount) | |
885 | 988 | func calcScriptActions (acc,balance) = { | |
886 | - | let $ | |
887 | - | let scriptActions = $ | |
888 | - | let i = $ | |
989 | + | let $t02296522993 = acc | |
990 | + | let scriptActions = $t02296522993._1 | |
991 | + | let i = $t02296522993._2 | |
889 | 992 | let wAmount = fraction(balance, withdrawAmount, total_supply) | |
890 | 993 | if (assert((wAmount >= minAmounts[i]))) | |
891 | 994 | then throw("Withdrawal resulted in fewer coins than expected") | |
892 | 995 | else { | |
893 | 996 | let us = unstake(wAmount, assetIds[i]) | |
894 | 997 | if ((us == us)) | |
895 | 998 | then $Tuple2((scriptActions ++ [IntegerEntry((assetIds[i] + kAssetBalance), (balance - wAmount)), ScriptTransfer(msg.caller, wAmount, fromBase58String(assetIds[i]))]), (i + 1)) | |
896 | 999 | else throw("Strict value is not equal to itself.") | |
897 | 1000 | } | |
898 | 1001 | } | |
899 | 1002 | ||
900 | - | let $ | |
1003 | + | let $t02348323551 = { | |
901 | 1004 | let $l = _xp() | |
902 | 1005 | let $s = size($l) | |
903 | 1006 | let $acc0 = $Tuple2(nil, 0) | |
904 | 1007 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
905 | 1008 | then $a | |
906 | 1009 | else calcScriptActions($a, $l[$i]) | |
907 | 1010 | ||
908 | 1011 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
909 | 1012 | then $a | |
910 | 1013 | else throw("List size exceeds 15") | |
911 | 1014 | ||
912 | 1015 | $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) | |
913 | 1016 | } | |
914 | - | let scriptActions = $ | |
915 | - | let i = $ | |
1017 | + | let scriptActions = $t02348323551._1 | |
1018 | + | let i = $t02348323551._2 | |
916 | 1019 | (scriptActions ++ [Burn(shareAssetId, withdrawAmount), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))]) | |
917 | 1020 | } | |
918 | 1021 | else throw("Strict value is not equal to itself.") | |
919 | 1022 | } | |
920 | 1023 | } | |
921 | 1024 | }) | |
922 | 1025 | ||
923 | 1026 | ||
924 | 1027 | ||
925 | 1028 | @Callable(msg) | |
926 | - | func calcWithdrawOneCoin (_tokenAmount,i) = $Tuple2(nil, _calcWithdrawOneCoin(_xp(), _tokenAmount, i, msg.caller)._1) | |
1029 | + | func calcWithdrawOneCoin (tokenAmount,tokenOut,user) = { | |
1030 | + | let i = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
1031 | + | $Tuple2(nil, _calcWithdrawOneCoin(_xp(), tokenAmount, i, Address(fromBase58String(user)))._1) | |
1032 | + | } | |
927 | 1033 | ||
928 | 1034 | ||
929 | 1035 | ||
930 | 1036 | @Callable(msg) | |
931 | 1037 | func withdrawOneCoin (tokenOut,minAmount,unlockAmount) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
932 | 1038 | then throw("size(payments) != 1") | |
933 | 1039 | else { | |
934 | 1040 | let suspicious = checkSuspicious() | |
935 | 1041 | if (suspicious._1) | |
936 | 1042 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
937 | 1043 | else { | |
938 | 1044 | let payment = msg.payments[0] | |
939 | 1045 | let tokenIn = payment.assetId | |
940 | 1046 | if ((tokenIn != shareAssetId)) | |
941 | 1047 | then throw("unknown token") | |
942 | 1048 | else { | |
943 | - | let | |
1049 | + | let outIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
944 | 1050 | let _tokenAmount = payment.amount | |
945 | 1051 | let unlock = if ((unlockAmount > 0)) | |
946 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString( | |
1052 | + | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
947 | 1053 | else 0 | |
948 | 1054 | if ((unlock == unlock)) | |
949 | 1055 | then { | |
950 | 1056 | let withdrawAmount = (_tokenAmount + unlockAmount) | |
951 | 1057 | let xp = _xp() | |
952 | - | let $ | |
953 | - | let dy = $ | |
954 | - | let dy_fee = $ | |
1058 | + | let $t02478224863 = _calcWithdrawOneCoin(xp, withdrawAmount, outIndex, msg.caller) | |
1059 | + | let dy = $t02478224863._1 | |
1060 | + | let dy_fee = $t02478224863._2 | |
955 | 1061 | if (assert((dy >= minAmount))) | |
956 | 1062 | then throw("Not enough coins removed") | |
957 | 1063 | else { | |
958 | 1064 | let governanceFees = fraction(dy_fee, feeGovernance, feeScale6) | |
959 | - | let dy_and_fee = (dy + dy_fee) | |
960 | - | let us = unstake(dy_and_fee, tokenOut) | |
961 | - | if ((us == us)) | |
962 | - | then [ScriptTransfer(msg.caller, dy, fromBase58String(tokenOut)), IntegerEntry((assetIds[i] + kAssetBalance), (xp[i] - dy_and_fee)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(tokenOut)), ScriptTransfer(capMoneyBoxAddress, (dy_fee - governanceFees), fromBase58String(tokenOut)), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))] | |
963 | - | else throw("Strict value is not equal to itself.") | |
1065 | + | let dy_and_fee = (dy + governanceFees) | |
1066 | + | func makeNewBalances (acc,tokenBalance) = { | |
1067 | + | let $t02512925155 = acc | |
1068 | + | let newBalances = $t02512925155._1 | |
1069 | + | let i = $t02512925155._2 | |
1070 | + | if ((i == outIndex)) | |
1071 | + | then $Tuple2((newBalances :+ (tokenBalance - dy_and_fee)), (i + 1)) | |
1072 | + | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
1073 | + | } | |
1074 | + | ||
1075 | + | let $t02532225383 = { | |
1076 | + | let $l = xp | |
1077 | + | let $s = size($l) | |
1078 | + | let $acc0 = $Tuple2(nil, 0) | |
1079 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1080 | + | then $a | |
1081 | + | else makeNewBalances($a, $l[$i]) | |
1082 | + | ||
1083 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1084 | + | then $a | |
1085 | + | else throw("List size exceeds 15") | |
1086 | + | ||
1087 | + | $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) | |
1088 | + | } | |
1089 | + | let newBalances = $t02532225383._1 | |
1090 | + | let i = $t02532225383._2 | |
1091 | + | if (checkDAppThreshold(newBalances)) | |
1092 | + | then throw() | |
1093 | + | else { | |
1094 | + | let us = unstake(dy_and_fee, tokenOut) | |
1095 | + | if ((us == us)) | |
1096 | + | then [ScriptTransfer(msg.caller, dy, fromBase58String(tokenOut)), IntegerEntry((assetIds[i] + kAssetBalance), (xp[i] - dy_and_fee)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(tokenOut)), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))] | |
1097 | + | else throw("Strict value is not equal to itself.") | |
1098 | + | } | |
964 | 1099 | } | |
965 | 1100 | } | |
966 | 1101 | else throw("Strict value is not equal to itself.") | |
967 | 1102 | } | |
968 | 1103 | } | |
969 | 1104 | }) | |
970 | 1105 | ||
971 | 1106 | ||
972 | 1107 | ||
973 | 1108 | @Callable(msg) | |
974 | 1109 | func A () = $Tuple2(nil, _A()) | |
975 | 1110 | ||
976 | 1111 | ||
977 | 1112 | ||
978 | 1113 | @Callable(msg) | |
979 | 1114 | func getVirtualPrice () = { | |
980 | 1115 | let D = get_D(_xp(), _A()) | |
981 | 1116 | $Tuple2(nil, fraction(D, PRECISION, shareSupply)) | |
982 | 1117 | } | |
983 | 1118 | ||
984 | 1119 | ||
985 | 1120 | ||
986 | 1121 | @Callable(msg) | |
987 | 1122 | func calcTokenAmount (amounts,deposit) = { | |
988 | 1123 | let amp = _A() | |
989 | 1124 | let balances = _xp() | |
990 | 1125 | let D0 = getDMem(balances, amp) | |
991 | 1126 | func calcNewBalances (acc,balance) = { | |
992 | - | let $ | |
993 | - | let newBalances = $ | |
994 | - | let i = $ | |
1127 | + | let $t02624626272 = acc | |
1128 | + | let newBalances = $t02624626272._1 | |
1129 | + | let i = $t02624626272._2 | |
995 | 1130 | let newBalance = (balance + (if (deposit) | |
996 | 1131 | then amounts[i] | |
997 | 1132 | else -(amounts[i]))) | |
998 | 1133 | $Tuple2((newBalances :+ newBalance), (i + 1)) | |
999 | 1134 | } | |
1000 | 1135 | ||
1001 | 1136 | let newBalances = ( let $l = balances | |
1002 | 1137 | let $s = size($l) | |
1003 | 1138 | let $acc0 = $Tuple2(nil, 0) | |
1004 | 1139 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1005 | 1140 | then $a | |
1006 | 1141 | else calcNewBalances($a, $l[$i]) | |
1007 | 1142 | ||
1008 | 1143 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1009 | 1144 | then $a | |
1010 | 1145 | else throw("List size exceeds 15") | |
1011 | 1146 | ||
1012 | 1147 | $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))._1 | |
1013 | 1148 | let D1 = getDMem(newBalances, amp) | |
1014 | 1149 | let diff = if (deposit) | |
1015 | 1150 | then (D1 - D0) | |
1016 | 1151 | else (D0 - D1) | |
1017 | 1152 | $Tuple2(nil, fraction(diff, shareSupply, D0)) | |
1018 | 1153 | } | |
1019 | 1154 | ||
1020 | 1155 | ||
1021 | 1156 | ||
1022 | 1157 | @Callable(msg) | |
1023 | 1158 | func rampA (_futureA,_futureTime) = valueOrElse(isActive(), valueOrElse(isAdminCall(msg), if (assert((blockTimestamp >= (initial_A_time + MIN_RAMP_TIME)))) | |
1024 | 1159 | then throw("too often") | |
1025 | 1160 | else if (assert((_futureTime >= (blockTimestamp + MIN_RAMP_TIME)))) | |
1026 | 1161 | then throw("insufficient time") | |
1027 | 1162 | else { | |
1028 | 1163 | let _initial_A = _A() | |
1029 | 1164 | if (assert(if ((_futureA > 0)) | |
1030 | 1165 | then (MAX_A > _futureA) | |
1031 | 1166 | else false)) | |
1032 | 1167 | then throw("out of base range") | |
1033 | 1168 | else if (assert(if (if ((_futureA >= _initial_A)) | |
1034 | 1169 | then ((_initial_A * MAX_A_CHANGE) >= _futureA) | |
1035 | 1170 | else false) | |
1036 | 1171 | then true | |
1037 | 1172 | else if ((_initial_A > _futureA)) | |
1038 | 1173 | then ((_futureA * MAX_A_CHANGE) >= _initial_A) | |
1039 | 1174 | else false)) | |
1040 | 1175 | then throw("out of range") | |
1041 | 1176 | else [IntegerEntry("initial_A", _initial_A), IntegerEntry("future_A", _futureA), IntegerEntry("initial_A_time", blockTimestamp), IntegerEntry("future_A_time", _futureTime)] | |
1042 | 1177 | })) | |
1043 | 1178 | ||
1044 | 1179 | ||
1045 | 1180 | ||
1046 | 1181 | @Callable(msg) | |
1047 | 1182 | func stopRampA () = valueOrElse(isActive(), valueOrElse(isAdminCall(msg), { | |
1048 | 1183 | let currentA = _A() | |
1049 | 1184 | [IntegerEntry("initial_A", currentA), IntegerEntry("future_A", currentA), IntegerEntry("initial_A_time", blockTimestamp), IntegerEntry("future_A_time", blockTimestamp)] | |
1050 | 1185 | })) | |
1051 | 1186 | ||
1052 | 1187 | ||
1053 | 1188 | ||
1054 | 1189 | @Callable(msg) | |
1055 | 1190 | func shutdown () = valueOrElse(isAdminCall(msg), if (!(active)) | |
1056 | 1191 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
1057 | 1192 | else suspend("Paused by admin")) | |
1058 | 1193 | ||
1059 | 1194 | ||
1060 | 1195 | ||
1061 | 1196 | @Callable(msg) | |
1062 | 1197 | func activate () = valueOrElse(isAdminCall(msg), if (active) | |
1063 | 1198 | then throwIsActive() | |
1064 | 1199 | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
1065 | 1200 | ||
1066 | 1201 | ||
1067 | 1202 | ||
1068 | 1203 | @Callable(msg) | |
1069 | 1204 | func keepLimitForFirstHarvest (shareLimit) = valueOrElse(isActive(), valueOrElse(isAdminCall(msg), [IntegerEntry(kShareLimit, shareLimit)])) | |
1070 | 1205 | ||
1071 | 1206 | ||
1072 | 1207 | @Verifier(tx) | |
1073 | 1208 | func verify () = { | |
1074 | 1209 | let multiSignedByAdmins = { | |
1075 | 1210 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
1076 | 1211 | then 1 | |
1077 | 1212 | else 0 | |
1078 | 1213 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
1079 | 1214 | then 1 | |
1080 | 1215 | else 0 | |
1081 | 1216 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
1082 | 1217 | then 1 | |
1083 | 1218 | else 0 | |
1084 | 1219 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
1085 | 1220 | } | |
1086 | 1221 | match tx { | |
1087 | 1222 | case inv: InvokeScriptTransaction => | |
1088 | 1223 | let callTakeIntoAccount = if ((inv.dApp == this)) | |
1089 | 1224 | then (inv.function == "takeIntoAccountExtraFunds") | |
1090 | 1225 | else false | |
1091 | 1226 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
1092 | 1227 | then true | |
1093 | 1228 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
1094 | 1229 | then true | |
1095 | 1230 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
1096 | 1231 | then true | |
1097 | 1232 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyInvoke) | |
1098 | 1233 | if (if (callTakeIntoAccount) | |
1099 | 1234 | then signedByAdmin | |
1100 | 1235 | else false) | |
1101 | 1236 | then true | |
1102 | 1237 | else multiSignedByAdmins | |
1103 | 1238 | case _ => | |
1104 | 1239 | multiSignedByAdmins | |
1105 | 1240 | } | |
1106 | 1241 | } | |
1107 | 1242 |
github/deemru/w8io/026f985 158.84 ms ◑