tx · DSdMaVasgRi8PCoaaq2ri7xwsWEjn81ztJjfdxVez3gY

3NDFcJ3K5esyuknc2ngNcw59e8SJXtfgaHB:  -0.01000000 Waves

2023.09.22 21:04 [2766923] smart account 3NDFcJ3K5esyuknc2ngNcw59e8SJXtfgaHB > SELF 0.00000000 Waves

{ "type": 13, "id": "DSdMaVasgRi8PCoaaq2ri7xwsWEjn81ztJjfdxVez3gY", "fee": 1000000, "feeAssetId": null, "timestamp": 1695405918858, "version": 2, "chainId": 84, "sender": "3NDFcJ3K5esyuknc2ngNcw59e8SJXtfgaHB", "senderPublicKey": "8M2WuphuhMvTZMcpBocfLqUvkcFJisjdcCZaaPHxpwmS", "proofs": [ "2XmZWg4FBbnKTo5XxYzYnKJkQi2hSDC7WZcNGbtH4EorQuMPh3nN39qDkNsUKfKA9nvVE4vum8YUr6qkUjta83n7" ], "script": "base64:BgLAAggCEgASAwoBARIAEgAiBnVzZG5JZCIJdXNkbklkU3RyIghwdXp6bGVJZCILcHV6emxlSWRTdHIiBVNjYWxlIg10cnlHZXRJbnRlZ2VyIgNrZXkiByRtYXRjaDAiAWIiEGNsYWltQWxpYXNSZXN1bHQiB2FkZHJlc3MiCmFzc2V0SWRTdHIiCmFkZHJlc3NTdHIiD2N1cnJlbnRJbnRlcmVzdCIMc3Rha2VkQW1vdW50IhhsYXN0Q2hlY2tJbnRlcmVzdEluU3RhdGUiEWxhc3RDaGVja0ludGVyZXN0IgZyZXdhcmQiC2NsYWltUmVzdWx0IgFpIgZhbW91bnQiEXRvdGFsU3Rha2VkQW1vdW50IghwbXRBc3NldCIJcG10QW1vdW50Ig1pbnRlcmVzdERlbHRhIgJ0eCIGdmVyaWZ5CAABYQEgbySjyqsw3FIpmOgsYVruWn8jTcItdbvpnapU4NLQB8EAAWICLDhVcmZEVmQ1R3JlZVV3bTd1UGs3ZVl6MWVNdjM3Nmt6UjUyQzZzQU5Qa3dTAAFjASBhIEdqteU0lNOM+a3jecT6cJU92ajDMxppPdJKJ6I3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aWwFAXUJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAXoBAUEACQD0AwMIBQF6CWJvZHlCeXRlcwkAkQMCCAUBegZwcm9vZnMAAAgFAXoPc2VuZGVyUHVibGljS2V56Ta5Sg==", "height": 2766923, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FNpyEmdbhsfxaghg8FrLSBSruzAQmXWSDukqbmmNSKGw Next: 7KoKHebjbi7Sr441at7eCZRdJPqn2yJ9jhpet6wR4TNm Diff:
OldNewDifferences
8080 let interestDelta = if ((totalStakedAmount > 0))
8181 then fraction(amount, Scale, totalStakedAmount)
8282 else 0
83- if ((pmtAsset != usdnId))
84- then $Tuple2([IntegerEntry((("global_" + puzzleIdStr) + "_earnings"), (tryGetInteger((("global_" + puzzleIdStr) + "_earnings")) + amount)), IntegerEntry((("global_lastCheck_" + puzzleIdStr) + "_interest"), (currentInterest + interestDelta))], amount)
85- else nil
83+ $Tuple2([IntegerEntry((("global_" + puzzleIdStr) + "_earnings"), (tryGetInteger((("global_" + puzzleIdStr) + "_earnings")) + amount)), IntegerEntry((("global_lastCheck_" + puzzleIdStr) + "_interest"), (currentInterest + interestDelta))], amount)
8684 }
8785 else throw("Strict value is not equal to itself.")
8886 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let usdnId = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS'
55
66 let usdnIdStr = "8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS"
77
88 let puzzleId = base58'7Y96UTbBQ45cjWoHeFj2EhnjdgEt6iK2LnA4eTcfxdoD'
99
1010 let puzzleIdStr = "7Y96UTbBQ45cjWoHeFj2EhnjdgEt6iK2LnA4eTcfxdoD"
1111
1212 let Scale = 1000000000000
1313
1414 func tryGetInteger (key) = match getInteger(this, key) {
1515 case b: Int =>
1616 b
1717 case _ =>
1818 0
1919 }
2020
2121
2222 func claimAliasResult (address,assetIdStr) = {
2323 let addressStr = toString(address)
2424 let currentInterest = tryGetInteger((("global_lastCheck_" + assetIdStr) + "_interest"))
2525 let stakedAmount = tryGetInteger((addressStr + "_staked"))
2626 let lastCheckInterestInState = tryGetInteger((((addressStr + "_lastCheck_") + assetIdStr) + "_interest"))
2727 let lastCheckInterest = if ((lastCheckInterestInState == 0))
2828 then 0
2929 else lastCheckInterestInState
3030 let reward = fraction((currentInterest - lastCheckInterest), stakedAmount, Scale)
3131 [IntegerEntry((((addressStr + "_lastCheck_") + assetIdStr) + "_interest"), currentInterest), IntegerEntry((((addressStr + "_") + assetIdStr) + "_claimed"), (tryGetInteger((((addressStr + "_") + assetIdStr) + "_claimed")) + reward)), ScriptTransfer(address, reward, fromBase58String(assetIdStr))]
3232 }
3333
3434
3535 func claimResult (address) = (claimAliasResult(address, usdnIdStr) ++ claimAliasResult(address, puzzleIdStr))
3636
3737
3838 @Callable(i)
3939 func stake () = {
4040 let amount = i.payments[0].amount
4141 let addressStr = toString(i.caller)
4242 let assetIdStr = toBase58String(usdnId)
4343 let totalStakedAmount = tryGetInteger("global_staked")
4444 if ((i.payments[0].assetId != puzzleId))
4545 then throw("wrong asset attached")
4646 else (claimResult(i.caller) ++ [IntegerEntry("global_staked", (totalStakedAmount + amount)), IntegerEntry((addressStr + "_staked"), (tryGetInteger((addressStr + "_staked")) + amount))])
4747 }
4848
4949
5050
5151 @Callable(i)
5252 func unStake (amount) = {
5353 let addressStr = toString(i.caller)
5454 let stakedAmount = tryGetInteger((addressStr + "_staked"))
5555 if ((amount > stakedAmount))
5656 then throw("you don't have tokens available")
5757 else (claimResult(i.caller) ++ [IntegerEntry((addressStr + "_staked"), (stakedAmount - amount)), IntegerEntry("global_staked", (tryGetInteger("global_staked") - amount)), ScriptTransfer(i.caller, amount, puzzleId)])
5858 }
5959
6060
6161
6262 @Callable(i)
6363 func claimReward () = claimResult(i.caller)
6464
6565
6666
6767 @Callable(i)
6868 func topUpReward () = {
6969 let pmtAsset = value(i.payments[0].assetId)
7070 let pmtAmount = i.payments[0].amount
7171 let amount = if ((pmtAsset == usdnId))
7272 then 0
7373 else if ((pmtAsset == puzzleId))
7474 then pmtAmount
7575 else throw("not correct asset attached")
7676 if ((amount == amount))
7777 then {
7878 let currentInterest = tryGetInteger((("global_lastCheck_" + puzzleIdStr) + "_interest"))
7979 let totalStakedAmount = tryGetInteger("global_staked")
8080 let interestDelta = if ((totalStakedAmount > 0))
8181 then fraction(amount, Scale, totalStakedAmount)
8282 else 0
83- if ((pmtAsset != usdnId))
84- then $Tuple2([IntegerEntry((("global_" + puzzleIdStr) + "_earnings"), (tryGetInteger((("global_" + puzzleIdStr) + "_earnings")) + amount)), IntegerEntry((("global_lastCheck_" + puzzleIdStr) + "_interest"), (currentInterest + interestDelta))], amount)
85- else nil
83+ $Tuple2([IntegerEntry((("global_" + puzzleIdStr) + "_earnings"), (tryGetInteger((("global_" + puzzleIdStr) + "_earnings")) + amount)), IntegerEntry((("global_lastCheck_" + puzzleIdStr) + "_interest"), (currentInterest + interestDelta))], amount)
8684 }
8785 else throw("Strict value is not equal to itself.")
8886 }
8987
9088
9189 @Verifier(tx)
9290 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
9391

github/deemru/w8io/026f985 
22.44 ms