tx · EU27fddjnuKPi8dejTXxmr4Xt57pLtsdS8rg8VVpX99Q 3N2jRBKLDjcZb6Le3vVc891poZyizxBWoPS: -0.03200000 Waves 2022.06.12 13:39 [2093048] smart account 3N2jRBKLDjcZb6Le3vVc891poZyizxBWoPS > SELF 0.00000000 Waves
{ "type": 13, "id": "EU27fddjnuKPi8dejTXxmr4Xt57pLtsdS8rg8VVpX99Q", "fee": 3200000, "feeAssetId": null, "timestamp": 1655030534243, "version": 2, "chainId": 84, "sender": "3N2jRBKLDjcZb6Le3vVc891poZyizxBWoPS", "senderPublicKey": "J3n99NtyU5SSXRJ8TLsXe7d4dnFFwvHZ9EE7LYZrf94A", "proofs": [ "3K4AvN9fbe7sDzmHe8LsFCGRRznfDs5UsapcNtoiQLAjWE4nB72qH4LHuLkro7tj5jy5DqhohQHhovF6d1fGmVxS" ], "script": "base64:AAIFAAAAAAAAABIIAhIAEgMKAQESABIAEgMKAQgAAAAoAAAAAA1rX3RvdGFsU3VwcGx5AgAAAA1rX3RvdGFsU3VwcGx5AAAAABBrX2xhc3RVcGRhdGVUaW1lAgAAABBrX2xhc3RVcGRhdGVUaW1lAAAAABZrX3Jld2FyZFBlclRva2VuU3RvcmVkAgAAABZrX3Jld2FyZFBlclRva2VuU3RvcmVkAAAAAAxrX3Jld2FyZFJhdGUCAAAADGtfcmV3YXJkUmF0ZQAAAAAOa19wZXJpb2RGaW5pc2gCAAAADmtfcGVyaW9kRmluaXNoAAAAAAlrX2JhbGFuY2UCAAAACWtfYmFsYW5jZQAAAAAUa191c2VyUmV3YXJkUGVyVG9rZW4CAAAAFGtfdXNlclJld2FyZFBlclRva2VuAAAAAAxrX3VzZXJSZXdhcmQCAAAADGtfdXNlclJld2FyZAAAAAANQURNSU5fQUREUkVTUwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVAclVP0KO/wDfBwx2OpLuZNFuE7wGM2NuwAAAAAEVVNETgEAAAAg93bq9/eDymXbbhPuAjvPWCmVqcHRjfJL2mzYHWK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VRJT04EAAAADXJlbWFpbmluZ1RpbWUJAABlAAAAAgkBAAAADHBlcmlvZEZpbmlzaAAAAAAFAAAACXRpbWVzdGFtcAQAAAAIbGVmdG92ZXIJAABoAAAAAgkBAAAACnJld2FyZFJhdGUAAAAABQAAAA1yZW1haW5pbmdUaW1lCQAAaQAAAAIJAABkAAAAAgUAAAAHX3Jld2FyZAUAAAAIbGVmdG92ZXIFAAAACERVUkFUSU9OCQAETgAAAAIJAAROAAAAAgkBAAAAEHVwZGF0ZVJld2FyZFJhdGUAAAABBQAAAA1uZXdSZXdhcmRSYXRlCQEAAAAadXBkYXRlUmV3YXJkUGVyVG9rZW5TdG9yZWQAAAABBQAAABduZXdSZXdhcmRQZXJUb2tlblN0b3JlZAkBAAAACnVwZGF0ZVRpbWUAAAACBQAAAAl0aW1lc3RhbXAJAABkAAAAAgUAAAAJdGltZXN0YW1wBQAAAAhEVVJBVElPTgAAAAFpAQAAAAt2aWV3X3Jld2FyZAAAAAEAAAAHX3N0YWtlcgQAAAAMc3Rha2VyRWFybmVkCAkBAAAADHVwZGF0ZVJld2FyZAAAAAIFAAAAB19zdGFrZXIAAAAAAAAAAAAAAAACXzMJAAACAAAAAQkAAaQAAAABBQAAAAxzdGFrZXJFYXJuZWQAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleaCMwQQ=", "height": 2093048, "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'3MpZsE8o8ypmWX43SaA3FYuNmAFYdhpCenn') | |
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 (_balanceDelta) = if (((totalSupply() + _balanceDelta) == 0)) | |
105 | + | then rewardPerTokenStored() | |
106 | + | else { | |
107 | + | let timeInterval = (lastTimeRewardApplicable() - lastUpdateTime()) | |
108 | + | let diff = (divd(rewardRate(), (totalSupply() + _balanceDelta)) * timeInterval) | |
109 | + | (rewardPerTokenStored() + diff) | |
110 | + | } | |
111 | + | ||
112 | + | ||
113 | + | func earned (_staker,_balanceDelta) = { | |
114 | + | let rewardDelta = (rewardPerToken(_balanceDelta) - userRewardPerTokenPaid(_staker)) | |
115 | + | (((balanceOf(_staker) + _balanceDelta) * rewardDelta) + rewards(_staker)) | |
116 | + | } | |
117 | + | ||
118 | + | ||
119 | + | func updateReward (_staker,_balanceDelta) = { | |
120 | + | let newRewardPerTokenStored = rewardPerToken(_balanceDelta) | |
121 | + | let newLastUpdateTime = currentTimestampSec() | |
122 | + | let $t036953894 = if ((_staker != "")) | |
123 | + | then $Tuple2(earned(_staker, (balanceOf(_staker) + _balanceDelta)), newRewardPerTokenStored) | |
124 | + | else $Tuple2(0, 0) | |
125 | + | let stakerEarned = $t036953894._1 | |
126 | + | let stakerRewardPerTokenPaid = $t036953894._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 $t042044365 = updateReward(_staker, _amount) | |
139 | + | let newRewardPerTokenStored = $t042044365._1 | |
140 | + | let newLastUpdateTime = $t042044365._2 | |
141 | + | let stakerEarned = $t042044365._3 | |
142 | + | let stakerRewardPerTokenPaid = $t042044365._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 $t047804942 = updateReward(_staker, -(_amount)) | |
156 | + | let newRewardPerTokenStored = $t047804942._1 | |
157 | + | let newLastUpdateTime = $t047804942._2 | |
158 | + | let stakerEarned = $t047804942._3 | |
159 | + | let stakerRewardPerTokenPaid = $t047804942._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 $t053575492 = updateReward(_staker, 0) | |
170 | + | let newRewardPerTokenStored = $t053575492._1 | |
171 | + | let newLastUpdateTime = $t053575492._2 | |
172 | + | let stakerEarned = $t053575492._3 | |
173 | + | let stakerRewardPerTokenPaid = $t053575492._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, 0)._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/026f985 18.64 ms ◑