tx · H7DmuyYxWsXne84GZuMu4rMD7DTV8xen5hDAzABqprXQ 3MuGfNhF98CNBCfthhoJEo6SYUv7zTgkK4J: -0.02500000 Waves 2023.02.10 10:54 [2443255] smart account 3MuGfNhF98CNBCfthhoJEo6SYUv7zTgkK4J > SELF 0.00000000 Waves
{ "type": 13, "id": "H7DmuyYxWsXne84GZuMu4rMD7DTV8xen5hDAzABqprXQ", "fee": 2500000, "feeAssetId": null, "timestamp": 1676015670441, "version": 2, "chainId": 84, "sender": "3MuGfNhF98CNBCfthhoJEo6SYUv7zTgkK4J", "senderPublicKey": "4DthuG3xjZV9WtZ34Y66AummdAr67wRzwWsVQL4y2bob", "proofs": [ "4XBuKpidA93ughDb3ANkfedcy64AE7uyhv69FVPwHFhkEaCBvY7sNzycpYM3vNUND8whjff4Fiybrs2BTzUyqTvz", "UKNGjYqYvRCpvU7Yj1AM85kRKV7ojLeUZ1Gx46EThP7VAL7sr5QiQPiBswivTHPad4Ee5MR16V4JFUNvJSWyqL9", "59ZcZGsKYLp9VUcVH4DrHU9Fmo6KroGy223npNTSUgXKpDS1KwV8gP9Ythv47R1tbVw4D6Jpoo2CEB4XBGpRgKFP" ], "script": "base64:BgIpCAISBwoFCAgBAQgSABIDCgEBEgASABIAEgMKAQgSBAoCCAESBAoCCAFSAAlzZXBhcmF0b3ICAl9fAANTRVACAl9fAAVNVUxUNgDAhD0ABU1VTFQ4AIDC1y8ABk1VTFRYNgkAtgIBBQVNVUxUNgAGTVVMVFg4CQC2AgEFBU1VTFQ4AAdNVUxUWDE4CQC2AgEAgICQu7rWrfANAApXQVZFU0lEU1RSAgVXQVZFUwAHV0FWRVNJRAkA2QQBBQpXQVZFU0lEU1RSAAlEQVlNSUxMSVMAgLiZKQAZSWR4Q29udHJvbENmZ05ldXRyaW5vRGFwcAABABhJZHhDb250cm9sQ2ZnQXVjdGlvbkRhcHAAAgAUSWR4Q29udHJvbENmZ1JwZERhcHAAAwAVSWR4Q29udHJvbENmZ01hdGhEYX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height": 2443255, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G3m4WoFVto2gB57qYS2pnvttJNqw84wP55eytu41BHoS Next: EJkoxxWdHk8tnPnYp3ih2YCWhMamX4TJVczwhzL2jK8T Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
50 | 50 | func keyControlCfg () = "%s__controlConfig" | |
51 | 51 | ||
52 | 52 | ||
53 | - | func readControlCfgOrFail (control) = split(getStringOrFail(control, keyControlCfg()), SEP) | |
53 | + | func readControlCfgOrFail (control) = split_4C(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))) | |
262 | 262 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
263 | 263 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
264 | 264 | func forEachAssetCacheUserReward (accum,asset) = { | |
265 | - | let $ | |
266 | - | let rewardTotal = $ | |
267 | - | let cached = $ | |
268 | - | let dynamic = $ | |
269 | - | let rewardCachedPartKEY = $ | |
265 | + | let $t01079910934 = calcReward(userAddress, asset, stakedAmountX, depositNumUser, depositNumLast) | |
266 | + | let rewardTotal = $t01079910934._1 | |
267 | + | let cached = $t01079910934._2 | |
268 | + | let dynamic = $t01079910934._3 | |
269 | + | let rewardCachedPartKEY = $t01079910934._4 | |
270 | 270 | (accum :+ IntegerEntry(rewardCachedPartKEY, rewardTotal)) | |
271 | 271 | } | |
272 | 272 | ||
304 | 304 | func IncrementNotDistributedRewardEntry (tkn,amountInc) = { | |
305 | 305 | let notDistributedRewardKEY = keyNotDistributedReward(tkn) | |
306 | 306 | let notDistributedReward = getIntOrElse(notDistributedRewardKEY, 0) | |
307 | - | ||
307 | + | IntegerEntry(notDistributedRewardKEY, (notDistributedReward + amountInc)) | |
308 | 308 | } | |
309 | 309 | ||
310 | 310 | ||
313 | 313 | if ((size(i.payments) > 0)) | |
314 | 314 | then throw("payments are not accepted") | |
315 | 315 | else { | |
316 | - | let $ | |
317 | - | let isNewUser = $ | |
318 | - | let stakedAmount = $ | |
319 | - | let stakingStart = $ | |
316 | + | let $t01387513980 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
317 | + | let isNewUser = $t01387513980._1 | |
318 | + | let stakedAmount = $t01387513980._2 | |
319 | + | let stakingStart = $t01387513980._3 | |
320 | 320 | let stakedAmountX = toBigInt(stakedAmount) | |
321 | 321 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
322 | 322 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
323 | 323 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
324 | 324 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
325 | - | let $ | |
326 | - | let rewardTotal = $ | |
327 | - | let cached = $ | |
328 | - | let dynamic = $ | |
329 | - | let rewardCachedPartKEY = $ | |
325 | + | let $t01435114489 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
326 | + | let rewardTotal = $t01435114489._1 | |
327 | + | let cached = $t01435114489._2 | |
328 | + | let dynamic = $t01435114489._3 | |
329 | + | let rewardCachedPartKEY = $t01435114489._4 | |
330 | 330 | let claimedKEY = keyClaimed(userAddressStr, asset) | |
331 | - | let $ | |
332 | - | let data = $ | |
333 | - | let claimedAmtByAsset = $ | |
331 | + | let $t01454914586 = accum | |
332 | + | let data = $t01454914586._1 | |
333 | + | let claimedAmtByAsset = $t01454914586._2 | |
334 | 334 | let newPart = makeString([asset, toString(rewardTotal)], ":") | |
335 | 335 | let claimedAmtByAssetNew = makeString([claimedAmtByAsset, newPart], "_") | |
336 | 336 | if ((0 >= rewardTotal)) | |
338 | 338 | else $Tuple2((((data :+ ScriptTransfer(userAddress, rewardTotal, toAssetVect(asset))) :+ IntegerEntry(claimedKEY, (valueOrElse(getInteger(claimedKEY), 0) + rewardTotal))) :+ IntegerEntry(rewardCachedPartKEY, 0)), claimedAmtByAssetNew) | |
339 | 339 | } | |
340 | 340 | ||
341 | - | let $ | |
341 | + | let $t01504615159 = { | |
342 | 342 | let $l = supportedAssetsList | |
343 | 343 | let $s = size($l) | |
344 | 344 | let $acc0 = $Tuple2(nil, "") | |
352 | 352 | ||
353 | 353 | $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) | |
354 | 354 | } | |
355 | - | let transfers = $ | |
356 | - | let claimedAmtByAssetResult = $ | |
355 | + | let transfers = $t01504615159._1 | |
356 | + | let claimedAmtByAssetResult = $t01504615159._2 | |
357 | 357 | if ((0 >= size(transfers))) | |
358 | 358 | then $Tuple2(nil, 0) | |
359 | 359 | else $Tuple2(((transfers :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) :+ ClaimHistoryEntry(userAddress, i.transactionId, drop(claimedAmtByAssetResult, 1))), size(transfers)) | |
362 | 362 | ||
363 | 363 | ||
364 | 364 | @Callable(i) | |
365 | - | func | |
365 | + | func constructorV1 (neutrinoContractAddress,mathContractAddress,minLockAmount,halfLife,supportedRewardAssets) = if ((i.caller != this)) | |
366 | 366 | then throw("Permission denied") | |
367 | 367 | else [StringEntry(keyNeutrinoContractAddress(), neutrinoContractAddress), StringEntry(keyMathContractAddress(), mathContractAddress), IntegerEntry(keyMinLockAmount(), minLockAmount), IntegerEntry(keyHalfLife(), halfLife), StringEntry(keySupportedRewardAssets(), supportedRewardAssets)] | |
368 | 368 | ||
370 | 370 | ||
371 | 371 | @Callable(i) | |
372 | 372 | func stake () = { | |
373 | - | let $ | |
374 | - | let bondAssetId = $ | |
375 | - | let minLockAmount = $ | |
376 | - | let halfLife = $ | |
373 | + | let $t01601016072 = getParamsOrFail() | |
374 | + | let bondAssetId = $t01601016072._1 | |
375 | + | let minLockAmount = $t01601016072._2 | |
376 | + | let halfLife = $t01601016072._3 | |
377 | 377 | if ((size(i.payments) != 1)) | |
378 | 378 | then throw("Invalid payments size") | |
379 | 379 | else { | |
386 | 386 | else { | |
387 | 387 | let userAddress = i.caller | |
388 | 388 | let userAddressStr = toString(i.caller) | |
389 | - | let $ | |
390 | - | let isNewUser = $ | |
391 | - | let lockAmount = $ | |
392 | - | let lockStartHeight = $ | |
389 | + | let $t01661416721 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, -1)) | |
390 | + | let isNewUser = $t01661416721._1 | |
391 | + | let lockAmount = $t01661416721._2 | |
392 | + | let lockStartHeight = $t01661416721._3 | |
393 | 393 | let mergedAmount = if (isNewUser) | |
394 | 394 | then amount | |
395 | 395 | else (amount + lockAmount) | |
399 | 399 | if ((minLockAmount > mergedAmount)) | |
400 | 400 | then throw(("Min lock amount is " + toString(minLockAmount))) | |
401 | 401 | else { | |
402 | - | let $ | |
402 | + | let $t01708217184 = StatsResult(amount, 1, if (isNewUser) | |
403 | 403 | then 1 | |
404 | 404 | else 0) | |
405 | - | let statsEntries = $ | |
406 | - | let totalStaked = $ | |
407 | - | let totalStakedNew = $ | |
405 | + | let statsEntries = $t01708217184._1 | |
406 | + | let totalStaked = $t01708217184._2 | |
407 | + | let totalStakedNew = $t01708217184._3 | |
408 | 408 | ((([HistoryRecordEntry("stake", userAddress, i.transactionId, lockAmount, lockStartHeight, mergedAmount, mergedStartHeight)] ++ RewardEntries(isNewUser, userAddressStr, lockAmount)) ++ LockParamsEntry(userAddress, mergedAmount, mergedStartHeight)) ++ statsEntries) | |
409 | 409 | } | |
410 | 410 | } | |
419 | 419 | else { | |
420 | 420 | let userAddress = i.caller | |
421 | 421 | let userAddressStr = toString(userAddress) | |
422 | - | let $ | |
423 | - | let bondAssetId = $ | |
424 | - | let minLockAmount = $ | |
425 | - | let halfLife = $ | |
426 | - | let $ | |
427 | - | let isNewUser = $ | |
428 | - | let lockAmount = $ | |
429 | - | let lockStart = $ | |
422 | + | let $t01767017732 = getParamsOrFail() | |
423 | + | let bondAssetId = $t01767017732._1 | |
424 | + | let minLockAmount = $t01767017732._2 | |
425 | + | let halfLife = $t01767017732._3 | |
426 | + | let $t01773517809 = getUserParamsOrFail(userAddress) | |
427 | + | let isNewUser = $t01773517809._1 | |
428 | + | let lockAmount = $t01773517809._2 | |
429 | + | let lockStart = $t01773517809._3 | |
430 | 430 | if ((0 >= lockAmount)) | |
431 | 431 | then throw("Nothing to unstake") | |
432 | 432 | else if ((amount > lockAmount)) | |
438 | 438 | then throw(("Your gNsbt are taking part in voting, cannot unstake until " + toString(releaseTime))) | |
439 | 439 | else { | |
440 | 440 | let comissionAmount = asInt(invoke(mathContract, "getUnstakeComissionAmountREADONLY", [amount, lockStart, halfLife], nil)) | |
441 | - | let $ | |
441 | + | let $t01845018604 = StatsResult(-(amount), if ((amount == lockAmount)) | |
442 | 442 | then -1 | |
443 | 443 | else 0, if ((amount == lockAmount)) | |
444 | 444 | then -1 | |
445 | 445 | else 0) | |
446 | - | let statsEntries = $ | |
447 | - | let totalStaked = $ | |
448 | - | let totalStakedNew = $ | |
446 | + | let statsEntries = $t01845018604._1 | |
447 | + | let totalStaked = $t01845018604._2 | |
448 | + | let totalStakedNew = $t01845018604._3 | |
449 | 449 | ((([ScriptTransfer(userAddress, (amount - comissionAmount), bondAssetId), ScriptTransfer(auctionContract, comissionAmount, bondAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, lockAmount, lockStart, (lockAmount - amount), lockStart)] ++ RewardEntries(false, userAddressStr, lockAmount)) ++ LockParamsEntry(userAddress, (lockAmount - amount), lockStart)) ++ statsEntries) | |
450 | 450 | } | |
451 | 451 | } | |
454 | 454 | ||
455 | 455 | ||
456 | 456 | @Callable(i) | |
457 | - | func deposit () = if ((size(i.payments) != 1)) | |
458 | - | then throw("exact 1 payment is allowed only") | |
459 | - | else { | |
460 | - | let pmt = i.payments[0] | |
461 | - | let amount = pmt.amount | |
462 | - | let pmtAssetId = valueOrElse(pmt.assetId, WAVESID) | |
463 | - | let pmtAssetIdStr = toBase58String(pmtAssetId) | |
464 | - | let pmtMultX = if ((pmtAssetId == WAVESID)) | |
465 | - | then MULTX8 | |
466 | - | else MULTX6 | |
467 | - | let amountX = toBigInt(amount) | |
468 | - | let totalStaked = getIntOrElse(keyLockParamTotalAmount(), 0) | |
469 | - | let totalStakedX = toBigInt(totalStaked) | |
470 | - | if ((0 > totalStaked)) | |
471 | - | then throw("TODO: case is not supported") | |
472 | - | else if ((totalStaked == 0)) | |
473 | - | then IncrementNotDistributedRewardEntry(pmtAssetIdStr, amount) | |
474 | - | else { | |
475 | - | let rewardPerNsbtX18 = fraction(amountX, MULTX18, totalStakedX) | |
476 | - | let depositNumLastKEY = keyDepositNumLast() | |
477 | - | let depositNumLast = getIntOrElse(depositNumLastKEY, -1) | |
478 | - | let depositNumNew = (depositNumLast + 1) | |
479 | - | if (!(contains(supportedAssetsStr, pmtAssetIdStr))) | |
480 | - | then throw(((supportedAssetsStr + " doesn't contain ") + pmtAssetIdStr)) | |
457 | + | func deposit () = { | |
458 | + | let totalStaked = getIntOrElse(keyLockParamTotalAmount(), 0) | |
459 | + | if ((0 > totalStaked)) | |
460 | + | then throw("TODO: case is not supported") | |
461 | + | else { | |
462 | + | let depositNumLastKEY = keyDepositNumLast() | |
463 | + | let depositNumLast = getIntOrElse(depositNumLastKEY, -1) | |
464 | + | let depositNumNew = (depositNumLast + 1) | |
465 | + | func dep (acc,pmt) = { | |
466 | + | let amount = pmt.amount | |
467 | + | let pmtAssetId = valueOrElse(pmt.assetId, WAVESID) | |
468 | + | let pmtAssetIdStr = toBase58String(pmtAssetId) | |
469 | + | if (!(contains(supportedAssetsStr, pmtAssetIdStr))) | |
470 | + | then throw(((supportedAssetsStr + " doesn't contain ") + pmtAssetIdStr)) | |
471 | + | else if ((totalStaked == 0)) | |
472 | + | then (acc :+ IncrementNotDistributedRewardEntry(pmtAssetIdStr, amount)) | |
481 | 473 | else { | |
474 | + | let rewardPerNsbtX18 = fraction(toBigInt(amount), MULTX18, toBigInt(totalStaked)) | |
482 | 475 | func refreshRewardPerNsbtSUM (accum,nextAsset) = { | |
483 | - | let rewardPerNsbtSumNewKEY = keyRewardPerNsbtSumAt(depositNumNew, nextAsset) | |
484 | 476 | let sumLastStr = getStrOrElse(keyRewardPerNsbtSumAt(depositNumLast, nextAsset), "0") | |
485 | - | (accum :+ (if ((nextAsset == pmtAssetIdStr)) | |
486 | - | then | |
487 | - | else | |
477 | + | (accum :+ StringEntry(keyRewardPerNsbtSumAt(depositNumNew, nextAsset), if ((nextAsset == pmtAssetIdStr)) | |
478 | + | then toString((parseBigIntValue(sumLastStr) + rewardPerNsbtX18)) | |
479 | + | else sumLastStr)) | |
488 | 480 | } | |
489 | 481 | ||
490 | - | (({ | |
482 | + | ((acc ++ { | |
491 | 483 | let $l = supportedAssetsList | |
492 | 484 | let $s = size($l) | |
493 | 485 | let $acc0 = nil | |
500 | 492 | else throw("List size exceeds 9") | |
501 | 493 | ||
502 | 494 | $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) | |
503 | - | } | |
495 | + | }) ++ DepositsTotalsEntries(amount, pmtAssetIdStr)) | |
504 | 496 | } | |
505 | - | } | |
506 | - | } | |
497 | + | } | |
498 | + | ||
499 | + | ({ | |
500 | + | let $l = i.payments | |
501 | + | let $s = size($l) | |
502 | + | let $acc0 = nil | |
503 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
504 | + | then $a | |
505 | + | else dep($a, $l[$i]) | |
506 | + | ||
507 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
508 | + | then $a | |
509 | + | else throw("List size exceeds 10") | |
510 | + | ||
511 | + | $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) | |
512 | + | } :+ IntegerEntry(depositNumLastKEY, depositNumNew)) | |
513 | + | } | |
514 | + | } | |
507 | 515 | ||
508 | 516 | ||
509 | 517 | ||
538 | 546 | } | |
539 | 547 | else { | |
540 | 548 | let userAddress = addressFromStringValue(userAddressStr) | |
541 | - | let $ | |
542 | - | let isNewUser = $ | |
543 | - | let stakedAmount = $ | |
544 | - | let stakingStart = $ | |
549 | + | let $t02111121216 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
550 | + | let isNewUser = $t02111121216._1 | |
551 | + | let stakedAmount = $t02111121216._2 | |
552 | + | let stakingStart = $t02111121216._3 | |
545 | 553 | let stakedAmountX = toBigInt(stakedAmount) | |
546 | 554 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
547 | 555 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
548 | 556 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
549 | 557 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
550 | - | let $ | |
551 | - | let rewardTotal = $ | |
552 | - | let cached = $ | |
553 | - | let dynamic = $ | |
554 | - | let rewardCachedPartKEY = $ | |
558 | + | let $t02156221700 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
559 | + | let rewardTotal = $t02156221700._1 | |
560 | + | let cached = $t02156221700._2 | |
561 | + | let dynamic = $t02156221700._3 | |
562 | + | let rewardCachedPartKEY = $t02156221700._4 | |
555 | 563 | let claimed = valueOrElse(getInteger(keyClaimed(userAddressStr, asset)), 0) | |
556 | 564 | ((accum + makeString([asset, toString(rewardTotal), toString(claimed)], ":")) + "_") | |
557 | 565 | } | |
610 | 618 | then $Tuple2(nil, [0, totalNsbtAmt, 0]) | |
611 | 619 | else { | |
612 | 620 | let userAddress = toAddressOrFail(userAddressStr) | |
613 | - | let $ | |
614 | - | let isNewUser = $ | |
615 | - | let userNsbtAmt = $ | |
616 | - | let stakingStart = $ | |
621 | + | let $t02337823482 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
622 | + | let isNewUser = $t02337823482._1 | |
623 | + | let userNsbtAmt = $t02337823482._2 | |
624 | + | let stakingStart = $t02337823482._3 | |
617 | 625 | $Tuple2(nil, [userNsbtAmt, totalNsbtAmt, stakingStart]) | |
618 | 626 | } | |
619 | 627 | } |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
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 | 24 | let IdxControlCfgNeutrinoDapp = 1 | |
25 | 25 | ||
26 | 26 | let IdxControlCfgAuctionDapp = 2 | |
27 | 27 | ||
28 | 28 | let IdxControlCfgRpdDapp = 3 | |
29 | 29 | ||
30 | 30 | let IdxControlCfgMathDapp = 4 | |
31 | 31 | ||
32 | 32 | let IdxControlCfgLiquidationDapp = 5 | |
33 | 33 | ||
34 | 34 | let IdxControlCfgRestDapp = 6 | |
35 | 35 | ||
36 | 36 | let IdxControlCfgNodeRegistryDapp = 7 | |
37 | 37 | ||
38 | 38 | let IdxControlCfgNsbtStakingDapp = 8 | |
39 | 39 | ||
40 | 40 | let IdxControlCfgMediatorDapp = 9 | |
41 | 41 | ||
42 | 42 | let IdxControlCfgGovernanceDapp = 13 | |
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 | - | func readControlCfgOrFail (control) = split(getStringOrFail(control, keyControlCfg()), SEP) | |
53 | + | func readControlCfgOrFail (control) = split_4C(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 | let govContract = getContractAddressOrFail(controlCfg, IdxControlCfgGovernanceDapp) | |
70 | 70 | ||
71 | 71 | func keyBondAsset () = "bond_asset_id" | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func keyUserGnsbtReleaseTime (userAddr) = ("%s%s_userGnsbtReleaseTime__" + userAddr) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func keyNeutrinoContractAddress () = "%s__neutrinoContractAddress" | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func keyMathContractAddress () = "%s__mathContract" | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func keyMinLockAmount () = "%s__minLockAmount" | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func keyHalfLife () = "%s__halfLife" | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func keyLockParamUserAmount (userAddress) = makeString(["%s%s%s", "paramByUser", toString(userAddress), "amount"], separator) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func keyLockParamStartBlock (userAddress) = makeString(["%s%s%s", "paramByUser", toString(userAddress), "start"], separator) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func keyHistoryRecord (type,userAddress,txId) = makeString(["%s%s%s%s", "history", type, toString(userAddress), toBase58String(txId)], separator) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func keyLockParamTotalAmount () = makeString(["%s%s", "stats", "activeTotalLocked"], separator) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func keyStatsLocksCount () = makeString(["%s%s", "stats", "locksCount"], separator) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func keyStatsUsersCount () = makeString(["%s%s", "stats", "activeUsersCount"], separator) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func keyStatsDepositAmtByDay (timestamp) = makeString(["%s%s%d", "stats", "depositAmtByDay", toString(timestamp)], separator) | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func keyStatsDepositAmtTotals () = makeString(["%s%s%d", "stats", "depositAmtTotals"], separator) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func keyNextPeriod () = "%s__nextPeriod" | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func keySupportedRewardAssets () = "supportedRewardAssets" | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func keyDepositNumLast () = makeString(["%s%s%s", "dep", "lastNum"], separator) | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | func keyUserRewardFromDepositNum (userAddress) = makeString(["%s%s%s", "userRwdFromDepNum", userAddress], separator) | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | func keyRewardPerNsbtSumAt (depositNum,tkn) = makeString(["%s%d", "rwdPerNsbtSumByDepNum", toString(depositNum), tkn], separator) | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | func keyReward (userAddress,tkn) = makeString(["%s%s%s", "rwd", userAddress, tkn], separator) | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func keyClaimed (userAddress,tkn) = makeString(["%s%s%s", "clm", userAddress, tkn], separator) | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func keyNotDistributedReward (tkn) = makeString(["%s%s", "notDistributed", tkn], separator) | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func toX18 (origVal,origMult) = fraction(toBigInt(origVal), MULTX18, origMult) | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func getIntOrZero (key) = valueOrElse(getInteger(this, key), 0) | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal) | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), (("Mandatory this." + key) + " is not defined")) | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | func getStrOrElse (key,defaultVal) = valueOrElse(getString(this, key), defaultVal) | |
150 | 150 | ||
151 | 151 | ||
152 | 152 | func toAddressOrFail (addressStr) = valueOrErrorMessage(addressFromString(addressStr), ("couldn't parse passed addressStr=" + addressStr)) | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | func toAssetVect (assetStr) = if ((assetStr == WAVESIDSTR)) | |
156 | 156 | then unit | |
157 | 157 | else fromBase58String(assetStr) | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func asInt (val) = match val { | |
161 | 161 | case valInt: Int => | |
162 | 162 | valInt | |
163 | 163 | case _ => | |
164 | 164 | throw("fail to cast into Int") | |
165 | 165 | } | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | 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) | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func formatClaimHistoryRecord (user,claimedRewards) = makeString(["%s%d%d%s", user, toString(lastBlock.height), toString(lastBlock.timestamp), claimedRewards], separator) | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func HistoryRecordEntry (type,userAddress,txId,oldAmount,oldStart,newAmount,newStart) = StringEntry(keyHistoryRecord(type, userAddress, txId), formatHistoryRecord(oldAmount, oldStart, newAmount, newStart)) | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func ClaimHistoryEntry (userAddress,txId,claimedRewards) = StringEntry(keyHistoryRecord("claim", userAddress, txId), formatClaimHistoryRecord(toString(userAddress), claimedRewards)) | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func StatsResult (totalLockedInc,lockCountInc,usersCountInc) = { | |
181 | 181 | let locksCount = getIntOrZero(keyStatsLocksCount()) | |
182 | 182 | let usersCount = getIntOrZero(keyStatsUsersCount()) | |
183 | 183 | let totalAmount = getIntOrZero(keyLockParamTotalAmount()) | |
184 | 184 | let totalAmountNew = (totalAmount + totalLockedInc) | |
185 | 185 | $Tuple3([IntegerEntry(keyStatsLocksCount(), (locksCount + lockCountInc)), IntegerEntry(keyStatsUsersCount(), (usersCount + usersCountInc)), IntegerEntry(keyLockParamTotalAmount(), totalAmountNew)], totalAmount, totalAmountNew) | |
186 | 186 | } | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | func LockParamsEntry (userAddress,amount,start) = [IntegerEntry(keyLockParamUserAmount(userAddress), amount), IntegerEntry(keyLockParamStartBlock(userAddress), start)] | |
190 | 190 | ||
191 | 191 | ||
192 | 192 | func getParamsOrFail () = $Tuple3(fromBase58String(getStringValue(neutrinoContract, keyBondAsset())), getIntOrFail(keyMinLockAmount()), getIntOrFail(keyHalfLife())) | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | func isActiveUser (userAddress) = (getIntOrElse(keyLockParamUserAmount(userAddress), 0) > 0) | |
196 | 196 | ||
197 | 197 | ||
198 | 198 | func getUserParamsOrUnit (userAddress) = if (isActiveUser(userAddress)) | |
199 | 199 | then $Tuple3(false, getIntOrFail(keyLockParamUserAmount(userAddress)), getIntOrFail(keyLockParamStartBlock(userAddress))) | |
200 | 200 | else unit | |
201 | 201 | ||
202 | 202 | ||
203 | 203 | func getUserParamsOrFail (userAddress) = valueOrErrorMessage(getUserParamsOrUnit(userAddress), (("User " + toString(userAddress)) + " is not defined")) | |
204 | 204 | ||
205 | 205 | ||
206 | 206 | let supportedAssetsStr = getStrOrElse(keySupportedRewardAssets(), "") | |
207 | 207 | ||
208 | 208 | let supportedAssetsList = split(supportedAssetsStr, "_") | |
209 | 209 | ||
210 | 210 | func calcReward (userAddress,assetId,stakedAmountX,depositNumUser,depositNumLast) = { | |
211 | 211 | let rewardPerNsbtSumLastKEY = keyRewardPerNsbtSumAt(depositNumLast, assetId) | |
212 | 212 | let sumLastX18 = parseBigIntValue(getStrOrElse(keyRewardPerNsbtSumAt(depositNumLast, assetId), "0")) | |
213 | 213 | let sumUserX18 = parseBigIntValue(getStrOrElse(keyRewardPerNsbtSumAt(depositNumUser, assetId), "0")) | |
214 | 214 | let rewardDynamicPart = toInt(fraction((sumLastX18 - sumUserX18), stakedAmountX, MULTX18)) | |
215 | 215 | let rewardCachedPartKEY = keyReward(userAddress, assetId) | |
216 | 216 | let rewardCachedPart = getIntOrElse(rewardCachedPartKEY, 0) | |
217 | 217 | $Tuple4((rewardCachedPart + rewardDynamicPart), rewardCachedPart, rewardDynamicPart, rewardCachedPartKEY) | |
218 | 218 | } | |
219 | 219 | ||
220 | 220 | ||
221 | 221 | func toStartOfDay (timestamp) = ((timestamp / DAYMILLIS) * DAYMILLIS) | |
222 | 222 | ||
223 | 223 | ||
224 | 224 | func findElementPosition (src,element,sep) = { | |
225 | 225 | let elementStart = valueOrErrorMessage(indexOf(src, element), ((("there is no substring " + element) + " in ") + src)) | |
226 | 226 | if ((elementStart == 0)) | |
227 | 227 | then 0 | |
228 | 228 | else { | |
229 | 229 | let left = take(src, elementStart) | |
230 | 230 | (size(split(left, sep)) - 1) | |
231 | 231 | } | |
232 | 232 | } | |
233 | 233 | ||
234 | 234 | ||
235 | 235 | let DepositTotalsPREFIX = "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" | |
236 | 236 | ||
237 | 237 | func updateDepositTotals (currVal,idxToUpdate,deltaAmt) = { | |
238 | 238 | let currArr = split(currVal, SEP) | |
239 | 239 | func updDepTotByIdx (idx) = if ((idx != idxToUpdate)) | |
240 | 240 | then currArr[idx] | |
241 | 241 | else toString((parseIntValue(currArr[idx]) + deltaAmt)) | |
242 | 242 | ||
243 | 243 | 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) | |
244 | 244 | } | |
245 | 245 | ||
246 | 246 | ||
247 | 247 | func DepositsTotalsEntries (depositAmount,assetIdStr) = { | |
248 | 248 | let startOfDay = toStartOfDay(lastBlock.timestamp) | |
249 | 249 | let byDayKEY = keyStatsDepositAmtByDay(startOfDay) | |
250 | 250 | let totalsKEY = keyStatsDepositAmtTotals() | |
251 | 251 | let position = findElementPosition(supportedAssetsStr, assetIdStr, "_") | |
252 | 252 | let defaultDATA = (DepositTotalsPREFIX + "__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0") | |
253 | 253 | let currTotalsDATA = valueOrElse(getString(this, totalsKEY), defaultDATA) | |
254 | 254 | let newTotalsDATA = updateDepositTotals(currTotalsDATA, (position + 1), depositAmount) | |
255 | 255 | [StringEntry(totalsKEY, newTotalsDATA), StringEntry(byDayKEY, newTotalsDATA)] | |
256 | 256 | } | |
257 | 257 | ||
258 | 258 | ||
259 | 259 | func RewardEntries (isNewUser,userAddress,stakedAmount) = { | |
260 | 260 | let stakedAmountX = toBigInt(stakedAmount) | |
261 | 261 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddress) | |
262 | 262 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
263 | 263 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
264 | 264 | func forEachAssetCacheUserReward (accum,asset) = { | |
265 | - | let $ | |
266 | - | let rewardTotal = $ | |
267 | - | let cached = $ | |
268 | - | let dynamic = $ | |
269 | - | let rewardCachedPartKEY = $ | |
265 | + | let $t01079910934 = calcReward(userAddress, asset, stakedAmountX, depositNumUser, depositNumLast) | |
266 | + | let rewardTotal = $t01079910934._1 | |
267 | + | let cached = $t01079910934._2 | |
268 | + | let dynamic = $t01079910934._3 | |
269 | + | let rewardCachedPartKEY = $t01079910934._4 | |
270 | 270 | (accum :+ IntegerEntry(rewardCachedPartKEY, rewardTotal)) | |
271 | 271 | } | |
272 | 272 | ||
273 | 273 | if (if ((depositNumLast == -1)) | |
274 | 274 | then (depositNumUser == -1) | |
275 | 275 | else false) | |
276 | 276 | then nil | |
277 | 277 | else if (if ((depositNumLast == -1)) | |
278 | 278 | then (depositNumUser > -1) | |
279 | 279 | else false) | |
280 | 280 | then throw("invalid depositNumLast and depositNumUser state") | |
281 | 281 | else if (if ((depositNumLast > -1)) | |
282 | 282 | then (depositNumUser >= -1) | |
283 | 283 | else false) | |
284 | 284 | then if (isNewUser) | |
285 | 285 | then [IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)] | |
286 | 286 | else ({ | |
287 | 287 | let $l = supportedAssetsList | |
288 | 288 | let $s = size($l) | |
289 | 289 | let $acc0 = nil | |
290 | 290 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
291 | 291 | then $a | |
292 | 292 | else forEachAssetCacheUserReward($a, $l[$i]) | |
293 | 293 | ||
294 | 294 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
295 | 295 | then $a | |
296 | 296 | else throw("List size exceeds 9") | |
297 | 297 | ||
298 | 298 | $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) | |
299 | 299 | } :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) | |
300 | 300 | else throw(((("uncovered condition: depositNumLast=" + toString(depositNumLast)) + " depositNumUser=") + toString(depositNumUser))) | |
301 | 301 | } | |
302 | 302 | ||
303 | 303 | ||
304 | 304 | func IncrementNotDistributedRewardEntry (tkn,amountInc) = { | |
305 | 305 | let notDistributedRewardKEY = keyNotDistributedReward(tkn) | |
306 | 306 | let notDistributedReward = getIntOrElse(notDistributedRewardKEY, 0) | |
307 | - | ||
307 | + | IntegerEntry(notDistributedRewardKEY, (notDistributedReward + amountInc)) | |
308 | 308 | } | |
309 | 309 | ||
310 | 310 | ||
311 | 311 | func commonClaim (userAddress,i) = { | |
312 | 312 | let userAddressStr = toString(userAddress) | |
313 | 313 | if ((size(i.payments) > 0)) | |
314 | 314 | then throw("payments are not accepted") | |
315 | 315 | else { | |
316 | - | let $ | |
317 | - | let isNewUser = $ | |
318 | - | let stakedAmount = $ | |
319 | - | let stakingStart = $ | |
316 | + | let $t01387513980 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
317 | + | let isNewUser = $t01387513980._1 | |
318 | + | let stakedAmount = $t01387513980._2 | |
319 | + | let stakingStart = $t01387513980._3 | |
320 | 320 | let stakedAmountX = toBigInt(stakedAmount) | |
321 | 321 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
322 | 322 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
323 | 323 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
324 | 324 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
325 | - | let $ | |
326 | - | let rewardTotal = $ | |
327 | - | let cached = $ | |
328 | - | let dynamic = $ | |
329 | - | let rewardCachedPartKEY = $ | |
325 | + | let $t01435114489 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
326 | + | let rewardTotal = $t01435114489._1 | |
327 | + | let cached = $t01435114489._2 | |
328 | + | let dynamic = $t01435114489._3 | |
329 | + | let rewardCachedPartKEY = $t01435114489._4 | |
330 | 330 | let claimedKEY = keyClaimed(userAddressStr, asset) | |
331 | - | let $ | |
332 | - | let data = $ | |
333 | - | let claimedAmtByAsset = $ | |
331 | + | let $t01454914586 = accum | |
332 | + | let data = $t01454914586._1 | |
333 | + | let claimedAmtByAsset = $t01454914586._2 | |
334 | 334 | let newPart = makeString([asset, toString(rewardTotal)], ":") | |
335 | 335 | let claimedAmtByAssetNew = makeString([claimedAmtByAsset, newPart], "_") | |
336 | 336 | if ((0 >= rewardTotal)) | |
337 | 337 | then $Tuple2(data, claimedAmtByAssetNew) | |
338 | 338 | else $Tuple2((((data :+ ScriptTransfer(userAddress, rewardTotal, toAssetVect(asset))) :+ IntegerEntry(claimedKEY, (valueOrElse(getInteger(claimedKEY), 0) + rewardTotal))) :+ IntegerEntry(rewardCachedPartKEY, 0)), claimedAmtByAssetNew) | |
339 | 339 | } | |
340 | 340 | ||
341 | - | let $ | |
341 | + | let $t01504615159 = { | |
342 | 342 | let $l = supportedAssetsList | |
343 | 343 | let $s = size($l) | |
344 | 344 | let $acc0 = $Tuple2(nil, "") | |
345 | 345 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
346 | 346 | then $a | |
347 | 347 | else forEachAssetCalcUnclaimedReward($a, $l[$i]) | |
348 | 348 | ||
349 | 349 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
350 | 350 | then $a | |
351 | 351 | else throw("List size exceeds 9") | |
352 | 352 | ||
353 | 353 | $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) | |
354 | 354 | } | |
355 | - | let transfers = $ | |
356 | - | let claimedAmtByAssetResult = $ | |
355 | + | let transfers = $t01504615159._1 | |
356 | + | let claimedAmtByAssetResult = $t01504615159._2 | |
357 | 357 | if ((0 >= size(transfers))) | |
358 | 358 | then $Tuple2(nil, 0) | |
359 | 359 | else $Tuple2(((transfers :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) :+ ClaimHistoryEntry(userAddress, i.transactionId, drop(claimedAmtByAssetResult, 1))), size(transfers)) | |
360 | 360 | } | |
361 | 361 | } | |
362 | 362 | ||
363 | 363 | ||
364 | 364 | @Callable(i) | |
365 | - | func | |
365 | + | func constructorV1 (neutrinoContractAddress,mathContractAddress,minLockAmount,halfLife,supportedRewardAssets) = if ((i.caller != this)) | |
366 | 366 | then throw("Permission denied") | |
367 | 367 | else [StringEntry(keyNeutrinoContractAddress(), neutrinoContractAddress), StringEntry(keyMathContractAddress(), mathContractAddress), IntegerEntry(keyMinLockAmount(), minLockAmount), IntegerEntry(keyHalfLife(), halfLife), StringEntry(keySupportedRewardAssets(), supportedRewardAssets)] | |
368 | 368 | ||
369 | 369 | ||
370 | 370 | ||
371 | 371 | @Callable(i) | |
372 | 372 | func stake () = { | |
373 | - | let $ | |
374 | - | let bondAssetId = $ | |
375 | - | let minLockAmount = $ | |
376 | - | let halfLife = $ | |
373 | + | let $t01601016072 = getParamsOrFail() | |
374 | + | let bondAssetId = $t01601016072._1 | |
375 | + | let minLockAmount = $t01601016072._2 | |
376 | + | let halfLife = $t01601016072._3 | |
377 | 377 | if ((size(i.payments) != 1)) | |
378 | 378 | then throw("Invalid payments size") | |
379 | 379 | else { | |
380 | 380 | let payment = i.payments[0] | |
381 | 381 | let amount = payment.amount | |
382 | 382 | let invalidAssetMessage = (("Invalid asset. " + toBase58String(bondAssetId)) + " is expected") | |
383 | 383 | let assetId = valueOrErrorMessage(payment.assetId, invalidAssetMessage) | |
384 | 384 | if ((assetId != bondAssetId)) | |
385 | 385 | then throw(invalidAssetMessage) | |
386 | 386 | else { | |
387 | 387 | let userAddress = i.caller | |
388 | 388 | let userAddressStr = toString(i.caller) | |
389 | - | let $ | |
390 | - | let isNewUser = $ | |
391 | - | let lockAmount = $ | |
392 | - | let lockStartHeight = $ | |
389 | + | let $t01661416721 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, -1)) | |
390 | + | let isNewUser = $t01661416721._1 | |
391 | + | let lockAmount = $t01661416721._2 | |
392 | + | let lockStartHeight = $t01661416721._3 | |
393 | 393 | let mergedAmount = if (isNewUser) | |
394 | 394 | then amount | |
395 | 395 | else (amount + lockAmount) | |
396 | 396 | let mergedStartHeight = if (isNewUser) | |
397 | 397 | then height | |
398 | 398 | else asInt(invoke(mathContract, "mergeStakesREADONLY", [amount, height, lockAmount, lockStartHeight, halfLife], nil)) | |
399 | 399 | if ((minLockAmount > mergedAmount)) | |
400 | 400 | then throw(("Min lock amount is " + toString(minLockAmount))) | |
401 | 401 | else { | |
402 | - | let $ | |
402 | + | let $t01708217184 = StatsResult(amount, 1, if (isNewUser) | |
403 | 403 | then 1 | |
404 | 404 | else 0) | |
405 | - | let statsEntries = $ | |
406 | - | let totalStaked = $ | |
407 | - | let totalStakedNew = $ | |
405 | + | let statsEntries = $t01708217184._1 | |
406 | + | let totalStaked = $t01708217184._2 | |
407 | + | let totalStakedNew = $t01708217184._3 | |
408 | 408 | ((([HistoryRecordEntry("stake", userAddress, i.transactionId, lockAmount, lockStartHeight, mergedAmount, mergedStartHeight)] ++ RewardEntries(isNewUser, userAddressStr, lockAmount)) ++ LockParamsEntry(userAddress, mergedAmount, mergedStartHeight)) ++ statsEntries) | |
409 | 409 | } | |
410 | 410 | } | |
411 | 411 | } | |
412 | 412 | } | |
413 | 413 | ||
414 | 414 | ||
415 | 415 | ||
416 | 416 | @Callable(i) | |
417 | 417 | func unstake (amount) = if ((size(i.payments) != 0)) | |
418 | 418 | then throw("unstake doesn't require any payment") | |
419 | 419 | else { | |
420 | 420 | let userAddress = i.caller | |
421 | 421 | let userAddressStr = toString(userAddress) | |
422 | - | let $ | |
423 | - | let bondAssetId = $ | |
424 | - | let minLockAmount = $ | |
425 | - | let halfLife = $ | |
426 | - | let $ | |
427 | - | let isNewUser = $ | |
428 | - | let lockAmount = $ | |
429 | - | let lockStart = $ | |
422 | + | let $t01767017732 = getParamsOrFail() | |
423 | + | let bondAssetId = $t01767017732._1 | |
424 | + | let minLockAmount = $t01767017732._2 | |
425 | + | let halfLife = $t01767017732._3 | |
426 | + | let $t01773517809 = getUserParamsOrFail(userAddress) | |
427 | + | let isNewUser = $t01773517809._1 | |
428 | + | let lockAmount = $t01773517809._2 | |
429 | + | let lockStart = $t01773517809._3 | |
430 | 430 | if ((0 >= lockAmount)) | |
431 | 431 | then throw("Nothing to unstake") | |
432 | 432 | else if ((amount > lockAmount)) | |
433 | 433 | then throw(((("Requested " + toString(amount)) + ", but staked only ") + toString(lockAmount))) | |
434 | 434 | else { | |
435 | 435 | let t = value(blockInfoByHeight(height)).timestamp | |
436 | 436 | let releaseTime = valueOrElse(getInteger(govContract, keyUserGnsbtReleaseTime(userAddressStr)), 0) | |
437 | 437 | if ((releaseTime >= t)) | |
438 | 438 | then throw(("Your gNsbt are taking part in voting, cannot unstake until " + toString(releaseTime))) | |
439 | 439 | else { | |
440 | 440 | let comissionAmount = asInt(invoke(mathContract, "getUnstakeComissionAmountREADONLY", [amount, lockStart, halfLife], nil)) | |
441 | - | let $ | |
441 | + | let $t01845018604 = StatsResult(-(amount), if ((amount == lockAmount)) | |
442 | 442 | then -1 | |
443 | 443 | else 0, if ((amount == lockAmount)) | |
444 | 444 | then -1 | |
445 | 445 | else 0) | |
446 | - | let statsEntries = $ | |
447 | - | let totalStaked = $ | |
448 | - | let totalStakedNew = $ | |
446 | + | let statsEntries = $t01845018604._1 | |
447 | + | let totalStaked = $t01845018604._2 | |
448 | + | let totalStakedNew = $t01845018604._3 | |
449 | 449 | ((([ScriptTransfer(userAddress, (amount - comissionAmount), bondAssetId), ScriptTransfer(auctionContract, comissionAmount, bondAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, lockAmount, lockStart, (lockAmount - amount), lockStart)] ++ RewardEntries(false, userAddressStr, lockAmount)) ++ LockParamsEntry(userAddress, (lockAmount - amount), lockStart)) ++ statsEntries) | |
450 | 450 | } | |
451 | 451 | } | |
452 | 452 | } | |
453 | 453 | ||
454 | 454 | ||
455 | 455 | ||
456 | 456 | @Callable(i) | |
457 | - | func deposit () = if ((size(i.payments) != 1)) | |
458 | - | then throw("exact 1 payment is allowed only") | |
459 | - | else { | |
460 | - | let pmt = i.payments[0] | |
461 | - | let amount = pmt.amount | |
462 | - | let pmtAssetId = valueOrElse(pmt.assetId, WAVESID) | |
463 | - | let pmtAssetIdStr = toBase58String(pmtAssetId) | |
464 | - | let pmtMultX = if ((pmtAssetId == WAVESID)) | |
465 | - | then MULTX8 | |
466 | - | else MULTX6 | |
467 | - | let amountX = toBigInt(amount) | |
468 | - | let totalStaked = getIntOrElse(keyLockParamTotalAmount(), 0) | |
469 | - | let totalStakedX = toBigInt(totalStaked) | |
470 | - | if ((0 > totalStaked)) | |
471 | - | then throw("TODO: case is not supported") | |
472 | - | else if ((totalStaked == 0)) | |
473 | - | then IncrementNotDistributedRewardEntry(pmtAssetIdStr, amount) | |
474 | - | else { | |
475 | - | let rewardPerNsbtX18 = fraction(amountX, MULTX18, totalStakedX) | |
476 | - | let depositNumLastKEY = keyDepositNumLast() | |
477 | - | let depositNumLast = getIntOrElse(depositNumLastKEY, -1) | |
478 | - | let depositNumNew = (depositNumLast + 1) | |
479 | - | if (!(contains(supportedAssetsStr, pmtAssetIdStr))) | |
480 | - | then throw(((supportedAssetsStr + " doesn't contain ") + pmtAssetIdStr)) | |
457 | + | func deposit () = { | |
458 | + | let totalStaked = getIntOrElse(keyLockParamTotalAmount(), 0) | |
459 | + | if ((0 > totalStaked)) | |
460 | + | then throw("TODO: case is not supported") | |
461 | + | else { | |
462 | + | let depositNumLastKEY = keyDepositNumLast() | |
463 | + | let depositNumLast = getIntOrElse(depositNumLastKEY, -1) | |
464 | + | let depositNumNew = (depositNumLast + 1) | |
465 | + | func dep (acc,pmt) = { | |
466 | + | let amount = pmt.amount | |
467 | + | let pmtAssetId = valueOrElse(pmt.assetId, WAVESID) | |
468 | + | let pmtAssetIdStr = toBase58String(pmtAssetId) | |
469 | + | if (!(contains(supportedAssetsStr, pmtAssetIdStr))) | |
470 | + | then throw(((supportedAssetsStr + " doesn't contain ") + pmtAssetIdStr)) | |
471 | + | else if ((totalStaked == 0)) | |
472 | + | then (acc :+ IncrementNotDistributedRewardEntry(pmtAssetIdStr, amount)) | |
481 | 473 | else { | |
474 | + | let rewardPerNsbtX18 = fraction(toBigInt(amount), MULTX18, toBigInt(totalStaked)) | |
482 | 475 | func refreshRewardPerNsbtSUM (accum,nextAsset) = { | |
483 | - | let rewardPerNsbtSumNewKEY = keyRewardPerNsbtSumAt(depositNumNew, nextAsset) | |
484 | 476 | let sumLastStr = getStrOrElse(keyRewardPerNsbtSumAt(depositNumLast, nextAsset), "0") | |
485 | - | (accum :+ (if ((nextAsset == pmtAssetIdStr)) | |
486 | - | then | |
487 | - | else | |
477 | + | (accum :+ StringEntry(keyRewardPerNsbtSumAt(depositNumNew, nextAsset), if ((nextAsset == pmtAssetIdStr)) | |
478 | + | then toString((parseBigIntValue(sumLastStr) + rewardPerNsbtX18)) | |
479 | + | else sumLastStr)) | |
488 | 480 | } | |
489 | 481 | ||
490 | - | (({ | |
482 | + | ((acc ++ { | |
491 | 483 | let $l = supportedAssetsList | |
492 | 484 | let $s = size($l) | |
493 | 485 | let $acc0 = nil | |
494 | 486 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
495 | 487 | then $a | |
496 | 488 | else refreshRewardPerNsbtSUM($a, $l[$i]) | |
497 | 489 | ||
498 | 490 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
499 | 491 | then $a | |
500 | 492 | else throw("List size exceeds 9") | |
501 | 493 | ||
502 | 494 | $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) | |
503 | - | } | |
495 | + | }) ++ DepositsTotalsEntries(amount, pmtAssetIdStr)) | |
504 | 496 | } | |
505 | - | } | |
506 | - | } | |
497 | + | } | |
498 | + | ||
499 | + | ({ | |
500 | + | let $l = i.payments | |
501 | + | let $s = size($l) | |
502 | + | let $acc0 = nil | |
503 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
504 | + | then $a | |
505 | + | else dep($a, $l[$i]) | |
506 | + | ||
507 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
508 | + | then $a | |
509 | + | else throw("List size exceeds 10") | |
510 | + | ||
511 | + | $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) | |
512 | + | } :+ IntegerEntry(depositNumLastKEY, depositNumNew)) | |
513 | + | } | |
514 | + | } | |
507 | 515 | ||
508 | 516 | ||
509 | 517 | ||
510 | 518 | @Callable(i) | |
511 | 519 | func claimRewards () = commonClaim(i.caller, i) | |
512 | 520 | ||
513 | 521 | ||
514 | 522 | ||
515 | 523 | @Callable(i) | |
516 | 524 | func claimRewardsByOriginCaller () = commonClaim(i.originCaller, i) | |
517 | 525 | ||
518 | 526 | ||
519 | 527 | ||
520 | 528 | @Callable(i) | |
521 | 529 | func unclaimedRewardsREADONLY (userAddressStr) = { | |
522 | 530 | func forEachAssetZeroReward (accum,asset) = ((accum + makeString([asset, "0", "0"], ":")) + "_") | |
523 | 531 | ||
524 | 532 | let unclaimedRewardStr = if ((userAddressStr == "")) | |
525 | 533 | then { | |
526 | 534 | let $l = supportedAssetsList | |
527 | 535 | let $s = size($l) | |
528 | 536 | let $acc0 = "" | |
529 | 537 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
530 | 538 | then $a | |
531 | 539 | else forEachAssetZeroReward($a, $l[$i]) | |
532 | 540 | ||
533 | 541 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
534 | 542 | then $a | |
535 | 543 | else throw("List size exceeds 9") | |
536 | 544 | ||
537 | 545 | $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) | |
538 | 546 | } | |
539 | 547 | else { | |
540 | 548 | let userAddress = addressFromStringValue(userAddressStr) | |
541 | - | let $ | |
542 | - | let isNewUser = $ | |
543 | - | let stakedAmount = $ | |
544 | - | let stakingStart = $ | |
549 | + | let $t02111121216 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
550 | + | let isNewUser = $t02111121216._1 | |
551 | + | let stakedAmount = $t02111121216._2 | |
552 | + | let stakingStart = $t02111121216._3 | |
545 | 553 | let stakedAmountX = toBigInt(stakedAmount) | |
546 | 554 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
547 | 555 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
548 | 556 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
549 | 557 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
550 | - | let $ | |
551 | - | let rewardTotal = $ | |
552 | - | let cached = $ | |
553 | - | let dynamic = $ | |
554 | - | let rewardCachedPartKEY = $ | |
558 | + | let $t02156221700 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
559 | + | let rewardTotal = $t02156221700._1 | |
560 | + | let cached = $t02156221700._2 | |
561 | + | let dynamic = $t02156221700._3 | |
562 | + | let rewardCachedPartKEY = $t02156221700._4 | |
555 | 563 | let claimed = valueOrElse(getInteger(keyClaimed(userAddressStr, asset)), 0) | |
556 | 564 | ((accum + makeString([asset, toString(rewardTotal), toString(claimed)], ":")) + "_") | |
557 | 565 | } | |
558 | 566 | ||
559 | 567 | let $l = supportedAssetsList | |
560 | 568 | let $s = size($l) | |
561 | 569 | let $acc0 = "" | |
562 | 570 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
563 | 571 | then $a | |
564 | 572 | else forEachAssetCalcUnclaimedReward($a, $l[$i]) | |
565 | 573 | ||
566 | 574 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
567 | 575 | then $a | |
568 | 576 | else throw("List size exceeds 9") | |
569 | 577 | ||
570 | 578 | $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) | |
571 | 579 | } | |
572 | 580 | $Tuple2(nil, dropRight(unclaimedRewardStr, 1)) | |
573 | 581 | } | |
574 | 582 | ||
575 | 583 | ||
576 | 584 | ||
577 | 585 | @Callable(i) | |
578 | 586 | func nsbtUnstakingSYSREADONLY (userAddressStrOrEmpty,unstakeAmtP) = { | |
579 | 587 | let resultArray = if ((userAddressStrOrEmpty == "")) | |
580 | 588 | then [0, 0, 0, 0] | |
581 | 589 | else { | |
582 | 590 | let userAddress = addressFromStringValue(userAddressStrOrEmpty) | |
583 | 591 | let cfgDATA = getParamsOrFail() | |
584 | 592 | let nsbtAssetId = cfgDATA._1 | |
585 | 593 | let minLockAmount = cfgDATA._2 | |
586 | 594 | let halfLife = cfgDATA._3 | |
587 | 595 | let userDATA = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
588 | 596 | let isNewUser = userDATA._1 | |
589 | 597 | let stakedAmount = userDATA._2 | |
590 | 598 | let lockStart = userDATA._3 | |
591 | 599 | let unstakeAmt = if ((unstakeAmtP > stakedAmount)) | |
592 | 600 | then stakedAmount | |
593 | 601 | else unstakeAmtP | |
594 | 602 | let stakedAmountNEW = (stakedAmount - unstakeAmt) | |
595 | 603 | let comissionAmount = if ((unstakeAmt == 0)) | |
596 | 604 | then 0 | |
597 | 605 | else asInt(invoke(mathContract, "getUnstakeComissionAmountREADONLY", [unstakeAmt, lockStart, halfLife], nil)) | |
598 | 606 | let receiveAmount = (unstakeAmt - comissionAmount) | |
599 | 607 | [stakedAmount, stakedAmountNEW, receiveAmount, comissionAmount] | |
600 | 608 | } | |
601 | 609 | $Tuple2(nil, resultArray) | |
602 | 610 | } | |
603 | 611 | ||
604 | 612 | ||
605 | 613 | ||
606 | 614 | @Callable(i) | |
607 | 615 | func nsbtStakingSYSREADONLY (userAddressStr,nsbtDiff) = { | |
608 | 616 | let totalNsbtAmt = getIntOrElse(keyLockParamTotalAmount(), 0) | |
609 | 617 | if ((userAddressStr == "")) | |
610 | 618 | then $Tuple2(nil, [0, totalNsbtAmt, 0]) | |
611 | 619 | else { | |
612 | 620 | let userAddress = toAddressOrFail(userAddressStr) | |
613 | - | let $ | |
614 | - | let isNewUser = $ | |
615 | - | let userNsbtAmt = $ | |
616 | - | let stakingStart = $ | |
621 | + | let $t02337823482 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
622 | + | let isNewUser = $t02337823482._1 | |
623 | + | let userNsbtAmt = $t02337823482._2 | |
624 | + | let stakingStart = $t02337823482._3 | |
617 | 625 | $Tuple2(nil, [userNsbtAmt, totalNsbtAmt, stakingStart]) | |
618 | 626 | } | |
619 | 627 | } | |
620 | 628 | ||
621 | 629 | ||
622 | 630 | @Verifier(tx) | |
623 | 631 | func verify () = { | |
624 | 632 | let pubKeyAdminsListStr = makeString(["ExtEEK19nmKj9mCpnWyvEEJFYATLMcVEMvohhUHkyHNm", "Ev5py5FfBQX9cZpYKnfQrTB49Byf8QmpZWeDVRim4yV7", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR"], SEP) | |
625 | 633 | let pubKeyAdminsList = split(valueOrElse(getString(controlContract, "%s__multisig"), pubKeyAdminsListStr), SEP) | |
626 | 634 | let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0]))) | |
627 | 635 | then 1 | |
628 | 636 | else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1]))) | |
629 | 637 | then 1 | |
630 | 638 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2]))) | |
631 | 639 | then 1 | |
632 | 640 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3]))) | |
633 | 641 | then 2 | |
634 | 642 | else 0)) | |
635 | 643 | (count >= 3) | |
636 | 644 | } | |
637 | 645 |
github/deemru/w8io/169f3d6 102.15 ms ◑