tx · 5yqrQoxTgwxJPJ5b29hrX8WcJADFso6XEn2qA6QdAENg 3MraMhbSj9ikEdQyvBHciaGzf2KhzbDp1KH: -0.03200000 Waves 2022.06.12 12:41 [2092984] smart account 3MraMhbSj9ikEdQyvBHciaGzf2KhzbDp1KH > SELF 0.00000000 Waves
{ "type": 13, "id": "5yqrQoxTgwxJPJ5b29hrX8WcJADFso6XEn2qA6QdAENg", "fee": 3200000, "feeAssetId": null, "timestamp": 1655026945810, "version": 2, "chainId": 84, "sender": "3MraMhbSj9ikEdQyvBHciaGzf2KhzbDp1KH", "senderPublicKey": "6qZhQ75rMxzTxaVeq94FrZk8Z2SEuW6PxPvb5Aw7Nndx", "proofs": [ "24iucqyA1moUZQpitwzHpTLLRrktUNW6Q7eZnEobmsGHboZrV9jEiaE5VHzk8egVtfUMu1UgbY2NRRwqWrxUueNY" ], "script": "base64:AAIFAAAAAAAAABIIAhIAEgMKAQESABIAEgMKAQgAAAAoAAAAAA1rX3RvdGFsU3VwcGx5AgAAAA1rX3RvdGFsU3VwcGx5AAAAABBrX2xhc3RVcGRhdGVUaW1lAgAAABBrX2xhc3RVcGRhdGVUaW1lAAAAABZrX3Jld2FyZFBlclRva2VuU3RvcmVkAgAAABZrX3Jld2FyZFBlclRva2VuU3RvcmVkAAAAAAxrX3Jld2FyZFJhdGUCAAAADGtfcmV3YXJkUmF0ZQAAAAAOa19wZXJpb2RGaW5pc2gCAAAADmtfcGVyaW9kRmluaXNoAAAAAAlrX2JhbGFuY2UCAAAACWtfYmFsYW5jZQAAAAAUa191c2VyUmV3YXJkUGVyVG9rZW4CAAAAFGtfdXNlclJld2FyZFBlclRva2VuAAAAAAxrX3VzZXJSZXdhcmQCAAAADGtfdXNlclJld2FyZAAAAAANQURNSU5fQUREUkVTUwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVNS4yhTmTPnu5W0qgJjbPBCOVEnrzTExpwAAAAAEVVNETgEAAAAg93bq9/eDymXbbhPuAjvPWCmVqcHRjfJL2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1haW5pbmdUaW1lCQAAaQAAAAIJAABkAAAAAgUAAAAHX3Jld2FyZAUAAAAIbGVmdG92ZXIFAAAACERVUkFUSU9OCQAETgAAAAIJAAROAAAAAgkBAAAAEHVwZGF0ZVJld2FyZFJhdGUAAAABBQAAAA1uZXdSZXdhcmRSYXRlCQEAAAAadXBkYXRlUmV3YXJkUGVyVG9rZW5TdG9yZWQAAAABBQAAABduZXdSZXdhcmRQZXJUb2tlblN0b3JlZAkBAAAACnVwZGF0ZVRpbWUAAAACBQAAAAl0aW1lc3RhbXAJAABkAAAAAgUAAAAJdGltZXN0YW1wBQAAAAhEVVJBVElPTgAAAAFpAQAAAAt2aWV3X3Jld2FyZAAAAAEAAAAHX3N0YWtlcgQAAAAMc3Rha2VyRWFybmVkCAkBAAAADHVwZGF0ZVJld2FyZAAAAAIFAAAAB19zdGFrZXIJAQAAAAliYWxhbmNlT2YAAAABBQAAAAdfc3Rha2VyAAAAAl8zCQAAAgAAAAEJAAGkAAAAAQUAAAAMc3Rha2VyRWFybmVkAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXmmF7P3", "height": 2092984, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let k_totalSupply = "k_totalSupply" | |
5 | + | ||
6 | + | let k_lastUpdateTime = "k_lastUpdateTime" | |
7 | + | ||
8 | + | let k_rewardPerTokenStored = "k_rewardPerTokenStored" | |
9 | + | ||
10 | + | let k_rewardRate = "k_rewardRate" | |
11 | + | ||
12 | + | let k_periodFinish = "k_periodFinish" | |
13 | + | ||
14 | + | let k_balance = "k_balance" | |
15 | + | ||
16 | + | let k_userRewardPerToken = "k_userRewardPerToken" | |
17 | + | ||
18 | + | let k_userReward = "k_userReward" | |
19 | + | ||
20 | + | let ADMIN_ADDRESS = Address(base58'3N9JrPyndxJmvbeXdD6YgVnspJ3KDXrTFft') | |
21 | + | ||
22 | + | let USDN = base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ' | |
23 | + | ||
24 | + | let TSN = base58'HL6bTgU1e5SoaSDxp9PV1Bj8WvKAk8jReNwgax44d5S6' | |
25 | + | ||
26 | + | let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
27 | + | ||
28 | + | let DURATION = ((60 * 60) * 24) | |
29 | + | ||
30 | + | let NO_ADDDRESS = "" | |
31 | + | ||
32 | + | let NO_STAKER = 0 | |
33 | + | ||
34 | + | func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN) | |
35 | + | ||
36 | + | ||
37 | + | func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN) | |
38 | + | ||
39 | + | ||
40 | + | func abs (_x) = if ((_x > 0)) | |
41 | + | then _x | |
42 | + | else -(_x) | |
43 | + | ||
44 | + | ||
45 | + | func minv (_x,_y) = if ((_x > _y)) | |
46 | + | then _y | |
47 | + | else _x | |
48 | + | ||
49 | + | ||
50 | + | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
51 | + | ||
52 | + | ||
53 | + | func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k)) | |
54 | + | ||
55 | + | ||
56 | + | func int0 (k) = valueOrElse(getInteger(this, k), 0) | |
57 | + | ||
58 | + | ||
59 | + | func totalSupply () = int0(k_totalSupply) | |
60 | + | ||
61 | + | ||
62 | + | func rewardPerTokenStored () = int0(k_rewardPerTokenStored) | |
63 | + | ||
64 | + | ||
65 | + | func lastUpdateTime () = int0(k_lastUpdateTime) | |
66 | + | ||
67 | + | ||
68 | + | func rewardRate () = int0(k_rewardRate) | |
69 | + | ||
70 | + | ||
71 | + | func periodFinish () = int0(k_periodFinish) | |
72 | + | ||
73 | + | ||
74 | + | func rewards (_staker) = int0(toCompositeKey(k_userReward, _staker)) | |
75 | + | ||
76 | + | ||
77 | + | func userRewardPerTokenPaid (_staker) = int0(toCompositeKey(k_userRewardPerToken, _staker)) | |
78 | + | ||
79 | + | ||
80 | + | func balanceOf (_staker) = int0(toCompositeKey(k_balance, _staker)) | |
81 | + | ||
82 | + | ||
83 | + | func updateRewardRate (_rewardRate) = [IntegerEntry(k_rewardRate, _rewardRate)] | |
84 | + | ||
85 | + | ||
86 | + | func updateTime (_lastUpdateTime,_periodFinish) = [IntegerEntry(k_lastUpdateTime, _lastUpdateTime), IntegerEntry(k_periodFinish, _periodFinish)] | |
87 | + | ||
88 | + | ||
89 | + | func updateRewardPerTokenStored (_rewardPerTokenStored) = [IntegerEntry(k_rewardPerTokenStored, _rewardPerTokenStored)] | |
90 | + | ||
91 | + | ||
92 | + | func updateUserRewards (_staker,_reward,_userRewardPerToken) = [IntegerEntry(toCompositeKey(k_userReward, _staker), _reward), IntegerEntry(toCompositeKey(k_userRewardPerToken, _staker), _userRewardPerToken)] | |
93 | + | ||
94 | + | ||
95 | + | func updateBalance (_staker,_delta) = [IntegerEntry(toCompositeKey(k_balance, _staker), (balanceOf(_staker) + _delta)), IntegerEntry(k_totalSupply, (totalSupply() + _delta))] | |
96 | + | ||
97 | + | ||
98 | + | func currentTimestampSec () = (lastBlock.timestamp / 1000) | |
99 | + | ||
100 | + | ||
101 | + | func lastTimeRewardApplicable () = minv(currentTimestampSec(), periodFinish()) | |
102 | + | ||
103 | + | ||
104 | + | func rewardPerToken () = if ((totalSupply() == 0)) | |
105 | + | then rewardPerTokenStored() | |
106 | + | else { | |
107 | + | let timeInterval = (lastTimeRewardApplicable() - lastUpdateTime()) | |
108 | + | let diff = (divd(rewardRate(), totalSupply()) * timeInterval) | |
109 | + | (rewardPerTokenStored() + diff) | |
110 | + | } | |
111 | + | ||
112 | + | ||
113 | + | func earned (_staker,_balance) = { | |
114 | + | let rewardDelta = (rewardPerToken() - userRewardPerTokenPaid(_staker)) | |
115 | + | ((_balance * rewardDelta) + rewards(_staker)) | |
116 | + | } | |
117 | + | ||
118 | + | ||
119 | + | func updateReward (_staker,_balance) = { | |
120 | + | let newRewardPerTokenStored = rewardPerToken() | |
121 | + | let newLastUpdateTime = currentTimestampSec() | |
122 | + | let $t035803753 = if ((_staker != "")) | |
123 | + | then $Tuple2(earned(_staker, _balance), newRewardPerTokenStored) | |
124 | + | else $Tuple2(0, 0) | |
125 | + | let stakerEarned = $t035803753._1 | |
126 | + | let stakerRewardPerTokenPaid = $t035803753._2 | |
127 | + | $Tuple4(newRewardPerTokenStored, newLastUpdateTime, stakerEarned, stakerRewardPerTokenPaid) | |
128 | + | } | |
129 | + | ||
130 | + | ||
131 | + | @Callable(i) | |
132 | + | func stake () = { | |
133 | + | let _staker = toString(i.caller) | |
134 | + | let _amount = i.payments[0].amount | |
135 | + | if ((i.payments[0].assetId != TSN)) | |
136 | + | then throw("Invalid staking asset") | |
137 | + | else { | |
138 | + | let $t040634245 = updateReward(_staker, (balanceOf(_staker) + _amount)) | |
139 | + | let newRewardPerTokenStored = $t040634245._1 | |
140 | + | let newLastUpdateTime = $t040634245._2 | |
141 | + | let stakerEarned = $t040634245._3 | |
142 | + | let stakerRewardPerTokenPaid = $t040634245._4 | |
143 | + | (((updateUserRewards(_staker, 0, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateBalance(_staker, _amount)) | |
144 | + | } | |
145 | + | } | |
146 | + | ||
147 | + | ||
148 | + | ||
149 | + | @Callable(i) | |
150 | + | func unStake (_amount) = { | |
151 | + | let _staker = toString(i.caller) | |
152 | + | if ((_amount > balanceOf(_staker))) | |
153 | + | then throw("Invalid balance") | |
154 | + | else { | |
155 | + | let $t046604842 = updateReward(_staker, (balanceOf(_staker) - _amount)) | |
156 | + | let newRewardPerTokenStored = $t046604842._1 | |
157 | + | let newLastUpdateTime = $t046604842._2 | |
158 | + | let stakerEarned = $t046604842._3 | |
159 | + | let stakerRewardPerTokenPaid = $t046604842._4 | |
160 | + | ((((updateUserRewards(_staker, 0, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateBalance(_staker, -(_amount))) ++ [ScriptTransfer(i.caller, _amount, TSN)]) | |
161 | + | } | |
162 | + | } | |
163 | + | ||
164 | + | ||
165 | + | ||
166 | + | @Callable(i) | |
167 | + | func withdrawRewards () = { | |
168 | + | let _staker = toString(i.caller) | |
169 | + | let $t052575409 = updateReward(_staker, balanceOf(_staker)) | |
170 | + | let newRewardPerTokenStored = $t052575409._1 | |
171 | + | let newLastUpdateTime = $t052575409._2 | |
172 | + | let stakerEarned = $t052575409._3 | |
173 | + | let stakerRewardPerTokenPaid = $t052575409._4 | |
174 | + | if ((0 >= stakerEarned)) | |
175 | + | then throw("No reward") | |
176 | + | else (((updateUserRewards(_staker, 0, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ [ScriptTransfer(i.caller, stakerEarned, USDN)]) | |
177 | + | } | |
178 | + | ||
179 | + | ||
180 | + | ||
181 | + | @Callable(i) | |
182 | + | func addRewards () = if ((i.payments[0].assetId != USDN)) | |
183 | + | then throw("Invaliid addRewards params") | |
184 | + | else { | |
185 | + | let _reward = i.payments[0].amount | |
186 | + | let newRewardPerTokenStored = updateReward(NO_ADDDRESS, NO_STAKER)._1 | |
187 | + | let timestamp = currentTimestampSec() | |
188 | + | let newRewardRate = if ((timestamp > periodFinish())) | |
189 | + | then (_reward / DURATION) | |
190 | + | else { | |
191 | + | let remainingTime = (periodFinish() - timestamp) | |
192 | + | let leftover = (rewardRate() * remainingTime) | |
193 | + | ((_reward + leftover) / DURATION) | |
194 | + | } | |
195 | + | ((updateRewardRate(newRewardRate) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(timestamp, (timestamp + DURATION))) | |
196 | + | } | |
197 | + | ||
198 | + | ||
199 | + | ||
200 | + | @Callable(i) | |
201 | + | func view_reward (_staker) = { | |
202 | + | let stakerEarned = updateReward(_staker, balanceOf(_staker))._3 | |
203 | + | throw(toString(stakerEarned)) | |
204 | + | } | |
205 | + | ||
206 | + | ||
207 | + | @Verifier(tx) | |
208 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
209 | + |
github/deemru/w8io/169f3d6 37.37 ms ◑