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