tx · 5v1jk2kEZpMZmPyPKQxdiQjqJ6zojXVPJsbTMtvudwmy

3NDFcJ3K5esyuknc2ngNcw59e8SJXtfgaHB:  -0.01000000 Waves

2023.09.22 22:53 [2767040] smart account 3NDFcJ3K5esyuknc2ngNcw59e8SJXtfgaHB > SELF 0.00000000 Waves

{ "type": 13, "id": "5v1jk2kEZpMZmPyPKQxdiQjqJ6zojXVPJsbTMtvudwmy", "fee": 1000000, "feeAssetId": null, "timestamp": 1695412384120, "version": 2, "chainId": 84, "sender": "3NDFcJ3K5esyuknc2ngNcw59e8SJXtfgaHB", "senderPublicKey": "8M2WuphuhMvTZMcpBocfLqUvkcFJisjdcCZaaPHxpwmS", "proofs": [ "gqXS4nbGrw5YJHgEi5ALZpRiqg9ppRDiDPa9xgicgrG5sfC2Hd86GMQMGPQbQiLifCKD6bbMeuKhDPWw1MeLA7X" ], "script": "base64:BgLRAggCEgASAwoBARIAEgAiBnVzZG5JZCIJdXNkbklkU3RyIghwdXp6bGVJZCILcHV6emxlSWRTdHIiBVNjYWxlIg10cnlHZXRJbnRlZ2VyIgNrZXkiByRtYXRjaDAiAWIiDHRyeUdldFN0cmluZyIBYSIQY2xhaW1BbGlhc1Jlc3VsdCIHYWRkcmVzcyIKYXNzZXRJZFN0ciIKYWRkcmVzc1N0ciIPY3VycmVudEludGVyZXN0IgxzdGFrZWRBbW91bnQiGGxhc3RDaGVja0ludGVyZXN0SW5TdGF0ZSIRbGFzdENoZWNrSW50ZXJlc3QiBnJld2FyZCILY2xhaW1SZXN1bHQiAWkiBmFtb3VudCIRdG90YWxTdGFrZWRBbW91bnQiCHBtdEFzc2V0IglwbXRBbW91bnQiDWludGVyZXN0RGVsdGEiAnR4IgZ2ZXJpZnkJAAFhASBvJKPKqzDcUimY6CxhWu5afyNNwi11u+mdqlTg0tAHwQABYgIsOFVyZkRWZDVHcmVlVXdtN3VQazdlWXoxZU12Mzc2a3pSNTJDNnNBTlBrd1MAAWMBIGEgR2q15TSU04z5reN5xP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2Vhcm5pbmdzBQF3CQDMCAIJAQxJbnRlZ2VyRW50cnkCCQCsAgIJAKwCAgIRZ2xvYmFsX2xhc3RDaGVja18FAWICCV9pbnRlcmVzdAkAZAIFAXAFAUEFA25pbAUBdwUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQFCAQFDAAkA9AMDCAUBQglib2R5Qnl0ZXMJAJEDAggFAUIGcHJvb2ZzAAAIBQFCD3NlbmRlclB1YmxpY0tleZIfEXg=", "height": 2767040, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 53o7hZJrEa37S5iecxSxvnCZD7kqEo2tZVcrR9PUC2Wd Next: 91KaMZtsU3d8AR9Y1AGSFnGReQHeMmqHGA8u9aWzX1La Diff:
OldNewDifferences
8383 else throw("not correct asset attached")
8484 if ((amount == amount))
8585 then {
86- let currentInterest = tryGetInteger((("global_lastCheck_" + puzzleIdStr) + "_interest"))
86+ let currentInterest = tryGetInteger((("global_lastCheck_" + usdnIdStr) + "_interest"))
8787 let totalStakedAmount = tryGetInteger("global_staked")
8888 let interestDelta = if ((totalStakedAmount > 0))
8989 then fraction(amount, Scale, totalStakedAmount)
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 tryGetString (key) = match getString(this, key) {
2323 case a: String =>
2424 a
2525 case _ =>
2626 ""
2727 }
2828
2929
3030 func claimAliasResult (address,assetIdStr) = {
3131 let addressStr = toString(address)
3232 let currentInterest = tryGetInteger((("global_lastCheck_" + assetIdStr) + "_interest"))
3333 let stakedAmount = tryGetInteger((addressStr + "_staked"))
3434 let lastCheckInterestInState = tryGetInteger((((addressStr + "_lastCheck_") + assetIdStr) + "_interest"))
3535 let lastCheckInterest = if ((lastCheckInterestInState == 0))
3636 then 0
3737 else lastCheckInterestInState
3838 let reward = fraction((currentInterest - lastCheckInterest), stakedAmount, Scale)
3939 [IntegerEntry((((addressStr + "_lastCheck_") + assetIdStr) + "_interest"), currentInterest), IntegerEntry((((addressStr + "_") + assetIdStr) + "_claimed"), (tryGetInteger((((addressStr + "_") + assetIdStr) + "_claimed")) + reward)), ScriptTransfer(address, reward, fromBase58String(assetIdStr))]
4040 }
4141
4242
4343 func claimResult (address) = (claimAliasResult(address, usdnIdStr) ++ claimAliasResult(address, puzzleIdStr))
4444
4545
4646 @Callable(i)
4747 func stake () = {
4848 let amount = i.payments[0].amount
4949 let addressStr = toString(i.caller)
5050 let assetIdStr = toBase58String(usdnId)
5151 let totalStakedAmount = tryGetInteger("global_staked")
5252 if ((i.payments[0].assetId != puzzleId))
5353 then throw("wrong asset attached")
5454 else (claimResult(i.caller) ++ [IntegerEntry("global_staked", (totalStakedAmount + amount)), IntegerEntry((addressStr + "_staked"), (tryGetInteger((addressStr + "_staked")) + amount))])
5555 }
5656
5757
5858
5959 @Callable(i)
6060 func unStake (amount) = {
6161 let addressStr = toString(i.caller)
6262 let stakedAmount = tryGetInteger((addressStr + "_staked"))
6363 if ((amount > stakedAmount))
6464 then throw("you don't have tokens available")
6565 else (claimResult(i.caller) ++ [IntegerEntry((addressStr + "_staked"), (stakedAmount - amount)), IntegerEntry("global_staked", (tryGetInteger("global_staked") - amount)), ScriptTransfer(i.caller, amount, puzzleId)])
6666 }
6767
6868
6969
7070 @Callable(i)
7171 func claimReward () = claimResult(i.caller)
7272
7373
7474
7575 @Callable(i)
7676 func topUpReward () = {
7777 let pmtAsset = value(i.payments[0].assetId)
7878 let pmtAmount = i.payments[0].amount
7979 let amount = if ((pmtAsset == puzzleId))
8080 then 0
8181 else if ((pmtAsset == usdnId))
8282 then pmtAmount
8383 else throw("not correct asset attached")
8484 if ((amount == amount))
8585 then {
86- let currentInterest = tryGetInteger((("global_lastCheck_" + puzzleIdStr) + "_interest"))
86+ let currentInterest = tryGetInteger((("global_lastCheck_" + usdnIdStr) + "_interest"))
8787 let totalStakedAmount = tryGetInteger("global_staked")
8888 let interestDelta = if ((totalStakedAmount > 0))
8989 then fraction(amount, Scale, totalStakedAmount)
9090 else 0
9191 if ((pmtAsset != puzzleId))
9292 then $Tuple2([IntegerEntry((("global_" + usdnIdStr) + "_earnings"), (tryGetInteger((("global_" + usdnIdStr) + "_earnings")) + amount)), IntegerEntry((("global_lastCheck_" + usdnIdStr) + "_interest"), (currentInterest + interestDelta))], amount)
9393 else nil
9494 }
9595 else throw("Strict value is not equal to itself.")
9696 }
9797
9898
9999 @Verifier(tx)
100100 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
101101

github/deemru/w8io/026f985 
22.20 ms