tx · 91KaMZtsU3d8AR9Y1AGSFnGReQHeMmqHGA8u9aWzX1La

3NDFcJ3K5esyuknc2ngNcw59e8SJXtfgaHB:  -0.01000000 Waves

2023.09.25 15:55 [2770967] smart account 3NDFcJ3K5esyuknc2ngNcw59e8SJXtfgaHB > SELF 0.00000000 Waves

{ "type": 13, "id": "91KaMZtsU3d8AR9Y1AGSFnGReQHeMmqHGA8u9aWzX1La", "fee": 1000000, "feeAssetId": null, "timestamp": 1695646534392, "version": 2, "chainId": 84, "sender": "3NDFcJ3K5esyuknc2ngNcw59e8SJXtfgaHB", "senderPublicKey": "8M2WuphuhMvTZMcpBocfLqUvkcFJisjdcCZaaPHxpwmS", "proofs": [ "3kKu3xNeKy7G4J1h1f9yiUH2ubzCijtijsbS8PoN5UfBL7muEfx8cj56iSGXuwzFxiZK9LAQDcnoumYhBfT4CxKG" ], "script": "base64:BgINCAISABIDCgEBEgASAAkABnVzZG5JZAEgbySjyqsw3FIpmOgsYVruWn8jTcItdbvpnapU4NLQB8EACXVzZG5JZFN0cgIsOFVyZkRWZDVHcmVlVXdtN3VQazdlWXoxZU12Mzc2a3pSNTJDNnNBTlBrd1MACHB1enpsZUlkASBhIEdqteU0lNOM+a3jecT6cJU92ajDMxppPdJKJ6I3YAALcHV6emxlSWRTdHICLDdZOTZVVGJCUTQ1Y2pXb0hlRmoyRWhuamRnRXQ2aUsyTG5BNGVUY2Z4ZG9EAAVTY2FsZQCAoJSljR0BDXRyeUdldEludGVnZXIBA2tleQQHJG1hdGNoMAkAmggCBQR0aGlzBQNrZXkDCQABAgUHJG1hdGNoMAIDSW50BAFiBQckbWF0Y2gwBQFiAAABDHRyeUdldFN0cmluZwEDa2V5BAckbWF0Y2gwCQCdCAIFBHRoaXMFA2tleQMJAAECBQckbWF0Y2gwAgZTdHJpbmcEAWEFByRtYXRjaDAFAWECAAEQY2xhaW1BbGlhc1Jlc3VsdAIHYWRkcmVzcwphc3NldElkU3RyBAphZGRyZXNzU3RyCQClCAEFB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XN0RGVsdGEFA25pbAUGYW1vdW50BQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5zPf1VQ==", "height": 2770967, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5v1jk2kEZpMZmPyPKQxdiQjqJ6zojXVPJsbTMtvudwmy Next: none 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 {
8686 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.65 ms