tx · Ct8W11t2G1ttQsodNs5mHhYVhHNptaAmvS9NpgtE5rCK 3N5yarEiTQccnnuerogYT3BxM5Zc5bRgDZy: -0.03100000 Waves 2022.11.21 13:53 [2326779] smart account 3N5yarEiTQccnnuerogYT3BxM5Zc5bRgDZy > SELF 0.00000000 Waves
{ "type": 13, "id": "Ct8W11t2G1ttQsodNs5mHhYVhHNptaAmvS9NpgtE5rCK", "fee": 3100000, "feeAssetId": null, "timestamp": 1669027994735, "version": 2, "chainId": 84, "sender": "3N5yarEiTQccnnuerogYT3BxM5Zc5bRgDZy", "senderPublicKey": "FK9j3YFWVChXKESTn33fMZz1JseCNMMqHhfB7smxJo4e", "proofs": [ "4n49kb9DK2TnNncpgdrtGiYwqU6EGmMEmYvKJVnzF8wocq4CKt8XL9miJyBvF642tnDT834XJ6BfC9zhFnCnbLt7" ], "script": "base64:BgIvCAISBQoDAQgIEgASABIDCgEBEgASABIAEgMKAQgSAwoBCBIECgIIARIDCgEBEgBpAAlzZXBhcmF0b3ICAl9fAANTRVACAl9fAAVNVUxUNgDAhD0ABU1VTFQ4AIDC1y8ABk1VTFRYNgkAtgIBBQVNVUxUNgAGTVVMVFg4CQC2AgEFBU1VTFQ4AAdNVUxUWDE4CQC2AgEAgICQu7rWrfANAApXQVZFU0lEU1RSAgVXQVZFUwAHV0FWRVNJRAkA2QQBBQpXQVZFU0lEU1RSAAlEQVlNSUxMSVMAgLiZKQANREVGQVVMVFBFUklPRAkAaAIAoAsADgAZSWR4Q29udHJvbENmZ05ldXRyaW5vRGFwcAABABhJZHhDb250cm9sQ2ZnQXVjdGlvbkRhcHAAAgAUSWR4Q29udHJvbENmZ1JwZERhcHAAAwAVSWR4Q29udHJvbENmZ01hdGhEYXBwAAQAHElkeENvbnRyb2xDZmdMaXF1aWRhdGlvbkRhcHAABQAVSWR4Q29udHJvbENmZ1Jlc3REYXBwAAYAHUlkeENvbnRyb2xDZmdOb2RlUmVnaXN0cnlEYXBwAAcAHElkeENvbnRyb2xD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2CQDMCAIFIHN1cmZWb3RpbmdQb3dlclJlc3RyaWN0aXZlUGVyaW9kCQDMCAIFG2JyVG9TdGFydFN1cmZUcmFuc2Zvcm1hdGlvbgUDbmlsAJG7t6A=", "height": 2326779, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8jMpDxhfGn11M1m7QqTccXb6n7P8EDQju6YCe2kjdH2J Next: BPc8E4DJmBDdKqE58NFoQaajKT35tKuEqz8aBYMFufUR Diff:
Old | New | Differences | |
---|---|---|---|
21 | 21 | ||
22 | 22 | let DAYMILLIS = 86400000 | |
23 | 23 | ||
24 | + | let DEFAULTPERIOD = (1440 * 14) | |
25 | + | ||
24 | 26 | let IdxControlCfgNeutrinoDapp = 1 | |
25 | 27 | ||
26 | 28 | let IdxControlCfgAuctionDapp = 2 | |
42 | 44 | let IdxControlCfgSurfStakingDapp = 10 | |
43 | 45 | ||
44 | 46 | let IdxControlCfgGnsbtControllerDapp = 11 | |
47 | + | ||
48 | + | let IdxControlCfgRestV2Dapp = 12 | |
49 | + | ||
50 | + | let IdxControlCfgGovernanceDapp = 13 | |
45 | 51 | ||
46 | 52 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
47 | 53 | ||
70 | 76 | let neutrinoContract = getContractAddressOrFail(controlCfg, IdxControlCfgNeutrinoDapp) | |
71 | 77 | ||
72 | 78 | let auctionContract = getContractAddressOrFail(controlCfg, IdxControlCfgAuctionDapp) | |
79 | + | ||
80 | + | let govContract = getContractAddressOrFail(controlCfg, IdxControlCfgGovernanceDapp) | |
73 | 81 | ||
74 | 82 | let gnsbtFromSurfCoeff = valueOrElse(getInteger(this, keyGnsbtFromSurfCoeff()), 300) | |
75 | 83 | ||
109 | 117 | func keyStatsDepositAmtByDay (timestamp) = makeString(["%s%s%d", "stats", "depositAmtByDay", toString(timestamp)], separator) | |
110 | 118 | ||
111 | 119 | ||
112 | - | func keyStatsDepositAmtTotals () = makeString(["%s%s%d", "stats", "depositAmtTotals"], separator) | |
113 | - | ||
114 | - | ||
115 | - | func keyNextPeriod () = "%s__nextPeriod" | |
120 | + | func keyStatsDepositAmtTotals () = makeString(["%s%s", "stats", "depositAmtTotals"], separator) | |
116 | 121 | ||
117 | 122 | ||
118 | 123 | func keySupportedRewardAssets () = "supportedRewardAssets" | |
119 | 124 | ||
120 | 125 | ||
121 | - | func keyDepositNumLast () = makeString([" | |
126 | + | func keyDepositNumLast () = makeString(["%s%s", "dep", "lastNum"], separator) | |
122 | 127 | ||
123 | 128 | ||
124 | - | func keyUserRewardFromDepositNum (userAddress) = makeString(["%s%s | |
129 | + | func keyUserRewardFromDepositNum (userAddress) = makeString(["%s%s", "userRwdFromDepNum", userAddress], separator) | |
125 | 130 | ||
126 | 131 | ||
127 | 132 | func keyRewardPerNsbtSumAt (depositNum,tkn) = makeString(["%s%d", "rwdPerNsbtSumByDepNum", toString(depositNum), tkn], separator) | |
134 | 139 | ||
135 | 140 | ||
136 | 141 | func keyNotDistributedReward (tkn) = makeString(["%s%s", "notDistributed", tkn], separator) | |
142 | + | ||
143 | + | ||
144 | + | func keyVpPeriodDuration () = makeString(["%s%s", "vp", "periodDuration"], separator) | |
145 | + | ||
146 | + | ||
147 | + | func keyLastTotalsPeriodProcessed () = makeString(["%s%s", "vp", "lastTotalsPeriodProcessed"], separator) | |
148 | + | ||
149 | + | ||
150 | + | func keyLastUserPeriodProcessed (userAddress) = makeString(["%s%s%s", "vp", "lastUserPeriodProcessed", userAddress], separator) | |
151 | + | ||
152 | + | ||
153 | + | func keyTotalMature () = makeString(["%s%s", "vp", "totalMature"], separator) | |
154 | + | ||
155 | + | ||
156 | + | func keyTotalTeen () = makeString(["%s%s", "vp", "totalTeen"], separator) | |
157 | + | ||
158 | + | ||
159 | + | func keyTotalKid () = makeString(["%s%s", "vp", "totalKid"], separator) | |
160 | + | ||
161 | + | ||
162 | + | func keyUserMature (userAddress) = makeString(["%s%s%s", "vp", "userMature", userAddress], separator) | |
163 | + | ||
164 | + | ||
165 | + | func keyUserTeen (userAddress) = makeString(["%s%s%s", "vp", "userTeen", userAddress], separator) | |
166 | + | ||
167 | + | ||
168 | + | func keyUserKid (userAddress) = makeString(["%s%s%s", "vp", "userKid", userAddress], separator) | |
137 | 169 | ||
138 | 170 | ||
139 | 171 | func toX18 (origVal,origMult) = fraction(toBigInt(origVal), MULTX18, origMult) | |
272 | 304 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
273 | 305 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
274 | 306 | func forEachAssetCacheUserReward (accum,asset) = { | |
275 | - | let $ | |
276 | - | let rewardTotal = $ | |
277 | - | let cached = $ | |
278 | - | let dynamic = $ | |
279 | - | let rewardCachedPartKEY = $ | |
307 | + | let $t01210412239 = calcReward(userAddress, asset, stakedAmountX, depositNumUser, depositNumLast) | |
308 | + | let rewardTotal = $t01210412239._1 | |
309 | + | let cached = $t01210412239._2 | |
310 | + | let dynamic = $t01210412239._3 | |
311 | + | let rewardCachedPartKEY = $t01210412239._4 | |
280 | 312 | (accum :+ IntegerEntry(rewardCachedPartKEY, rewardTotal)) | |
281 | 313 | } | |
282 | 314 | ||
321 | 353 | func surfToGnsbt (surfAmt) = (surfAmt / gnsbtFromSurfCoeff) | |
322 | 354 | ||
323 | 355 | ||
324 | - | func mergeVotingPowerEffectiveHeight (quarantinePeriod,vpEffectiveHeight,stakedAmt,stakedAmtNEW) = { | |
325 | - | let remainingToWait = (vpEffectiveHeight - height) | |
326 | - | if ((0 >= remainingToWait)) | |
327 | - | then (height + quarantinePeriod) | |
328 | - | else { | |
329 | - | let alreadyWaited = (quarantinePeriod - remainingToWait) | |
330 | - | let kX8 = if ((stakedAmtNEW != 0)) | |
331 | - | then fraction(stakedAmt, MULT8, stakedAmtNEW) | |
332 | - | else vpEffectiveHeight | |
333 | - | ((quarantinePeriod + height) - fraction(alreadyWaited, kX8, MULT8)) | |
334 | - | } | |
356 | + | func mergeStake (userAddress,amountToAdd,userTeen,userKid) = { | |
357 | + | let $t01516215272 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
358 | + | let isNewUser = $t01516215272._1 | |
359 | + | let stakedAmount = $t01516215272._2 | |
360 | + | let vpEffectiveHeight = $t01516215272._3 | |
361 | + | let stakedAmountNEW = if (isNewUser) | |
362 | + | then amountToAdd | |
363 | + | else (amountToAdd + stakedAmount) | |
364 | + | let W2 = getIntOrElse(keyVpPeriodDuration(), DEFAULTPERIOD) | |
365 | + | let period = (height / W2) | |
366 | + | let vpEffectivePeriodNEW = if ((userKid > 0)) | |
367 | + | then (period + 2) | |
368 | + | else if ((userTeen > 0)) | |
369 | + | then (period + 1) | |
370 | + | else period | |
371 | + | $Tuple5(isNewUser, stakedAmount, vpEffectiveHeight, stakedAmountNEW, (vpEffectivePeriodNEW * W2)) | |
335 | 372 | } | |
336 | 373 | ||
337 | 374 | ||
338 | - | func mergeStake (userAddress,amountToAdd) = { | |
339 | - | let $t01487114981 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
340 | - | let isNewUser = $t01487114981._1 | |
341 | - | let stakedAmount = $t01487114981._2 | |
342 | - | let vpEffectiveHeight = $t01487114981._3 | |
343 | - | let stakedAmountNEW = if (isNewUser) | |
344 | - | then amountToAdd | |
345 | - | else (amountToAdd + stakedAmount) | |
346 | - | let quarantinePeriod = (1440 * 14) | |
347 | - | let vpEffectiveHeightNEW = if (isNewUser) | |
348 | - | then (quarantinePeriod + height) | |
349 | - | else mergeVotingPowerEffectiveHeight(quarantinePeriod, vpEffectiveHeight, stakedAmount, stakedAmountNEW) | |
350 | - | $Tuple5(isNewUser, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW) | |
375 | + | func updateTotals () = { | |
376 | + | let period = (height / getIntOrElse(keyVpPeriodDuration(), DEFAULTPERIOD)) | |
377 | + | if ((period > getIntOrZero(keyLastTotalsPeriodProcessed()))) | |
378 | + | then { | |
379 | + | let totalMature = valueOrElse(getInteger(keyTotalMature()), getIntOrZero(keyLockParamTotalAmount())) | |
380 | + | [IntegerEntry(keyTotalMature(), (totalMature + getIntOrZero(keyTotalTeen()))), IntegerEntry(keyTotalTeen(), getIntOrZero(keyTotalKid())), IntegerEntry(keyTotalKid(), 0), IntegerEntry(keyLastTotalsPeriodProcessed(), period)] | |
381 | + | } | |
382 | + | else nil | |
351 | 383 | } | |
352 | 384 | ||
353 | 385 | ||
386 | + | func onStake (userAddressStr,amountToAdd) = if ((0 > amountToAdd)) | |
387 | + | then throw("amountToAdd should be >= 0") | |
388 | + | else { | |
389 | + | let W2 = getIntOrElse(keyVpPeriodDuration(), DEFAULTPERIOD) | |
390 | + | let period = (height / W2) | |
391 | + | let totalMature = valueOrElse(getInteger(keyTotalMature()), getIntOrZero(keyLockParamTotalAmount())) | |
392 | + | let totalTeen = getIntOrZero(keyTotalTeen()) | |
393 | + | let totalKid = getIntOrZero(keyTotalKid()) | |
394 | + | let userMature = valueOrElse(getInteger(keyUserMature(userAddressStr)), getIntOrZero(keyLockParamUserAmount(addressFromStringValue(userAddressStr)))) | |
395 | + | let userTeen = getIntOrZero(keyUserTeen(userAddressStr)) | |
396 | + | let userKid = getIntOrZero(keyUserKid(userAddressStr)) | |
397 | + | let tmp = if ((period > getIntOrZero(keyLastUserPeriodProcessed(userAddressStr)))) | |
398 | + | then $Tuple7((totalMature + userTeen), (totalTeen + (userKid - userTeen)), (totalKid - userKid), (userMature + userTeen), userKid, 0, [IntegerEntry(keyLastUserPeriodProcessed(userAddressStr), period)]) | |
399 | + | else $Tuple7(totalMature, totalTeen, totalKid, userMature, userTeen, userKid, nil) | |
400 | + | let totals = if ((period > getIntOrZero(keyLastTotalsPeriodProcessed()))) | |
401 | + | then $Tuple4([IntegerEntry(keyTotalMature(), (tmp._1 + tmp._2)), IntegerEntry(keyTotalTeen(), tmp._3), IntegerEntry(keyTotalKid(), 0), IntegerEntry(keyLastTotalsPeriodProcessed(), period)], (tmp._1 + tmp._2), tmp._3, 0) | |
402 | + | else $Tuple4(nil, totalMature, totalTeen, totalKid) | |
403 | + | let newKid = fraction(amountToAdd, (height % W2), W2) | |
404 | + | let newTeen = (amountToAdd - newKid) | |
405 | + | $Tuple7(((((totals._1 :+ IntegerEntry(keyUserMature(userAddressStr), tmp._4)) :+ IntegerEntry(keyUserTeen(userAddressStr), (tmp._5 + newTeen))) :+ IntegerEntry(keyUserKid(userAddressStr), (tmp._6 + newKid))) ++ tmp._7), totals._2, totals._3, totals._4, tmp._4, (tmp._5 + newTeen), (tmp._6 + newKid)) | |
406 | + | } | |
407 | + | ||
408 | + | ||
409 | + | let IdxNewDiff = 0 | |
410 | + | ||
411 | + | let IdxNewGnsbt = 1 | |
412 | + | ||
413 | + | func userDecrease (gnsbt,diff) = if ((diff >= gnsbt)) | |
414 | + | then [(diff - gnsbt), 0] | |
415 | + | else [0, (gnsbt - diff)] | |
416 | + | ||
417 | + | ||
418 | + | func onUnstake (userAddressStr,amountToRemove) = if ((amountToRemove >= 0)) | |
419 | + | then throw("amountToRemove should be < 0") | |
420 | + | else { | |
421 | + | let W2 = getIntOrElse(keyVpPeriodDuration(), DEFAULTPERIOD) | |
422 | + | let period = (height / W2) | |
423 | + | let totalMature = valueOrElse(getInteger(keyTotalMature()), getIntOrZero(keyLockParamTotalAmount())) | |
424 | + | let totalTeen = getIntOrZero(keyTotalTeen()) | |
425 | + | let totalKid = getIntOrZero(keyTotalKid()) | |
426 | + | let userMature = valueOrElse(getInteger(keyUserMature(userAddressStr)), getIntOrZero(keyLockParamUserAmount(addressFromStringValue(userAddressStr)))) | |
427 | + | let userTeen = getIntOrZero(keyUserTeen(userAddressStr)) | |
428 | + | let userKid = getIntOrZero(keyUserKid(userAddressStr)) | |
429 | + | let um = userDecrease(userMature, amountToRemove) | |
430 | + | let ut = userDecrease(userTeen, um[IdxNewDiff]) | |
431 | + | let uk = userDecrease(userKid, ut[IdxNewDiff]) | |
432 | + | if ((uk[IdxNewDiff] != 0)) | |
433 | + | then throw("Should not happen") | |
434 | + | else { | |
435 | + | let tmp = if ((period > getIntOrZero(keyLastUserPeriodProcessed(userAddressStr)))) | |
436 | + | then $Tuple7((totalMature + ut[IdxNewGnsbt]), (totalTeen + (uk[IdxNewGnsbt] - ut[IdxNewGnsbt])), (totalKid - uk[IdxNewGnsbt]), (um[IdxNewGnsbt] + ut[IdxNewGnsbt]), uk[IdxNewGnsbt], 0, [IntegerEntry(keyLastUserPeriodProcessed(userAddressStr), period)]) | |
437 | + | else $Tuple7(totalMature, totalTeen, totalKid, um[IdxNewGnsbt], ut[IdxNewGnsbt], uk[IdxNewGnsbt], nil) | |
438 | + | let totals = if ((period > getIntOrZero(keyLastTotalsPeriodProcessed()))) | |
439 | + | then $Tuple4([IntegerEntry(keyTotalMature(), (tmp._1 + tmp._2)), IntegerEntry(keyTotalTeen(), tmp._3), IntegerEntry(keyTotalKid(), 0), IntegerEntry(keyLastTotalsPeriodProcessed(), period)], (tmp._1 + tmp._2), tmp._3, 0) | |
440 | + | else $Tuple4(nil, totalMature, totalTeen, totalKid) | |
441 | + | $Tuple7(((((totals._1 :+ IntegerEntry(keyUserMature(userAddressStr), tmp._4)) :+ IntegerEntry(keyUserTeen(userAddressStr), tmp._5)) :+ IntegerEntry(keyUserKid(userAddressStr), tmp._6)) ++ tmp._7), totals._2, totals._3, totals._4, tmp._4, tmp._5, tmp._6) | |
442 | + | } | |
443 | + | } | |
444 | + | ||
445 | + | ||
354 | 446 | func commonStake (userAddress,i) = { | |
355 | - | let $ | |
356 | - | let stakedAssetId = $ | |
357 | - | let minLockAmount = $ | |
447 | + | let $t02108321137 = getParamsOrFail() | |
448 | + | let stakedAssetId = $t02108321137._1 | |
449 | + | let minLockAmount = $t02108321137._2 | |
358 | 450 | if ((size(i.payments) != 1)) | |
359 | 451 | then throw("Invalid payments size") | |
360 | 452 | else { | |
366 | 458 | then throw(invalidAssetMessage) | |
367 | 459 | else { | |
368 | 460 | let userAddressStr = toString(userAddress) | |
369 | - | let mergedData = mergeStake(userAddress, amount) | |
461 | + | let r = onStake(userAddressStr, amount) | |
462 | + | let mergedData = mergeStake(userAddress, amount, r._6, r._7) | |
370 | 463 | let isNewUser = mergedData._1 | |
371 | 464 | let stakedAmount = mergedData._2 | |
372 | 465 | let vpEffectiveHeight = mergedData._3 | |
375 | 468 | if ((minLockAmount > stakedAmountNEW)) | |
376 | 469 | then throw(("Min lock amount is " + toString(minLockAmount))) | |
377 | 470 | else { | |
378 | - | let $ | |
471 | + | let $t02199122093 = StatsResult(amount, 1, if (isNewUser) | |
379 | 472 | then 1 | |
380 | 473 | else 0) | |
381 | - | let statsEntries = $ | |
382 | - | let totalStaked = $ | |
383 | - | let totalStakedNew = $ | |
384 | - | ((([HistoryRecordEntry("stake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW)] ++ RewardEntries(isNewUser, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeightNEW)) ++ statsEntries) | |
474 | + | let statsEntries = $t02199122093._1 | |
475 | + | let totalStaked = $t02199122093._2 | |
476 | + | let totalStakedNew = $t02199122093._3 | |
477 | + | (((([HistoryRecordEntry("stake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW)] ++ RewardEntries(isNewUser, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeightNEW)) ++ statsEntries) ++ r._1) | |
385 | 478 | } | |
386 | 479 | } | |
387 | 480 | } | |
393 | 486 | if ((size(i.payments) > 0)) | |
394 | 487 | then throw("payments are not accepted") | |
395 | 488 | else { | |
396 | - | let $ | |
397 | - | let isNewUser = $ | |
398 | - | let stakedAmount = $ | |
399 | - | let stakingStart = $ | |
489 | + | let $t02260022705 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
490 | + | let isNewUser = $t02260022705._1 | |
491 | + | let stakedAmount = $t02260022705._2 | |
492 | + | let stakingStart = $t02260022705._3 | |
400 | 493 | let stakedAmountX = toBigInt(stakedAmount) | |
401 | 494 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
402 | 495 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
403 | 496 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
404 | 497 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
405 | - | let $ | |
406 | - | let rewardTotal = $ | |
407 | - | let cached = $ | |
408 | - | let dynamic = $ | |
409 | - | let rewardCachedPartKEY = $ | |
498 | + | let $t02307623214 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
499 | + | let rewardTotal = $t02307623214._1 | |
500 | + | let cached = $t02307623214._2 | |
501 | + | let dynamic = $t02307623214._3 | |
502 | + | let rewardCachedPartKEY = $t02307623214._4 | |
410 | 503 | let claimedKEY = keyClaimed(userAddressStr, asset) | |
411 | - | let $ | |
412 | - | let data = $ | |
413 | - | let claimedAmtByAsset = $ | |
504 | + | let $t02327423311 = accum | |
505 | + | let data = $t02327423311._1 | |
506 | + | let claimedAmtByAsset = $t02327423311._2 | |
414 | 507 | let newPart = makeString([asset, toString(rewardTotal)], ":") | |
415 | 508 | let claimedAmtByAssetNew = makeString([claimedAmtByAsset, newPart], "_") | |
416 | 509 | if ((0 >= rewardTotal)) | |
418 | 511 | else $Tuple2((((data :+ ScriptTransfer(userAddress, rewardTotal, toAssetVect(asset))) :+ IntegerEntry(claimedKEY, (valueOrElse(getInteger(claimedKEY), 0) + rewardTotal))) :+ IntegerEntry(rewardCachedPartKEY, 0)), claimedAmtByAssetNew) | |
419 | 512 | } | |
420 | 513 | ||
421 | - | let $ | |
514 | + | let $t02377123884 = { | |
422 | 515 | let $l = supportedAssetsList | |
423 | 516 | let $s = size($l) | |
424 | 517 | let $acc0 = $Tuple2(nil, "") | |
432 | 525 | ||
433 | 526 | $f0_2($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) | |
434 | 527 | } | |
435 | - | let transfers = $ | |
436 | - | let claimedAmtByAssetResult = $ | |
528 | + | let transfers = $t02377123884._1 | |
529 | + | let claimedAmtByAssetResult = $t02377123884._2 | |
437 | 530 | if ((0 >= size(transfers))) | |
438 | 531 | then $Tuple2(nil, 0) | |
439 | 532 | else $Tuple2(((transfers :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) :+ ClaimHistoryEntry(userAddress, i.transactionId, drop(claimedAmtByAssetResult, 1))), size(transfers)) | |
464 | 557 | else { | |
465 | 558 | let userAddress = i.caller | |
466 | 559 | let userAddressStr = toString(userAddress) | |
467 | - | let $ | |
468 | - | let stakedAssetId = $ | |
469 | - | let minLockAmount = $ | |
470 | - | let $ | |
471 | - | let isNewUser = $ | |
472 | - | let stakedAmount = $ | |
473 | - | let vpEffectiveHeight = $ | |
560 | + | let $t02481824872 = getParamsOrFail() | |
561 | + | let stakedAssetId = $t02481824872._1 | |
562 | + | let minLockAmount = $t02481824872._2 | |
563 | + | let $t02487524959 = getUserParamsOrFail(userAddress) | |
564 | + | let isNewUser = $t02487524959._1 | |
565 | + | let stakedAmount = $t02487524959._2 | |
566 | + | let vpEffectiveHeight = $t02487524959._3 | |
474 | 567 | let swapParamsSTRUCT = asSwapParamsSTRUCT(reentrantInvoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStr, 0], nil)) | |
475 | 568 | let swapLimitSpentInUsdn = swapParamsSTRUCT._2 | |
476 | 569 | let blcks2LmtReset = swapParamsSTRUCT._3 | |
482 | 575 | then throw(((("Requested " + toString(amount)) + ", but staked only ") + toString(stakedAmount))) | |
483 | 576 | else { | |
484 | 577 | let stakedAmountNEW = (stakedAmount - amount) | |
485 | - | let $ | |
578 | + | let $t02559725755 = StatsResult(-(amount), if ((amount == stakedAmount)) | |
486 | 579 | then -1 | |
487 | 580 | else 0, if ((amount == stakedAmount)) | |
488 | 581 | then -1 | |
489 | 582 | else 0) | |
490 | - | let statsEntries = $ | |
491 | - | let totalStaked = $ | |
492 | - | let totalStakedNew = $ | |
493 | - | ((([ScriptTransfer(userAddress, amount, stakedAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeight)] ++ RewardEntries(false, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeight)) ++ statsEntries) | |
583 | + | let statsEntries = $t02559725755._1 | |
584 | + | let totalStaked = $t02559725755._2 | |
585 | + | let totalStakedNew = $t02559725755._3 | |
586 | + | (((([ScriptTransfer(userAddress, amount, stakedAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeight)] ++ RewardEntries(false, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeight)) ++ statsEntries) ++ onUnstake(userAddressStr, amount)._1) | |
494 | 587 | } | |
495 | 588 | } | |
496 | 589 | ||
530 | 623 | else StringEntry(rewardPerNsbtSumNewKEY, sumLastStr))) | |
531 | 624 | } | |
532 | 625 | ||
533 | - | (({ | |
626 | + | ((({ | |
534 | 627 | let $l = supportedAssetsList | |
535 | 628 | let $s = size($l) | |
536 | 629 | let $acc0 = nil | |
543 | 636 | else throw("List size exceeds 9") | |
544 | 637 | ||
545 | 638 | $f0_2($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) | |
546 | - | } :+ IntegerEntry(depositNumLastKEY, depositNumNew)) ++ DepositsTotalsEntries(amount, pmtAssetIdStr)) | |
639 | + | } :+ IntegerEntry(depositNumLastKEY, depositNumNew)) ++ DepositsTotalsEntries(amount, pmtAssetIdStr)) ++ updateTotals()) | |
547 | 640 | } | |
548 | 641 | } | |
549 | 642 | } | |
581 | 674 | } | |
582 | 675 | else { | |
583 | 676 | let userAddress = addressFromStringValue(userAddressStr) | |
584 | - | let $ | |
585 | - | let isNewUser = $ | |
586 | - | let stakedAmount = $ | |
587 | - | let stakingStart = $ | |
677 | + | let $t02847728582 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
678 | + | let isNewUser = $t02847728582._1 | |
679 | + | let stakedAmount = $t02847728582._2 | |
680 | + | let stakingStart = $t02847728582._3 | |
588 | 681 | let stakedAmountX = toBigInt(stakedAmount) | |
589 | 682 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
590 | 683 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
591 | 684 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
592 | 685 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
593 | - | let $ | |
594 | - | let rewardTotal = $ | |
595 | - | let cached = $ | |
596 | - | let dynamic = $ | |
597 | - | let rewardCachedPartKEY = $ | |
686 | + | let $t02892829066 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
687 | + | let rewardTotal = $t02892829066._1 | |
688 | + | let cached = $t02892829066._2 | |
689 | + | let dynamic = $t02892829066._3 | |
690 | + | let rewardCachedPartKEY = $t02892829066._4 | |
598 | 691 | let claimed = valueOrElse(getInteger(keyClaimed(userAddressStr, asset)), 0) | |
599 | 692 | ((accum + makeString([asset, toString(rewardTotal), toString(claimed)], ":")) + "_") | |
600 | 693 | } | |
618 | 711 | ||
619 | 712 | ||
620 | 713 | @Callable(i) | |
714 | + | func updateVotingPower (userAddressStr) = if (!(isDefined(addressFromString(userAddressStr)))) | |
715 | + | then throw("Invalid user address") | |
716 | + | else { | |
717 | + | let r = onStake(userAddressStr, 0) | |
718 | + | $Tuple2(r._1, [surfToGnsbt(r._2), surfToGnsbt(r._3), surfToGnsbt(r._4), surfToGnsbt(r._5), surfToGnsbt(r._6), surfToGnsbt(r._7)]) | |
719 | + | } | |
720 | + | ||
721 | + | ||
722 | + | ||
723 | + | @Callable(i) | |
621 | 724 | func surfStakingSYSREADONLY (userAddressStrOrEmpty,surfDiff) = { | |
622 | 725 | let surfTotal = getIntOrElse(keyLockParamTotalAmount(), 0) | |
623 | 726 | let gnsbtFromSurfTotal = surfToGnsbt(surfTotal) | |
727 | + | let r = if ((surfDiff >= 0)) | |
728 | + | then onStake(userAddressStrOrEmpty, surfDiff) | |
729 | + | else onUnstake(userAddressStrOrEmpty, surfDiff) | |
624 | 730 | if ((userAddressStrOrEmpty == "")) | |
625 | - | then $Tuple2(nil, [0, surfTotal, 0, gnsbtFromSurfTotal, | |
731 | + | then $Tuple2(nil, [0, surfTotal, 0, gnsbtFromSurfTotal, height, height, surfToGnsbt(r._2), surfToGnsbt(r._3), surfToGnsbt(r._4), surfToGnsbt(r._5), surfToGnsbt(r._6), surfToGnsbt(r._7)]) | |
626 | 732 | else { | |
627 | 733 | let userAddress = toAddressOrFail(userAddressStrOrEmpty) | |
628 | - | let mergedData = mergeStake(userAddress, surfDiff) | |
629 | - | let isNewUser = mergedData._1 | |
734 | + | let mergedData = mergeStake(userAddress, surfDiff, r._6, r._7) | |
630 | 735 | let stakedAmount = mergedData._2 | |
631 | 736 | let vpEffectiveHeight = mergedData._3 | |
632 | 737 | let stakedAmountNEW = mergedData._4 | |
633 | 738 | let vpEffectiveHeightNEW = mergedData._5 | |
634 | 739 | let surfUser = stakedAmount | |
635 | 740 | let gnsbtFromSurfUser = surfToGnsbt(surfUser) | |
636 | - | $Tuple2(nil, [surfUser, surfTotal, gnsbtFromSurfUser, gnsbtFromSurfTotal, vpEffectiveHeight, vpEffectiveHeightNEW]) | |
741 | + | $Tuple2(nil, [surfUser, surfTotal, gnsbtFromSurfUser, gnsbtFromSurfTotal, vpEffectiveHeight, vpEffectiveHeightNEW, surfToGnsbt(r._2), surfToGnsbt(r._3), surfToGnsbt(r._4), surfToGnsbt(r._5), surfToGnsbt(r._6), surfToGnsbt(r._7)]) | |
637 | 742 | } | |
638 | 743 | } | |
639 | 744 | ||
647 | 752 | @Callable(i) | |
648 | 753 | func configSYSREADONLY () = { | |
649 | 754 | let minLockAmt = getIntegerValue(keyMinLockAmount()) | |
650 | - | let surfVotingPowerRestrictivePeriod = | |
755 | + | let surfVotingPowerRestrictivePeriod = DEFAULTPERIOD | |
651 | 756 | let brToStartSurfTransformation = 1150000 | |
652 | 757 | $Tuple2(nil, [minLockAmt, (gnsbtFromSurfCoeff * MULT6), surfVotingPowerRestrictivePeriod, brToStartSurfTransformation]) | |
653 | 758 | } |
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 DAYMILLIS = 86400000 | |
23 | 23 | ||
24 | + | let DEFAULTPERIOD = (1440 * 14) | |
25 | + | ||
24 | 26 | let IdxControlCfgNeutrinoDapp = 1 | |
25 | 27 | ||
26 | 28 | let IdxControlCfgAuctionDapp = 2 | |
27 | 29 | ||
28 | 30 | let IdxControlCfgRpdDapp = 3 | |
29 | 31 | ||
30 | 32 | let IdxControlCfgMathDapp = 4 | |
31 | 33 | ||
32 | 34 | let IdxControlCfgLiquidationDapp = 5 | |
33 | 35 | ||
34 | 36 | let IdxControlCfgRestDapp = 6 | |
35 | 37 | ||
36 | 38 | let IdxControlCfgNodeRegistryDapp = 7 | |
37 | 39 | ||
38 | 40 | let IdxControlCfgNsbtStakingDapp = 8 | |
39 | 41 | ||
40 | 42 | let IdxControlCfgMediatorDapp = 9 | |
41 | 43 | ||
42 | 44 | let IdxControlCfgSurfStakingDapp = 10 | |
43 | 45 | ||
44 | 46 | let IdxControlCfgGnsbtControllerDapp = 11 | |
47 | + | ||
48 | + | let IdxControlCfgRestV2Dapp = 12 | |
49 | + | ||
50 | + | let IdxControlCfgGovernanceDapp = 13 | |
45 | 51 | ||
46 | 52 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
47 | 53 | ||
48 | 54 | ||
49 | 55 | func keyControlAddress () = "%s%s__config__controlAddress" | |
50 | 56 | ||
51 | 57 | ||
52 | 58 | func keyControlCfg () = "%s__controlConfig" | |
53 | 59 | ||
54 | 60 | ||
55 | 61 | func keyGnsbtFromSurfCoeff () = "%s%s__cfg__gnsbtFromSurfCoeff" | |
56 | 62 | ||
57 | 63 | ||
58 | 64 | func readControlCfgOrFail (control) = split_4C(getStringOrFail(control, keyControlCfg()), SEP) | |
59 | 65 | ||
60 | 66 | ||
61 | 67 | func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx))) | |
62 | 68 | ||
63 | 69 | ||
64 | 70 | let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx")) | |
65 | 71 | ||
66 | 72 | let controlCfg = readControlCfgOrFail(controlContract) | |
67 | 73 | ||
68 | 74 | let mathContract = getContractAddressOrFail(controlCfg, IdxControlCfgMathDapp) | |
69 | 75 | ||
70 | 76 | let neutrinoContract = getContractAddressOrFail(controlCfg, IdxControlCfgNeutrinoDapp) | |
71 | 77 | ||
72 | 78 | let auctionContract = getContractAddressOrFail(controlCfg, IdxControlCfgAuctionDapp) | |
79 | + | ||
80 | + | let govContract = getContractAddressOrFail(controlCfg, IdxControlCfgGovernanceDapp) | |
73 | 81 | ||
74 | 82 | let gnsbtFromSurfCoeff = valueOrElse(getInteger(this, keyGnsbtFromSurfCoeff()), 300) | |
75 | 83 | ||
76 | 84 | func keyBondAsset () = "bond_asset_id" | |
77 | 85 | ||
78 | 86 | ||
79 | 87 | func keyAuctionContractAddress () = "auction_contract" | |
80 | 88 | ||
81 | 89 | ||
82 | 90 | func keyMinLockAmount () = "%s__minLockAmount" | |
83 | 91 | ||
84 | 92 | ||
85 | 93 | func keyStakedAssetId () = "%s__stakedAssetId" | |
86 | 94 | ||
87 | 95 | ||
88 | 96 | func keyLockParamUserAmount (userAddress) = makeString(["%s%s%s", "paramByUser", toString(userAddress), "amount"], separator) | |
89 | 97 | ||
90 | 98 | ||
91 | 99 | func keyLockParamStartBlock (userAddress) = makeString(["%s%s%s", "paramByUser", toString(userAddress), "start"], separator) | |
92 | 100 | ||
93 | 101 | ||
94 | 102 | func keyLockParamVotingPowerEffectiveHeight (userAddress) = makeString(["%s%s%s", "paramByUser", toString(userAddress), "vpEffectiveHeight"], separator) | |
95 | 103 | ||
96 | 104 | ||
97 | 105 | func keyHistoryRecord (type,userAddress,txId) = makeString(["%s%s%s%s", "history", type, toString(userAddress), toBase58String(txId)], separator) | |
98 | 106 | ||
99 | 107 | ||
100 | 108 | func keyLockParamTotalAmount () = makeString(["%s%s", "stats", "activeTotalLocked"], separator) | |
101 | 109 | ||
102 | 110 | ||
103 | 111 | func keyStatsLocksCount () = makeString(["%s%s", "stats", "locksCount"], separator) | |
104 | 112 | ||
105 | 113 | ||
106 | 114 | func keyStatsUsersCount () = makeString(["%s%s", "stats", "activeUsersCount"], separator) | |
107 | 115 | ||
108 | 116 | ||
109 | 117 | func keyStatsDepositAmtByDay (timestamp) = makeString(["%s%s%d", "stats", "depositAmtByDay", toString(timestamp)], separator) | |
110 | 118 | ||
111 | 119 | ||
112 | - | func keyStatsDepositAmtTotals () = makeString(["%s%s%d", "stats", "depositAmtTotals"], separator) | |
113 | - | ||
114 | - | ||
115 | - | func keyNextPeriod () = "%s__nextPeriod" | |
120 | + | func keyStatsDepositAmtTotals () = makeString(["%s%s", "stats", "depositAmtTotals"], separator) | |
116 | 121 | ||
117 | 122 | ||
118 | 123 | func keySupportedRewardAssets () = "supportedRewardAssets" | |
119 | 124 | ||
120 | 125 | ||
121 | - | func keyDepositNumLast () = makeString([" | |
126 | + | func keyDepositNumLast () = makeString(["%s%s", "dep", "lastNum"], separator) | |
122 | 127 | ||
123 | 128 | ||
124 | - | func keyUserRewardFromDepositNum (userAddress) = makeString(["%s%s | |
129 | + | func keyUserRewardFromDepositNum (userAddress) = makeString(["%s%s", "userRwdFromDepNum", userAddress], separator) | |
125 | 130 | ||
126 | 131 | ||
127 | 132 | func keyRewardPerNsbtSumAt (depositNum,tkn) = makeString(["%s%d", "rwdPerNsbtSumByDepNum", toString(depositNum), tkn], separator) | |
128 | 133 | ||
129 | 134 | ||
130 | 135 | func keyReward (userAddress,tkn) = makeString(["%s%s%s", "rwd", userAddress, tkn], separator) | |
131 | 136 | ||
132 | 137 | ||
133 | 138 | func keyClaimed (userAddress,tkn) = makeString(["%s%s%s", "clm", userAddress, tkn], separator) | |
134 | 139 | ||
135 | 140 | ||
136 | 141 | func keyNotDistributedReward (tkn) = makeString(["%s%s", "notDistributed", tkn], separator) | |
142 | + | ||
143 | + | ||
144 | + | func keyVpPeriodDuration () = makeString(["%s%s", "vp", "periodDuration"], separator) | |
145 | + | ||
146 | + | ||
147 | + | func keyLastTotalsPeriodProcessed () = makeString(["%s%s", "vp", "lastTotalsPeriodProcessed"], separator) | |
148 | + | ||
149 | + | ||
150 | + | func keyLastUserPeriodProcessed (userAddress) = makeString(["%s%s%s", "vp", "lastUserPeriodProcessed", userAddress], separator) | |
151 | + | ||
152 | + | ||
153 | + | func keyTotalMature () = makeString(["%s%s", "vp", "totalMature"], separator) | |
154 | + | ||
155 | + | ||
156 | + | func keyTotalTeen () = makeString(["%s%s", "vp", "totalTeen"], separator) | |
157 | + | ||
158 | + | ||
159 | + | func keyTotalKid () = makeString(["%s%s", "vp", "totalKid"], separator) | |
160 | + | ||
161 | + | ||
162 | + | func keyUserMature (userAddress) = makeString(["%s%s%s", "vp", "userMature", userAddress], separator) | |
163 | + | ||
164 | + | ||
165 | + | func keyUserTeen (userAddress) = makeString(["%s%s%s", "vp", "userTeen", userAddress], separator) | |
166 | + | ||
167 | + | ||
168 | + | func keyUserKid (userAddress) = makeString(["%s%s%s", "vp", "userKid", userAddress], separator) | |
137 | 169 | ||
138 | 170 | ||
139 | 171 | func toX18 (origVal,origMult) = fraction(toBigInt(origVal), MULTX18, origMult) | |
140 | 172 | ||
141 | 173 | ||
142 | 174 | func getIntOrZero (key) = valueOrElse(getInteger(this, key), 0) | |
143 | 175 | ||
144 | 176 | ||
145 | 177 | func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal) | |
146 | 178 | ||
147 | 179 | ||
148 | 180 | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), (("Mandatory this." + key) + " is not defined")) | |
149 | 181 | ||
150 | 182 | ||
151 | 183 | func getStrOrElse (key,defaultVal) = valueOrElse(getString(this, key), defaultVal) | |
152 | 184 | ||
153 | 185 | ||
154 | 186 | func toAddressOrFail (addressStr) = valueOrErrorMessage(addressFromString(addressStr), ("couldn't parse passed addressStr=" + addressStr)) | |
155 | 187 | ||
156 | 188 | ||
157 | 189 | func toAssetVect (assetStr) = if ((assetStr == WAVESIDSTR)) | |
158 | 190 | then unit | |
159 | 191 | else fromBase58String(assetStr) | |
160 | 192 | ||
161 | 193 | ||
162 | 194 | func asInt (val) = match val { | |
163 | 195 | case valInt: Int => | |
164 | 196 | valInt | |
165 | 197 | case _ => | |
166 | 198 | throw("fail to cast into Int") | |
167 | 199 | } | |
168 | 200 | ||
169 | 201 | ||
170 | 202 | func asSwapParamsSTRUCT (v) = match v { | |
171 | 203 | case struct: (Int, Int, Int, Int, Int, Int, Int) => | |
172 | 204 | struct | |
173 | 205 | case _ => | |
174 | 206 | throw("fail to cast into Int") | |
175 | 207 | } | |
176 | 208 | ||
177 | 209 | ||
178 | 210 | 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) | |
179 | 211 | ||
180 | 212 | ||
181 | 213 | func formatClaimHistoryRecord (user,claimedRewards) = makeString(["%s%d%d%s", user, toString(lastBlock.height), toString(lastBlock.timestamp), claimedRewards], separator) | |
182 | 214 | ||
183 | 215 | ||
184 | 216 | func HistoryRecordEntry (type,userAddress,txId,oldAmount,oldStart,newAmount,newStart) = StringEntry(keyHistoryRecord(type, userAddress, txId), formatHistoryRecord(oldAmount, oldStart, newAmount, newStart)) | |
185 | 217 | ||
186 | 218 | ||
187 | 219 | func ClaimHistoryEntry (userAddress,txId,claimedRewards) = StringEntry(keyHistoryRecord("claim", userAddress, txId), formatClaimHistoryRecord(toString(userAddress), claimedRewards)) | |
188 | 220 | ||
189 | 221 | ||
190 | 222 | func StatsResult (totalLockedInc,lockCountInc,usersCountInc) = { | |
191 | 223 | let locksCount = getIntOrZero(keyStatsLocksCount()) | |
192 | 224 | let usersCount = getIntOrZero(keyStatsUsersCount()) | |
193 | 225 | let totalAmount = getIntOrZero(keyLockParamTotalAmount()) | |
194 | 226 | let totalAmountNew = (totalAmount + totalLockedInc) | |
195 | 227 | $Tuple3([IntegerEntry(keyStatsLocksCount(), (locksCount + lockCountInc)), IntegerEntry(keyStatsUsersCount(), (usersCount + usersCountInc)), IntegerEntry(keyLockParamTotalAmount(), totalAmountNew)], totalAmount, totalAmountNew) | |
196 | 228 | } | |
197 | 229 | ||
198 | 230 | ||
199 | 231 | func LockParamsEntry (userAddress,amount,votingPowerEffectiveHeight) = [IntegerEntry(keyLockParamUserAmount(userAddress), amount), IntegerEntry(keyLockParamStartBlock(userAddress), votingPowerEffectiveHeight)] | |
200 | 232 | ||
201 | 233 | ||
202 | 234 | func getParamsOrFail () = $Tuple2(fromBase58String(getStringOrFail(this, keyStakedAssetId())), getIntOrFail(keyMinLockAmount())) | |
203 | 235 | ||
204 | 236 | ||
205 | 237 | func isActiveUser (userAddress) = (getIntOrElse(keyLockParamUserAmount(userAddress), 0) > 0) | |
206 | 238 | ||
207 | 239 | ||
208 | 240 | func getUserParamsOrUnit (userAddress) = if (isActiveUser(userAddress)) | |
209 | 241 | then $Tuple3(false, getIntOrFail(keyLockParamUserAmount(userAddress)), getIntOrFail(keyLockParamStartBlock(userAddress))) | |
210 | 242 | else unit | |
211 | 243 | ||
212 | 244 | ||
213 | 245 | func getUserParamsOrFail (userAddress) = valueOrErrorMessage(getUserParamsOrUnit(userAddress), (("User " + toString(userAddress)) + " is not defined")) | |
214 | 246 | ||
215 | 247 | ||
216 | 248 | let supportedAssetsStr = getStrOrElse(keySupportedRewardAssets(), "") | |
217 | 249 | ||
218 | 250 | let supportedAssetsList = split(supportedAssetsStr, "_") | |
219 | 251 | ||
220 | 252 | func calcReward (userAddress,assetId,stakedAmountX,depositNumUser,depositNumLast) = { | |
221 | 253 | let rewardPerNsbtSumLastKEY = keyRewardPerNsbtSumAt(depositNumLast, assetId) | |
222 | 254 | let sumLastX18 = parseBigIntValue(getStrOrElse(keyRewardPerNsbtSumAt(depositNumLast, assetId), "0")) | |
223 | 255 | let sumUserX18 = parseBigIntValue(getStrOrElse(keyRewardPerNsbtSumAt(depositNumUser, assetId), "0")) | |
224 | 256 | let rewardDynamicPart = toInt(fraction((sumLastX18 - sumUserX18), stakedAmountX, MULTX18)) | |
225 | 257 | let rewardCachedPartKEY = keyReward(userAddress, assetId) | |
226 | 258 | let rewardCachedPart = getIntOrElse(rewardCachedPartKEY, 0) | |
227 | 259 | $Tuple4((rewardCachedPart + rewardDynamicPart), rewardCachedPart, rewardDynamicPart, rewardCachedPartKEY) | |
228 | 260 | } | |
229 | 261 | ||
230 | 262 | ||
231 | 263 | func toStartOfDay (timestamp) = ((timestamp / DAYMILLIS) * DAYMILLIS) | |
232 | 264 | ||
233 | 265 | ||
234 | 266 | func findElementPosition (src,element,sep) = { | |
235 | 267 | let elementStart = valueOrErrorMessage(indexOf(src, element), ((("there is no substring " + element) + " in ") + src)) | |
236 | 268 | if ((elementStart == 0)) | |
237 | 269 | then 0 | |
238 | 270 | else { | |
239 | 271 | let left = take(src, elementStart) | |
240 | 272 | (size(split(left, sep)) - 1) | |
241 | 273 | } | |
242 | 274 | } | |
243 | 275 | ||
244 | 276 | ||
245 | 277 | let DepositTotalsPREFIX = "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" | |
246 | 278 | ||
247 | 279 | func updateDepositTotals (currVal,idxToUpdate,deltaAmt) = { | |
248 | 280 | let currArr = split(currVal, SEP) | |
249 | 281 | func updDepTotByIdx (idx) = if ((idx != idxToUpdate)) | |
250 | 282 | then currArr[idx] | |
251 | 283 | else toString((parseIntValue(currArr[idx]) + deltaAmt)) | |
252 | 284 | ||
253 | 285 | makeString([DepositTotalsPREFIX, updDepTotByIdx(1), updDepTotByIdx(2), updDepTotByIdx(3), updDepTotByIdx(4), updDepTotByIdx(5), updDepTotByIdx(6), updDepTotByIdx(7), updDepTotByIdx(8), updDepTotByIdx(9), updDepTotByIdx(10), updDepTotByIdx(11), updDepTotByIdx(12), updDepTotByIdx(13), updDepTotByIdx(14), updDepTotByIdx(15), updDepTotByIdx(16), updDepTotByIdx(17), updDepTotByIdx(18)], SEP) | |
254 | 286 | } | |
255 | 287 | ||
256 | 288 | ||
257 | 289 | func DepositsTotalsEntries (depositAmount,assetIdStr) = { | |
258 | 290 | let startOfDay = toStartOfDay(lastBlock.timestamp) | |
259 | 291 | let byDayKEY = keyStatsDepositAmtByDay(startOfDay) | |
260 | 292 | let totalsKEY = keyStatsDepositAmtTotals() | |
261 | 293 | let position = findElementPosition(supportedAssetsStr, assetIdStr, "_") | |
262 | 294 | let defaultDATA = (DepositTotalsPREFIX + "__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0") | |
263 | 295 | let currTotalsDATA = valueOrElse(getString(this, totalsKEY), defaultDATA) | |
264 | 296 | let newTotalsDATA = updateDepositTotals(currTotalsDATA, (position + 1), depositAmount) | |
265 | 297 | [StringEntry(totalsKEY, newTotalsDATA), StringEntry(byDayKEY, newTotalsDATA)] | |
266 | 298 | } | |
267 | 299 | ||
268 | 300 | ||
269 | 301 | func RewardEntries (isNewUser,userAddress,stakedAmount) = { | |
270 | 302 | let stakedAmountX = toBigInt(stakedAmount) | |
271 | 303 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddress) | |
272 | 304 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
273 | 305 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
274 | 306 | func forEachAssetCacheUserReward (accum,asset) = { | |
275 | - | let $ | |
276 | - | let rewardTotal = $ | |
277 | - | let cached = $ | |
278 | - | let dynamic = $ | |
279 | - | let rewardCachedPartKEY = $ | |
307 | + | let $t01210412239 = calcReward(userAddress, asset, stakedAmountX, depositNumUser, depositNumLast) | |
308 | + | let rewardTotal = $t01210412239._1 | |
309 | + | let cached = $t01210412239._2 | |
310 | + | let dynamic = $t01210412239._3 | |
311 | + | let rewardCachedPartKEY = $t01210412239._4 | |
280 | 312 | (accum :+ IntegerEntry(rewardCachedPartKEY, rewardTotal)) | |
281 | 313 | } | |
282 | 314 | ||
283 | 315 | if (if ((depositNumLast == -1)) | |
284 | 316 | then (depositNumUser == -1) | |
285 | 317 | else false) | |
286 | 318 | then nil | |
287 | 319 | else if (if ((depositNumLast == -1)) | |
288 | 320 | then (depositNumUser > -1) | |
289 | 321 | else false) | |
290 | 322 | then throw("invalid depositNumLast and depositNumUser state") | |
291 | 323 | else if (if ((depositNumLast > -1)) | |
292 | 324 | then (depositNumUser >= -1) | |
293 | 325 | else false) | |
294 | 326 | then if (isNewUser) | |
295 | 327 | then [IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)] | |
296 | 328 | else ({ | |
297 | 329 | let $l = supportedAssetsList | |
298 | 330 | let $s = size($l) | |
299 | 331 | let $acc0 = nil | |
300 | 332 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
301 | 333 | then $a | |
302 | 334 | else forEachAssetCacheUserReward($a, $l[$i]) | |
303 | 335 | ||
304 | 336 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
305 | 337 | then $a | |
306 | 338 | else throw("List size exceeds 9") | |
307 | 339 | ||
308 | 340 | $f0_2($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) | |
309 | 341 | } :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) | |
310 | 342 | else throw(((("uncovered condition: depositNumLast=" + toString(depositNumLast)) + " depositNumUser=") + toString(depositNumUser))) | |
311 | 343 | } | |
312 | 344 | ||
313 | 345 | ||
314 | 346 | func IncrementNotDistributedRewardEntry (tkn,amountInc) = { | |
315 | 347 | let notDistributedRewardKEY = keyNotDistributedReward(tkn) | |
316 | 348 | let notDistributedReward = getIntOrElse(notDistributedRewardKEY, 0) | |
317 | 349 | [IntegerEntry(notDistributedRewardKEY, (notDistributedReward + amountInc))] | |
318 | 350 | } | |
319 | 351 | ||
320 | 352 | ||
321 | 353 | func surfToGnsbt (surfAmt) = (surfAmt / gnsbtFromSurfCoeff) | |
322 | 354 | ||
323 | 355 | ||
324 | - | func mergeVotingPowerEffectiveHeight (quarantinePeriod,vpEffectiveHeight,stakedAmt,stakedAmtNEW) = { | |
325 | - | let remainingToWait = (vpEffectiveHeight - height) | |
326 | - | if ((0 >= remainingToWait)) | |
327 | - | then (height + quarantinePeriod) | |
328 | - | else { | |
329 | - | let alreadyWaited = (quarantinePeriod - remainingToWait) | |
330 | - | let kX8 = if ((stakedAmtNEW != 0)) | |
331 | - | then fraction(stakedAmt, MULT8, stakedAmtNEW) | |
332 | - | else vpEffectiveHeight | |
333 | - | ((quarantinePeriod + height) - fraction(alreadyWaited, kX8, MULT8)) | |
334 | - | } | |
356 | + | func mergeStake (userAddress,amountToAdd,userTeen,userKid) = { | |
357 | + | let $t01516215272 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
358 | + | let isNewUser = $t01516215272._1 | |
359 | + | let stakedAmount = $t01516215272._2 | |
360 | + | let vpEffectiveHeight = $t01516215272._3 | |
361 | + | let stakedAmountNEW = if (isNewUser) | |
362 | + | then amountToAdd | |
363 | + | else (amountToAdd + stakedAmount) | |
364 | + | let W2 = getIntOrElse(keyVpPeriodDuration(), DEFAULTPERIOD) | |
365 | + | let period = (height / W2) | |
366 | + | let vpEffectivePeriodNEW = if ((userKid > 0)) | |
367 | + | then (period + 2) | |
368 | + | else if ((userTeen > 0)) | |
369 | + | then (period + 1) | |
370 | + | else period | |
371 | + | $Tuple5(isNewUser, stakedAmount, vpEffectiveHeight, stakedAmountNEW, (vpEffectivePeriodNEW * W2)) | |
335 | 372 | } | |
336 | 373 | ||
337 | 374 | ||
338 | - | func mergeStake (userAddress,amountToAdd) = { | |
339 | - | let $t01487114981 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
340 | - | let isNewUser = $t01487114981._1 | |
341 | - | let stakedAmount = $t01487114981._2 | |
342 | - | let vpEffectiveHeight = $t01487114981._3 | |
343 | - | let stakedAmountNEW = if (isNewUser) | |
344 | - | then amountToAdd | |
345 | - | else (amountToAdd + stakedAmount) | |
346 | - | let quarantinePeriod = (1440 * 14) | |
347 | - | let vpEffectiveHeightNEW = if (isNewUser) | |
348 | - | then (quarantinePeriod + height) | |
349 | - | else mergeVotingPowerEffectiveHeight(quarantinePeriod, vpEffectiveHeight, stakedAmount, stakedAmountNEW) | |
350 | - | $Tuple5(isNewUser, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW) | |
375 | + | func updateTotals () = { | |
376 | + | let period = (height / getIntOrElse(keyVpPeriodDuration(), DEFAULTPERIOD)) | |
377 | + | if ((period > getIntOrZero(keyLastTotalsPeriodProcessed()))) | |
378 | + | then { | |
379 | + | let totalMature = valueOrElse(getInteger(keyTotalMature()), getIntOrZero(keyLockParamTotalAmount())) | |
380 | + | [IntegerEntry(keyTotalMature(), (totalMature + getIntOrZero(keyTotalTeen()))), IntegerEntry(keyTotalTeen(), getIntOrZero(keyTotalKid())), IntegerEntry(keyTotalKid(), 0), IntegerEntry(keyLastTotalsPeriodProcessed(), period)] | |
381 | + | } | |
382 | + | else nil | |
351 | 383 | } | |
352 | 384 | ||
353 | 385 | ||
386 | + | func onStake (userAddressStr,amountToAdd) = if ((0 > amountToAdd)) | |
387 | + | then throw("amountToAdd should be >= 0") | |
388 | + | else { | |
389 | + | let W2 = getIntOrElse(keyVpPeriodDuration(), DEFAULTPERIOD) | |
390 | + | let period = (height / W2) | |
391 | + | let totalMature = valueOrElse(getInteger(keyTotalMature()), getIntOrZero(keyLockParamTotalAmount())) | |
392 | + | let totalTeen = getIntOrZero(keyTotalTeen()) | |
393 | + | let totalKid = getIntOrZero(keyTotalKid()) | |
394 | + | let userMature = valueOrElse(getInteger(keyUserMature(userAddressStr)), getIntOrZero(keyLockParamUserAmount(addressFromStringValue(userAddressStr)))) | |
395 | + | let userTeen = getIntOrZero(keyUserTeen(userAddressStr)) | |
396 | + | let userKid = getIntOrZero(keyUserKid(userAddressStr)) | |
397 | + | let tmp = if ((period > getIntOrZero(keyLastUserPeriodProcessed(userAddressStr)))) | |
398 | + | then $Tuple7((totalMature + userTeen), (totalTeen + (userKid - userTeen)), (totalKid - userKid), (userMature + userTeen), userKid, 0, [IntegerEntry(keyLastUserPeriodProcessed(userAddressStr), period)]) | |
399 | + | else $Tuple7(totalMature, totalTeen, totalKid, userMature, userTeen, userKid, nil) | |
400 | + | let totals = if ((period > getIntOrZero(keyLastTotalsPeriodProcessed()))) | |
401 | + | then $Tuple4([IntegerEntry(keyTotalMature(), (tmp._1 + tmp._2)), IntegerEntry(keyTotalTeen(), tmp._3), IntegerEntry(keyTotalKid(), 0), IntegerEntry(keyLastTotalsPeriodProcessed(), period)], (tmp._1 + tmp._2), tmp._3, 0) | |
402 | + | else $Tuple4(nil, totalMature, totalTeen, totalKid) | |
403 | + | let newKid = fraction(amountToAdd, (height % W2), W2) | |
404 | + | let newTeen = (amountToAdd - newKid) | |
405 | + | $Tuple7(((((totals._1 :+ IntegerEntry(keyUserMature(userAddressStr), tmp._4)) :+ IntegerEntry(keyUserTeen(userAddressStr), (tmp._5 + newTeen))) :+ IntegerEntry(keyUserKid(userAddressStr), (tmp._6 + newKid))) ++ tmp._7), totals._2, totals._3, totals._4, tmp._4, (tmp._5 + newTeen), (tmp._6 + newKid)) | |
406 | + | } | |
407 | + | ||
408 | + | ||
409 | + | let IdxNewDiff = 0 | |
410 | + | ||
411 | + | let IdxNewGnsbt = 1 | |
412 | + | ||
413 | + | func userDecrease (gnsbt,diff) = if ((diff >= gnsbt)) | |
414 | + | then [(diff - gnsbt), 0] | |
415 | + | else [0, (gnsbt - diff)] | |
416 | + | ||
417 | + | ||
418 | + | func onUnstake (userAddressStr,amountToRemove) = if ((amountToRemove >= 0)) | |
419 | + | then throw("amountToRemove should be < 0") | |
420 | + | else { | |
421 | + | let W2 = getIntOrElse(keyVpPeriodDuration(), DEFAULTPERIOD) | |
422 | + | let period = (height / W2) | |
423 | + | let totalMature = valueOrElse(getInteger(keyTotalMature()), getIntOrZero(keyLockParamTotalAmount())) | |
424 | + | let totalTeen = getIntOrZero(keyTotalTeen()) | |
425 | + | let totalKid = getIntOrZero(keyTotalKid()) | |
426 | + | let userMature = valueOrElse(getInteger(keyUserMature(userAddressStr)), getIntOrZero(keyLockParamUserAmount(addressFromStringValue(userAddressStr)))) | |
427 | + | let userTeen = getIntOrZero(keyUserTeen(userAddressStr)) | |
428 | + | let userKid = getIntOrZero(keyUserKid(userAddressStr)) | |
429 | + | let um = userDecrease(userMature, amountToRemove) | |
430 | + | let ut = userDecrease(userTeen, um[IdxNewDiff]) | |
431 | + | let uk = userDecrease(userKid, ut[IdxNewDiff]) | |
432 | + | if ((uk[IdxNewDiff] != 0)) | |
433 | + | then throw("Should not happen") | |
434 | + | else { | |
435 | + | let tmp = if ((period > getIntOrZero(keyLastUserPeriodProcessed(userAddressStr)))) | |
436 | + | then $Tuple7((totalMature + ut[IdxNewGnsbt]), (totalTeen + (uk[IdxNewGnsbt] - ut[IdxNewGnsbt])), (totalKid - uk[IdxNewGnsbt]), (um[IdxNewGnsbt] + ut[IdxNewGnsbt]), uk[IdxNewGnsbt], 0, [IntegerEntry(keyLastUserPeriodProcessed(userAddressStr), period)]) | |
437 | + | else $Tuple7(totalMature, totalTeen, totalKid, um[IdxNewGnsbt], ut[IdxNewGnsbt], uk[IdxNewGnsbt], nil) | |
438 | + | let totals = if ((period > getIntOrZero(keyLastTotalsPeriodProcessed()))) | |
439 | + | then $Tuple4([IntegerEntry(keyTotalMature(), (tmp._1 + tmp._2)), IntegerEntry(keyTotalTeen(), tmp._3), IntegerEntry(keyTotalKid(), 0), IntegerEntry(keyLastTotalsPeriodProcessed(), period)], (tmp._1 + tmp._2), tmp._3, 0) | |
440 | + | else $Tuple4(nil, totalMature, totalTeen, totalKid) | |
441 | + | $Tuple7(((((totals._1 :+ IntegerEntry(keyUserMature(userAddressStr), tmp._4)) :+ IntegerEntry(keyUserTeen(userAddressStr), tmp._5)) :+ IntegerEntry(keyUserKid(userAddressStr), tmp._6)) ++ tmp._7), totals._2, totals._3, totals._4, tmp._4, tmp._5, tmp._6) | |
442 | + | } | |
443 | + | } | |
444 | + | ||
445 | + | ||
354 | 446 | func commonStake (userAddress,i) = { | |
355 | - | let $ | |
356 | - | let stakedAssetId = $ | |
357 | - | let minLockAmount = $ | |
447 | + | let $t02108321137 = getParamsOrFail() | |
448 | + | let stakedAssetId = $t02108321137._1 | |
449 | + | let minLockAmount = $t02108321137._2 | |
358 | 450 | if ((size(i.payments) != 1)) | |
359 | 451 | then throw("Invalid payments size") | |
360 | 452 | else { | |
361 | 453 | let payment = i.payments[0] | |
362 | 454 | let amount = payment.amount | |
363 | 455 | let invalidAssetMessage = (("Invalid asset. " + toBase58String(stakedAssetId)) + " is expected") | |
364 | 456 | let assetId = valueOrErrorMessage(payment.assetId, invalidAssetMessage) | |
365 | 457 | if ((assetId != stakedAssetId)) | |
366 | 458 | then throw(invalidAssetMessage) | |
367 | 459 | else { | |
368 | 460 | let userAddressStr = toString(userAddress) | |
369 | - | let mergedData = mergeStake(userAddress, amount) | |
461 | + | let r = onStake(userAddressStr, amount) | |
462 | + | let mergedData = mergeStake(userAddress, amount, r._6, r._7) | |
370 | 463 | let isNewUser = mergedData._1 | |
371 | 464 | let stakedAmount = mergedData._2 | |
372 | 465 | let vpEffectiveHeight = mergedData._3 | |
373 | 466 | let stakedAmountNEW = mergedData._4 | |
374 | 467 | let vpEffectiveHeightNEW = mergedData._5 | |
375 | 468 | if ((minLockAmount > stakedAmountNEW)) | |
376 | 469 | then throw(("Min lock amount is " + toString(minLockAmount))) | |
377 | 470 | else { | |
378 | - | let $ | |
471 | + | let $t02199122093 = StatsResult(amount, 1, if (isNewUser) | |
379 | 472 | then 1 | |
380 | 473 | else 0) | |
381 | - | let statsEntries = $ | |
382 | - | let totalStaked = $ | |
383 | - | let totalStakedNew = $ | |
384 | - | ((([HistoryRecordEntry("stake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW)] ++ RewardEntries(isNewUser, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeightNEW)) ++ statsEntries) | |
474 | + | let statsEntries = $t02199122093._1 | |
475 | + | let totalStaked = $t02199122093._2 | |
476 | + | let totalStakedNew = $t02199122093._3 | |
477 | + | (((([HistoryRecordEntry("stake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW)] ++ RewardEntries(isNewUser, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeightNEW)) ++ statsEntries) ++ r._1) | |
385 | 478 | } | |
386 | 479 | } | |
387 | 480 | } | |
388 | 481 | } | |
389 | 482 | ||
390 | 483 | ||
391 | 484 | func commonClaim (userAddress,i) = { | |
392 | 485 | let userAddressStr = toString(userAddress) | |
393 | 486 | if ((size(i.payments) > 0)) | |
394 | 487 | then throw("payments are not accepted") | |
395 | 488 | else { | |
396 | - | let $ | |
397 | - | let isNewUser = $ | |
398 | - | let stakedAmount = $ | |
399 | - | let stakingStart = $ | |
489 | + | let $t02260022705 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
490 | + | let isNewUser = $t02260022705._1 | |
491 | + | let stakedAmount = $t02260022705._2 | |
492 | + | let stakingStart = $t02260022705._3 | |
400 | 493 | let stakedAmountX = toBigInt(stakedAmount) | |
401 | 494 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
402 | 495 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
403 | 496 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
404 | 497 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
405 | - | let $ | |
406 | - | let rewardTotal = $ | |
407 | - | let cached = $ | |
408 | - | let dynamic = $ | |
409 | - | let rewardCachedPartKEY = $ | |
498 | + | let $t02307623214 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
499 | + | let rewardTotal = $t02307623214._1 | |
500 | + | let cached = $t02307623214._2 | |
501 | + | let dynamic = $t02307623214._3 | |
502 | + | let rewardCachedPartKEY = $t02307623214._4 | |
410 | 503 | let claimedKEY = keyClaimed(userAddressStr, asset) | |
411 | - | let $ | |
412 | - | let data = $ | |
413 | - | let claimedAmtByAsset = $ | |
504 | + | let $t02327423311 = accum | |
505 | + | let data = $t02327423311._1 | |
506 | + | let claimedAmtByAsset = $t02327423311._2 | |
414 | 507 | let newPart = makeString([asset, toString(rewardTotal)], ":") | |
415 | 508 | let claimedAmtByAssetNew = makeString([claimedAmtByAsset, newPart], "_") | |
416 | 509 | if ((0 >= rewardTotal)) | |
417 | 510 | then $Tuple2(data, claimedAmtByAssetNew) | |
418 | 511 | else $Tuple2((((data :+ ScriptTransfer(userAddress, rewardTotal, toAssetVect(asset))) :+ IntegerEntry(claimedKEY, (valueOrElse(getInteger(claimedKEY), 0) + rewardTotal))) :+ IntegerEntry(rewardCachedPartKEY, 0)), claimedAmtByAssetNew) | |
419 | 512 | } | |
420 | 513 | ||
421 | - | let $ | |
514 | + | let $t02377123884 = { | |
422 | 515 | let $l = supportedAssetsList | |
423 | 516 | let $s = size($l) | |
424 | 517 | let $acc0 = $Tuple2(nil, "") | |
425 | 518 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
426 | 519 | then $a | |
427 | 520 | else forEachAssetCalcUnclaimedReward($a, $l[$i]) | |
428 | 521 | ||
429 | 522 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
430 | 523 | then $a | |
431 | 524 | else throw("List size exceeds 9") | |
432 | 525 | ||
433 | 526 | $f0_2($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) | |
434 | 527 | } | |
435 | - | let transfers = $ | |
436 | - | let claimedAmtByAssetResult = $ | |
528 | + | let transfers = $t02377123884._1 | |
529 | + | let claimedAmtByAssetResult = $t02377123884._2 | |
437 | 530 | if ((0 >= size(transfers))) | |
438 | 531 | then $Tuple2(nil, 0) | |
439 | 532 | else $Tuple2(((transfers :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) :+ ClaimHistoryEntry(userAddress, i.transactionId, drop(claimedAmtByAssetResult, 1))), size(transfers)) | |
440 | 533 | } | |
441 | 534 | } | |
442 | 535 | ||
443 | 536 | ||
444 | 537 | @Callable(i) | |
445 | 538 | func constructor (minLockAmount,supportedRewardAssets,stakedAssetId) = if ((i.caller != this)) | |
446 | 539 | then throw("Permission denied") | |
447 | 540 | else [IntegerEntry(keyMinLockAmount(), minLockAmount), StringEntry(keySupportedRewardAssets(), supportedRewardAssets), StringEntry(keyStakedAssetId(), stakedAssetId)] | |
448 | 541 | ||
449 | 542 | ||
450 | 543 | ||
451 | 544 | @Callable(i) | |
452 | 545 | func stake () = commonStake(i.caller, i) | |
453 | 546 | ||
454 | 547 | ||
455 | 548 | ||
456 | 549 | @Callable(i) | |
457 | 550 | func stakeByOriginCaller () = commonStake(i.originCaller, i) | |
458 | 551 | ||
459 | 552 | ||
460 | 553 | ||
461 | 554 | @Callable(i) | |
462 | 555 | func unstake (amount) = if ((size(i.payments) != 0)) | |
463 | 556 | then throw("unstake doesn't require any payment") | |
464 | 557 | else { | |
465 | 558 | let userAddress = i.caller | |
466 | 559 | let userAddressStr = toString(userAddress) | |
467 | - | let $ | |
468 | - | let stakedAssetId = $ | |
469 | - | let minLockAmount = $ | |
470 | - | let $ | |
471 | - | let isNewUser = $ | |
472 | - | let stakedAmount = $ | |
473 | - | let vpEffectiveHeight = $ | |
560 | + | let $t02481824872 = getParamsOrFail() | |
561 | + | let stakedAssetId = $t02481824872._1 | |
562 | + | let minLockAmount = $t02481824872._2 | |
563 | + | let $t02487524959 = getUserParamsOrFail(userAddress) | |
564 | + | let isNewUser = $t02487524959._1 | |
565 | + | let stakedAmount = $t02487524959._2 | |
566 | + | let vpEffectiveHeight = $t02487524959._3 | |
474 | 567 | let swapParamsSTRUCT = asSwapParamsSTRUCT(reentrantInvoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStr, 0], nil)) | |
475 | 568 | let swapLimitSpentInUsdn = swapParamsSTRUCT._2 | |
476 | 569 | let blcks2LmtReset = swapParamsSTRUCT._3 | |
477 | 570 | if ((swapLimitSpentInUsdn > 0)) | |
478 | 571 | then throw((("You have already made a swap operation. Wait " + toString((height + blcks2LmtReset))) + " height to unstake")) | |
479 | 572 | else if ((0 >= stakedAmount)) | |
480 | 573 | then throw("Nothing to unstake") | |
481 | 574 | else if ((amount > stakedAmount)) | |
482 | 575 | then throw(((("Requested " + toString(amount)) + ", but staked only ") + toString(stakedAmount))) | |
483 | 576 | else { | |
484 | 577 | let stakedAmountNEW = (stakedAmount - amount) | |
485 | - | let $ | |
578 | + | let $t02559725755 = StatsResult(-(amount), if ((amount == stakedAmount)) | |
486 | 579 | then -1 | |
487 | 580 | else 0, if ((amount == stakedAmount)) | |
488 | 581 | then -1 | |
489 | 582 | else 0) | |
490 | - | let statsEntries = $ | |
491 | - | let totalStaked = $ | |
492 | - | let totalStakedNew = $ | |
493 | - | ((([ScriptTransfer(userAddress, amount, stakedAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeight)] ++ RewardEntries(false, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeight)) ++ statsEntries) | |
583 | + | let statsEntries = $t02559725755._1 | |
584 | + | let totalStaked = $t02559725755._2 | |
585 | + | let totalStakedNew = $t02559725755._3 | |
586 | + | (((([ScriptTransfer(userAddress, amount, stakedAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeight)] ++ RewardEntries(false, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeight)) ++ statsEntries) ++ onUnstake(userAddressStr, amount)._1) | |
494 | 587 | } | |
495 | 588 | } | |
496 | 589 | ||
497 | 590 | ||
498 | 591 | ||
499 | 592 | @Callable(i) | |
500 | 593 | func deposit () = if ((size(i.payments) != 1)) | |
501 | 594 | then throw("exact 1 payment is allowed only") | |
502 | 595 | else { | |
503 | 596 | let pmt = i.payments[0] | |
504 | 597 | let amount = pmt.amount | |
505 | 598 | let pmtAssetId = valueOrElse(pmt.assetId, WAVESID) | |
506 | 599 | let pmtAssetIdStr = toBase58String(pmtAssetId) | |
507 | 600 | let pmtMultX = if ((pmtAssetId == WAVESID)) | |
508 | 601 | then MULTX8 | |
509 | 602 | else MULTX6 | |
510 | 603 | let amountX = toBigInt(amount) | |
511 | 604 | let totalStaked = getIntOrElse(keyLockParamTotalAmount(), 0) | |
512 | 605 | let totalStakedX = toBigInt(totalStaked) | |
513 | 606 | if ((0 > totalStaked)) | |
514 | 607 | then throw("TODO: case is not supported") | |
515 | 608 | else if ((totalStaked == 0)) | |
516 | 609 | then IncrementNotDistributedRewardEntry(pmtAssetIdStr, amount) | |
517 | 610 | else { | |
518 | 611 | let rewardPerNsbtX18 = fraction(amountX, MULTX18, totalStakedX) | |
519 | 612 | let depositNumLastKEY = keyDepositNumLast() | |
520 | 613 | let depositNumLast = getIntOrElse(depositNumLastKEY, -1) | |
521 | 614 | let depositNumNew = (depositNumLast + 1) | |
522 | 615 | if (!(contains(supportedAssetsStr, pmtAssetIdStr))) | |
523 | 616 | then throw(((supportedAssetsStr + " doesn't contain ") + pmtAssetIdStr)) | |
524 | 617 | else { | |
525 | 618 | func refreshRewardPerNsbtSUM (accum,nextAsset) = { | |
526 | 619 | let rewardPerNsbtSumNewKEY = keyRewardPerNsbtSumAt(depositNumNew, nextAsset) | |
527 | 620 | let sumLastStr = getStrOrElse(keyRewardPerNsbtSumAt(depositNumLast, nextAsset), "0") | |
528 | 621 | (accum :+ (if ((nextAsset == pmtAssetIdStr)) | |
529 | 622 | then StringEntry(rewardPerNsbtSumNewKEY, toString((parseBigIntValue(sumLastStr) + rewardPerNsbtX18))) | |
530 | 623 | else StringEntry(rewardPerNsbtSumNewKEY, sumLastStr))) | |
531 | 624 | } | |
532 | 625 | ||
533 | - | (({ | |
626 | + | ((({ | |
534 | 627 | let $l = supportedAssetsList | |
535 | 628 | let $s = size($l) | |
536 | 629 | let $acc0 = nil | |
537 | 630 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
538 | 631 | then $a | |
539 | 632 | else refreshRewardPerNsbtSUM($a, $l[$i]) | |
540 | 633 | ||
541 | 634 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
542 | 635 | then $a | |
543 | 636 | else throw("List size exceeds 9") | |
544 | 637 | ||
545 | 638 | $f0_2($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) | |
546 | - | } :+ IntegerEntry(depositNumLastKEY, depositNumNew)) ++ DepositsTotalsEntries(amount, pmtAssetIdStr)) | |
639 | + | } :+ IntegerEntry(depositNumLastKEY, depositNumNew)) ++ DepositsTotalsEntries(amount, pmtAssetIdStr)) ++ updateTotals()) | |
547 | 640 | } | |
548 | 641 | } | |
549 | 642 | } | |
550 | 643 | ||
551 | 644 | ||
552 | 645 | ||
553 | 646 | @Callable(i) | |
554 | 647 | func claimRewards () = commonClaim(i.caller, i) | |
555 | 648 | ||
556 | 649 | ||
557 | 650 | ||
558 | 651 | @Callable(i) | |
559 | 652 | func claimRewardsByOriginCaller () = commonClaim(i.originCaller, i) | |
560 | 653 | ||
561 | 654 | ||
562 | 655 | ||
563 | 656 | @Callable(i) | |
564 | 657 | func unclaimedRewardsREADONLY (userAddressStr) = { | |
565 | 658 | func forEachAssetZeroReward (accum,asset) = ((accum + makeString([asset, "0", "0"], ":")) + "_") | |
566 | 659 | ||
567 | 660 | let unclaimedRewardStr = if ((userAddressStr == "")) | |
568 | 661 | then { | |
569 | 662 | let $l = supportedAssetsList | |
570 | 663 | let $s = size($l) | |
571 | 664 | let $acc0 = "" | |
572 | 665 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
573 | 666 | then $a | |
574 | 667 | else forEachAssetZeroReward($a, $l[$i]) | |
575 | 668 | ||
576 | 669 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
577 | 670 | then $a | |
578 | 671 | else throw("List size exceeds 9") | |
579 | 672 | ||
580 | 673 | $f0_2($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) | |
581 | 674 | } | |
582 | 675 | else { | |
583 | 676 | let userAddress = addressFromStringValue(userAddressStr) | |
584 | - | let $ | |
585 | - | let isNewUser = $ | |
586 | - | let stakedAmount = $ | |
587 | - | let stakingStart = $ | |
677 | + | let $t02847728582 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
678 | + | let isNewUser = $t02847728582._1 | |
679 | + | let stakedAmount = $t02847728582._2 | |
680 | + | let stakingStart = $t02847728582._3 | |
588 | 681 | let stakedAmountX = toBigInt(stakedAmount) | |
589 | 682 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
590 | 683 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
591 | 684 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
592 | 685 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
593 | - | let $ | |
594 | - | let rewardTotal = $ | |
595 | - | let cached = $ | |
596 | - | let dynamic = $ | |
597 | - | let rewardCachedPartKEY = $ | |
686 | + | let $t02892829066 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
687 | + | let rewardTotal = $t02892829066._1 | |
688 | + | let cached = $t02892829066._2 | |
689 | + | let dynamic = $t02892829066._3 | |
690 | + | let rewardCachedPartKEY = $t02892829066._4 | |
598 | 691 | let claimed = valueOrElse(getInteger(keyClaimed(userAddressStr, asset)), 0) | |
599 | 692 | ((accum + makeString([asset, toString(rewardTotal), toString(claimed)], ":")) + "_") | |
600 | 693 | } | |
601 | 694 | ||
602 | 695 | let $l = supportedAssetsList | |
603 | 696 | let $s = size($l) | |
604 | 697 | let $acc0 = "" | |
605 | 698 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
606 | 699 | then $a | |
607 | 700 | else forEachAssetCalcUnclaimedReward($a, $l[$i]) | |
608 | 701 | ||
609 | 702 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
610 | 703 | then $a | |
611 | 704 | else throw("List size exceeds 9") | |
612 | 705 | ||
613 | 706 | $f0_2($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) | |
614 | 707 | } | |
615 | 708 | $Tuple2(nil, dropRight(unclaimedRewardStr, 1)) | |
616 | 709 | } | |
617 | 710 | ||
618 | 711 | ||
619 | 712 | ||
620 | 713 | @Callable(i) | |
714 | + | func updateVotingPower (userAddressStr) = if (!(isDefined(addressFromString(userAddressStr)))) | |
715 | + | then throw("Invalid user address") | |
716 | + | else { | |
717 | + | let r = onStake(userAddressStr, 0) | |
718 | + | $Tuple2(r._1, [surfToGnsbt(r._2), surfToGnsbt(r._3), surfToGnsbt(r._4), surfToGnsbt(r._5), surfToGnsbt(r._6), surfToGnsbt(r._7)]) | |
719 | + | } | |
720 | + | ||
721 | + | ||
722 | + | ||
723 | + | @Callable(i) | |
621 | 724 | func surfStakingSYSREADONLY (userAddressStrOrEmpty,surfDiff) = { | |
622 | 725 | let surfTotal = getIntOrElse(keyLockParamTotalAmount(), 0) | |
623 | 726 | let gnsbtFromSurfTotal = surfToGnsbt(surfTotal) | |
727 | + | let r = if ((surfDiff >= 0)) | |
728 | + | then onStake(userAddressStrOrEmpty, surfDiff) | |
729 | + | else onUnstake(userAddressStrOrEmpty, surfDiff) | |
624 | 730 | if ((userAddressStrOrEmpty == "")) | |
625 | - | then $Tuple2(nil, [0, surfTotal, 0, gnsbtFromSurfTotal, | |
731 | + | then $Tuple2(nil, [0, surfTotal, 0, gnsbtFromSurfTotal, height, height, surfToGnsbt(r._2), surfToGnsbt(r._3), surfToGnsbt(r._4), surfToGnsbt(r._5), surfToGnsbt(r._6), surfToGnsbt(r._7)]) | |
626 | 732 | else { | |
627 | 733 | let userAddress = toAddressOrFail(userAddressStrOrEmpty) | |
628 | - | let mergedData = mergeStake(userAddress, surfDiff) | |
629 | - | let isNewUser = mergedData._1 | |
734 | + | let mergedData = mergeStake(userAddress, surfDiff, r._6, r._7) | |
630 | 735 | let stakedAmount = mergedData._2 | |
631 | 736 | let vpEffectiveHeight = mergedData._3 | |
632 | 737 | let stakedAmountNEW = mergedData._4 | |
633 | 738 | let vpEffectiveHeightNEW = mergedData._5 | |
634 | 739 | let surfUser = stakedAmount | |
635 | 740 | let gnsbtFromSurfUser = surfToGnsbt(surfUser) | |
636 | - | $Tuple2(nil, [surfUser, surfTotal, gnsbtFromSurfUser, gnsbtFromSurfTotal, vpEffectiveHeight, vpEffectiveHeightNEW]) | |
741 | + | $Tuple2(nil, [surfUser, surfTotal, gnsbtFromSurfUser, gnsbtFromSurfTotal, vpEffectiveHeight, vpEffectiveHeightNEW, surfToGnsbt(r._2), surfToGnsbt(r._3), surfToGnsbt(r._4), surfToGnsbt(r._5), surfToGnsbt(r._6), surfToGnsbt(r._7)]) | |
637 | 742 | } | |
638 | 743 | } | |
639 | 744 | ||
640 | 745 | ||
641 | 746 | ||
642 | 747 | @Callable(i) | |
643 | 748 | func gnsbtFromSurfSYSREADONLY (surfAmt) = $Tuple2(nil, surfToGnsbt(surfAmt)) | |
644 | 749 | ||
645 | 750 | ||
646 | 751 | ||
647 | 752 | @Callable(i) | |
648 | 753 | func configSYSREADONLY () = { | |
649 | 754 | let minLockAmt = getIntegerValue(keyMinLockAmount()) | |
650 | - | let surfVotingPowerRestrictivePeriod = | |
755 | + | let surfVotingPowerRestrictivePeriod = DEFAULTPERIOD | |
651 | 756 | let brToStartSurfTransformation = 1150000 | |
652 | 757 | $Tuple2(nil, [minLockAmt, (gnsbtFromSurfCoeff * MULT6), surfVotingPowerRestrictivePeriod, brToStartSurfTransformation]) | |
653 | 758 | } | |
654 | 759 | ||
655 | 760 |
github/deemru/w8io/026f985 106.19 ms ◑