tx · G8PPjDoVTucoiTTZmikHFVkxRAmUtf9aKmTzp9uKSVJz

3N1HdGqmcf4nVsUgmWiwB8p6p8ErWBmvQua:  -0.01000000 Waves

2023.11.16 16:04 [2845975] smart account 3N1HdGqmcf4nVsUgmWiwB8p6p8ErWBmvQua > SELF 0.00000000 Waves

{ "type": 13, "id": "G8PPjDoVTucoiTTZmikHFVkxRAmUtf9aKmTzp9uKSVJz", "fee": 1000000, "feeAssetId": null, "timestamp": 1700139916894, "version": 2, "chainId": 84, "sender": "3N1HdGqmcf4nVsUgmWiwB8p6p8ErWBmvQua", "senderPublicKey": "JAEVvs5E9kGyXWx3YQaivUpUP3vb3pgr2eS6UrYr1A8P", "proofs": [ "4Qk3wezqf7wUPoUQUkoFMFDnByKn8MpFDYhWxvtfwaxNBoNEAc11tXEcxsM5W36ZiVXB2QhYUYTCsesiX5bUAtv5" ], "script": "base64:AAIFAAAAAAAAAAgIAhIAEgASAAAAAA4AAAAACE9XTkVSX1BLAQAAACD+9CsLFiFJC8RGtLCwzR0ek1aKw5ef/3Hp6vXrubt/IAAAAAALU1RBS0VfQVNTRVQBAAAAIPss+diV/WzAQQQ+1nCaM2epB5cN0dakuic5O0p9U6wiAAAAAApFQVJOX0FTU0VUAQAAACD7LPnYlf1swEEEPtZwmjNnqQeXDdHWpLonOTtKfVOsIgAAAAANVE9LRU5TX1BFUl9NUwAAAAAAAAAAAQAAAAADU0VQAgAAAAJfXwAAAAALREVOT01JTkFUT1IADeC2s6dkAAABAAAAEHVzZXJEZXBvc2l0ZWRLZXkAAAABAAAABHVzZXIJAAS5AAAAAgkABEwAAAACAgAAAAJ1ZAkABEwAAAACCQACWAAAAAEIBQAAAAR1c2VyAAAABWJ5dGVzBQAAAANuaWwFAAAAA1NFUAEAAAARdG90YWxEZXBvc2l0ZWRLZXkAAAAAAgAAAAJ0ZAEAAAANbGFzdFVwZGF0ZUtleQAAAAACAAAAAmx1AQAAABdyZXdhcmRQZXJUb2tlblN0b3JlZEtleQAA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AAAAWkAAAAGY2FsbGVyAAAAAAAAAAAABQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAIT1dORVJfUEv33ITa", "height": 2845975, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4Dqtd1ucyeBYQGnhd2rjxCgyLSiKGrYLdSKynpGHaN5A Next: 9aXKVK5LNruHXzZrUVaz5R8z93pEDHP4wjJRXXKKEPde Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let OWNER_PK = base58'JAEVvs5E9kGyXWx3YQaivUpUP3vb3pgr2eS6UrYr1A8P'
5+
46 let STAKE_ASSET = base58'HuV7L2uJ4v2SDS5xqZLWPHhimTUgEMKstmxwfBY17SX3'
57
68 let EARN_ASSET = base58'HuV7L2uJ4v2SDS5xqZLWPHhimTUgEMKstmxwfBY17SX3'
124126
125127
126128 @Verifier(tx)
127-func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
129+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], OWNER_PK)
128130
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let OWNER_PK = base58'JAEVvs5E9kGyXWx3YQaivUpUP3vb3pgr2eS6UrYr1A8P'
5+
46 let STAKE_ASSET = base58'HuV7L2uJ4v2SDS5xqZLWPHhimTUgEMKstmxwfBY17SX3'
57
68 let EARN_ASSET = base58'HuV7L2uJ4v2SDS5xqZLWPHhimTUgEMKstmxwfBY17SX3'
79
810 let TOKENS_PER_MS = 1
911
1012 let SEP = "__"
1113
1214 let DENOMINATOR = 1000000000000000000
1315
1416 func userDepositedKey (user) = makeString(["ud", toBase58String(user.bytes)], SEP)
1517
1618
1719 func totalDepositedKey () = "td"
1820
1921
2022 func lastUpdateKey () = "lu"
2123
2224
2325 func rewardPerTokenStoredKey () = "rpts"
2426
2527
2628 func userRewardPerTokenPaidKey (user) = makeString(["urpd", toBase58String(user.bytes)], SEP)
2729
2830
2931 func userRewards (user) = makeString(["ur", toBase58String(user.bytes)], SEP)
3032
3133
3234 func calcRewardPerTokenStored () = {
3335 let totalDeposited = toBigInt( match getInteger(totalDepositedKey()) {
3436 case a: Int =>
3537 a
3638 case _ =>
3739 0
3840 })
3941 let lastUpdate = toBigInt( match getInteger(lastUpdateKey()) {
4042 case a: Int =>
4143 a
4244 case _ =>
4345 lastBlock.timestamp
4446 })
4547 let rewardPerTokenStored = parseBigIntValue( match getString(rewardPerTokenStoredKey()) {
4648 case a: String =>
4749 a
4850 case _ =>
4951 "0"
5052 })
5153 if ((totalDeposited == toBigInt(0)))
5254 then rewardPerTokenStored
5355 else (rewardPerTokenStored + (((toBigInt(TOKENS_PER_MS) * (toBigInt(lastBlock.timestamp) - lastUpdate)) * toBigInt(DENOMINATOR)) / totalDeposited))
5456 }
5557
5658
5759 func earned (user) = {
5860 let userDeposited = toBigInt( match getInteger(userDepositedKey(user)) {
5961 case a: Int =>
6062 a
6163 case _ =>
6264 0
6365 })
6466 let userRewardPerTokenPaid = parseBigIntValue(getStringValue(userRewardPerTokenPaidKey(user)))
6567 let rewards = toBigInt( match getInteger(userRewards(user)) {
6668 case a: Int =>
6769 a
6870 case _ =>
6971 0
7072 })
7173 (fraction(userDeposited, (calcRewardPerTokenStored() - userRewardPerTokenPaid), toBigInt(DENOMINATOR)) + rewards)
7274 }
7375
7476
7577 @Callable(i)
7678 func update () = [IntegerEntry(lastUpdateKey(), lastBlock.timestamp), StringEntry(rewardPerTokenStoredKey(), toString(calcRewardPerTokenStored()))]
7779
7880
7981
8082 @Callable(i)
8183 func deposit () = if (if ((size(i.payments) != 1))
8284 then true
8385 else (i.payments[0].assetId != STAKE_ASSET))
8486 then throw("incorrect asset deposits")
8587 else {
8688 let userDeposited = match getInteger(userDepositedKey(i.caller)) {
8789 case a: Int =>
8890 a
8991 case _ =>
9092 0
9193 }
9294 let totalDeposited = match getInteger(totalDepositedKey()) {
9395 case a: Int =>
9496 a
9597 case _ =>
9698 0
9799 }
98100 [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))
99101 then 0
100102 else toInt(earned(i.caller)))]
101103 }
102104
103105
104106
105107 @Callable(i)
106108 func withdraw () = {
107109 let userDeposited = match getInteger(userDepositedKey(i.caller)) {
108110 case a: Int =>
109111 a
110112 case _ =>
111113 0
112114 }
113115 let totalDeposited = match getInteger(totalDepositedKey()) {
114116 case a: Int =>
115117 a
116118 case _ =>
117119 0
118120 }
119121 let earnedTokens = toInt(earned(i.caller))
120122 if ((userDeposited == 0))
121123 then throw("empty deposit")
122124 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)]
123125 }
124126
125127
126128 @Verifier(tx)
127-func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
129+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], OWNER_PK)
128130

github/deemru/w8io/026f985 
27.65 ms