tx · 7he1ggiUFVYdSUwdM6v4HwCLgo1SoT7ys8KRGUpcE2pq 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz: -0.03500000 Waves 2022.06.28 15:04 [2116262] smart account 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz > SELF 0.00000000 Waves
{ "type": 13, "id": "7he1ggiUFVYdSUwdM6v4HwCLgo1SoT7ys8KRGUpcE2pq", "fee": 3500000, "feeAssetId": null, "timestamp": 1656417854022, "version": 2, "chainId": 84, "sender": "3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz", "senderPublicKey": "D28XoueZWsMfm8Y5pa6C5ZFuYoWgre2Wm8tzJANJgMnq", "proofs": [ "3vTXrWZ33BD8oLFfAMr152re73118ZwfYrFgztux6hYUrpZ5Tc7jCdsgsLtHReqi151y3UZM6dhvpAzgwqArGt4Z" ], "script": "base64:AAIFAAAAAAAAACcIAhIDCgEIEgMKAQgSABIAEgQKAggBEgMKAQgSBAoCCAgSBAoCCAgAAABTAAAAAAZTQ0FMRTgAAAAAAAAAAAgAAAAABU1VTFQ4AAAAAAAF9eEAAAAAAAdTQ0FMRTE4AAAAAAAAAAASAAAAAAZNVUxUMTgJAAE2AAAAAQAN4Lazp2QAAAAAAAADU0VQAgAAAAJfXwAAAAAOUE9PTFdFSUdIVE1VTFQFAAAABU1VTFQ4AAAAAAp6ZXJvQmlnSW50CQABNgAAAAEAAAAAAAAAAAAAAAAACW9uZUJpZ0ludAkAATYAAAABAAAAAAAAAAABAQAAAAlhc0FueUxpc3QAAAABAAAAA3ZhbAQAAAAHJG1hdGNoMAUAAAADdmFsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAlMaXN0W0FueV0EAAAACnZhbEFueUx5c3QFAAAAByRtYXRjaDAFAAAACnZhbEFueUx5c3QJAAACAAAAAQIAAAAbZmFpbCB0byBjYXN0IGludG8gTGlzdFtBbnldAQAAAAVhc0ludAAAAAEAAAADdmFsBAAAAAckbWF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AAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAnBrBQAAAAckbWF0Y2gwBQAAAAJwawMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgMJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA90YXJnZXRQdWJsaWNLZXkGCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAARbWlncmF0b3JQdWJsaWNLZXkgYM0T", "height": 2116262, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BecFheBjTurW9FBz7e27FvvcgqBYioLXz3SfBGcWkVah Next: CQ5nnArRDFZ6uTT2V3jvpeBzLt84peT4XGhas1RDEW4Z Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 8 | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
87 | - | ||
88 | - | ||
89 | - | func keyVotingEmissionContract () = "%s__votingEmissionContract" | |
90 | 87 | ||
91 | 88 | ||
92 | 89 | let IdxFactoryCfgStakingDapp = 1 | |
239 | 236 | ||
240 | 237 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
241 | 238 | ||
242 | - | func keyNextUser (lpAssetId) = makeString(["%s%s", lpAssetId, "nextUser"], SEP) | |
243 | - | ||
244 | - | ||
245 | - | func getUsersListName (lpAssetId) = makeString(["users", lpAssetId], SEP) | |
246 | - | ||
247 | - | ||
248 | - | func keyListHead (listName) = makeString(["%s%s%s", listName, "head"], SEP) | |
249 | - | ||
250 | - | ||
251 | - | func keyListSize (listName) = makeString(["%s%s%s", listName, "size"], SEP) | |
252 | - | ||
253 | - | ||
254 | - | func keyListPrev (listName,id) = makeString(["%s%s%s%s", listName, id, "prev"], SEP) | |
255 | - | ||
256 | - | ||
257 | - | func keyListNext (listName,id) = makeString(["%s%s%s%s", listName, id, "next"], SEP) | |
258 | - | ||
259 | - | ||
260 | - | func containsNode (listName,id) = { | |
261 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
262 | - | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
263 | - | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
264 | - | if (if ((id == valueOrElse(headOrUnit, ""))) | |
265 | - | then true | |
266 | - | else (prevOrUnit != unit)) | |
267 | - | then true | |
268 | - | else (nextOrUnit != unit) | |
269 | - | } | |
270 | - | ||
271 | - | ||
272 | - | func insertNodeActions (listName,id) = { | |
273 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
274 | - | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
275 | - | let checkNode = if (!(containsNode(listName, id))) | |
276 | - | then true | |
277 | - | else throw("Node exists") | |
278 | - | if ((checkNode == checkNode)) | |
279 | - | then (([IntegerEntry(keyListSize(listName), (listSize + 1))] ++ (if ((headOrUnit != unit)) | |
280 | - | then [StringEntry(keyListNext(listName, id), value(headOrUnit)), StringEntry(keyListPrev(listName, value(headOrUnit)), id)] | |
281 | - | else nil)) ++ [StringEntry(keyListHead(listName), id)]) | |
282 | - | else throw("Strict value is not equal to itself.") | |
283 | - | } | |
284 | - | ||
285 | - | ||
286 | - | func deleteNodeActions (listName,id) = { | |
287 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
288 | - | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
289 | - | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
290 | - | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
291 | - | ([IntegerEntry(keyListSize(listName), (listSize - 1))] ++ (if (if ((prevOrUnit != unit)) | |
292 | - | then (nextOrUnit != unit) | |
293 | - | else false) | |
294 | - | then [StringEntry(keyListNext(listName, value(prevOrUnit)), value(nextOrUnit)), StringEntry(keyListPrev(listName, value(nextOrUnit)), value(prevOrUnit)), DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, id))] | |
295 | - | else if ((nextOrUnit != unit)) | |
296 | - | then [StringEntry(keyListHead(listName), value(nextOrUnit)), DeleteEntry(keyListNext(listName, id)), DeleteEntry(keyListPrev(listName, value(nextOrUnit)))] | |
297 | - | else if ((prevOrUnit != unit)) | |
298 | - | then [DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, value(prevOrUnit)))] | |
299 | - | else if ((id == valueOrElse(headOrUnit, ""))) | |
300 | - | then [DeleteEntry(keyListHead(listName))] | |
301 | - | else throw(((("invalid node: " + listName) + ".") + id)))) | |
302 | - | } | |
303 | - | ||
304 | - | ||
305 | 239 | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == zeroBigInt)) | |
306 | 240 | then (stakedByUser > zeroBigInt) | |
307 | 241 | else false) | |
343 | 277 | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX3 * toBigInt(dh))) | |
344 | 278 | let wxPerLpX3New = (toBigInt(poolWxEmissionPerBlockX3) / nonZeroStakedTotalNew) | |
345 | 279 | let wxPerLpIntegralLastUpdHeightNew = height | |
346 | - | let debug = makeString([toString(wxPerLpIntegralNew), toString(dh), toString(wxPerLpX3), toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), toString(poolWeight)], "::") | |
280 | + | let debug = makeString([toString(wxPerLpIntegralNew), "dh=", toString(dh), "wxPerLpX3=", toString(wxPerLpX3), "stakedTotal=", toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), "poolWeight=", toString(poolWeight)], "::") | |
347 | 281 | $Tuple3(wxPerLpIntegralNew, [StringEntry(wxPerLpIntegralKEY, toString(wxPerLpIntegralNew)), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), StringEntry(wxPerLpKEY, toString(wxPerLpX3New))], debug) | |
348 | 282 | } | |
349 | 283 | ||
350 | 284 | ||
351 | 285 | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
352 | - | let $ | |
353 | - | let wxPerLpIntegralNew = $ | |
354 | - | let poolIntegralSTATE = $ | |
355 | - | let poolDEBUG = $ | |
286 | + | let $t01150611628 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
287 | + | let wxPerLpIntegralNew = $t01150611628._1 | |
288 | + | let poolIntegralSTATE = $t01150611628._2 | |
289 | + | let poolDEBUG = $t01150611628._3 | |
356 | 290 | let MULT3 = 1000 | |
357 | 291 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
358 | 292 | let stakedByUser = readStaked(stakedByUserKEY) | |
366 | 300 | let wxToClaimUserNew = (wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), toBigInt(stakedByUser), toBigInt(MULT11))) | |
367 | 301 | let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew | |
368 | 302 | let wxPerLpIntegralUserLastUpdHeightNew = height | |
369 | - | let debug = makeString([toString(wxToClaimUser), toString(wxPerLpIntegralUserLast), toString(stakedByUser), poolDEBUG, toString(height)], "::") | |
303 | + | let debug = makeString(["wxToClaimUser", toString(wxToClaimUser), "wxPerLpInteg", toString(wxPerLpIntegralUserLastUpdHeightOrZero), "this.getString", toString(value(parseBigInt(getStringOrFail(this, wxPerLpIntegralUserLastKEY)))), "wxPerLpIntegralNew", toString(wxPerLpIntegralNew), "wxToClaimUserNew", toString(wxToClaimUserNew), "wxPerLpIntegralUserLast", toString(wxPerLpIntegralUserLast), toString(stakedByUser), "poolDEBUG=", poolDEBUG, "height=", toString(height)], "::") | |
370 | 304 | $Tuple3(wxToClaimUserNew, (poolIntegralSTATE ++ [StringEntry(wxToClaimUserKEY, toString(wxToClaimUserNew)), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), StringEntry(wxPerLpIntegralUserLastKEY, toString(wxPerLpIntegralUserLastNew))]), debug) | |
371 | 305 | } | |
372 | 306 | ||
401 | 335 | } | |
402 | 336 | ||
403 | 337 | ||
404 | - | let permissionDeniedError = throw("Permission denied") | |
405 | - | ||
406 | - | func mustThis (i) = if ((i.caller == this)) | |
407 | - | then true | |
408 | - | else permissionDeniedError | |
409 | - | ||
410 | - | ||
411 | - | func mustManager (i) = match managerPublicKeyOrUnit() { | |
412 | - | case pk: ByteVector => | |
413 | - | if ((i.callerPublicKey == pk)) | |
414 | - | then true | |
415 | - | else permissionDeniedError | |
416 | - | case _: Unit => | |
417 | - | if ((i.caller == this)) | |
418 | - | then true | |
419 | - | else permissionDeniedError | |
420 | - | case _ => | |
421 | - | throw("Match error") | |
422 | - | } | |
338 | + | func mustManager (i) = { | |
339 | + | let pd = throw("Permission denied") | |
340 | + | match managerPublicKeyOrUnit() { | |
341 | + | case pk: ByteVector => | |
342 | + | if ((i.callerPublicKey == pk)) | |
343 | + | then true | |
344 | + | else pd | |
345 | + | case _: Unit => | |
346 | + | if ((i.caller == this)) | |
347 | + | then true | |
348 | + | else pd | |
349 | + | case _ => | |
350 | + | throw("Match error") | |
351 | + | } | |
352 | + | } | |
423 | 353 | ||
424 | 354 | ||
425 | 355 | @Callable(i) | |
427 | 357 | let checkCaller = mustManager(i) | |
428 | 358 | if ((checkCaller == checkCaller)) | |
429 | 359 | then [StringEntry(keyFactoryAddress(), factoryAddressStr)] | |
430 | - | else throw("Strict value is not equal to itself.") | |
431 | - | } | |
432 | - | ||
433 | - | ||
434 | - | ||
435 | - | @Callable(i) | |
436 | - | func constructorV2 (votingEmissionContract) = { | |
437 | - | let cheks = [mustManager(i), if ((addressFromString(votingEmissionContract) != unit)) | |
438 | - | then true | |
439 | - | else "invalid voting emission contract address"] | |
440 | - | if ((cheks == cheks)) | |
441 | - | then [StringEntry(keyVotingEmissionContract(), votingEmissionContract)] | |
442 | 360 | else throw("Strict value is not equal to itself.") | |
443 | 361 | } | |
444 | 362 | ||
496 | 414 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
497 | 415 | let stakedByUser = readStaked(stakedByUserKEY) | |
498 | 416 | let stakedTotal = readStaked(stakedTotalKEY) | |
499 | - | let $t01901519132 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
500 | - | let wxToClaimUserNew = $t01901519132._1 | |
501 | - | let integralSTATE = $t01901519132._2 | |
502 | - | let debug = $t01901519132._3 | |
503 | - | let listName = getUsersListName(lpAssetIdStr) | |
504 | - | let listActions = if (containsNode(listName, userAddressStr)) | |
505 | - | then nil | |
506 | - | else insertNodeActions(listName, userAddressStr) | |
507 | - | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
417 | + | let $t01617716294 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
418 | + | let wxToClaimUserNew = $t01617716294._1 | |
419 | + | let integralSTATE = $t01617716294._2 | |
420 | + | let debug = $t01617716294._3 | |
421 | + | ([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
508 | 422 | } | |
509 | 423 | ||
510 | 424 | ||
524 | 438 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
525 | 439 | let stakedByUser = readStaked(stakedByUserKEY) | |
526 | 440 | let stakedTotal = readStaked(stakedTotalKEY) | |
527 | - | let $t02046720585 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
528 | - | let wxToClaimUserNew = $t02046720585._1 | |
529 | - | let integralSTATE = $t02046720585._2 | |
530 | - | let debug = $t02046720585._3 | |
531 | - | let listName = getUsersListName(lpAssetIdStr) | |
532 | - | let listActions = if (containsNode(listName, userAddressStr)) | |
533 | - | then deleteNodeActions(listName, userAddressStr) | |
534 | - | else nil | |
441 | + | let $t01743117549 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
442 | + | let wxToClaimUserNew = $t01743117549._1 | |
443 | + | let integralSTATE = $t01743117549._2 | |
444 | + | let debug = $t01743117549._3 | |
535 | 445 | if ((amount > stakedByUser)) | |
536 | 446 | then throw("passed amount is less then available") | |
537 | - | else | |
447 | + | else ([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
538 | 448 | } | |
539 | 449 | ||
540 | 450 | ||
541 | 451 | ||
542 | 452 | @Callable(i) | |
543 | 453 | func claimWx (lpAssetIdStr) = { | |
454 | + | let userAddress = i.caller | |
544 | 455 | let userAddressStr = toString(i.caller) | |
545 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
546 | - | $Tuple2(nil, result) | |
547 | - | } | |
548 | - | ||
549 | - | ||
550 | - | ||
551 | - | @Callable(i) | |
552 | - | func claimWxINTERNAL (lpAssetIdStr,userAddressStr) = { | |
553 | - | let checkCaller = mustThis(i) | |
554 | - | if ((checkCaller == checkCaller)) | |
555 | - | then { | |
556 | - | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), "claimWxINTERNAL: invalid user address") | |
557 | - | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
558 | - | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
559 | - | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
560 | - | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
561 | - | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
562 | - | let claimedByUser = toBigInt(getIntOrZero(this, claimedByUserKEY)) | |
563 | - | let claimedByUserMinReward = toBigInt(getIntOrZero(this, claimedByUserMinRewardKEY)) | |
564 | - | let claimedByUserBoostReward = toBigInt(getIntOrZero(this, claimedByUserBoostRewardKEY)) | |
565 | - | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
566 | - | let $t02232722439 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
567 | - | let wxToClaimUserNew = $t02232722439._1 | |
568 | - | let integralSTATE = $t02232722439._2 | |
569 | - | let debug = $t02232722439._3 | |
570 | - | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
571 | - | if ((zeroBigInt >= availableToClaim)) | |
572 | - | then throw("nothing to claim") | |
573 | - | else { | |
574 | - | let wxAmountBoostTotal = asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]) | |
575 | - | let minRewardPart = availableToClaim | |
576 | - | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
577 | - | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
578 | - | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
579 | - | if ((emitBoost == emitBoost)) | |
580 | - | then { | |
581 | - | let claimedByUserValue = (claimedByUser + availableToClaim) | |
582 | - | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
583 | - | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserMinReward + minRewardPart) | |
584 | - | let claimedTotalPlusAvailableToClaim = (claimedByUserMinReward + minRewardPart) | |
456 | + | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
457 | + | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
458 | + | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
459 | + | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
460 | + | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
461 | + | let claimedByUser = toBigInt(getIntOrZero(this, claimedByUserKEY)) | |
462 | + | let claimedByUserMinReward = toBigInt(getIntOrZero(this, claimedByUserMinRewardKEY)) | |
463 | + | let claimedByUserBoostReward = toBigInt(getIntOrZero(this, claimedByUserBoostRewardKEY)) | |
464 | + | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
465 | + | let $t01878718899 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
466 | + | let wxToClaimUserNew = $t01878718899._1 | |
467 | + | let integralSTATE = $t01878718899._2 | |
468 | + | let debug = $t01878718899._3 | |
469 | + | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
470 | + | if ((zeroBigInt >= availableToClaim)) | |
471 | + | then throw("nothing to claim") | |
472 | + | else { | |
473 | + | let wxAmountBoostTotal = asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]) | |
474 | + | let minRewardPart = availableToClaim | |
475 | + | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
476 | + | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
477 | + | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
478 | + | if ((emitBoost == emitBoost)) | |
479 | + | then { | |
480 | + | let claimedByUserValue = (claimedByUser + availableToClaim) | |
481 | + | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
482 | + | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserMinReward + minRewardPart) | |
483 | + | let claimedTotalPlusAvailableToClaim = (claimedByUserMinReward + minRewardPart) | |
585 | 484 | [StringEntry(claimedByUserKEY, toString(claimedByUserValue)), StringEntry(claimedByUserMinRewardKEY, toString(claimedByUserMinRewardPlusPart)), StringEntry(claimedByUserBoostRewardKEY, toString(claimedByUserBoostRewardPlusBoostRewardPart)), StringEntry(claimedTotalKEY, toString(claimedTotalPlusAvailableToClaim)), ScriptTransfer(userAddress, toInt(minRewardPart), wxAssetId), ScriptTransfer(userAddress, toInt(boostRewardPart), wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, toInt(availableToClaim), i.transactionId)] | |
586 | - | } | |
587 | - | else throw("Strict value is not equal to itself.") | |
588 | 485 | } | |
486 | + | else throw("Strict value is not equal to itself.") | |
589 | 487 | } | |
590 | - | else throw("Strict value is not equal to itself.") | |
591 | 488 | } | |
592 | 489 | ||
593 | 490 | ||
609 | 506 | else (height - emissionStartBlock) | |
610 | 507 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
611 | 508 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
612 | - | let $ | |
613 | - | let wxToClaimUserNew = $ | |
614 | - | let integralSTATE = $ | |
615 | - | let debug = $ | |
509 | + | let $t02149921611 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
510 | + | let wxToClaimUserNew = $t02149921611._1 | |
511 | + | let integralSTATE = $t02149921611._2 | |
512 | + | let debug = $t02149921611._3 | |
616 | 513 | let availableToClaim = (wxToClaimUserNew - toBigInt(claimedByUser)) | |
617 | 514 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
618 | 515 | let wxAmountBoostTotal = asInt(boostInvResult[0]) | |
620 | 517 | let minRewardPart = availableToClaim | |
621 | 518 | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
622 | 519 | let totalReward = (minRewardPart + boostRewardPart) | |
623 | - | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), ((((debug + "::") + toString(userWxReward)) + "::BOOST::") + boostDebug)], SEP)) | |
624 | - | } | |
625 | - | ||
626 | - | ||
627 | - | ||
628 | - | @Callable(i) | |
629 | - | func usersListTraversal (lpAssetId) = { | |
630 | - | let checkCaller = if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyVotingEmissionContract()), ""))) | |
631 | - | then true | |
632 | - | else mustManager(i) | |
633 | - | if ((checkCaller == checkCaller)) | |
634 | - | then { | |
635 | - | let listName = getUsersListName(lpAssetId) | |
636 | - | let userOrUnit = getString(keyNextUser(lpAssetId)) | |
637 | - | let headOrUnit = getString(keyListHead(listName)) | |
638 | - | match userOrUnit { | |
639 | - | case _: Unit => | |
640 | - | match headOrUnit { | |
641 | - | case _: Unit => | |
642 | - | $Tuple2(nil, false) | |
643 | - | case head: String => | |
644 | - | $Tuple2([StringEntry(keyNextUser(lpAssetId), head)], true) | |
645 | - | case _ => | |
646 | - | throw("Match error") | |
647 | - | } | |
648 | - | case userAddress: String => | |
649 | - | let claimedByUser = getIntOrZero(this, keyClaimedByUser(lpAssetId, userAddress)) | |
650 | - | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId)) | |
651 | - | let $t02671526818 = refreshINTEGRALS(lpAssetId, userAddress, poolAddress, 0) | |
652 | - | let wxToClaimUserNew = $t02671526818._1 | |
653 | - | let integralSTATE = $t02671526818._2 | |
654 | - | let debug = $t02671526818._3 | |
655 | - | let availableToClaim = (wxToClaimUserNew - toBigInt(claimedByUser)) | |
656 | - | let r = if ((availableToClaim > zeroBigInt)) | |
657 | - | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress], nil) | |
658 | - | else unit | |
659 | - | if ((r == r)) | |
660 | - | then { | |
661 | - | let nextUserOrUnit = getString(keyListNext(listName, userAddress)) | |
662 | - | match nextUserOrUnit { | |
663 | - | case _: Unit => | |
664 | - | $Tuple2([DeleteEntry(keyNextUser(lpAssetId))], false) | |
665 | - | case nextUser: String => | |
666 | - | $Tuple2([StringEntry(keyNextUser(lpAssetId), nextUser)], true) | |
667 | - | case _ => | |
668 | - | throw("Match error") | |
669 | - | } | |
670 | - | } | |
671 | - | else throw("Strict value is not equal to itself.") | |
672 | - | case _ => | |
673 | - | throw("Match error") | |
674 | - | } | |
675 | - | } | |
676 | - | else throw("Strict value is not equal to itself.") | |
520 | + | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), ((((debug + "::") + toString(userWxReward)) + "::BOOSTDEBUG::") + boostDebug)], SEP)) | |
677 | 521 | } | |
678 | 522 | ||
679 | 523 | ||
682 | 526 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
683 | 527 | then throw("permissions denied") | |
684 | 528 | else { | |
685 | - | let $ | |
686 | - | let wxPerLpIntegralNew = $ | |
687 | - | let poolIntegralSTATE = $ | |
688 | - | let poolDEBUG = $ | |
529 | + | let $t02252422634 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
530 | + | let wxPerLpIntegralNew = $t02252422634._1 | |
531 | + | let poolIntegralSTATE = $t02252422634._2 | |
532 | + | let poolDEBUG = $t02252422634._3 | |
689 | 533 | poolIntegralSTATE | |
690 | 534 | } | |
691 | 535 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 8 | |
5 | 5 | ||
6 | 6 | let MULT8 = 100000000 | |
7 | 7 | ||
8 | 8 | let SCALE18 = 18 | |
9 | 9 | ||
10 | 10 | let MULT18 = toBigInt(1000000000000000000) | |
11 | 11 | ||
12 | 12 | let SEP = "__" | |
13 | 13 | ||
14 | 14 | let POOLWEIGHTMULT = MULT8 | |
15 | 15 | ||
16 | 16 | let zeroBigInt = toBigInt(0) | |
17 | 17 | ||
18 | 18 | let oneBigInt = toBigInt(1) | |
19 | 19 | ||
20 | 20 | func asAnyList (val) = match val { | |
21 | 21 | case valAnyLyst: List[Any] => | |
22 | 22 | valAnyLyst | |
23 | 23 | case _ => | |
24 | 24 | throw("fail to cast into List[Any]") | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func asInt (val) = match val { | |
29 | 29 | case valInt: Int => | |
30 | 30 | valInt | |
31 | 31 | case _ => | |
32 | 32 | throw("fail to cast into Int") | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func asString (val) = match val { | |
37 | 37 | case valStr: String => | |
38 | 38 | valStr | |
39 | 39 | case _ => | |
40 | 40 | throw("fail to cast into Int") | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func asByteVector (val) = match val { | |
45 | 45 | case valBin: ByteVector => | |
46 | 46 | valBin | |
47 | 47 | case _ => | |
48 | 48 | throw("fail to cast into Int") | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func getBigIntFromStringOrZero (address,key) = value(parseBigInt(valueOrElse(getString(address, key), "0"))) | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func getBigIntFromStringOrDefault (address,key,defaultVal) = match getString(address, key) { | |
71 | 71 | case s: String => | |
72 | 72 | value(parseBigInt(s)) | |
73 | 73 | case _: Unit => | |
74 | 74 | defaultVal | |
75 | 75 | case _ => | |
76 | 76 | throw("Match error") | |
77 | 77 | } | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult)) | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18)) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
87 | - | ||
88 | - | ||
89 | - | func keyVotingEmissionContract () = "%s__votingEmissionContract" | |
90 | 87 | ||
91 | 88 | ||
92 | 89 | let IdxFactoryCfgStakingDapp = 1 | |
93 | 90 | ||
94 | 91 | let IdxFactoryCfgBoostingDapp = 2 | |
95 | 92 | ||
96 | 93 | let IdxFactoryCfgIdoDapp = 3 | |
97 | 94 | ||
98 | 95 | let IdxFactoryCfgTeamDapp = 4 | |
99 | 96 | ||
100 | 97 | let IdxFactoryCfgEmissionDapp = 5 | |
101 | 98 | ||
102 | 99 | let IdxFactoryCfgRestDapp = 6 | |
103 | 100 | ||
104 | 101 | let IdxFactoryCfgSlippageDapp = 7 | |
105 | 102 | ||
106 | 103 | func keyFactoryCfg () = "%s__factoryConfig" | |
107 | 104 | ||
108 | 105 | ||
109 | 106 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
110 | 107 | ||
111 | 108 | ||
112 | 109 | func keyMigratorPublicKey () = "%s__migratorPublicKey" | |
113 | 110 | ||
114 | 111 | ||
115 | 112 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
116 | 113 | ||
117 | 114 | ||
118 | 115 | func keyStablePoolAddonAddr () = "%s__stablePoolAddonAddr" | |
119 | 116 | ||
120 | 117 | ||
121 | 118 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
122 | 119 | ||
123 | 120 | ||
124 | 121 | func keyFactoryLpList () = "%s__lpTokensList" | |
125 | 122 | ||
126 | 123 | ||
127 | 124 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
128 | 125 | ||
129 | 126 | ||
130 | 127 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
131 | 128 | ||
132 | 129 | ||
133 | 130 | func readLpList (factory) = split(valueOrElse(getString(factory, keyFactoryLpList()), ""), SEP) | |
134 | 131 | ||
135 | 132 | ||
136 | 133 | func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP) | |
137 | 134 | ||
138 | 135 | ||
139 | 136 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
140 | 137 | ||
141 | 138 | ||
142 | 139 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
143 | 140 | ||
144 | 141 | ||
145 | 142 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
146 | 143 | ||
147 | 144 | ||
148 | 145 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
149 | 146 | ||
150 | 147 | ||
151 | 148 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
152 | 149 | ||
153 | 150 | ||
154 | 151 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
155 | 152 | ||
156 | 153 | ||
157 | 154 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
158 | 155 | ||
159 | 156 | ||
160 | 157 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
161 | 158 | ||
162 | 159 | ||
163 | 160 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP) | |
164 | 161 | ||
165 | 162 | ||
166 | 163 | func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr) | |
167 | 164 | ||
168 | 165 | ||
169 | 166 | func keyClaimedByUser (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimed", userAddressStr, lpAssetIdStr], SEP) | |
170 | 167 | ||
171 | 168 | ||
172 | 169 | func keyClaimedByUserMinReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedMinReward", userAddressStr, lpAssetIdStr], SEP) | |
173 | 170 | ||
174 | 171 | ||
175 | 172 | func keyClaimedByUserBoostReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedBoostReward", userAddressStr, lpAssetIdStr], SEP) | |
176 | 173 | ||
177 | 174 | ||
178 | 175 | func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed__total", lpAssetIdStr], SEP) | |
179 | 176 | ||
180 | 177 | ||
181 | 178 | func readStaked (key) = valueOrElse(getInteger(this, key), 0) | |
182 | 179 | ||
183 | 180 | ||
184 | 181 | func keyLastTotalLpBalance (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "bal"], SEP) | |
185 | 182 | ||
186 | 183 | ||
187 | 184 | func keyLastUserLpBalance (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "bal"], SEP) | |
188 | 185 | ||
189 | 186 | ||
190 | 187 | func keyTotalLpBalanceIntegral (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "balINT"], SEP) | |
191 | 188 | ||
192 | 189 | ||
193 | 190 | func keyUserLpBalanceIntegral (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "balINT"], SEP) | |
194 | 191 | ||
195 | 192 | ||
196 | 193 | func keyTotalLpBalanceIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "lastUpd"], SEP) | |
197 | 194 | ||
198 | 195 | ||
199 | 196 | func keyUserLpBalanceIntegralLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "lastUpd"], SEP) | |
200 | 197 | ||
201 | 198 | ||
202 | 199 | func keyWxPerLpIntegral (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpInt"], SEP) | |
203 | 200 | ||
204 | 201 | ||
205 | 202 | func keyWxPerLpIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpIntH"], SEP) | |
206 | 203 | ||
207 | 204 | ||
208 | 205 | func keyWxToClaimUser (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpInt"], SEP) | |
209 | 206 | ||
210 | 207 | ||
211 | 208 | func keyWxPerLpIntegralUserLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpIntH"], SEP) | |
212 | 209 | ||
213 | 210 | ||
214 | 211 | func keyWxPerLp (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLp"], SEP) | |
215 | 212 | ||
216 | 213 | ||
217 | 214 | func keyWxPerLpX18 (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLpX18"], SEP) | |
218 | 215 | ||
219 | 216 | ||
220 | 217 | func keyWxPerLpIntegralUserLast (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "uIntL"], SEP) | |
221 | 218 | ||
222 | 219 | ||
223 | 220 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
224 | 221 | ||
225 | 222 | ||
226 | 223 | func formatHistoryRecord (userAddress,lpAssetId,type,amount) = makeString(["%s%s%s%d%d%d", userAddress, lpAssetId, type, toString(height), toString(lastBlock.timestamp), toString(amount)], SEP) | |
227 | 224 | ||
228 | 225 | ||
229 | 226 | func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount)) | |
230 | 227 | ||
231 | 228 | ||
232 | 229 | let factoryAddress = getStringOrFail(this, keyFactoryAddress()) | |
233 | 230 | ||
234 | 231 | let factoryContract = addressFromStringValue(factoryAddress) | |
235 | 232 | ||
236 | 233 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
237 | 234 | ||
238 | 235 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
239 | 236 | ||
240 | 237 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
241 | 238 | ||
242 | - | func keyNextUser (lpAssetId) = makeString(["%s%s", lpAssetId, "nextUser"], SEP) | |
243 | - | ||
244 | - | ||
245 | - | func getUsersListName (lpAssetId) = makeString(["users", lpAssetId], SEP) | |
246 | - | ||
247 | - | ||
248 | - | func keyListHead (listName) = makeString(["%s%s%s", listName, "head"], SEP) | |
249 | - | ||
250 | - | ||
251 | - | func keyListSize (listName) = makeString(["%s%s%s", listName, "size"], SEP) | |
252 | - | ||
253 | - | ||
254 | - | func keyListPrev (listName,id) = makeString(["%s%s%s%s", listName, id, "prev"], SEP) | |
255 | - | ||
256 | - | ||
257 | - | func keyListNext (listName,id) = makeString(["%s%s%s%s", listName, id, "next"], SEP) | |
258 | - | ||
259 | - | ||
260 | - | func containsNode (listName,id) = { | |
261 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
262 | - | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
263 | - | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
264 | - | if (if ((id == valueOrElse(headOrUnit, ""))) | |
265 | - | then true | |
266 | - | else (prevOrUnit != unit)) | |
267 | - | then true | |
268 | - | else (nextOrUnit != unit) | |
269 | - | } | |
270 | - | ||
271 | - | ||
272 | - | func insertNodeActions (listName,id) = { | |
273 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
274 | - | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
275 | - | let checkNode = if (!(containsNode(listName, id))) | |
276 | - | then true | |
277 | - | else throw("Node exists") | |
278 | - | if ((checkNode == checkNode)) | |
279 | - | then (([IntegerEntry(keyListSize(listName), (listSize + 1))] ++ (if ((headOrUnit != unit)) | |
280 | - | then [StringEntry(keyListNext(listName, id), value(headOrUnit)), StringEntry(keyListPrev(listName, value(headOrUnit)), id)] | |
281 | - | else nil)) ++ [StringEntry(keyListHead(listName), id)]) | |
282 | - | else throw("Strict value is not equal to itself.") | |
283 | - | } | |
284 | - | ||
285 | - | ||
286 | - | func deleteNodeActions (listName,id) = { | |
287 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
288 | - | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
289 | - | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
290 | - | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
291 | - | ([IntegerEntry(keyListSize(listName), (listSize - 1))] ++ (if (if ((prevOrUnit != unit)) | |
292 | - | then (nextOrUnit != unit) | |
293 | - | else false) | |
294 | - | then [StringEntry(keyListNext(listName, value(prevOrUnit)), value(nextOrUnit)), StringEntry(keyListPrev(listName, value(nextOrUnit)), value(prevOrUnit)), DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, id))] | |
295 | - | else if ((nextOrUnit != unit)) | |
296 | - | then [StringEntry(keyListHead(listName), value(nextOrUnit)), DeleteEntry(keyListNext(listName, id)), DeleteEntry(keyListPrev(listName, value(nextOrUnit)))] | |
297 | - | else if ((prevOrUnit != unit)) | |
298 | - | then [DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, value(prevOrUnit)))] | |
299 | - | else if ((id == valueOrElse(headOrUnit, ""))) | |
300 | - | then [DeleteEntry(keyListHead(listName))] | |
301 | - | else throw(((("invalid node: " + listName) + ".") + id)))) | |
302 | - | } | |
303 | - | ||
304 | - | ||
305 | 239 | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == zeroBigInt)) | |
306 | 240 | then (stakedByUser > zeroBigInt) | |
307 | 241 | else false) | |
308 | 242 | then zeroBigInt | |
309 | 243 | else if ((stakedByUser == zeroBigInt)) | |
310 | 244 | then wxPerLpIntegralNew | |
311 | 245 | else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > zeroBigInt)) | |
312 | 246 | then (stakedByUser > zeroBigInt) | |
313 | 247 | else false) | |
314 | 248 | then value(parseBigInt(getStringOrFail(this, wxPerLpIntegralUserLastKEY))) | |
315 | 249 | else throw("calcWxPerLpIntegralUserLast: unexpected state") | |
316 | 250 | ||
317 | 251 | ||
318 | 252 | func refreshPoolINTEGRALS (lpAssetIdStr,poolAddressStr,lpDeltaAmount) = { | |
319 | 253 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
320 | 254 | let stakedTotal = toBigInt(readStaked(stakedTotalKEY)) | |
321 | 255 | let nonZeroStakedTotal = if ((stakedTotal == zeroBigInt)) | |
322 | 256 | then oneBigInt | |
323 | 257 | else stakedTotal | |
324 | 258 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
325 | 259 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
326 | 260 | let MULT3 = 1000 | |
327 | 261 | let wxEmissionPerBlockX3 = (getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) * MULT3) | |
328 | 262 | let poolWxEmissionPerBlockX3 = fraction(wxEmissionPerBlockX3, poolWeight, (POOLWEIGHTMULT * 3)) | |
329 | 263 | let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr) | |
330 | 264 | let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr) | |
331 | 265 | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
332 | 266 | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
333 | 267 | let wxPerLpIntegral = getBigIntFromStringOrZero(this, wxPerLpIntegralKEY) | |
334 | 268 | let wxPerLpOrZeroX3 = 0 | |
335 | 269 | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
336 | 270 | let wxPerLpX3 = if ((wxPerLpOrZeroX3 != 0)) | |
337 | 271 | then toBigInt(wxPerLpOrZeroX3) | |
338 | 272 | else fraction(toBigInt(poolWxEmissionPerBlockX3), toBigInt(MULT8), nonZeroStakedTotal) | |
339 | 273 | let stakedTotalNew = (stakedTotal + toBigInt(lpDeltaAmount)) | |
340 | 274 | let nonZeroStakedTotalNew = if ((stakedTotalNew == zeroBigInt)) | |
341 | 275 | then oneBigInt | |
342 | 276 | else stakedTotalNew | |
343 | 277 | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX3 * toBigInt(dh))) | |
344 | 278 | let wxPerLpX3New = (toBigInt(poolWxEmissionPerBlockX3) / nonZeroStakedTotalNew) | |
345 | 279 | let wxPerLpIntegralLastUpdHeightNew = height | |
346 | - | let debug = makeString([toString(wxPerLpIntegralNew), toString(dh), toString(wxPerLpX3), toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), toString(poolWeight)], "::") | |
280 | + | let debug = makeString([toString(wxPerLpIntegralNew), "dh=", toString(dh), "wxPerLpX3=", toString(wxPerLpX3), "stakedTotal=", toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), "poolWeight=", toString(poolWeight)], "::") | |
347 | 281 | $Tuple3(wxPerLpIntegralNew, [StringEntry(wxPerLpIntegralKEY, toString(wxPerLpIntegralNew)), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), StringEntry(wxPerLpKEY, toString(wxPerLpX3New))], debug) | |
348 | 282 | } | |
349 | 283 | ||
350 | 284 | ||
351 | 285 | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
352 | - | let $ | |
353 | - | let wxPerLpIntegralNew = $ | |
354 | - | let poolIntegralSTATE = $ | |
355 | - | let poolDEBUG = $ | |
286 | + | let $t01150611628 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
287 | + | let wxPerLpIntegralNew = $t01150611628._1 | |
288 | + | let poolIntegralSTATE = $t01150611628._2 | |
289 | + | let poolDEBUG = $t01150611628._3 | |
356 | 290 | let MULT3 = 1000 | |
357 | 291 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
358 | 292 | let stakedByUser = readStaked(stakedByUserKEY) | |
359 | 293 | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
360 | 294 | let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr) | |
361 | 295 | let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr) | |
362 | 296 | let wxToClaimUser = getBigIntFromStringOrZero(this, wxToClaimUserKEY) | |
363 | 297 | let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY) | |
364 | 298 | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(toBigInt(stakedByUser), toBigInt(wxPerLpIntegralUserLastUpdHeightOrZero), wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
365 | 299 | let MULT11 = (MULT8 * MULT3) | |
366 | 300 | let wxToClaimUserNew = (wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), toBigInt(stakedByUser), toBigInt(MULT11))) | |
367 | 301 | let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew | |
368 | 302 | let wxPerLpIntegralUserLastUpdHeightNew = height | |
369 | - | let debug = makeString([toString(wxToClaimUser), toString(wxPerLpIntegralUserLast), toString(stakedByUser), poolDEBUG, toString(height)], "::") | |
303 | + | let debug = makeString(["wxToClaimUser", toString(wxToClaimUser), "wxPerLpInteg", toString(wxPerLpIntegralUserLastUpdHeightOrZero), "this.getString", toString(value(parseBigInt(getStringOrFail(this, wxPerLpIntegralUserLastKEY)))), "wxPerLpIntegralNew", toString(wxPerLpIntegralNew), "wxToClaimUserNew", toString(wxToClaimUserNew), "wxPerLpIntegralUserLast", toString(wxPerLpIntegralUserLast), toString(stakedByUser), "poolDEBUG=", poolDEBUG, "height=", toString(height)], "::") | |
370 | 304 | $Tuple3(wxToClaimUserNew, (poolIntegralSTATE ++ [StringEntry(wxToClaimUserKEY, toString(wxToClaimUserNew)), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), StringEntry(wxPerLpIntegralUserLastKEY, toString(wxPerLpIntegralUserLastNew))]), debug) | |
371 | 305 | } | |
372 | 306 | ||
373 | 307 | ||
374 | 308 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
375 | 309 | case s: String => | |
376 | 310 | fromBase58String(s) | |
377 | 311 | case _: Unit => | |
378 | 312 | unit | |
379 | 313 | case _ => | |
380 | 314 | throw("Match error") | |
381 | 315 | } | |
382 | 316 | ||
383 | 317 | ||
384 | 318 | func migratorPublicKeyOrUnit () = match getString(keyMigratorPublicKey()) { | |
385 | 319 | case s: String => | |
386 | 320 | fromBase58String(s) | |
387 | 321 | case _: Unit => | |
388 | 322 | unit | |
389 | 323 | case _ => | |
390 | 324 | throw("Match error") | |
391 | 325 | } | |
392 | 326 | ||
393 | 327 | ||
394 | 328 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
395 | 329 | case s: String => | |
396 | 330 | fromBase58String(s) | |
397 | 331 | case _: Unit => | |
398 | 332 | unit | |
399 | 333 | case _ => | |
400 | 334 | throw("Match error") | |
401 | 335 | } | |
402 | 336 | ||
403 | 337 | ||
404 | - | let permissionDeniedError = throw("Permission denied") | |
405 | - | ||
406 | - | func mustThis (i) = if ((i.caller == this)) | |
407 | - | then true | |
408 | - | else permissionDeniedError | |
409 | - | ||
410 | - | ||
411 | - | func mustManager (i) = match managerPublicKeyOrUnit() { | |
412 | - | case pk: ByteVector => | |
413 | - | if ((i.callerPublicKey == pk)) | |
414 | - | then true | |
415 | - | else permissionDeniedError | |
416 | - | case _: Unit => | |
417 | - | if ((i.caller == this)) | |
418 | - | then true | |
419 | - | else permissionDeniedError | |
420 | - | case _ => | |
421 | - | throw("Match error") | |
422 | - | } | |
338 | + | func mustManager (i) = { | |
339 | + | let pd = throw("Permission denied") | |
340 | + | match managerPublicKeyOrUnit() { | |
341 | + | case pk: ByteVector => | |
342 | + | if ((i.callerPublicKey == pk)) | |
343 | + | then true | |
344 | + | else pd | |
345 | + | case _: Unit => | |
346 | + | if ((i.caller == this)) | |
347 | + | then true | |
348 | + | else pd | |
349 | + | case _ => | |
350 | + | throw("Match error") | |
351 | + | } | |
352 | + | } | |
423 | 353 | ||
424 | 354 | ||
425 | 355 | @Callable(i) | |
426 | 356 | func constructor (factoryAddressStr) = { | |
427 | 357 | let checkCaller = mustManager(i) | |
428 | 358 | if ((checkCaller == checkCaller)) | |
429 | 359 | then [StringEntry(keyFactoryAddress(), factoryAddressStr)] | |
430 | - | else throw("Strict value is not equal to itself.") | |
431 | - | } | |
432 | - | ||
433 | - | ||
434 | - | ||
435 | - | @Callable(i) | |
436 | - | func constructorV2 (votingEmissionContract) = { | |
437 | - | let cheks = [mustManager(i), if ((addressFromString(votingEmissionContract) != unit)) | |
438 | - | then true | |
439 | - | else "invalid voting emission contract address"] | |
440 | - | if ((cheks == cheks)) | |
441 | - | then [StringEntry(keyVotingEmissionContract(), votingEmissionContract)] | |
442 | 360 | else throw("Strict value is not equal to itself.") | |
443 | 361 | } | |
444 | 362 | ||
445 | 363 | ||
446 | 364 | ||
447 | 365 | @Callable(i) | |
448 | 366 | func setManager (pendingManagerPublicKey) = { | |
449 | 367 | let checkCaller = mustManager(i) | |
450 | 368 | if ((checkCaller == checkCaller)) | |
451 | 369 | then { | |
452 | 370 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
453 | 371 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
454 | 372 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
455 | 373 | else throw("Strict value is not equal to itself.") | |
456 | 374 | } | |
457 | 375 | else throw("Strict value is not equal to itself.") | |
458 | 376 | } | |
459 | 377 | ||
460 | 378 | ||
461 | 379 | ||
462 | 380 | @Callable(i) | |
463 | 381 | func confirmManager () = { | |
464 | 382 | let pm = pendingManagerPublicKeyOrUnit() | |
465 | 383 | let hasPM = if (isDefined(pm)) | |
466 | 384 | then true | |
467 | 385 | else throw("No pending manager") | |
468 | 386 | if ((hasPM == hasPM)) | |
469 | 387 | then { | |
470 | 388 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
471 | 389 | then true | |
472 | 390 | else throw("You are not pending manager") | |
473 | 391 | if ((checkPM == checkPM)) | |
474 | 392 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
475 | 393 | else throw("Strict value is not equal to itself.") | |
476 | 394 | } | |
477 | 395 | else throw("Strict value is not equal to itself.") | |
478 | 396 | } | |
479 | 397 | ||
480 | 398 | ||
481 | 399 | ||
482 | 400 | @Callable(i) | |
483 | 401 | func stake () = if ((size(i.payments) != 1)) | |
484 | 402 | then throw("invalid payment - exact one payment must be attached") | |
485 | 403 | else { | |
486 | 404 | let pmt = i.payments[0] | |
487 | 405 | let lpAssetId = value(pmt.assetId) | |
488 | 406 | let lpAssetIdStr = toBase58String(lpAssetId) | |
489 | 407 | let amount = pmt.amount | |
490 | 408 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
491 | 409 | let callerStr = toString(i.caller) | |
492 | 410 | let userAddressStr = if ((callerStr == poolAddressStr)) | |
493 | 411 | then toString(i.originCaller) | |
494 | 412 | else callerStr | |
495 | 413 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
496 | 414 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
497 | 415 | let stakedByUser = readStaked(stakedByUserKEY) | |
498 | 416 | let stakedTotal = readStaked(stakedTotalKEY) | |
499 | - | let $t01901519132 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
500 | - | let wxToClaimUserNew = $t01901519132._1 | |
501 | - | let integralSTATE = $t01901519132._2 | |
502 | - | let debug = $t01901519132._3 | |
503 | - | let listName = getUsersListName(lpAssetIdStr) | |
504 | - | let listActions = if (containsNode(listName, userAddressStr)) | |
505 | - | then nil | |
506 | - | else insertNodeActions(listName, userAddressStr) | |
507 | - | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
417 | + | let $t01617716294 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
418 | + | let wxToClaimUserNew = $t01617716294._1 | |
419 | + | let integralSTATE = $t01617716294._2 | |
420 | + | let debug = $t01617716294._3 | |
421 | + | ([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
508 | 422 | } | |
509 | 423 | ||
510 | 424 | ||
511 | 425 | ||
512 | 426 | @Callable(i) | |
513 | 427 | func unstake (lpAssetIdStr,amount) = { | |
514 | 428 | let lpAssetId = fromBase58String(lpAssetIdStr) | |
515 | 429 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
516 | 430 | let poolAddon = valueOrElse(getString(this, keyStablePoolAddonAddr()), poolAddressStr) | |
517 | 431 | let callerStr = toString(i.caller) | |
518 | 432 | let userAddressStr = if (if ((callerStr == poolAddressStr)) | |
519 | 433 | then true | |
520 | 434 | else (callerStr == poolAddon)) | |
521 | 435 | then toString(i.originCaller) | |
522 | 436 | else callerStr | |
523 | 437 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
524 | 438 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
525 | 439 | let stakedByUser = readStaked(stakedByUserKEY) | |
526 | 440 | let stakedTotal = readStaked(stakedTotalKEY) | |
527 | - | let $t02046720585 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
528 | - | let wxToClaimUserNew = $t02046720585._1 | |
529 | - | let integralSTATE = $t02046720585._2 | |
530 | - | let debug = $t02046720585._3 | |
531 | - | let listName = getUsersListName(lpAssetIdStr) | |
532 | - | let listActions = if (containsNode(listName, userAddressStr)) | |
533 | - | then deleteNodeActions(listName, userAddressStr) | |
534 | - | else nil | |
441 | + | let $t01743117549 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
442 | + | let wxToClaimUserNew = $t01743117549._1 | |
443 | + | let integralSTATE = $t01743117549._2 | |
444 | + | let debug = $t01743117549._3 | |
535 | 445 | if ((amount > stakedByUser)) | |
536 | 446 | then throw("passed amount is less then available") | |
537 | - | else | |
447 | + | else ([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
538 | 448 | } | |
539 | 449 | ||
540 | 450 | ||
541 | 451 | ||
542 | 452 | @Callable(i) | |
543 | 453 | func claimWx (lpAssetIdStr) = { | |
454 | + | let userAddress = i.caller | |
544 | 455 | let userAddressStr = toString(i.caller) | |
545 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
546 | - | $Tuple2(nil, result) | |
547 | - | } | |
548 | - | ||
549 | - | ||
550 | - | ||
551 | - | @Callable(i) | |
552 | - | func claimWxINTERNAL (lpAssetIdStr,userAddressStr) = { | |
553 | - | let checkCaller = mustThis(i) | |
554 | - | if ((checkCaller == checkCaller)) | |
555 | - | then { | |
556 | - | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), "claimWxINTERNAL: invalid user address") | |
557 | - | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
558 | - | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
559 | - | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
560 | - | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
561 | - | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
562 | - | let claimedByUser = toBigInt(getIntOrZero(this, claimedByUserKEY)) | |
563 | - | let claimedByUserMinReward = toBigInt(getIntOrZero(this, claimedByUserMinRewardKEY)) | |
564 | - | let claimedByUserBoostReward = toBigInt(getIntOrZero(this, claimedByUserBoostRewardKEY)) | |
565 | - | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
566 | - | let $t02232722439 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
567 | - | let wxToClaimUserNew = $t02232722439._1 | |
568 | - | let integralSTATE = $t02232722439._2 | |
569 | - | let debug = $t02232722439._3 | |
570 | - | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
571 | - | if ((zeroBigInt >= availableToClaim)) | |
572 | - | then throw("nothing to claim") | |
573 | - | else { | |
574 | - | let wxAmountBoostTotal = asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]) | |
575 | - | let minRewardPart = availableToClaim | |
576 | - | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
577 | - | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
578 | - | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
579 | - | if ((emitBoost == emitBoost)) | |
580 | - | then { | |
581 | - | let claimedByUserValue = (claimedByUser + availableToClaim) | |
582 | - | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
583 | - | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserMinReward + minRewardPart) | |
584 | - | let claimedTotalPlusAvailableToClaim = (claimedByUserMinReward + minRewardPart) | |
456 | + | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
457 | + | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
458 | + | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
459 | + | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
460 | + | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
461 | + | let claimedByUser = toBigInt(getIntOrZero(this, claimedByUserKEY)) | |
462 | + | let claimedByUserMinReward = toBigInt(getIntOrZero(this, claimedByUserMinRewardKEY)) | |
463 | + | let claimedByUserBoostReward = toBigInt(getIntOrZero(this, claimedByUserBoostRewardKEY)) | |
464 | + | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
465 | + | let $t01878718899 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
466 | + | let wxToClaimUserNew = $t01878718899._1 | |
467 | + | let integralSTATE = $t01878718899._2 | |
468 | + | let debug = $t01878718899._3 | |
469 | + | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
470 | + | if ((zeroBigInt >= availableToClaim)) | |
471 | + | then throw("nothing to claim") | |
472 | + | else { | |
473 | + | let wxAmountBoostTotal = asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]) | |
474 | + | let minRewardPart = availableToClaim | |
475 | + | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
476 | + | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
477 | + | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
478 | + | if ((emitBoost == emitBoost)) | |
479 | + | then { | |
480 | + | let claimedByUserValue = (claimedByUser + availableToClaim) | |
481 | + | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
482 | + | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserMinReward + minRewardPart) | |
483 | + | let claimedTotalPlusAvailableToClaim = (claimedByUserMinReward + minRewardPart) | |
585 | 484 | [StringEntry(claimedByUserKEY, toString(claimedByUserValue)), StringEntry(claimedByUserMinRewardKEY, toString(claimedByUserMinRewardPlusPart)), StringEntry(claimedByUserBoostRewardKEY, toString(claimedByUserBoostRewardPlusBoostRewardPart)), StringEntry(claimedTotalKEY, toString(claimedTotalPlusAvailableToClaim)), ScriptTransfer(userAddress, toInt(minRewardPart), wxAssetId), ScriptTransfer(userAddress, toInt(boostRewardPart), wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, toInt(availableToClaim), i.transactionId)] | |
586 | - | } | |
587 | - | else throw("Strict value is not equal to itself.") | |
588 | 485 | } | |
486 | + | else throw("Strict value is not equal to itself.") | |
589 | 487 | } | |
590 | - | else throw("Strict value is not equal to itself.") | |
591 | 488 | } | |
592 | 489 | ||
593 | 490 | ||
594 | 491 | ||
595 | 492 | @Callable(i) | |
596 | 493 | func claimWxREADONLY (lpAssetIdStr,userAddressStr) = { | |
597 | 494 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
598 | 495 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
599 | 496 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
600 | 497 | let stakedByUser = readStaked(stakedByUserKEY) | |
601 | 498 | let stakedTotal = readStaked(stakedTotalKEY) | |
602 | 499 | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
603 | 500 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
604 | 501 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
605 | 502 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
606 | 503 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
607 | 504 | let passedBlocks = if ((emissionStartBlock > height)) | |
608 | 505 | then 0 | |
609 | 506 | else (height - emissionStartBlock) | |
610 | 507 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
611 | 508 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
612 | - | let $ | |
613 | - | let wxToClaimUserNew = $ | |
614 | - | let integralSTATE = $ | |
615 | - | let debug = $ | |
509 | + | let $t02149921611 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
510 | + | let wxToClaimUserNew = $t02149921611._1 | |
511 | + | let integralSTATE = $t02149921611._2 | |
512 | + | let debug = $t02149921611._3 | |
616 | 513 | let availableToClaim = (wxToClaimUserNew - toBigInt(claimedByUser)) | |
617 | 514 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
618 | 515 | let wxAmountBoostTotal = asInt(boostInvResult[0]) | |
619 | 516 | let boostDebug = asString(boostInvResult[1]) | |
620 | 517 | let minRewardPart = availableToClaim | |
621 | 518 | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
622 | 519 | let totalReward = (minRewardPart + boostRewardPart) | |
623 | - | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), ((((debug + "::") + toString(userWxReward)) + "::BOOST::") + boostDebug)], SEP)) | |
624 | - | } | |
625 | - | ||
626 | - | ||
627 | - | ||
628 | - | @Callable(i) | |
629 | - | func usersListTraversal (lpAssetId) = { | |
630 | - | let checkCaller = if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyVotingEmissionContract()), ""))) | |
631 | - | then true | |
632 | - | else mustManager(i) | |
633 | - | if ((checkCaller == checkCaller)) | |
634 | - | then { | |
635 | - | let listName = getUsersListName(lpAssetId) | |
636 | - | let userOrUnit = getString(keyNextUser(lpAssetId)) | |
637 | - | let headOrUnit = getString(keyListHead(listName)) | |
638 | - | match userOrUnit { | |
639 | - | case _: Unit => | |
640 | - | match headOrUnit { | |
641 | - | case _: Unit => | |
642 | - | $Tuple2(nil, false) | |
643 | - | case head: String => | |
644 | - | $Tuple2([StringEntry(keyNextUser(lpAssetId), head)], true) | |
645 | - | case _ => | |
646 | - | throw("Match error") | |
647 | - | } | |
648 | - | case userAddress: String => | |
649 | - | let claimedByUser = getIntOrZero(this, keyClaimedByUser(lpAssetId, userAddress)) | |
650 | - | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId)) | |
651 | - | let $t02671526818 = refreshINTEGRALS(lpAssetId, userAddress, poolAddress, 0) | |
652 | - | let wxToClaimUserNew = $t02671526818._1 | |
653 | - | let integralSTATE = $t02671526818._2 | |
654 | - | let debug = $t02671526818._3 | |
655 | - | let availableToClaim = (wxToClaimUserNew - toBigInt(claimedByUser)) | |
656 | - | let r = if ((availableToClaim > zeroBigInt)) | |
657 | - | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress], nil) | |
658 | - | else unit | |
659 | - | if ((r == r)) | |
660 | - | then { | |
661 | - | let nextUserOrUnit = getString(keyListNext(listName, userAddress)) | |
662 | - | match nextUserOrUnit { | |
663 | - | case _: Unit => | |
664 | - | $Tuple2([DeleteEntry(keyNextUser(lpAssetId))], false) | |
665 | - | case nextUser: String => | |
666 | - | $Tuple2([StringEntry(keyNextUser(lpAssetId), nextUser)], true) | |
667 | - | case _ => | |
668 | - | throw("Match error") | |
669 | - | } | |
670 | - | } | |
671 | - | else throw("Strict value is not equal to itself.") | |
672 | - | case _ => | |
673 | - | throw("Match error") | |
674 | - | } | |
675 | - | } | |
676 | - | else throw("Strict value is not equal to itself.") | |
520 | + | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), ((((debug + "::") + toString(userWxReward)) + "::BOOSTDEBUG::") + boostDebug)], SEP)) | |
677 | 521 | } | |
678 | 522 | ||
679 | 523 | ||
680 | 524 | ||
681 | 525 | @Callable(i) | |
682 | 526 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
683 | 527 | then throw("permissions denied") | |
684 | 528 | else { | |
685 | - | let $ | |
686 | - | let wxPerLpIntegralNew = $ | |
687 | - | let poolIntegralSTATE = $ | |
688 | - | let poolDEBUG = $ | |
529 | + | let $t02252422634 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
530 | + | let wxPerLpIntegralNew = $t02252422634._1 | |
531 | + | let poolIntegralSTATE = $t02252422634._2 | |
532 | + | let poolDEBUG = $t02252422634._3 | |
689 | 533 | poolIntegralSTATE | |
690 | 534 | } | |
691 | 535 | ||
692 | 536 | ||
693 | 537 | @Verifier(tx) | |
694 | 538 | func verify () = { | |
695 | 539 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
696 | 540 | case pk: ByteVector => | |
697 | 541 | pk | |
698 | 542 | case _: Unit => | |
699 | 543 | tx.senderPublicKey | |
700 | 544 | case _ => | |
701 | 545 | throw("Match error") | |
702 | 546 | } | |
703 | 547 | let migratorPublicKey = match migratorPublicKeyOrUnit() { | |
704 | 548 | case pk: ByteVector => | |
705 | 549 | pk | |
706 | 550 | case _: Unit => | |
707 | 551 | tx.senderPublicKey | |
708 | 552 | case _ => | |
709 | 553 | throw("Match error") | |
710 | 554 | } | |
711 | 555 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
712 | 556 | then true | |
713 | 557 | else sigVerify(tx.bodyBytes, tx.proofs[0], migratorPublicKey) | |
714 | 558 | } | |
715 | 559 |
github/deemru/w8io/169f3d6 87.56 ms ◑