tx · Ga8ix3Wcaf4Hr4JJR7B1r4T3TtmjmwKU4yRqNorkHQGZ

3N1HdGqmcf4nVsUgmWiwB8p6p8ErWBmvQua:  -0.01000000 Waves

2023.11.16 15:43 [2845952] smart account 3N1HdGqmcf4nVsUgmWiwB8p6p8ErWBmvQua > SELF 0.00000000 Waves

{ "type": 13, "id": "Ga8ix3Wcaf4Hr4JJR7B1r4T3TtmjmwKU4yRqNorkHQGZ", "fee": 1000000, "feeAssetId": null, "timestamp": 1700138659692, "version": 2, "chainId": 84, "sender": "3N1HdGqmcf4nVsUgmWiwB8p6p8ErWBmvQua", "senderPublicKey": "JAEVvs5E9kGyXWx3YQaivUpUP3vb3pgr2eS6UrYr1A8P", "proofs": [ "eaiDtjvXCH6QToxjBgX4QDLWpjmFNBgwJYrfQwHuGFHzFdvjrXJHSCnrC8FZT2WrD6n44cM21Kf9rj39kXAGyKq" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAANAAAAAAtTVEFLRV9BU1NFVAEAAAAg+yz52JX9bMBBBD7WcJozZ6kHlw3R1qS6Jzk7Sn1TrCIAAAAACkVBUk5fQVNTRVQBAAAAIPss+diV/WzAQQQ+1nCaM2epB5cN0dakuic5O0p9U6wiAAAAAA1UT0tFTlNfUEVSX01TAAAAAAAAAAABAAAAAANTRVACAAAAAl9fAAAAAAtERU5PTUlOQVRPUgAN4Lazp2QAAAEAAAAQdXNlckRlcG9zaXRlZEtleQAAAAEAAAAEdXNlcgkABLkAAAACCQAETAAAAAICAAAAAnVkCQAETAAAAAIJAAJYAAAAAQgFAAAABHVzZXIAAAAFYnl0ZXMFAAAAA25pbAUAAAADU0VQAQAAABF0b3RhbERlcG9zaXRlZEtleQAAAAACAAAAAnRkAQAAAA1sYXN0VXBkYXRlS2V5AAAAAAIAAAACbHUBAAAAF3Jld2FyZFBlclRva2VuU3RvcmVkS2V5AAAAAAIAAAAEcnB0cwEAAAAZdXNlclJld2FyZFBlclRva2VuUGFpZEtleQAAAAEAAA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2l0ZWQFAAAADXVzZXJEZXBvc2l0ZWQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAQAAAA1sYXN0VXBkYXRlS2V5AAAAAAgFAAAACWxhc3RCbG9jawAAAAl0aW1lc3RhbXAJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAA11c2VyRGVwb3NpdGVkBQAAAAtTVEFLRV9BU1NFVAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADGVhcm5lZFRva2VucwUAAAAKRUFSTl9BU1NFVAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAAXcmV3YXJkUGVyVG9rZW5TdG9yZWRLZXkAAAAACQABpgAAAAEJAQAAABhjYWxjUmV3YXJkUGVyVG9rZW5TdG9yZWQAAAAACQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAABl1c2VyUmV3YXJkUGVyVG9rZW5QYWlkS2V5AAAAAQgFAAAAAWkAAAAGY2FsbGVyCQABpgAAAAEJAQAAABhjYWxjUmV3YXJkUGVyVG9rZW5TdG9yZWQAAAAACQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQEAAAALdXNlclJld2FyZHMAAAABCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAAFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5xwshwA==", "height": 2845952, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Gr3wQvFqWEQmDpPUeQnfFazxu5tqRDW1agfzAVU15tTc Next: 4Dqtd1ucyeBYQGnhd2rjxCgyLSiKGrYLdSKynpGHaN5A Diff:
OldNewDifferences
1212 let DENOMINATOR = 1000000000000000000
1313
1414 func userDepositedKey (user) = makeString(["ud", toBase58String(user.bytes)], SEP)
15-
16-
17-func userUpdateKey (user) = makeString(["uu", toBase58String(user.bytes)], SEP)
1815
1916
2017 func totalDepositedKey () = "td"
115112 0
116113 }
117114 let earnedTokens = toInt(earned(i.caller))
118-[IntegerEntry(userDepositedKey(i.caller), 0), IntegerEntry(totalDepositedKey(), (totalDeposited - userDeposited)), IntegerEntry(lastUpdateKey(), lastBlock.timestamp), ScriptTransfer(i.caller, userDeposited, STAKE_ASSET), ScriptTransfer(i.caller, earnedTokens, EARN_ASSET), StringEntry(rewardPerTokenStoredKey(), toString(calcRewardPerTokenStored())), StringEntry(userRewardPerTokenPaidKey(i.caller), toString(calcRewardPerTokenStored())), IntegerEntry(userRewards(i.caller), 0)]
115+ if ((userDeposited == 0))
116+ then throw("empty deposit")
117+ else [IntegerEntry(userDepositedKey(i.caller), 0), IntegerEntry(totalDepositedKey(), (totalDeposited - userDeposited)), IntegerEntry(lastUpdateKey(), lastBlock.timestamp), ScriptTransfer(i.caller, userDeposited, STAKE_ASSET), ScriptTransfer(i.caller, earnedTokens, EARN_ASSET), StringEntry(rewardPerTokenStoredKey(), toString(calcRewardPerTokenStored())), StringEntry(userRewardPerTokenPaidKey(i.caller), toString(calcRewardPerTokenStored())), IntegerEntry(userRewards(i.caller), 0)]
119118 }
120119
121120
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let STAKE_ASSET = base58'HuV7L2uJ4v2SDS5xqZLWPHhimTUgEMKstmxwfBY17SX3'
55
66 let EARN_ASSET = base58'HuV7L2uJ4v2SDS5xqZLWPHhimTUgEMKstmxwfBY17SX3'
77
88 let TOKENS_PER_MS = 1
99
1010 let SEP = "__"
1111
1212 let DENOMINATOR = 1000000000000000000
1313
1414 func userDepositedKey (user) = makeString(["ud", toBase58String(user.bytes)], SEP)
15-
16-
17-func userUpdateKey (user) = makeString(["uu", toBase58String(user.bytes)], SEP)
1815
1916
2017 func totalDepositedKey () = "td"
2118
2219
2320 func lastUpdateKey () = "lu"
2421
2522
2623 func rewardPerTokenStoredKey () = "rpts"
2724
2825
2926 func userRewardPerTokenPaidKey (user) = makeString(["urpd", toBase58String(user.bytes)], SEP)
3027
3128
3229 func userRewards (user) = makeString(["ur", toBase58String(user.bytes)], SEP)
3330
3431
3532 func calcRewardPerTokenStored () = {
3633 let totalDeposited = toBigInt( match getInteger(totalDepositedKey()) {
3734 case a: Int =>
3835 a
3936 case _ =>
4037 0
4138 })
4239 let lastUpdate = toBigInt( match getInteger(lastUpdateKey()) {
4340 case a: Int =>
4441 a
4542 case _ =>
4643 lastBlock.timestamp
4744 })
4845 let rewardPerTokenStored = parseBigIntValue( match getString(rewardPerTokenStoredKey()) {
4946 case a: String =>
5047 a
5148 case _ =>
5249 "0"
5350 })
5451 if ((totalDeposited == toBigInt(0)))
5552 then rewardPerTokenStored
5653 else (rewardPerTokenStored + (((toBigInt(TOKENS_PER_MS) * (toBigInt(lastBlock.timestamp) - lastUpdate)) * toBigInt(DENOMINATOR)) / totalDeposited))
5754 }
5855
5956
6057 func earned (user) = {
6158 let userDeposited = toBigInt( match getInteger(userDepositedKey(user)) {
6259 case a: Int =>
6360 a
6461 case _ =>
6562 0
6663 })
6764 let userRewardPerTokenPaid = parseBigIntValue(getStringValue(userRewardPerTokenPaidKey(user)))
6865 let rewards = toBigInt( match getInteger(userRewards(user)) {
6966 case a: Int =>
7067 a
7168 case _ =>
7269 0
7370 })
7471 (fraction(userDeposited, (calcRewardPerTokenStored() - userRewardPerTokenPaid), toBigInt(DENOMINATOR)) + rewards)
7572 }
7673
7774
7875 @Callable(i)
7976 func deposit () = if (if ((size(i.payments) != 1))
8077 then true
8178 else (i.payments[0].assetId != STAKE_ASSET))
8279 then throw("incorrect asset deposits")
8380 else {
8481 let userDeposited = match getInteger(userDepositedKey(i.caller)) {
8582 case a: Int =>
8683 a
8784 case _ =>
8885 0
8986 }
9087 let totalDeposited = match getInteger(totalDepositedKey()) {
9188 case a: Int =>
9289 a
9390 case _ =>
9491 0
9592 }
9693 [IntegerEntry(userDepositedKey(i.caller), (userDeposited + i.payments[0].amount)), IntegerEntry(totalDepositedKey(), (totalDeposited + i.payments[0].amount)), IntegerEntry(lastUpdateKey(), lastBlock.timestamp), StringEntry(rewardPerTokenStoredKey(), toString(calcRewardPerTokenStored())), StringEntry(userRewardPerTokenPaidKey(i.caller), toString(calcRewardPerTokenStored())), IntegerEntry(userRewards(i.caller), if ((userDeposited == 0))
9794 then 0
9895 else toInt(earned(i.caller)))]
9996 }
10097
10198
10299
103100 @Callable(i)
104101 func withdraw () = {
105102 let userDeposited = match getInteger(userDepositedKey(i.caller)) {
106103 case a: Int =>
107104 a
108105 case _ =>
109106 0
110107 }
111108 let totalDeposited = match getInteger(totalDepositedKey()) {
112109 case a: Int =>
113110 a
114111 case _ =>
115112 0
116113 }
117114 let earnedTokens = toInt(earned(i.caller))
118-[IntegerEntry(userDepositedKey(i.caller), 0), IntegerEntry(totalDepositedKey(), (totalDeposited - userDeposited)), IntegerEntry(lastUpdateKey(), lastBlock.timestamp), ScriptTransfer(i.caller, userDeposited, STAKE_ASSET), ScriptTransfer(i.caller, earnedTokens, EARN_ASSET), StringEntry(rewardPerTokenStoredKey(), toString(calcRewardPerTokenStored())), StringEntry(userRewardPerTokenPaidKey(i.caller), toString(calcRewardPerTokenStored())), IntegerEntry(userRewards(i.caller), 0)]
115+ if ((userDeposited == 0))
116+ then throw("empty deposit")
117+ else [IntegerEntry(userDepositedKey(i.caller), 0), IntegerEntry(totalDepositedKey(), (totalDeposited - userDeposited)), IntegerEntry(lastUpdateKey(), lastBlock.timestamp), ScriptTransfer(i.caller, userDeposited, STAKE_ASSET), ScriptTransfer(i.caller, earnedTokens, EARN_ASSET), StringEntry(rewardPerTokenStoredKey(), toString(calcRewardPerTokenStored())), StringEntry(userRewardPerTokenPaidKey(i.caller), toString(calcRewardPerTokenStored())), IntegerEntry(userRewards(i.caller), 0)]
119118 }
120119
121120
122121 @Verifier(tx)
123122 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
124123

github/deemru/w8io/026f985 
26.31 ms