tx · EbsRBQWZa8sJRpSdEuAtvhhzAdcEMshah6YSyeDUYVwo 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz: -0.02400000 Waves 2023.03.27 18:11 [2508531] smart account 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz > SELF 0.00000000 Waves
{ "type": 13, "id": "EbsRBQWZa8sJRpSdEuAtvhhzAdcEMshah6YSyeDUYVwo", "fee": 2400000, "feeAssetId": null, "timestamp": 1679929986663, "version": 2, "chainId": 84, "sender": "3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz", "senderPublicKey": "D28XoueZWsMfm8Y5pa6C5ZFuYoWgre2Wm8tzJANJgMnq", "proofs": [ "2j2xzJQvowKs6LZ7DhKsT4H5ri3oR5TjGS4r4Dj8bv54hrEoEqHGdzxw8V2JpiTErPtzLb7Vms9QkurpV6putD36" ], "script": "base64:BgK+IAgCEgMKAQgSAwoBCBIDCgEIEgASABIDCgEIEgQKAggBEgYKBAIBAgISAwoBCBIDCgEIEgUKAwgIBBIGCgQBGAgYEgQKAhgIEgQKAggIEgQKAggIEgMKAQgSBAoCCAgiBlNDQUxFOCIFTVVMVDMiBU1VTFQ4IgdTQ0FMRTE4IgZNVUxUMTgiA1NFUCIOUE9PTFdFSUdIVE1VTFQiCnplcm9CaWdJbnQiCW9uZUJpZ0ludCIHd3JhcEVyciIDbXNnIgh0aHJvd0VyciIJYXNBbnlMaXN0IgN2YWwiByRtYXRjaDAiCnZhbEFueUx5c3QiBWFzSW50IgZ2YWxJbnQiCGFzU3RyaW5nIgZ2YWxTdHIiDGFzQnl0ZVZlY3RvciIGdmFsQmluIg9nZXRTdHJpbmdPckZhaWwiB2FkZHJlc3MiA2tleSIYZ2V0U3RyaW5nQnlBZGRyZXNzT3JGYWlsIgxnZXRJbnRPclplcm8iD2dldEludE9yRGVmYXVsdCIKZGVmYXVsdFZhbCIMZ2V0SW50T3JGYWlsIhlnZXRCaWdJbnRGcm9tU3RyaW5n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JiVwQFAmFDBQJhRQUCY3IAAAJfMQQCY3oJALgCAgUCY2cFAmN5BAJjQQYEAmNCAwkAvwICBQJjegUBaAkA/AcEBQR0aGlzAg9jbGFpbVd4SU5URVJOQUwJAMwIAgUCYUMJAMwIAgUCYUUJAMwIAgUCY0EFA25pbAUDbmlsBQR1bml0AwkAAAIFAmNCBQJjQgQCZEEJAKIIAQkBAmJsAgUCYmgFAmFFBAJkeQUCZEEDCQABAgUCZHkCBFVuaXQJAJQKAgkAzAgCCQELRGVsZXRlRW50cnkBCQECYmUBBQJhQwUDbmlsBwMJAAECBQJkeQIGU3RyaW5nBAJkQgUCZHkJAJQKAgkAzAgCCQELU3RyaW5nRW50cnkCCQECYmUBBQJhQwUCZEIFA25pbAYJAAIBAgtNYXRjaCBlcnJvcgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECC01hdGNoIGVycm9yCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAmNuAQ5vbk1vZGlmeVdlaWdodAICYXUCYkEDCQECIT0CCAUCY24GY2FsbGVyBQJhWQkBAWwBAhJwZXJtaXNzaW9ucyBkZW5pZWQEAmRDCQECYnoDBQJhdQUCYkEAAAQCYngIBQJkQwJfMQQCYlkIBQJkQwJfMgQCYloIBQJkQwJfMwUCYlkBAmREAQJkRQAEAmRGBAFvCQECY2oAAwkAAQIFAW8CCkJ5dGVWZWN0b3IEAmNwBQFvBQJjcAMJAAECBQFvAgRVbml0CAUCZEQPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmRECWJvZHlCeXRlcwkAkQMCCAUCZEQGcHJvb2ZzAAAFAmRGXXHy5A==", "height": 2508531, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6ST3R7oAds1sqwyPD7hgcnwuz3VwoQXYE2fdK8tegr8p Next: Fxy6e2QGkatqZU7QT6sx8HAKTopY12XGXkVVoVtvm2Lm Diff:
Old | New | Differences | |
---|---|---|---|
29 | 29 | case valAnyLyst: List[Any] => | |
30 | 30 | valAnyLyst | |
31 | 31 | case _ => | |
32 | - | | |
32 | + | throwErr("fail to cast into List[Any]") | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
37 | 37 | case valInt: Int => | |
38 | 38 | valInt | |
39 | 39 | case _ => | |
40 | - | | |
40 | + | throwErr("fail to cast into Int") | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
45 | 45 | case valStr: String => | |
46 | 46 | valStr | |
47 | 47 | case _ => | |
48 | - | | |
48 | + | throwErr("fail to cast into Int") | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
53 | 53 | case valBin: ByteVector => | |
54 | 54 | valBin | |
55 | 55 | case _ => | |
56 | - | | |
56 | + | throwErr("fail to cast into Int") | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 | ||
60 | - | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
60 | + | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
61 | 61 | ||
62 | 62 | ||
63 | - | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
63 | + | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((((("mandatory " + toString(address)) + ".") + key) + " is not defined"))) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
69 | 69 | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
70 | 70 | ||
71 | 71 | ||
72 | - | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
72 | + | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func getBigIntFromStringOrZero (address,key) = value(parseBigInt(valueOrElse(getString(address, key), "0"))) | |
291 | 291 | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
292 | 292 | let checkNode = if (!(containsNode(listName, id))) | |
293 | 293 | then true | |
294 | - | else | |
294 | + | else throwErr("Node exists") | |
295 | 295 | if ((checkNode == checkNode)) | |
296 | 296 | then (([IntegerEntry(keyListSize(listName), (listSize + 1))] ++ (if ((headOrUnit != unit)) | |
297 | 297 | then [StringEntry(keyListNext(listName, id), value(headOrUnit)), StringEntry(keyListPrev(listName, value(headOrUnit)), id)] | |
315 | 315 | then [DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, value(prevOrUnit)))] | |
316 | 316 | else if ((id == valueOrElse(headOrUnit, ""))) | |
317 | 317 | then [DeleteEntry(keyListHead(listName))] | |
318 | - | else | |
318 | + | else throwErr(((("invalid node: " + listName) + ".") + id)))) | |
319 | 319 | } | |
320 | 320 | ||
321 | 321 | ||
329 | 329 | then (stakedByUser > zeroBigInt) | |
330 | 330 | else false) | |
331 | 331 | then value(parseBigInt(getStringOrFail(this, wxPerLpIntegralUserLastKEY))) | |
332 | - | else | |
332 | + | else throwErr("calcWxPerLpIntegralUserLast: unexpected state") | |
333 | 333 | ||
334 | 334 | ||
335 | 335 | func refreshPoolINTEGRALS (lpAssetIdStr,poolAddressStr,lpDeltaAmount) = { | |
365 | 365 | ||
366 | 366 | ||
367 | 367 | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
368 | - | let $ | |
369 | - | let wxPerLpIntegralNew = $ | |
370 | - | let poolIntegralSTATE = $ | |
371 | - | let poolDEBUG = $ | |
368 | + | let $t01481914941 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
369 | + | let wxPerLpIntegralNew = $t01481914941._1 | |
370 | + | let poolIntegralSTATE = $t01481914941._2 | |
371 | + | let poolDEBUG = $t01481914941._3 | |
372 | 372 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
373 | 373 | let stakedByUser = readStaked(stakedByUserKEY) | |
374 | 374 | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
406 | 406 | } | |
407 | 407 | ||
408 | 408 | ||
409 | - | let permissionDeniedError = | |
409 | + | let permissionDeniedError = throwErr("Permission denied") | |
410 | 410 | ||
411 | 411 | func mustThis (i) = if ((i.caller == this)) | |
412 | 412 | then true | |
440 | 440 | if ((refreshStakedVote == refreshStakedVote)) | |
441 | 441 | then { | |
442 | 442 | let stakedTotal = readStaked(stakedTotalKEY) | |
443 | - | let $ | |
444 | - | let wxToClaimUserNew = $ | |
445 | - | let integralSTATE = $ | |
446 | - | let debug = $ | |
443 | + | let $t01816018277 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
444 | + | let wxToClaimUserNew = $t01816018277._1 | |
445 | + | let integralSTATE = $t01816018277._2 | |
446 | + | let debug = $t01816018277._3 | |
447 | 447 | let listName = getUsersListName(lpAssetIdStr) | |
448 | 448 | let listActions = if (containsNode(listName, userAddressStr)) | |
449 | 449 | then nil | |
483 | 483 | else unit | |
484 | 484 | if ((r == r)) | |
485 | 485 | then if ((amount > stakedByUser)) | |
486 | - | then | |
486 | + | then throwErr(((((((("passed amount=" + toString(amount)) + " is greater than available=") + toString(stakedByUser)) + ". lpAssetId=") + lpAssetIdStr) + ". stakedByUserKEY=") + stakedByUserKEY)) | |
487 | 487 | else (([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(lpAssetRecipientAddress, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
488 | 488 | else throw("Strict value is not equal to itself.") | |
489 | 489 | } | |
533 | 533 | let pm = pendingManagerPublicKeyOrUnit() | |
534 | 534 | let hasPM = if (isDefined(pm)) | |
535 | 535 | then true | |
536 | - | else | |
536 | + | else throwErr("No pending manager") | |
537 | 537 | if ((hasPM == hasPM)) | |
538 | 538 | then { | |
539 | 539 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
540 | 540 | then true | |
541 | - | else | |
541 | + | else throwErr("You are not pending manager") | |
542 | 542 | if ((checkPM == checkPM)) | |
543 | 543 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
544 | 544 | else throw("Strict value is not equal to itself.") | |
550 | 550 | ||
551 | 551 | @Callable(i) | |
552 | 552 | func stake () = if ((size(i.payments) != 1)) | |
553 | - | then | |
553 | + | then throwErr("invalid payment - exact one payment must be attached") | |
554 | 554 | else { | |
555 | 555 | let pmt = i.payments[0] | |
556 | 556 | let lpAssetId = value(pmt.assetId) | |
557 | 557 | let lpAssetIdStr = toBase58String(lpAssetId) | |
558 | 558 | let amount = pmt.amount | |
559 | - | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
559 | + | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr))) | |
560 | 560 | let poolAddress = addressFromStringValue(poolAddressStr) | |
561 | 561 | let userAddress = if ((i.caller == poolAddress)) | |
562 | 562 | then i.originCaller | |
568 | 568 | ||
569 | 569 | @Callable(i) | |
570 | 570 | func stakeFor (userAddressStr) = if ((size(i.payments) != 1)) | |
571 | - | then | |
571 | + | then throwErr("invalid payment - exact one payment must be attached") | |
572 | 572 | else { | |
573 | 573 | let pmt = i.payments[0] | |
574 | 574 | let lpAssetId = value(pmt.assetId) | |
575 | 575 | let lpAssetIdStr = toBase58String(lpAssetId) | |
576 | 576 | let amount = pmt.amount | |
577 | - | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
577 | + | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr))) | |
578 | 578 | let poolAddress = addressFromStringValue(poolAddressStr) | |
579 | 579 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
580 | 580 | stakeActions(i, lpAssetId, poolAddress, userAddress, amount) | |
585 | 585 | @Callable(i) | |
586 | 586 | func unstake (lpAssetIdStr,amount) = { | |
587 | 587 | let lpAssetId = fromBase58String(lpAssetIdStr) | |
588 | - | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
588 | + | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr))) | |
589 | 589 | let poolAddress = addressFromStringValue(poolAddressStr) | |
590 | 590 | let poolAddon = valueOrElse(getString(poolAddress, keyAddonAddr()), poolAddressStr) | |
591 | 591 | let callerStr = toString(i.caller) | |
603 | 603 | @Callable(i) | |
604 | 604 | func unstakeINTERNAL (lpAssetId,amount,userAddress,lpAssetRecipientAddress) = { | |
605 | 605 | let lpAssetIdStr = toBase58String(lpAssetId) | |
606 | - | let poolAddress = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))) | |
606 | + | let poolAddress = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr)))) | |
607 | 607 | let checkCaller = if ((i.caller == poolAddress)) | |
608 | 608 | then true | |
609 | 609 | else permissionDeniedError | |
639 | 639 | let checkCaller = mustThis(i) | |
640 | 640 | if ((checkCaller == checkCaller)) | |
641 | 641 | then { | |
642 | - | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), "claimWxINTERNAL: invalid user address") | |
642 | + | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("claimWxINTERNAL: invalid user address")) | |
643 | 643 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
644 | 644 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
645 | 645 | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
649 | 649 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
650 | 650 | let claimedByUserBoostReward = getBigIntFromStringOrZero(this, claimedByUserBoostRewardKEY) | |
651 | 651 | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
652 | - | let $ | |
653 | - | let wxToClaimUserNew = $ | |
654 | - | let integralSTATE = $ | |
655 | - | let debug = $ | |
652 | + | let $t02631426426 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
653 | + | let wxToClaimUserNew = $t02631426426._1 | |
654 | + | let integralSTATE = $t02631426426._2 | |
655 | + | let debug = $t02631426426._3 | |
656 | 656 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
657 | 657 | if ((zeroBigInt >= availableToClaim)) | |
658 | 658 | then if (throwIfNothingToClaim) | |
659 | - | then | |
659 | + | then throwErr("nothing to claim") | |
660 | 660 | else $Tuple2(nil, 0) | |
661 | 661 | else { | |
662 | 662 | let wxAmountBoostTotal = max([asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]), 0]) | |
741 | 741 | else (height - emissionStartBlock) | |
742 | 742 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
743 | 743 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
744 | - | let $ | |
745 | - | let wxToClaimUserNew = $ | |
746 | - | let integralSTATE = $ | |
747 | - | let debug = $ | |
744 | + | let $t03047730589 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
745 | + | let wxToClaimUserNew = $t03047730589._1 | |
746 | + | let integralSTATE = $t03047730589._2 | |
747 | + | let debug = $t03047730589._3 | |
748 | 748 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
749 | 749 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
750 | 750 | let wxAmountBoostTotal = max([asInt(boostInvResult[0]), 0]) | |
818 | 818 | ||
819 | 819 | @Callable(i) | |
820 | 820 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
821 | - | then | |
821 | + | then throwErr("permissions denied") | |
822 | 822 | else { | |
823 | - | let $ | |
824 | - | let wxPerLpIntegralNew = $ | |
825 | - | let poolIntegralSTATE = $ | |
826 | - | let poolDEBUG = $ | |
823 | + | let $t03321333323 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
824 | + | let wxPerLpIntegralNew = $t03321333323._1 | |
825 | + | let poolIntegralSTATE = $t03321333323._2 | |
826 | + | let poolDEBUG = $t03321333323._3 | |
827 | 827 | poolIntegralSTATE | |
828 | 828 | } | |
829 | 829 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 8 | |
5 | 5 | ||
6 | 6 | let MULT3 = 1000 | |
7 | 7 | ||
8 | 8 | let MULT8 = 100000000 | |
9 | 9 | ||
10 | 10 | let SCALE18 = 18 | |
11 | 11 | ||
12 | 12 | let MULT18 = toBigInt(1000000000000000000) | |
13 | 13 | ||
14 | 14 | let SEP = "__" | |
15 | 15 | ||
16 | 16 | let POOLWEIGHTMULT = MULT8 | |
17 | 17 | ||
18 | 18 | let zeroBigInt = toBigInt(0) | |
19 | 19 | ||
20 | 20 | let oneBigInt = toBigInt(1) | |
21 | 21 | ||
22 | 22 | func wrapErr (msg) = makeString(["staking.ride:", toString(this), msg], " ") | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func throwErr (msg) = throw(wrapErr(msg)) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func asAnyList (val) = match val { | |
29 | 29 | case valAnyLyst: List[Any] => | |
30 | 30 | valAnyLyst | |
31 | 31 | case _ => | |
32 | - | | |
32 | + | throwErr("fail to cast into List[Any]") | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func asInt (val) = match val { | |
37 | 37 | case valInt: Int => | |
38 | 38 | valInt | |
39 | 39 | case _ => | |
40 | - | | |
40 | + | throwErr("fail to cast into Int") | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func asString (val) = match val { | |
45 | 45 | case valStr: String => | |
46 | 46 | valStr | |
47 | 47 | case _ => | |
48 | - | | |
48 | + | throwErr("fail to cast into Int") | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func asByteVector (val) = match val { | |
53 | 53 | case valBin: ByteVector => | |
54 | 54 | valBin | |
55 | 55 | case _ => | |
56 | - | | |
56 | + | throwErr("fail to cast into Int") | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 | ||
60 | - | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
60 | + | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
61 | 61 | ||
62 | 62 | ||
63 | - | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
63 | + | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((((("mandatory " + toString(address)) + ".") + key) + " is not defined"))) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
70 | 70 | ||
71 | 71 | ||
72 | - | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
72 | + | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func getBigIntFromStringOrZero (address,key) = value(parseBigInt(valueOrElse(getString(address, key), "0"))) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func getBigIntFromStringOrDefault (address,key,defaultVal) = match getString(address, key) { | |
79 | 79 | case s: String => | |
80 | 80 | value(parseBigInt(s)) | |
81 | 81 | case _: Unit => | |
82 | 82 | defaultVal | |
83 | 83 | case _ => | |
84 | 84 | throw("Match error") | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult)) | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18)) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func keyVotingEmissionContract () = "%s__votingEmissionContract" | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | let IdxFactoryCfgStakingDapp = 1 | |
101 | 101 | ||
102 | 102 | let IdxFactoryCfgBoostingDapp = 2 | |
103 | 103 | ||
104 | 104 | let IdxFactoryCfgIdoDapp = 3 | |
105 | 105 | ||
106 | 106 | let IdxFactoryCfgTeamDapp = 4 | |
107 | 107 | ||
108 | 108 | let IdxFactoryCfgEmissionDapp = 5 | |
109 | 109 | ||
110 | 110 | let IdxFactoryCfgRestDapp = 6 | |
111 | 111 | ||
112 | 112 | let IdxFactoryCfgSlippageDapp = 7 | |
113 | 113 | ||
114 | 114 | func keyFactoryCfg () = "%s__factoryConfig" | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func keyStablePoolAddonAddr () = "%s__stablePoolAddonAddr" | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func keyAddonAddr () = "%s__addonAddr" | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func keyFactoryLpList () = "%s__lpTokensList" | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func readLpList (factory) = split(valueOrElse(getString(factory, keyFactoryLpList()), ""), SEP) | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP) | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
148 | 148 | ||
149 | 149 | ||
150 | 150 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP) | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr) | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func keyClaimedByUser (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimed", userAddressStr, lpAssetIdStr], SEP) | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func keyClaimedByUserMinReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedMinReward", userAddressStr, lpAssetIdStr], SEP) | |
181 | 181 | ||
182 | 182 | ||
183 | 183 | func keyClaimedByUserBoostReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedBoostReward", userAddressStr, lpAssetIdStr], SEP) | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed__total", lpAssetIdStr], SEP) | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | func readStaked (key) = valueOrElse(getInteger(this, key), 0) | |
190 | 190 | ||
191 | 191 | ||
192 | 192 | func keyLastTotalLpBalance (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "bal"], SEP) | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | func keyLastUserLpBalance (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "bal"], SEP) | |
196 | 196 | ||
197 | 197 | ||
198 | 198 | func keyTotalLpBalanceIntegral (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "balINT"], SEP) | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | func keyUserLpBalanceIntegral (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "balINT"], SEP) | |
202 | 202 | ||
203 | 203 | ||
204 | 204 | func keyTotalLpBalanceIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "lastUpd"], SEP) | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | func keyUserLpBalanceIntegralLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "lastUpd"], SEP) | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | func keyWxPerLpIntegral (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpInt"], SEP) | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | func keyWxPerLpIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpIntH"], SEP) | |
214 | 214 | ||
215 | 215 | ||
216 | 216 | func keyWxToClaimUser (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpInt"], SEP) | |
217 | 217 | ||
218 | 218 | ||
219 | 219 | func keyWxPerLpIntegralUserLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpIntH"], SEP) | |
220 | 220 | ||
221 | 221 | ||
222 | 222 | func keyWxPerLp (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLp"], SEP) | |
223 | 223 | ||
224 | 224 | ||
225 | 225 | func keyWxPerLpX18 (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLpX18"], SEP) | |
226 | 226 | ||
227 | 227 | ||
228 | 228 | func keyWxPerLpIntegralUserLast (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "uIntL"], SEP) | |
229 | 229 | ||
230 | 230 | ||
231 | 231 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
232 | 232 | ||
233 | 233 | ||
234 | 234 | func formatHistoryRecord (userAddress,lpAssetId,type,amount) = makeString(["%s%s%s%d%d%d", userAddress, lpAssetId, type, toString(height), toString(lastBlock.timestamp), toString(amount)], SEP) | |
235 | 235 | ||
236 | 236 | ||
237 | 237 | func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount)) | |
238 | 238 | ||
239 | 239 | ||
240 | 240 | let factoryAddress = getStringOrFail(this, keyFactoryAddress()) | |
241 | 241 | ||
242 | 242 | let factoryContract = addressFromStringValue(factoryAddress) | |
243 | 243 | ||
244 | 244 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
245 | 245 | ||
246 | 246 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
247 | 247 | ||
248 | 248 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
249 | 249 | ||
250 | 250 | let boostCoeff = { | |
251 | 251 | let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil) | |
252 | 252 | if ($isInstanceOf(@, "Int")) | |
253 | 253 | then @ | |
254 | 254 | else throw(($getType(@) + " couldn't be cast to Int")) | |
255 | 255 | } | |
256 | 256 | ||
257 | 257 | let lpStakingPoolsContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(makeString(["%s", "lpStakingPoolsContract"], SEP)), wrapErr("lp_staking_pools contract address is undefined"))), wrapErr("invalid lp_staking_pools contract address")) | |
258 | 258 | ||
259 | 259 | func keyNextUser (lpAssetId) = makeString(["%s%s", lpAssetId, "nextUser"], SEP) | |
260 | 260 | ||
261 | 261 | ||
262 | 262 | func getUsersListName (lpAssetId) = makeString(["users", lpAssetId], SEP) | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | func keyListHead (listName) = makeString(["%s%s%s", listName, "head"], SEP) | |
266 | 266 | ||
267 | 267 | ||
268 | 268 | func keyListSize (listName) = makeString(["%s%s%s", listName, "size"], SEP) | |
269 | 269 | ||
270 | 270 | ||
271 | 271 | func keyListPrev (listName,id) = makeString(["%s%s%s%s", listName, id, "prev"], SEP) | |
272 | 272 | ||
273 | 273 | ||
274 | 274 | func keyListNext (listName,id) = makeString(["%s%s%s%s", listName, id, "next"], SEP) | |
275 | 275 | ||
276 | 276 | ||
277 | 277 | func containsNode (listName,id) = { | |
278 | 278 | let headOrUnit = getString(this, keyListHead(listName)) | |
279 | 279 | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
280 | 280 | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
281 | 281 | if (if ((id == valueOrElse(headOrUnit, ""))) | |
282 | 282 | then true | |
283 | 283 | else (prevOrUnit != unit)) | |
284 | 284 | then true | |
285 | 285 | else (nextOrUnit != unit) | |
286 | 286 | } | |
287 | 287 | ||
288 | 288 | ||
289 | 289 | func insertNodeActions (listName,id) = { | |
290 | 290 | let headOrUnit = getString(this, keyListHead(listName)) | |
291 | 291 | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
292 | 292 | let checkNode = if (!(containsNode(listName, id))) | |
293 | 293 | then true | |
294 | - | else | |
294 | + | else throwErr("Node exists") | |
295 | 295 | if ((checkNode == checkNode)) | |
296 | 296 | then (([IntegerEntry(keyListSize(listName), (listSize + 1))] ++ (if ((headOrUnit != unit)) | |
297 | 297 | then [StringEntry(keyListNext(listName, id), value(headOrUnit)), StringEntry(keyListPrev(listName, value(headOrUnit)), id)] | |
298 | 298 | else nil)) ++ [StringEntry(keyListHead(listName), id)]) | |
299 | 299 | else throw("Strict value is not equal to itself.") | |
300 | 300 | } | |
301 | 301 | ||
302 | 302 | ||
303 | 303 | func deleteNodeActions (listName,id) = { | |
304 | 304 | let headOrUnit = getString(this, keyListHead(listName)) | |
305 | 305 | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
306 | 306 | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
307 | 307 | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
308 | 308 | ([IntegerEntry(keyListSize(listName), (listSize - 1))] ++ (if (if ((prevOrUnit != unit)) | |
309 | 309 | then (nextOrUnit != unit) | |
310 | 310 | else false) | |
311 | 311 | then [StringEntry(keyListNext(listName, value(prevOrUnit)), value(nextOrUnit)), StringEntry(keyListPrev(listName, value(nextOrUnit)), value(prevOrUnit)), DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, id))] | |
312 | 312 | else if ((nextOrUnit != unit)) | |
313 | 313 | then [StringEntry(keyListHead(listName), value(nextOrUnit)), DeleteEntry(keyListNext(listName, id)), DeleteEntry(keyListPrev(listName, value(nextOrUnit)))] | |
314 | 314 | else if ((prevOrUnit != unit)) | |
315 | 315 | then [DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, value(prevOrUnit)))] | |
316 | 316 | else if ((id == valueOrElse(headOrUnit, ""))) | |
317 | 317 | then [DeleteEntry(keyListHead(listName))] | |
318 | - | else | |
318 | + | else throwErr(((("invalid node: " + listName) + ".") + id)))) | |
319 | 319 | } | |
320 | 320 | ||
321 | 321 | ||
322 | 322 | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == zeroBigInt)) | |
323 | 323 | then (stakedByUser > zeroBigInt) | |
324 | 324 | else false) | |
325 | 325 | then zeroBigInt | |
326 | 326 | else if ((stakedByUser == zeroBigInt)) | |
327 | 327 | then wxPerLpIntegralNew | |
328 | 328 | else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > zeroBigInt)) | |
329 | 329 | then (stakedByUser > zeroBigInt) | |
330 | 330 | else false) | |
331 | 331 | then value(parseBigInt(getStringOrFail(this, wxPerLpIntegralUserLastKEY))) | |
332 | - | else | |
332 | + | else throwErr("calcWxPerLpIntegralUserLast: unexpected state") | |
333 | 333 | ||
334 | 334 | ||
335 | 335 | func refreshPoolINTEGRALS (lpAssetIdStr,poolAddressStr,lpDeltaAmount) = { | |
336 | 336 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
337 | 337 | let stakedTotal = toBigInt(readStaked(stakedTotalKEY)) | |
338 | 338 | let nonZeroStakedTotal = if ((stakedTotal == zeroBigInt)) | |
339 | 339 | then oneBigInt | |
340 | 340 | else stakedTotal | |
341 | 341 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
342 | 342 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
343 | 343 | let wxEmissionPerBlockX3 = (getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) * MULT3) | |
344 | 344 | let poolWxEmissionPerBlockX3 = fraction(wxEmissionPerBlockX3, poolWeight, (POOLWEIGHTMULT * boostCoeff)) | |
345 | 345 | let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr) | |
346 | 346 | let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr) | |
347 | 347 | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
348 | 348 | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
349 | 349 | let wxPerLpIntegral = getBigIntFromStringOrZero(this, wxPerLpIntegralKEY) | |
350 | 350 | let wxPerLpOrZeroX3 = 0 | |
351 | 351 | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
352 | 352 | let wxPerLpX3 = if ((wxPerLpOrZeroX3 != 0)) | |
353 | 353 | then toBigInt(wxPerLpOrZeroX3) | |
354 | 354 | else fraction(toBigInt(poolWxEmissionPerBlockX3), toBigInt(MULT8), nonZeroStakedTotal) | |
355 | 355 | let stakedTotalNew = (stakedTotal + toBigInt(lpDeltaAmount)) | |
356 | 356 | let nonZeroStakedTotalNew = if ((stakedTotalNew == zeroBigInt)) | |
357 | 357 | then oneBigInt | |
358 | 358 | else stakedTotalNew | |
359 | 359 | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX3 * toBigInt(dh))) | |
360 | 360 | let wxPerLpX3New = (toBigInt(poolWxEmissionPerBlockX3) / nonZeroStakedTotalNew) | |
361 | 361 | let wxPerLpIntegralLastUpdHeightNew = height | |
362 | 362 | let debug = makeString([toString(wxPerLpIntegralNew), toString(dh), toString(wxPerLpX3), toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), toString(poolWeight)], "::") | |
363 | 363 | $Tuple3(wxPerLpIntegralNew, [StringEntry(wxPerLpIntegralKEY, toString(wxPerLpIntegralNew)), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), StringEntry(wxPerLpKEY, toString(wxPerLpX3New))], debug) | |
364 | 364 | } | |
365 | 365 | ||
366 | 366 | ||
367 | 367 | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
368 | - | let $ | |
369 | - | let wxPerLpIntegralNew = $ | |
370 | - | let poolIntegralSTATE = $ | |
371 | - | let poolDEBUG = $ | |
368 | + | let $t01481914941 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
369 | + | let wxPerLpIntegralNew = $t01481914941._1 | |
370 | + | let poolIntegralSTATE = $t01481914941._2 | |
371 | + | let poolDEBUG = $t01481914941._3 | |
372 | 372 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
373 | 373 | let stakedByUser = readStaked(stakedByUserKEY) | |
374 | 374 | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
375 | 375 | let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr) | |
376 | 376 | let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr) | |
377 | 377 | let wxToClaimUser = getBigIntFromStringOrZero(this, wxToClaimUserKEY) | |
378 | 378 | let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY) | |
379 | 379 | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(toBigInt(stakedByUser), toBigInt(wxPerLpIntegralUserLastUpdHeightOrZero), wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
380 | 380 | let MULT11 = (MULT8 * MULT3) | |
381 | 381 | let wxToClaimUserNew = max([(wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), toBigInt(stakedByUser), toBigInt(MULT11))), zeroBigInt]) | |
382 | 382 | let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew | |
383 | 383 | let wxPerLpIntegralUserLastUpdHeightNew = height | |
384 | 384 | let debug = makeString([toString(wxToClaimUser), toString(wxPerLpIntegralUserLast), toString(stakedByUser), poolDEBUG, toString(height)], "::") | |
385 | 385 | $Tuple3(wxToClaimUserNew, (poolIntegralSTATE ++ [StringEntry(wxToClaimUserKEY, toString(wxToClaimUserNew)), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), StringEntry(wxPerLpIntegralUserLastKEY, toString(wxPerLpIntegralUserLastNew))]), debug) | |
386 | 386 | } | |
387 | 387 | ||
388 | 388 | ||
389 | 389 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
390 | 390 | case s: String => | |
391 | 391 | fromBase58String(s) | |
392 | 392 | case _: Unit => | |
393 | 393 | unit | |
394 | 394 | case _ => | |
395 | 395 | throw("Match error") | |
396 | 396 | } | |
397 | 397 | ||
398 | 398 | ||
399 | 399 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
400 | 400 | case s: String => | |
401 | 401 | fromBase58String(s) | |
402 | 402 | case _: Unit => | |
403 | 403 | unit | |
404 | 404 | case _ => | |
405 | 405 | throw("Match error") | |
406 | 406 | } | |
407 | 407 | ||
408 | 408 | ||
409 | - | let permissionDeniedError = | |
409 | + | let permissionDeniedError = throwErr("Permission denied") | |
410 | 410 | ||
411 | 411 | func mustThis (i) = if ((i.caller == this)) | |
412 | 412 | then true | |
413 | 413 | else permissionDeniedError | |
414 | 414 | ||
415 | 415 | ||
416 | 416 | func mustManager (i) = match managerPublicKeyOrUnit() { | |
417 | 417 | case pk: ByteVector => | |
418 | 418 | if ((i.callerPublicKey == pk)) | |
419 | 419 | then true | |
420 | 420 | else permissionDeniedError | |
421 | 421 | case _: Unit => | |
422 | 422 | if ((i.caller == this)) | |
423 | 423 | then true | |
424 | 424 | else permissionDeniedError | |
425 | 425 | case _ => | |
426 | 426 | throw("Match error") | |
427 | 427 | } | |
428 | 428 | ||
429 | 429 | ||
430 | 430 | func stakeActions (i,lpAssetId,poolAddress,userAddress,amount) = { | |
431 | 431 | let userAddressStr = toString(userAddress) | |
432 | 432 | let lpAssetIdStr = toBase58String(lpAssetId) | |
433 | 433 | let poolAddressStr = toString(poolAddress) | |
434 | 434 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
435 | 435 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
436 | 436 | let stakedByUser = readStaked(stakedByUserKEY) | |
437 | 437 | let refreshStakedVote = if ((stakedByUser == 0)) | |
438 | 438 | then invoke(boostingContract, "onStakedVoteUpdate", [lpAssetIdStr, userAddressStr, true], nil) | |
439 | 439 | else unit | |
440 | 440 | if ((refreshStakedVote == refreshStakedVote)) | |
441 | 441 | then { | |
442 | 442 | let stakedTotal = readStaked(stakedTotalKEY) | |
443 | - | let $ | |
444 | - | let wxToClaimUserNew = $ | |
445 | - | let integralSTATE = $ | |
446 | - | let debug = $ | |
443 | + | let $t01816018277 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
444 | + | let wxToClaimUserNew = $t01816018277._1 | |
445 | + | let integralSTATE = $t01816018277._2 | |
446 | + | let debug = $t01816018277._3 | |
447 | 447 | let listName = getUsersListName(lpAssetIdStr) | |
448 | 448 | let listActions = if (containsNode(listName, userAddressStr)) | |
449 | 449 | then nil | |
450 | 450 | else insertNodeActions(listName, userAddressStr) | |
451 | 451 | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
452 | 452 | } | |
453 | 453 | else throw("Strict value is not equal to itself.") | |
454 | 454 | } | |
455 | 455 | ||
456 | 456 | ||
457 | 457 | func unstakeActions (i,lpAssetId,poolAddress,userAddress,lpAssetRecipientAddress,amount) = { | |
458 | 458 | let userAddressStr = toString(userAddress) | |
459 | 459 | let lpAssetIdStr = toBase58String(lpAssetId) | |
460 | 460 | let poolAddressStr = toString(poolAddress) | |
461 | 461 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
462 | 462 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
463 | 463 | let stakedByUser = readStaked(stakedByUserKEY) | |
464 | 464 | let stakedTotal = readStaked(stakedTotalKEY) | |
465 | 465 | let integralSTATE = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))._2 | |
466 | 466 | let listName = getUsersListName(lpAssetIdStr) | |
467 | 467 | let listActions = if (if (containsNode(listName, userAddressStr)) | |
468 | 468 | then (amount == stakedByUser) | |
469 | 469 | else false) | |
470 | 470 | then deleteNodeActions(listName, userAddressStr) | |
471 | 471 | else nil | |
472 | 472 | let refreshStakedVote = if ((amount == stakedByUser)) | |
473 | 473 | then invoke(boostingContract, "onStakedVoteUpdate", [lpAssetIdStr, userAddressStr, false], nil) | |
474 | 474 | else unit | |
475 | 475 | if ((refreshStakedVote == refreshStakedVote)) | |
476 | 476 | then { | |
477 | 477 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)) | |
478 | 478 | let wxToClaimUserNew = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0)._1 | |
479 | 479 | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
480 | 480 | let throwIfNothingToClaim = true | |
481 | 481 | let r = if ((availableToClaim > zeroBigInt)) | |
482 | 482 | then invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
483 | 483 | else unit | |
484 | 484 | if ((r == r)) | |
485 | 485 | then if ((amount > stakedByUser)) | |
486 | - | then | |
486 | + | then throwErr(((((((("passed amount=" + toString(amount)) + " is greater than available=") + toString(stakedByUser)) + ". lpAssetId=") + lpAssetIdStr) + ". stakedByUserKEY=") + stakedByUserKEY)) | |
487 | 487 | else (([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(lpAssetRecipientAddress, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
488 | 488 | else throw("Strict value is not equal to itself.") | |
489 | 489 | } | |
490 | 490 | else throw("Strict value is not equal to itself.") | |
491 | 491 | } | |
492 | 492 | ||
493 | 493 | ||
494 | 494 | @Callable(i) | |
495 | 495 | func constructor (factoryAddressStr) = { | |
496 | 496 | let checkCaller = mustManager(i) | |
497 | 497 | if ((checkCaller == checkCaller)) | |
498 | 498 | then [StringEntry(keyFactoryAddress(), factoryAddressStr)] | |
499 | 499 | else throw("Strict value is not equal to itself.") | |
500 | 500 | } | |
501 | 501 | ||
502 | 502 | ||
503 | 503 | ||
504 | 504 | @Callable(i) | |
505 | 505 | func constructorV2 (votingEmissionContract) = { | |
506 | 506 | let cheks = [mustManager(i), if ((addressFromString(votingEmissionContract) != unit)) | |
507 | 507 | then true | |
508 | 508 | else "invalid voting emission contract address"] | |
509 | 509 | if ((cheks == cheks)) | |
510 | 510 | then [StringEntry(keyVotingEmissionContract(), votingEmissionContract)] | |
511 | 511 | else throw("Strict value is not equal to itself.") | |
512 | 512 | } | |
513 | 513 | ||
514 | 514 | ||
515 | 515 | ||
516 | 516 | @Callable(i) | |
517 | 517 | func setManager (pendingManagerPublicKey) = { | |
518 | 518 | let checkCaller = mustManager(i) | |
519 | 519 | if ((checkCaller == checkCaller)) | |
520 | 520 | then { | |
521 | 521 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
522 | 522 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
523 | 523 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
524 | 524 | else throw("Strict value is not equal to itself.") | |
525 | 525 | } | |
526 | 526 | else throw("Strict value is not equal to itself.") | |
527 | 527 | } | |
528 | 528 | ||
529 | 529 | ||
530 | 530 | ||
531 | 531 | @Callable(i) | |
532 | 532 | func confirmManager () = { | |
533 | 533 | let pm = pendingManagerPublicKeyOrUnit() | |
534 | 534 | let hasPM = if (isDefined(pm)) | |
535 | 535 | then true | |
536 | - | else | |
536 | + | else throwErr("No pending manager") | |
537 | 537 | if ((hasPM == hasPM)) | |
538 | 538 | then { | |
539 | 539 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
540 | 540 | then true | |
541 | - | else | |
541 | + | else throwErr("You are not pending manager") | |
542 | 542 | if ((checkPM == checkPM)) | |
543 | 543 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
544 | 544 | else throw("Strict value is not equal to itself.") | |
545 | 545 | } | |
546 | 546 | else throw("Strict value is not equal to itself.") | |
547 | 547 | } | |
548 | 548 | ||
549 | 549 | ||
550 | 550 | ||
551 | 551 | @Callable(i) | |
552 | 552 | func stake () = if ((size(i.payments) != 1)) | |
553 | - | then | |
553 | + | then throwErr("invalid payment - exact one payment must be attached") | |
554 | 554 | else { | |
555 | 555 | let pmt = i.payments[0] | |
556 | 556 | let lpAssetId = value(pmt.assetId) | |
557 | 557 | let lpAssetIdStr = toBase58String(lpAssetId) | |
558 | 558 | let amount = pmt.amount | |
559 | - | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
559 | + | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr))) | |
560 | 560 | let poolAddress = addressFromStringValue(poolAddressStr) | |
561 | 561 | let userAddress = if ((i.caller == poolAddress)) | |
562 | 562 | then i.originCaller | |
563 | 563 | else i.caller | |
564 | 564 | stakeActions(i, lpAssetId, poolAddress, userAddress, amount) | |
565 | 565 | } | |
566 | 566 | ||
567 | 567 | ||
568 | 568 | ||
569 | 569 | @Callable(i) | |
570 | 570 | func stakeFor (userAddressStr) = if ((size(i.payments) != 1)) | |
571 | - | then | |
571 | + | then throwErr("invalid payment - exact one payment must be attached") | |
572 | 572 | else { | |
573 | 573 | let pmt = i.payments[0] | |
574 | 574 | let lpAssetId = value(pmt.assetId) | |
575 | 575 | let lpAssetIdStr = toBase58String(lpAssetId) | |
576 | 576 | let amount = pmt.amount | |
577 | - | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
577 | + | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr))) | |
578 | 578 | let poolAddress = addressFromStringValue(poolAddressStr) | |
579 | 579 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
580 | 580 | stakeActions(i, lpAssetId, poolAddress, userAddress, amount) | |
581 | 581 | } | |
582 | 582 | ||
583 | 583 | ||
584 | 584 | ||
585 | 585 | @Callable(i) | |
586 | 586 | func unstake (lpAssetIdStr,amount) = { | |
587 | 587 | let lpAssetId = fromBase58String(lpAssetIdStr) | |
588 | - | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
588 | + | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr))) | |
589 | 589 | let poolAddress = addressFromStringValue(poolAddressStr) | |
590 | 590 | let poolAddon = valueOrElse(getString(poolAddress, keyAddonAddr()), poolAddressStr) | |
591 | 591 | let callerStr = toString(i.caller) | |
592 | 592 | let userAddress = if (if ((callerStr == poolAddressStr)) | |
593 | 593 | then true | |
594 | 594 | else (callerStr == poolAddon)) | |
595 | 595 | then i.originCaller | |
596 | 596 | else i.caller | |
597 | 597 | let lpAssetRecipientAddress = i.caller | |
598 | 598 | unstakeActions(i, lpAssetId, poolAddress, userAddress, lpAssetRecipientAddress, amount) | |
599 | 599 | } | |
600 | 600 | ||
601 | 601 | ||
602 | 602 | ||
603 | 603 | @Callable(i) | |
604 | 604 | func unstakeINTERNAL (lpAssetId,amount,userAddress,lpAssetRecipientAddress) = { | |
605 | 605 | let lpAssetIdStr = toBase58String(lpAssetId) | |
606 | - | let poolAddress = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))) | |
606 | + | let poolAddress = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr)))) | |
607 | 607 | let checkCaller = if ((i.caller == poolAddress)) | |
608 | 608 | then true | |
609 | 609 | else permissionDeniedError | |
610 | 610 | if ((checkCaller == checkCaller)) | |
611 | 611 | then unstakeActions(i, lpAssetId, poolAddress, Address(userAddress), Address(lpAssetRecipientAddress), amount) | |
612 | 612 | else throw("Strict value is not equal to itself.") | |
613 | 613 | } | |
614 | 614 | ||
615 | 615 | ||
616 | 616 | ||
617 | 617 | @Callable(i) | |
618 | 618 | func claimWx (lpAssetIdStr) = { | |
619 | 619 | let userAddressStr = toString(i.caller) | |
620 | 620 | let throwIfNothingToClaim = true | |
621 | 621 | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
622 | 622 | $Tuple2(nil, result) | |
623 | 623 | } | |
624 | 624 | ||
625 | 625 | ||
626 | 626 | ||
627 | 627 | @Callable(i) | |
628 | 628 | func claimWxDoNotThrow (lpAssetIdStr) = { | |
629 | 629 | let userAddressStr = toString(i.caller) | |
630 | 630 | let throwIfNothingToClaim = false | |
631 | 631 | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
632 | 632 | $Tuple2(nil, result) | |
633 | 633 | } | |
634 | 634 | ||
635 | 635 | ||
636 | 636 | ||
637 | 637 | @Callable(i) | |
638 | 638 | func claimWxINTERNAL (lpAssetIdStr,userAddressStr,throwIfNothingToClaim) = { | |
639 | 639 | let checkCaller = mustThis(i) | |
640 | 640 | if ((checkCaller == checkCaller)) | |
641 | 641 | then { | |
642 | - | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), "claimWxINTERNAL: invalid user address") | |
642 | + | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("claimWxINTERNAL: invalid user address")) | |
643 | 643 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
644 | 644 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
645 | 645 | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
646 | 646 | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
647 | 647 | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
648 | 648 | let claimedByUser = getBigIntFromStringOrZero(this, claimedByUserKEY) | |
649 | 649 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
650 | 650 | let claimedByUserBoostReward = getBigIntFromStringOrZero(this, claimedByUserBoostRewardKEY) | |
651 | 651 | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
652 | - | let $ | |
653 | - | let wxToClaimUserNew = $ | |
654 | - | let integralSTATE = $ | |
655 | - | let debug = $ | |
652 | + | let $t02631426426 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
653 | + | let wxToClaimUserNew = $t02631426426._1 | |
654 | + | let integralSTATE = $t02631426426._2 | |
655 | + | let debug = $t02631426426._3 | |
656 | 656 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
657 | 657 | if ((zeroBigInt >= availableToClaim)) | |
658 | 658 | then if (throwIfNothingToClaim) | |
659 | - | then | |
659 | + | then throwErr("nothing to claim") | |
660 | 660 | else $Tuple2(nil, 0) | |
661 | 661 | else { | |
662 | 662 | let wxAmountBoostTotal = max([asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]), 0]) | |
663 | 663 | let minRewardPart = availableToClaim | |
664 | 664 | let boostRewardPart = min([(minRewardPart * toBigInt((boostCoeff - 1))), toBigInt(wxAmountBoostTotal)]) | |
665 | 665 | let totalReward = (minRewardPart + boostRewardPart) | |
666 | 666 | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
667 | 667 | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
668 | 668 | if ((emitBoost == emitBoost)) | |
669 | 669 | then { | |
670 | 670 | let claimedByUserValue = ((claimedByUser + minRewardPart) + boostRewardPart) | |
671 | 671 | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
672 | 672 | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserBoostReward + boostRewardPart) | |
673 | 673 | let claimedTotalPlusAvailableToClaim = (claimedTotal + availableToClaim) | |
674 | 674 | $Tuple2([StringEntry(claimedByUserKEY, toString(claimedByUserValue)), StringEntry(claimedByUserMinRewardKEY, toString(claimedByUserMinRewardPlusPart)), StringEntry(claimedByUserBoostRewardKEY, toString(claimedByUserBoostRewardPlusBoostRewardPart)), StringEntry(claimedTotalKEY, toString(claimedTotalPlusAvailableToClaim)), ScriptTransfer(userAddress, toInt(minRewardPart), wxAssetId), ScriptTransfer(userAddress, toInt(boostRewardPart), wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, toInt(availableToClaim), i.transactionId)], toInt(totalReward)) | |
675 | 675 | } | |
676 | 676 | else throw("Strict value is not equal to itself.") | |
677 | 677 | } | |
678 | 678 | } | |
679 | 679 | else throw("Strict value is not equal to itself.") | |
680 | 680 | } | |
681 | 681 | ||
682 | 682 | ||
683 | 683 | ||
684 | 684 | @Callable(i) | |
685 | 685 | func claimWxBulkInternalREADONLY (currentIter,lpAssetIds,userAddressStr,resAcc) = if ((currentIter == size(lpAssetIds))) | |
686 | 686 | then $Tuple2(nil, resAcc) | |
687 | 687 | else { | |
688 | 688 | let lpAssetId = lpAssetIds[currentIter] | |
689 | 689 | let info = split({ | |
690 | 690 | let @ = invoke(this, "claimWxREADONLY", [lpAssetId, userAddressStr], nil) | |
691 | 691 | if ($isInstanceOf(@, "String")) | |
692 | 692 | then @ | |
693 | 693 | else throw(($getType(@) + " couldn't be cast to String")) | |
694 | 694 | }, SEP) | |
695 | 695 | let unclaimed = info[3] | |
696 | 696 | let claimed = info[4] | |
697 | 697 | let userVoteFinalized = { | |
698 | 698 | let @ = invoke(boostingContract, "getUserVoteFinalizedREADONLY", [lpAssetId, userAddressStr], nil) | |
699 | 699 | if ($isInstanceOf(@, "Int")) | |
700 | 700 | then @ | |
701 | 701 | else throw(($getType(@) + " couldn't be cast to Int")) | |
702 | 702 | } | |
703 | 703 | let res = (resAcc :+ makeString(["%d%d%d", unclaimed, claimed, toString(userVoteFinalized)], SEP)) | |
704 | 704 | let inv = { | |
705 | 705 | let @ = invoke(this, "claimWxBulkInternalREADONLY", [(currentIter + 1), lpAssetIds, userAddressStr, res], nil) | |
706 | 706 | if ($isInstanceOf(@, "List[Any]")) | |
707 | 707 | then @ | |
708 | 708 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
709 | 709 | } | |
710 | 710 | if ((inv == inv)) | |
711 | 711 | then $Tuple2(nil, inv) | |
712 | 712 | else throw("Strict value is not equal to itself.") | |
713 | 713 | } | |
714 | 714 | ||
715 | 715 | ||
716 | 716 | ||
717 | 717 | @Callable(i) | |
718 | 718 | func claimWxBulkREADONLY (lpAssetIds,userAddressStr) = { | |
719 | 719 | let res = invoke(this, "claimWxBulkInternalREADONLY", [0, lpAssetIds, userAddressStr, nil], nil) | |
720 | 720 | $Tuple2(nil, res) | |
721 | 721 | } | |
722 | 722 | ||
723 | 723 | ||
724 | 724 | ||
725 | 725 | @Callable(i) | |
726 | 726 | func claimWxREADONLY (lpAssetIdStr,userAddressStr) = { | |
727 | 727 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
728 | 728 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
729 | 729 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
730 | 730 | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
731 | 731 | let stakedByUser = readStaked(stakedByUserKEY) | |
732 | 732 | let stakedTotal = readStaked(stakedTotalKEY) | |
733 | 733 | let claimedByUser = getBigIntFromStringOrZero(this, claimedByUserKEY) | |
734 | 734 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
735 | 735 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
736 | 736 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
737 | 737 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
738 | 738 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
739 | 739 | let passedBlocks = if ((emissionStartBlock > height)) | |
740 | 740 | then 0 | |
741 | 741 | else (height - emissionStartBlock) | |
742 | 742 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
743 | 743 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
744 | - | let $ | |
745 | - | let wxToClaimUserNew = $ | |
746 | - | let integralSTATE = $ | |
747 | - | let debug = $ | |
744 | + | let $t03047730589 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
745 | + | let wxToClaimUserNew = $t03047730589._1 | |
746 | + | let integralSTATE = $t03047730589._2 | |
747 | + | let debug = $t03047730589._3 | |
748 | 748 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
749 | 749 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
750 | 750 | let wxAmountBoostTotal = max([asInt(boostInvResult[0]), 0]) | |
751 | 751 | let boostDebug = asString(boostInvResult[1]) | |
752 | 752 | let minRewardPart = availableToClaim | |
753 | 753 | let boostRewardPart = min([(minRewardPart * toBigInt((boostCoeff - 1))), toBigInt(wxAmountBoostTotal)]) | |
754 | 754 | let totalReward = (minRewardPart + boostRewardPart) | |
755 | 755 | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), "soon"], SEP)) | |
756 | 756 | } | |
757 | 757 | ||
758 | 758 | ||
759 | 759 | ||
760 | 760 | @Callable(i) | |
761 | 761 | func stakedByUserREADONLY (lpAssetIdStr,userAddressStr) = { | |
762 | 762 | let stakedByUser = valueOrElse(getInteger(keyStakedByUser(userAddressStr, lpAssetIdStr)), 0) | |
763 | 763 | $Tuple2(nil, stakedByUser) | |
764 | 764 | } | |
765 | 765 | ||
766 | 766 | ||
767 | 767 | ||
768 | 768 | @Callable(i) | |
769 | 769 | func usersListTraversal (lpAssetId) = { | |
770 | 770 | let checkCaller = if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyVotingEmissionContract()), ""))) | |
771 | 771 | then true | |
772 | 772 | else mustManager(i) | |
773 | 773 | if ((checkCaller == checkCaller)) | |
774 | 774 | then { | |
775 | 775 | let listName = getUsersListName(lpAssetId) | |
776 | 776 | let userOrUnit = getString(keyNextUser(lpAssetId)) | |
777 | 777 | let headOrUnit = getString(keyListHead(listName)) | |
778 | 778 | match userOrUnit { | |
779 | 779 | case _: Unit => | |
780 | 780 | match headOrUnit { | |
781 | 781 | case _: Unit => | |
782 | 782 | $Tuple2(nil, false) | |
783 | 783 | case head: String => | |
784 | 784 | $Tuple2([StringEntry(keyNextUser(lpAssetId), head)], true) | |
785 | 785 | case _ => | |
786 | 786 | throw("Match error") | |
787 | 787 | } | |
788 | 788 | case userAddress: String => | |
789 | 789 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetId, userAddress)) | |
790 | 790 | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId)) | |
791 | 791 | let wxToClaimUserNew = refreshINTEGRALS(lpAssetId, userAddress, poolAddress, 0)._1 | |
792 | 792 | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
793 | 793 | let throwIfNothingToClaim = true | |
794 | 794 | let r = if ((availableToClaim > zeroBigInt)) | |
795 | 795 | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress, throwIfNothingToClaim], nil) | |
796 | 796 | else unit | |
797 | 797 | if ((r == r)) | |
798 | 798 | then { | |
799 | 799 | let nextUserOrUnit = getString(keyListNext(listName, userAddress)) | |
800 | 800 | match nextUserOrUnit { | |
801 | 801 | case _: Unit => | |
802 | 802 | $Tuple2([DeleteEntry(keyNextUser(lpAssetId))], false) | |
803 | 803 | case nextUser: String => | |
804 | 804 | $Tuple2([StringEntry(keyNextUser(lpAssetId), nextUser)], true) | |
805 | 805 | case _ => | |
806 | 806 | throw("Match error") | |
807 | 807 | } | |
808 | 808 | } | |
809 | 809 | else throw("Strict value is not equal to itself.") | |
810 | 810 | case _ => | |
811 | 811 | throw("Match error") | |
812 | 812 | } | |
813 | 813 | } | |
814 | 814 | else throw("Strict value is not equal to itself.") | |
815 | 815 | } | |
816 | 816 | ||
817 | 817 | ||
818 | 818 | ||
819 | 819 | @Callable(i) | |
820 | 820 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
821 | - | then | |
821 | + | then throwErr("permissions denied") | |
822 | 822 | else { | |
823 | - | let $ | |
824 | - | let wxPerLpIntegralNew = $ | |
825 | - | let poolIntegralSTATE = $ | |
826 | - | let poolDEBUG = $ | |
823 | + | let $t03321333323 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
824 | + | let wxPerLpIntegralNew = $t03321333323._1 | |
825 | + | let poolIntegralSTATE = $t03321333323._2 | |
826 | + | let poolDEBUG = $t03321333323._3 | |
827 | 827 | poolIntegralSTATE | |
828 | 828 | } | |
829 | 829 | ||
830 | 830 | ||
831 | 831 | @Verifier(tx) | |
832 | 832 | func verify () = { | |
833 | 833 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
834 | 834 | case pk: ByteVector => | |
835 | 835 | pk | |
836 | 836 | case _: Unit => | |
837 | 837 | tx.senderPublicKey | |
838 | 838 | case _ => | |
839 | 839 | throw("Match error") | |
840 | 840 | } | |
841 | 841 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
842 | 842 | } | |
843 | 843 |
github/deemru/w8io/169f3d6 119.34 ms ◑