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