tx · BpFBPt4RYhW9VKevUY1B1p2diT7NWx66HPzzCB9PHuKf 3N5yarEiTQccnnuerogYT3BxM5Zc5bRgDZy: -0.04000000 Waves 2022.08.05 08:27 [2170757] smart account 3N5yarEiTQccnnuerogYT3BxM5Zc5bRgDZy > SELF 0.00000000 Waves
{ "type": 13, "id": "BpFBPt4RYhW9VKevUY1B1p2diT7NWx66HPzzCB9PHuKf", "fee": 4000000, "feeAssetId": null, "timestamp": 1659677273351, "version": 1, "sender": "3N5yarEiTQccnnuerogYT3BxM5Zc5bRgDZy", "senderPublicKey": "FK9j3YFWVChXKESTn33fMZz1JseCNMMqHhfB7smxJo4e", "proofs": [ "5sUx3pjkzxuCwt9ZNvnt7kCGoWyu1adLkespn8k8ho3XJTip7b4NkZkbXgtvprmP5rNeRcJ6fxczCh79JHjEfRp8" ], "script": "base64:BgIlCAISBQoDAQgIEgASABIDCgEBEgASABIAEgMKAQgSBAoCCAESAE0ACXNlcGFyYXRvcgICX18AA1NFUAICX18ABU1VTFQ2AMCEPQAFTVVMVDgAgMLXLwAGTVVMVFg2CQC2AgEFBU1VTFQ2AAZNVUxUWDgJALYCAQUFTVVMVDgAB01VTFRYMTgJALYCAQCAgJC7utat8A0ACldBVkVTSURTVFICBVdBVkVTAAdXQVZFU0lECQDZBAEFCldBVkVTSURTVFIAGUlkeENvbnRyb2xDZmdOZXV0cmlub0RhcHAAAQAYSWR4Q29udHJvbENmZ0F1Y3Rpb25EYXBwAAIAFElkeENvbnRyb2xDZmdScGREYXBwAAMAFUlkeENvbnRyb2xDZmdNYXRoRGFwcAAEABxJZHhDb250cm9sQ2ZnTGlxdWlkYXRpb25EYXBwAAUAFUlkeENvbnRyb2xDZmdSZXN0RGFwcAAGAB1JZHhDb250cm9sQ2ZnTm9kZVJlZ2lzdHJ5RGFwcAAHABxJZHhDb250cm9sQ2ZnTnNidFN0YWtpbmdEYXBwAAgAGUlkeENvbnRyb2xDZmdNZWRpYXRvckRhcHAACQAcSWR4Q29udHJv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RvR25zYnQBBQhzdXJmVXNlcgkAlAoCBQNuaWwJAMwIAgUIc3VyZlVzZXIJAMwIAgUJc3VyZlRvdGFsCQDMCAIFEWduc2J0RnJvbVN1cmZVc2VyCQDMCAIFEmduc2J0RnJvbVN1cmZUb3RhbAkAzAgCBRF2cEVmZmVjdGl2ZUhlaWdodAkAzAgCBRR2cEVmZmVjdGl2ZUhlaWdodE5FVwUDbmlsAWkBEWNvbmZpZ1NZU1JFQURPTkxZAAQKbWluTG9ja0FtdAkBEUBleHRyTmF0aXZlKDEwNTUpAQkBEGtleU1pbkxvY2tBbW91bnQABBJnbnNidEZyb21TdXJmQ29lZmYJAGgCADwFBU1VTFQ2BCBzdXJmVm90aW5nUG93ZXJSZXN0cmljdGl2ZVBlcmlvZAkAaAIAoAsADgQbYnJUb1N0YXJ0U3VyZlRyYW5zZm9ybWF0aW9uALCYRgkAlAoCBQNuaWwJAMwIAgUKbWluTG9ja0FtdAkAzAgCBRJnbnNidEZyb21TdXJmQ29lZmYJAMwIAgUgc3VyZlZvdGluZ1Bvd2VyUmVzdHJpY3RpdmVQZXJpb2QJAMwIAgUbYnJUb1N0YXJ0U3VyZlRyYW5zZm9ybWF0aW9uBQNuaWwA7Wtygg==", "chainId": 84, "height": 2170757, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ATGScZ2BnkhhsgpdgkAYoeFEXYbXSJHxdc4eZnYCaAtS Next: CcGH7yZgP3KsW9T98fwiQHtprj1dbf7uqTKYAHHQR9Jt Diff:
Old | New | Differences | |
---|---|---|---|
268 | 268 | then (height + quarantinePeriod) | |
269 | 269 | else { | |
270 | 270 | let alreadyWaited = (quarantinePeriod - remainingToWait) | |
271 | - | let kX8 = fraction(stakedAmt, MULT8, stakedAmtNEW) | |
271 | + | let kX8 = if ((stakedAmtNEW != 0)) | |
272 | + | then fraction(stakedAmt, MULT8, stakedAmtNEW) | |
273 | + | else vpEffectiveHeight | |
272 | 274 | ((quarantinePeriod + height) - fraction(alreadyWaited, kX8, MULT8)) | |
273 | 275 | } | |
274 | 276 | } | |
275 | 277 | ||
276 | 278 | ||
277 | 279 | func mergeStake (userAddress,amountToAdd) = { | |
278 | - | let $ | |
279 | - | let isNewUser = $ | |
280 | - | let stakedAmount = $ | |
281 | - | let vpEffectiveHeight = $ | |
280 | + | let $t01241812528 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
281 | + | let isNewUser = $t01241812528._1 | |
282 | + | let stakedAmount = $t01241812528._2 | |
283 | + | let vpEffectiveHeight = $t01241812528._3 | |
282 | 284 | let stakedAmountNEW = if (isNewUser) | |
283 | 285 | then amountToAdd | |
284 | 286 | else (amountToAdd + stakedAmount) | |
291 | 293 | ||
292 | 294 | ||
293 | 295 | func commonStake (userAddress,i) = { | |
294 | - | let $ | |
295 | - | let stakedAssetId = $ | |
296 | - | let minLockAmount = $ | |
296 | + | let $t01301413068 = getParamsOrFail() | |
297 | + | let stakedAssetId = $t01301413068._1 | |
298 | + | let minLockAmount = $t01301413068._2 | |
297 | 299 | if ((size(i.payments) != 1)) | |
298 | 300 | then throw("Invalid payments size") | |
299 | 301 | else { | |
314 | 316 | if ((minLockAmount > stakedAmountNEW)) | |
315 | 317 | then throw(("Min lock amount is " + toString(minLockAmount))) | |
316 | 318 | else { | |
317 | - | let $ | |
319 | + | let $t01386713969 = StatsResult(amount, 1, if (isNewUser) | |
318 | 320 | then 1 | |
319 | 321 | else 0) | |
320 | - | let statsEntries = $ | |
321 | - | let totalStaked = $ | |
322 | - | let totalStakedNew = $ | |
322 | + | let statsEntries = $t01386713969._1 | |
323 | + | let totalStaked = $t01386713969._2 | |
324 | + | let totalStakedNew = $t01386713969._3 | |
323 | 325 | ((([HistoryRecordEntry("stake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW)] ++ RewardEntries(isNewUser, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeightNEW)) ++ statsEntries) | |
324 | 326 | } | |
325 | 327 | } | |
332 | 334 | if ((size(i.payments) > 0)) | |
333 | 335 | then throw("payments are not accepted") | |
334 | 336 | else { | |
335 | - | let $ | |
336 | - | let isNewUser = $ | |
337 | - | let stakedAmount = $ | |
338 | - | let stakingStart = $ | |
337 | + | let $t01444814553 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
338 | + | let isNewUser = $t01444814553._1 | |
339 | + | let stakedAmount = $t01444814553._2 | |
340 | + | let stakingStart = $t01444814553._3 | |
339 | 341 | let stakedAmountX = toBigInt(stakedAmount) | |
340 | 342 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
341 | 343 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
342 | 344 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
343 | 345 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
344 | - | let $ | |
345 | - | let rewardTotal = $ | |
346 | - | let cached = $ | |
347 | - | let dynamic = $ | |
348 | - | let rewardCachedPartKEY = $ | |
346 | + | let $t01492415062 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
347 | + | let rewardTotal = $t01492415062._1 | |
348 | + | let cached = $t01492415062._2 | |
349 | + | let dynamic = $t01492415062._3 | |
350 | + | let rewardCachedPartKEY = $t01492415062._4 | |
349 | 351 | let claimedKEY = keyClaimed(userAddressStr, asset) | |
350 | - | let $ | |
351 | - | let data = $ | |
352 | - | let claimedAmtByAsset = $ | |
352 | + | let $t01512215159 = accum | |
353 | + | let data = $t01512215159._1 | |
354 | + | let claimedAmtByAsset = $t01512215159._2 | |
353 | 355 | let newPart = makeString([asset, toString(rewardTotal)], ":") | |
354 | 356 | let claimedAmtByAssetNew = makeString([claimedAmtByAsset, newPart], "_") | |
355 | 357 | if ((0 >= rewardTotal)) | |
357 | 359 | else $Tuple2((((data :+ ScriptTransfer(userAddress, rewardTotal, toAssetVect(asset))) :+ IntegerEntry(claimedKEY, (valueOrElse(getInteger(claimedKEY), 0) + rewardTotal))) :+ IntegerEntry(rewardCachedPartKEY, 0)), claimedAmtByAssetNew) | |
358 | 360 | } | |
359 | 361 | ||
360 | - | let $ | |
362 | + | let $t01561915733 = { | |
361 | 363 | let $l = supportedAssetsList | |
362 | 364 | let $s = size($l) | |
363 | 365 | let $acc0 = $Tuple2(nil, "") | |
371 | 373 | ||
372 | 374 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
373 | 375 | } | |
374 | - | let transfers = $ | |
375 | - | let claimedAmtByAssetResult = $ | |
376 | + | let transfers = $t01561915733._1 | |
377 | + | let claimedAmtByAssetResult = $t01561915733._2 | |
376 | 378 | if ((0 >= size(transfers))) | |
377 | 379 | then nil | |
378 | 380 | else ((transfers :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) :+ ClaimHistoryEntry(userAddress, i.transactionId, drop(claimedAmtByAssetResult, 1))) | |
403 | 405 | else { | |
404 | 406 | let userAddress = i.caller | |
405 | 407 | let userAddressStr = toString(userAddress) | |
406 | - | let $ | |
407 | - | let stakedAssetId = $ | |
408 | - | let minLockAmount = $ | |
409 | - | let $ | |
410 | - | let isNewUser = $ | |
411 | - | let | |
412 | - | let | |
413 | - | if ((0 >= | |
408 | + | let $t01664216696 = getParamsOrFail() | |
409 | + | let stakedAssetId = $t01664216696._1 | |
410 | + | let minLockAmount = $t01664216696._2 | |
411 | + | let $t01669916783 = getUserParamsOrFail(userAddress) | |
412 | + | let isNewUser = $t01669916783._1 | |
413 | + | let stakedAmount = $t01669916783._2 | |
414 | + | let vpEffectiveHeight = $t01669916783._3 | |
415 | + | if ((0 >= stakedAmount)) | |
414 | 416 | then throw("Nothing to unstake") | |
415 | - | else if ((amount > | |
416 | - | then throw(((("Requested " + toString(amount)) + ", but staked only ") + toString( | |
417 | + | else if ((amount > stakedAmount)) | |
418 | + | then throw(((("Requested " + toString(amount)) + ", but staked only ") + toString(stakedAmount))) | |
417 | 419 | else { | |
418 | - | let $t01691217066 = StatsResult(-(amount), if ((amount == lockAmount)) | |
420 | + | let stakedAmountNEW = (stakedAmount - amount) | |
421 | + | let $t01702517183 = StatsResult(-(amount), if ((amount == stakedAmount)) | |
419 | 422 | then -1 | |
420 | - | else 0, if ((amount == | |
423 | + | else 0, if ((amount == stakedAmount)) | |
421 | 424 | then -1 | |
422 | 425 | else 0) | |
423 | - | let statsEntries = $ | |
424 | - | let totalStaked = $ | |
425 | - | let totalStakedNew = $ | |
426 | - | ((([ScriptTransfer(userAddress, amount, stakedAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, | |
426 | + | let statsEntries = $t01702517183._1 | |
427 | + | let totalStaked = $t01702517183._2 | |
428 | + | let totalStakedNew = $t01702517183._3 | |
429 | + | ((([ScriptTransfer(userAddress, amount, stakedAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeight)] ++ RewardEntries(false, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeight)) ++ statsEntries) | |
427 | 430 | } | |
428 | 431 | } | |
429 | 432 | ||
514 | 517 | } | |
515 | 518 | else { | |
516 | 519 | let userAddress = addressFromStringValue(userAddressStr) | |
517 | - | let $ | |
518 | - | let isNewUser = $ | |
519 | - | let stakedAmount = $ | |
520 | - | let stakingStart = $ | |
520 | + | let $t01975719862 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
521 | + | let isNewUser = $t01975719862._1 | |
522 | + | let stakedAmount = $t01975719862._2 | |
523 | + | let stakingStart = $t01975719862._3 | |
521 | 524 | let stakedAmountX = toBigInt(stakedAmount) | |
522 | 525 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
523 | 526 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
524 | 527 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
525 | 528 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
526 | - | let $ | |
527 | - | let rewardTotal = $ | |
528 | - | let cached = $ | |
529 | - | let dynamic = $ | |
530 | - | let rewardCachedPartKEY = $ | |
529 | + | let $t02020820346 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
530 | + | let rewardTotal = $t02020820346._1 | |
531 | + | let cached = $t02020820346._2 | |
532 | + | let dynamic = $t02020820346._3 | |
533 | + | let rewardCachedPartKEY = $t02020820346._4 | |
531 | 534 | let claimed = valueOrElse(getInteger(keyClaimed(userAddressStr, asset)), 0) | |
532 | 535 | ((accum + makeString([asset, toString(rewardTotal), toString(claimed)], ":")) + "_") | |
533 | 536 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let MULT6 = 1000000 | |
9 | 9 | ||
10 | 10 | let MULT8 = 100000000 | |
11 | 11 | ||
12 | 12 | let MULTX6 = toBigInt(MULT6) | |
13 | 13 | ||
14 | 14 | let MULTX8 = toBigInt(MULT8) | |
15 | 15 | ||
16 | 16 | let MULTX18 = toBigInt(1000000000000000000) | |
17 | 17 | ||
18 | 18 | let WAVESIDSTR = "WAVES" | |
19 | 19 | ||
20 | 20 | let WAVESID = fromBase58String(WAVESIDSTR) | |
21 | 21 | ||
22 | 22 | let IdxControlCfgNeutrinoDapp = 1 | |
23 | 23 | ||
24 | 24 | let IdxControlCfgAuctionDapp = 2 | |
25 | 25 | ||
26 | 26 | let IdxControlCfgRpdDapp = 3 | |
27 | 27 | ||
28 | 28 | let IdxControlCfgMathDapp = 4 | |
29 | 29 | ||
30 | 30 | let IdxControlCfgLiquidationDapp = 5 | |
31 | 31 | ||
32 | 32 | let IdxControlCfgRestDapp = 6 | |
33 | 33 | ||
34 | 34 | let IdxControlCfgNodeRegistryDapp = 7 | |
35 | 35 | ||
36 | 36 | let IdxControlCfgNsbtStakingDapp = 8 | |
37 | 37 | ||
38 | 38 | let IdxControlCfgMediatorDapp = 9 | |
39 | 39 | ||
40 | 40 | let IdxControlCfgSurfStakingDapp = 10 | |
41 | 41 | ||
42 | 42 | let IdxControlCfgGnsbtControllerDapp = 11 | |
43 | 43 | ||
44 | 44 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func keyControlAddress () = "%s%s__config__controlAddress" | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func keyControlCfg () = "%s__controlConfig" | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func readControlCfgOrFail (control) = split(getStringOrFail(control, keyControlCfg()), SEP) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx))) | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx")) | |
60 | 60 | ||
61 | 61 | let controlCfg = readControlCfgOrFail(controlContract) | |
62 | 62 | ||
63 | 63 | let mathContract = getContractAddressOrFail(controlCfg, IdxControlCfgMathDapp) | |
64 | 64 | ||
65 | 65 | let neutrinoContract = getContractAddressOrFail(controlCfg, IdxControlCfgNeutrinoDapp) | |
66 | 66 | ||
67 | 67 | let auctionContract = getContractAddressOrFail(controlCfg, IdxControlCfgAuctionDapp) | |
68 | 68 | ||
69 | 69 | func keyBondAsset () = "bond_asset_id" | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func keyAuctionContractAddress () = "auction_contract" | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func keyMinLockAmount () = "%s__minLockAmount" | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func keyStakedAssetId () = "%s__stakedAssetId" | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func keyLockParamUserAmount (userAddress) = makeString(["%s%s%s", "paramByUser", toString(userAddress), "amount"], separator) | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func keyLockParamStartBlock (userAddress) = makeString(["%s%s%s", "paramByUser", toString(userAddress), "start"], separator) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func keyLockParamVotingPowerEffectiveHeight (userAddress) = makeString(["%s%s%s", "paramByUser", toString(userAddress), "vpEffectiveHeight"], separator) | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func keyHistoryRecord (type,userAddress,txId) = makeString(["%s%s%s%s", "history", type, toString(userAddress), toBase58String(txId)], separator) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func keyLockParamTotalAmount () = makeString(["%s%s", "stats", "activeTotalLocked"], separator) | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func keyStatsLocksCount () = makeString(["%s%s", "stats", "locksCount"], separator) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func keyStatsUsersCount () = makeString(["%s%s", "stats", "activeUsersCount"], separator) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func keyNextPeriod () = "%s__nextPeriod" | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func keySupportedRewardAssets () = "supportedRewardAssets" | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func keyDepositNumLast () = makeString(["%s%s%s", "dep", "lastNum"], separator) | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func keyUserRewardFromDepositNum (userAddress) = makeString(["%s%s%s", "userRwdFromDepNum", userAddress], separator) | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func keyRewardPerNsbtSumAt (depositNum,tkn) = makeString(["%s%d", "rwdPerNsbtSumByDepNum", toString(depositNum), tkn], separator) | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func keyReward (userAddress,tkn) = makeString(["%s%s%s", "rwd", userAddress, tkn], separator) | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func keyClaimed (userAddress,tkn) = makeString(["%s%s%s", "clm", userAddress, tkn], separator) | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func keyNotDistributedReward (tkn) = makeString(["%s%s", "notDistributed", tkn], separator) | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func toX18 (origVal,origMult) = fraction(toBigInt(origVal), MULTX18, origMult) | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | func getIntOrZero (key) = valueOrElse(getInteger(this, key), 0) | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal) | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), (("Mandatory this." + key) + " is not defined")) | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func getStrOrElse (key,defaultVal) = valueOrElse(getString(this, key), defaultVal) | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func toAddressOrFail (addressStr) = valueOrErrorMessage(addressFromString(addressStr), ("couldn't parse passed addressStr=" + addressStr)) | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func toAssetVect (assetStr) = if ((assetStr == WAVESIDSTR)) | |
145 | 145 | then unit | |
146 | 146 | else fromBase58String(assetStr) | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | func asInt (val) = match val { | |
150 | 150 | case valInt: Int => | |
151 | 151 | valInt | |
152 | 152 | case _ => | |
153 | 153 | throw("fail to cast into Int") | |
154 | 154 | } | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func formatHistoryRecord (oldAmount,oldStart,newAmount,newStart) = makeString(["%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(oldAmount), toString(oldStart), toString(newAmount), toString(newStart)], separator) | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func formatClaimHistoryRecord (user,claimedRewards) = makeString(["%s%d%d%s", user, toString(lastBlock.height), toString(lastBlock.timestamp), claimedRewards], separator) | |
161 | 161 | ||
162 | 162 | ||
163 | 163 | func HistoryRecordEntry (type,userAddress,txId,oldAmount,oldStart,newAmount,newStart) = StringEntry(keyHistoryRecord(type, userAddress, txId), formatHistoryRecord(oldAmount, oldStart, newAmount, newStart)) | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | func ClaimHistoryEntry (userAddress,txId,claimedRewards) = StringEntry(keyHistoryRecord("claim", userAddress, txId), formatClaimHistoryRecord(toString(userAddress), claimedRewards)) | |
167 | 167 | ||
168 | 168 | ||
169 | 169 | func StatsResult (totalLockedInc,lockCountInc,usersCountInc) = { | |
170 | 170 | let locksCount = getIntOrZero(keyStatsLocksCount()) | |
171 | 171 | let usersCount = getIntOrZero(keyStatsUsersCount()) | |
172 | 172 | let totalAmount = getIntOrZero(keyLockParamTotalAmount()) | |
173 | 173 | let totalAmountNew = (totalAmount + totalLockedInc) | |
174 | 174 | $Tuple3([IntegerEntry(keyStatsLocksCount(), (locksCount + lockCountInc)), IntegerEntry(keyStatsUsersCount(), (usersCount + usersCountInc)), IntegerEntry(keyLockParamTotalAmount(), totalAmountNew)], totalAmount, totalAmountNew) | |
175 | 175 | } | |
176 | 176 | ||
177 | 177 | ||
178 | 178 | func LockParamsEntry (userAddress,amount,votingPowerEffectiveHeight) = [IntegerEntry(keyLockParamUserAmount(userAddress), amount), IntegerEntry(keyLockParamStartBlock(userAddress), votingPowerEffectiveHeight)] | |
179 | 179 | ||
180 | 180 | ||
181 | 181 | func getParamsOrFail () = $Tuple2(fromBase58String(getStringOrFail(this, keyStakedAssetId())), getIntOrFail(keyMinLockAmount())) | |
182 | 182 | ||
183 | 183 | ||
184 | 184 | func isActiveUser (userAddress) = (getIntOrElse(keyLockParamUserAmount(userAddress), 0) > 0) | |
185 | 185 | ||
186 | 186 | ||
187 | 187 | func getUserParamsOrUnit (userAddress) = if (isActiveUser(userAddress)) | |
188 | 188 | then $Tuple3(false, getIntOrFail(keyLockParamUserAmount(userAddress)), getIntOrFail(keyLockParamStartBlock(userAddress))) | |
189 | 189 | else unit | |
190 | 190 | ||
191 | 191 | ||
192 | 192 | func getUserParamsOrFail (userAddress) = valueOrErrorMessage(getUserParamsOrUnit(userAddress), (("User " + toString(userAddress)) + " is not defined")) | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | let supportedAssetsStr = getStrOrElse(keySupportedRewardAssets(), "") | |
196 | 196 | ||
197 | 197 | let supportedAssetsList = split(supportedAssetsStr, "_") | |
198 | 198 | ||
199 | 199 | func calcReward (userAddress,assetId,stakedAmountX,depositNumUser,depositNumLast) = { | |
200 | 200 | let rewardPerNsbtSumLastKEY = keyRewardPerNsbtSumAt(depositNumLast, assetId) | |
201 | 201 | let sumLastX18 = parseBigIntValue(getStrOrElse(keyRewardPerNsbtSumAt(depositNumLast, assetId), "0")) | |
202 | 202 | let sumUserX18 = parseBigIntValue(getStrOrElse(keyRewardPerNsbtSumAt(depositNumUser, assetId), "0")) | |
203 | 203 | let rewardDynamicPart = toInt(fraction((sumLastX18 - sumUserX18), stakedAmountX, MULTX18)) | |
204 | 204 | let rewardCachedPartKEY = keyReward(userAddress, assetId) | |
205 | 205 | let rewardCachedPart = getIntOrElse(rewardCachedPartKEY, 0) | |
206 | 206 | $Tuple4((rewardCachedPart + rewardDynamicPart), rewardCachedPart, rewardDynamicPart, rewardCachedPartKEY) | |
207 | 207 | } | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | func RewardEntries (isNewUser,userAddress,stakedAmount) = { | |
211 | 211 | let stakedAmountX = toBigInt(stakedAmount) | |
212 | 212 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddress) | |
213 | 213 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
214 | 214 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
215 | 215 | func forEachAssetCacheUserReward (accum,asset) = { | |
216 | 216 | let $t086398774 = calcReward(userAddress, asset, stakedAmountX, depositNumUser, depositNumLast) | |
217 | 217 | let rewardTotal = $t086398774._1 | |
218 | 218 | let cached = $t086398774._2 | |
219 | 219 | let dynamic = $t086398774._3 | |
220 | 220 | let rewardCachedPartKEY = $t086398774._4 | |
221 | 221 | (accum :+ IntegerEntry(rewardCachedPartKEY, rewardTotal)) | |
222 | 222 | } | |
223 | 223 | ||
224 | 224 | if (if ((depositNumLast == -1)) | |
225 | 225 | then (depositNumUser == -1) | |
226 | 226 | else false) | |
227 | 227 | then nil | |
228 | 228 | else if (if ((depositNumLast == -1)) | |
229 | 229 | then (depositNumUser > -1) | |
230 | 230 | else false) | |
231 | 231 | then throw("invalid depositNumLast and depositNumUser state") | |
232 | 232 | else if (if ((depositNumLast > -1)) | |
233 | 233 | then (depositNumUser >= -1) | |
234 | 234 | else false) | |
235 | 235 | then if (isNewUser) | |
236 | 236 | then [IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)] | |
237 | 237 | else ({ | |
238 | 238 | let $l = supportedAssetsList | |
239 | 239 | let $s = size($l) | |
240 | 240 | let $acc0 = nil | |
241 | 241 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
242 | 242 | then $a | |
243 | 243 | else forEachAssetCacheUserReward($a, $l[$i]) | |
244 | 244 | ||
245 | 245 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
246 | 246 | then $a | |
247 | 247 | else throw("List size exceeds 10") | |
248 | 248 | ||
249 | 249 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
250 | 250 | } :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) | |
251 | 251 | else throw(((("uncovered condition: depositNumLast=" + toString(depositNumLast)) + " depositNumUser=") + toString(depositNumUser))) | |
252 | 252 | } | |
253 | 253 | ||
254 | 254 | ||
255 | 255 | func IncrementNotDistributedRewardEntry (tkn,amountInc) = { | |
256 | 256 | let notDistributedRewardKEY = keyNotDistributedReward(tkn) | |
257 | 257 | let notDistributedReward = getIntOrElse(notDistributedRewardKEY, 0) | |
258 | 258 | [IntegerEntry(notDistributedRewardKEY, (notDistributedReward + amountInc))] | |
259 | 259 | } | |
260 | 260 | ||
261 | 261 | ||
262 | 262 | func surfToGnsbt (surfAmt) = (surfAmt / 60) | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | func mergeVotingPowerEffectiveHeight (quarantinePeriod,vpEffectiveHeight,stakedAmt,stakedAmtNEW) = { | |
266 | 266 | let remainingToWait = (vpEffectiveHeight - height) | |
267 | 267 | if ((0 >= remainingToWait)) | |
268 | 268 | then (height + quarantinePeriod) | |
269 | 269 | else { | |
270 | 270 | let alreadyWaited = (quarantinePeriod - remainingToWait) | |
271 | - | let kX8 = fraction(stakedAmt, MULT8, stakedAmtNEW) | |
271 | + | let kX8 = if ((stakedAmtNEW != 0)) | |
272 | + | then fraction(stakedAmt, MULT8, stakedAmtNEW) | |
273 | + | else vpEffectiveHeight | |
272 | 274 | ((quarantinePeriod + height) - fraction(alreadyWaited, kX8, MULT8)) | |
273 | 275 | } | |
274 | 276 | } | |
275 | 277 | ||
276 | 278 | ||
277 | 279 | func mergeStake (userAddress,amountToAdd) = { | |
278 | - | let $ | |
279 | - | let isNewUser = $ | |
280 | - | let stakedAmount = $ | |
281 | - | let vpEffectiveHeight = $ | |
280 | + | let $t01241812528 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
281 | + | let isNewUser = $t01241812528._1 | |
282 | + | let stakedAmount = $t01241812528._2 | |
283 | + | let vpEffectiveHeight = $t01241812528._3 | |
282 | 284 | let stakedAmountNEW = if (isNewUser) | |
283 | 285 | then amountToAdd | |
284 | 286 | else (amountToAdd + stakedAmount) | |
285 | 287 | let quarantinePeriod = (1440 * 14) | |
286 | 288 | let vpEffectiveHeightNEW = if (isNewUser) | |
287 | 289 | then (quarantinePeriod + height) | |
288 | 290 | else mergeVotingPowerEffectiveHeight(quarantinePeriod, vpEffectiveHeight, stakedAmount, stakedAmountNEW) | |
289 | 291 | $Tuple5(isNewUser, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW) | |
290 | 292 | } | |
291 | 293 | ||
292 | 294 | ||
293 | 295 | func commonStake (userAddress,i) = { | |
294 | - | let $ | |
295 | - | let stakedAssetId = $ | |
296 | - | let minLockAmount = $ | |
296 | + | let $t01301413068 = getParamsOrFail() | |
297 | + | let stakedAssetId = $t01301413068._1 | |
298 | + | let minLockAmount = $t01301413068._2 | |
297 | 299 | if ((size(i.payments) != 1)) | |
298 | 300 | then throw("Invalid payments size") | |
299 | 301 | else { | |
300 | 302 | let payment = i.payments[0] | |
301 | 303 | let amount = payment.amount | |
302 | 304 | let invalidAssetMessage = (("Invalid asset. " + toBase58String(stakedAssetId)) + " is expected") | |
303 | 305 | let assetId = valueOrErrorMessage(payment.assetId, invalidAssetMessage) | |
304 | 306 | if ((assetId != stakedAssetId)) | |
305 | 307 | then throw(invalidAssetMessage) | |
306 | 308 | else { | |
307 | 309 | let userAddressStr = toString(userAddress) | |
308 | 310 | let mergedData = mergeStake(userAddress, amount) | |
309 | 311 | let isNewUser = mergedData._1 | |
310 | 312 | let stakedAmount = mergedData._2 | |
311 | 313 | let vpEffectiveHeight = mergedData._3 | |
312 | 314 | let stakedAmountNEW = mergedData._4 | |
313 | 315 | let vpEffectiveHeightNEW = mergedData._5 | |
314 | 316 | if ((minLockAmount > stakedAmountNEW)) | |
315 | 317 | then throw(("Min lock amount is " + toString(minLockAmount))) | |
316 | 318 | else { | |
317 | - | let $ | |
319 | + | let $t01386713969 = StatsResult(amount, 1, if (isNewUser) | |
318 | 320 | then 1 | |
319 | 321 | else 0) | |
320 | - | let statsEntries = $ | |
321 | - | let totalStaked = $ | |
322 | - | let totalStakedNew = $ | |
322 | + | let statsEntries = $t01386713969._1 | |
323 | + | let totalStaked = $t01386713969._2 | |
324 | + | let totalStakedNew = $t01386713969._3 | |
323 | 325 | ((([HistoryRecordEntry("stake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW)] ++ RewardEntries(isNewUser, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeightNEW)) ++ statsEntries) | |
324 | 326 | } | |
325 | 327 | } | |
326 | 328 | } | |
327 | 329 | } | |
328 | 330 | ||
329 | 331 | ||
330 | 332 | func commonClaim (userAddress,i) = { | |
331 | 333 | let userAddressStr = toString(userAddress) | |
332 | 334 | if ((size(i.payments) > 0)) | |
333 | 335 | then throw("payments are not accepted") | |
334 | 336 | else { | |
335 | - | let $ | |
336 | - | let isNewUser = $ | |
337 | - | let stakedAmount = $ | |
338 | - | let stakingStart = $ | |
337 | + | let $t01444814553 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
338 | + | let isNewUser = $t01444814553._1 | |
339 | + | let stakedAmount = $t01444814553._2 | |
340 | + | let stakingStart = $t01444814553._3 | |
339 | 341 | let stakedAmountX = toBigInt(stakedAmount) | |
340 | 342 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
341 | 343 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
342 | 344 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
343 | 345 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
344 | - | let $ | |
345 | - | let rewardTotal = $ | |
346 | - | let cached = $ | |
347 | - | let dynamic = $ | |
348 | - | let rewardCachedPartKEY = $ | |
346 | + | let $t01492415062 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
347 | + | let rewardTotal = $t01492415062._1 | |
348 | + | let cached = $t01492415062._2 | |
349 | + | let dynamic = $t01492415062._3 | |
350 | + | let rewardCachedPartKEY = $t01492415062._4 | |
349 | 351 | let claimedKEY = keyClaimed(userAddressStr, asset) | |
350 | - | let $ | |
351 | - | let data = $ | |
352 | - | let claimedAmtByAsset = $ | |
352 | + | let $t01512215159 = accum | |
353 | + | let data = $t01512215159._1 | |
354 | + | let claimedAmtByAsset = $t01512215159._2 | |
353 | 355 | let newPart = makeString([asset, toString(rewardTotal)], ":") | |
354 | 356 | let claimedAmtByAssetNew = makeString([claimedAmtByAsset, newPart], "_") | |
355 | 357 | if ((0 >= rewardTotal)) | |
356 | 358 | then $Tuple2(data, claimedAmtByAssetNew) | |
357 | 359 | else $Tuple2((((data :+ ScriptTransfer(userAddress, rewardTotal, toAssetVect(asset))) :+ IntegerEntry(claimedKEY, (valueOrElse(getInteger(claimedKEY), 0) + rewardTotal))) :+ IntegerEntry(rewardCachedPartKEY, 0)), claimedAmtByAssetNew) | |
358 | 360 | } | |
359 | 361 | ||
360 | - | let $ | |
362 | + | let $t01561915733 = { | |
361 | 363 | let $l = supportedAssetsList | |
362 | 364 | let $s = size($l) | |
363 | 365 | let $acc0 = $Tuple2(nil, "") | |
364 | 366 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
365 | 367 | then $a | |
366 | 368 | else forEachAssetCalcUnclaimedReward($a, $l[$i]) | |
367 | 369 | ||
368 | 370 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
369 | 371 | then $a | |
370 | 372 | else throw("List size exceeds 10") | |
371 | 373 | ||
372 | 374 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
373 | 375 | } | |
374 | - | let transfers = $ | |
375 | - | let claimedAmtByAssetResult = $ | |
376 | + | let transfers = $t01561915733._1 | |
377 | + | let claimedAmtByAssetResult = $t01561915733._2 | |
376 | 378 | if ((0 >= size(transfers))) | |
377 | 379 | then nil | |
378 | 380 | else ((transfers :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) :+ ClaimHistoryEntry(userAddress, i.transactionId, drop(claimedAmtByAssetResult, 1))) | |
379 | 381 | } | |
380 | 382 | } | |
381 | 383 | ||
382 | 384 | ||
383 | 385 | @Callable(i) | |
384 | 386 | func constructor (minLockAmount,supportedRewardAssets,stakedAssetId) = if ((i.caller != this)) | |
385 | 387 | then throw("Permission denied") | |
386 | 388 | else [IntegerEntry(keyMinLockAmount(), minLockAmount), StringEntry(keySupportedRewardAssets(), supportedRewardAssets), StringEntry(keyStakedAssetId(), stakedAssetId)] | |
387 | 389 | ||
388 | 390 | ||
389 | 391 | ||
390 | 392 | @Callable(i) | |
391 | 393 | func stake () = commonStake(i.caller, i) | |
392 | 394 | ||
393 | 395 | ||
394 | 396 | ||
395 | 397 | @Callable(i) | |
396 | 398 | func stakeByOriginCaller () = commonStake(i.originCaller, i) | |
397 | 399 | ||
398 | 400 | ||
399 | 401 | ||
400 | 402 | @Callable(i) | |
401 | 403 | func unstake (amount) = if ((size(i.payments) != 0)) | |
402 | 404 | then throw("unstake doesn't require any payment") | |
403 | 405 | else { | |
404 | 406 | let userAddress = i.caller | |
405 | 407 | let userAddressStr = toString(userAddress) | |
406 | - | let $ | |
407 | - | let stakedAssetId = $ | |
408 | - | let minLockAmount = $ | |
409 | - | let $ | |
410 | - | let isNewUser = $ | |
411 | - | let | |
412 | - | let | |
413 | - | if ((0 >= | |
408 | + | let $t01664216696 = getParamsOrFail() | |
409 | + | let stakedAssetId = $t01664216696._1 | |
410 | + | let minLockAmount = $t01664216696._2 | |
411 | + | let $t01669916783 = getUserParamsOrFail(userAddress) | |
412 | + | let isNewUser = $t01669916783._1 | |
413 | + | let stakedAmount = $t01669916783._2 | |
414 | + | let vpEffectiveHeight = $t01669916783._3 | |
415 | + | if ((0 >= stakedAmount)) | |
414 | 416 | then throw("Nothing to unstake") | |
415 | - | else if ((amount > | |
416 | - | then throw(((("Requested " + toString(amount)) + ", but staked only ") + toString( | |
417 | + | else if ((amount > stakedAmount)) | |
418 | + | then throw(((("Requested " + toString(amount)) + ", but staked only ") + toString(stakedAmount))) | |
417 | 419 | else { | |
418 | - | let $t01691217066 = StatsResult(-(amount), if ((amount == lockAmount)) | |
420 | + | let stakedAmountNEW = (stakedAmount - amount) | |
421 | + | let $t01702517183 = StatsResult(-(amount), if ((amount == stakedAmount)) | |
419 | 422 | then -1 | |
420 | - | else 0, if ((amount == | |
423 | + | else 0, if ((amount == stakedAmount)) | |
421 | 424 | then -1 | |
422 | 425 | else 0) | |
423 | - | let statsEntries = $ | |
424 | - | let totalStaked = $ | |
425 | - | let totalStakedNew = $ | |
426 | - | ((([ScriptTransfer(userAddress, amount, stakedAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, | |
426 | + | let statsEntries = $t01702517183._1 | |
427 | + | let totalStaked = $t01702517183._2 | |
428 | + | let totalStakedNew = $t01702517183._3 | |
429 | + | ((([ScriptTransfer(userAddress, amount, stakedAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeight)] ++ RewardEntries(false, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeight)) ++ statsEntries) | |
427 | 430 | } | |
428 | 431 | } | |
429 | 432 | ||
430 | 433 | ||
431 | 434 | ||
432 | 435 | @Callable(i) | |
433 | 436 | func deposit () = if ((size(i.payments) != 1)) | |
434 | 437 | then throw("exact 1 payment is allowed only") | |
435 | 438 | else { | |
436 | 439 | let pmt = i.payments[0] | |
437 | 440 | let amount = pmt.amount | |
438 | 441 | let pmtAssetId = valueOrElse(pmt.assetId, WAVESID) | |
439 | 442 | let pmtAssetIdStr = toBase58String(pmtAssetId) | |
440 | 443 | let pmtMultX = if ((pmtAssetId == WAVESID)) | |
441 | 444 | then MULTX8 | |
442 | 445 | else MULTX6 | |
443 | 446 | let amountX = toBigInt(amount) | |
444 | 447 | let totalStaked = getIntOrElse(keyLockParamTotalAmount(), 0) | |
445 | 448 | let totalStakedX = toBigInt(totalStaked) | |
446 | 449 | if ((0 > totalStaked)) | |
447 | 450 | then throw("TODO: case is not supported") | |
448 | 451 | else if ((totalStaked == 0)) | |
449 | 452 | then IncrementNotDistributedRewardEntry(pmtAssetIdStr, amount) | |
450 | 453 | else { | |
451 | 454 | let rewardPerNsbtX18 = fraction(amountX, MULTX18, totalStakedX) | |
452 | 455 | let depositNumLastKEY = keyDepositNumLast() | |
453 | 456 | let depositNumLast = getIntOrElse(depositNumLastKEY, -1) | |
454 | 457 | let depositNumNew = (depositNumLast + 1) | |
455 | 458 | if (!(contains(supportedAssetsStr, pmtAssetIdStr))) | |
456 | 459 | then throw(((supportedAssetsStr + " doesn't contain ") + pmtAssetIdStr)) | |
457 | 460 | else { | |
458 | 461 | func refreshRewardPerNsbtSUM (accum,nextAsset) = { | |
459 | 462 | let rewardPerNsbtSumNewKEY = keyRewardPerNsbtSumAt(depositNumNew, nextAsset) | |
460 | 463 | let sumLastStr = getStrOrElse(keyRewardPerNsbtSumAt(depositNumLast, nextAsset), "0") | |
461 | 464 | (accum :+ (if ((nextAsset == pmtAssetIdStr)) | |
462 | 465 | then StringEntry(rewardPerNsbtSumNewKEY, toString((parseBigIntValue(sumLastStr) + rewardPerNsbtX18))) | |
463 | 466 | else StringEntry(rewardPerNsbtSumNewKEY, sumLastStr))) | |
464 | 467 | } | |
465 | 468 | ||
466 | 469 | ({ | |
467 | 470 | let $l = supportedAssetsList | |
468 | 471 | let $s = size($l) | |
469 | 472 | let $acc0 = nil | |
470 | 473 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
471 | 474 | then $a | |
472 | 475 | else refreshRewardPerNsbtSUM($a, $l[$i]) | |
473 | 476 | ||
474 | 477 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
475 | 478 | then $a | |
476 | 479 | else throw("List size exceeds 10") | |
477 | 480 | ||
478 | 481 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
479 | 482 | } :+ IntegerEntry(depositNumLastKEY, depositNumNew)) | |
480 | 483 | } | |
481 | 484 | } | |
482 | 485 | } | |
483 | 486 | ||
484 | 487 | ||
485 | 488 | ||
486 | 489 | @Callable(i) | |
487 | 490 | func claimRewards () = commonClaim(i.caller, i) | |
488 | 491 | ||
489 | 492 | ||
490 | 493 | ||
491 | 494 | @Callable(i) | |
492 | 495 | func claimRewardsByOriginCaller () = commonClaim(i.originCaller, i) | |
493 | 496 | ||
494 | 497 | ||
495 | 498 | ||
496 | 499 | @Callable(i) | |
497 | 500 | func unclaimedRewardsREADONLY (userAddressStr) = { | |
498 | 501 | func forEachAssetZeroReward (accum,asset) = ((accum + makeString([asset, "0", "0"], ":")) + "_") | |
499 | 502 | ||
500 | 503 | let unclaimedRewardStr = if ((userAddressStr == "")) | |
501 | 504 | then { | |
502 | 505 | let $l = supportedAssetsList | |
503 | 506 | let $s = size($l) | |
504 | 507 | let $acc0 = "" | |
505 | 508 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
506 | 509 | then $a | |
507 | 510 | else forEachAssetZeroReward($a, $l[$i]) | |
508 | 511 | ||
509 | 512 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
510 | 513 | then $a | |
511 | 514 | else throw("List size exceeds 10") | |
512 | 515 | ||
513 | 516 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
514 | 517 | } | |
515 | 518 | else { | |
516 | 519 | let userAddress = addressFromStringValue(userAddressStr) | |
517 | - | let $ | |
518 | - | let isNewUser = $ | |
519 | - | let stakedAmount = $ | |
520 | - | let stakingStart = $ | |
520 | + | let $t01975719862 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
521 | + | let isNewUser = $t01975719862._1 | |
522 | + | let stakedAmount = $t01975719862._2 | |
523 | + | let stakingStart = $t01975719862._3 | |
521 | 524 | let stakedAmountX = toBigInt(stakedAmount) | |
522 | 525 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
523 | 526 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
524 | 527 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
525 | 528 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
526 | - | let $ | |
527 | - | let rewardTotal = $ | |
528 | - | let cached = $ | |
529 | - | let dynamic = $ | |
530 | - | let rewardCachedPartKEY = $ | |
529 | + | let $t02020820346 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
530 | + | let rewardTotal = $t02020820346._1 | |
531 | + | let cached = $t02020820346._2 | |
532 | + | let dynamic = $t02020820346._3 | |
533 | + | let rewardCachedPartKEY = $t02020820346._4 | |
531 | 534 | let claimed = valueOrElse(getInteger(keyClaimed(userAddressStr, asset)), 0) | |
532 | 535 | ((accum + makeString([asset, toString(rewardTotal), toString(claimed)], ":")) + "_") | |
533 | 536 | } | |
534 | 537 | ||
535 | 538 | let $l = supportedAssetsList | |
536 | 539 | let $s = size($l) | |
537 | 540 | let $acc0 = "" | |
538 | 541 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
539 | 542 | then $a | |
540 | 543 | else forEachAssetCalcUnclaimedReward($a, $l[$i]) | |
541 | 544 | ||
542 | 545 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
543 | 546 | then $a | |
544 | 547 | else throw("List size exceeds 10") | |
545 | 548 | ||
546 | 549 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
547 | 550 | } | |
548 | 551 | $Tuple2(nil, dropRight(unclaimedRewardStr, 1)) | |
549 | 552 | } | |
550 | 553 | ||
551 | 554 | ||
552 | 555 | ||
553 | 556 | @Callable(i) | |
554 | 557 | func surfStakingSYSREADONLY (userAddressStrOrEmpty,surfDiff) = { | |
555 | 558 | let surfTotal = getIntOrElse(keyLockParamTotalAmount(), 0) | |
556 | 559 | let gnsbtFromSurfTotal = surfToGnsbt(surfTotal) | |
557 | 560 | if ((userAddressStrOrEmpty == "")) | |
558 | 561 | then $Tuple2(nil, [0, surfTotal, 0, gnsbtFromSurfTotal, 0, height, height]) | |
559 | 562 | else { | |
560 | 563 | let userAddress = toAddressOrFail(userAddressStrOrEmpty) | |
561 | 564 | let mergedData = mergeStake(userAddress, surfDiff) | |
562 | 565 | let isNewUser = mergedData._1 | |
563 | 566 | let stakedAmount = mergedData._2 | |
564 | 567 | let vpEffectiveHeight = mergedData._3 | |
565 | 568 | let stakedAmountNEW = mergedData._4 | |
566 | 569 | let vpEffectiveHeightNEW = mergedData._5 | |
567 | 570 | let surfUser = stakedAmount | |
568 | 571 | let gnsbtFromSurfUser = surfToGnsbt(surfUser) | |
569 | 572 | $Tuple2(nil, [surfUser, surfTotal, gnsbtFromSurfUser, gnsbtFromSurfTotal, vpEffectiveHeight, vpEffectiveHeightNEW]) | |
570 | 573 | } | |
571 | 574 | } | |
572 | 575 | ||
573 | 576 | ||
574 | 577 | ||
575 | 578 | @Callable(i) | |
576 | 579 | func configSYSREADONLY () = { | |
577 | 580 | let minLockAmt = getIntegerValue(keyMinLockAmount()) | |
578 | 581 | let gnsbtFromSurfCoeff = (60 * MULT6) | |
579 | 582 | let surfVotingPowerRestrictivePeriod = (1440 * 14) | |
580 | 583 | let brToStartSurfTransformation = 1150000 | |
581 | 584 | $Tuple2(nil, [minLockAmt, gnsbtFromSurfCoeff, surfVotingPowerRestrictivePeriod, brToStartSurfTransformation]) | |
582 | 585 | } | |
583 | 586 | ||
584 | 587 |
github/deemru/w8io/026f985 102.59 ms ◑