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