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