tx · FZPZdns2cWgvkQjdyteNN77MTtKLjxnJosJeijrK53zZ

3NBEuUXKfGqe1ZKUfx8b8YsguJKYLhy2bTJ:  -0.03700000 Waves

2023.02.11 09:44 [2444613] smart account 3NBEuUXKfGqe1ZKUfx8b8YsguJKYLhy2bTJ > SELF 0.00000000 Waves

{ "type": 13, "id": "FZPZdns2cWgvkQjdyteNN77MTtKLjxnJosJeijrK53zZ", "fee": 3700000, "feeAssetId": null, "timestamp": 1676097865076, "version": 2, "chainId": 84, "sender": "3NBEuUXKfGqe1ZKUfx8b8YsguJKYLhy2bTJ", "senderPublicKey": "2NgVCitn1k18yzwhrzdQXHDEygzSkjbXS4A1koTt14db", "proofs": [ "YzXxyQEgKufT6oWkXjBkzCZHCjCvcMsRSyCUihkwUmqQA4UEzaWZZYVYqQDAgZfYLjogFADUWDXvJuRRrJ1oZJe" ], "script": "base64:BgIxCAISAwoBCBIAEgMKAQESABIAEgASAwoBARIDCgEBEgASABIDCgEIEgMKAQgSAwoBCFQADWtfdG90YWxTdXBwbHkCDWtfdG90YWxTdXBwbHkAD2tfcmV3YXJkQmFsYW5jZQIPa19yZXdhcmRCYWxhbmNlAA9rX2xvY2tlZEJhbGFuY2UCD2tfbG9ja2VkQmFsYW5jZQANa19mcmVlQmFsYW5jZQINa19mcmVlQmFsYW5jZQAGa19yYXRlAgZrX3JhdGUAEGtfbGFzdFVwZGF0ZVRpbWUCEGtfbGFzdFVwZGF0ZVRpbWUAFmtfcmV3YXJkUGVyVG9rZW5TdG9yZWQCFmtfcmV3YXJkUGVyVG9rZW5TdG9yZWQADGtfcmV3YXJkUmF0ZQIMa19yZXdhcmRSYXRlAA5rX3BlcmlvZEZpbmlzaAIOa19wZXJpb2RGaW5pc2gAFGtfdXNlclJld2FyZFBlclRva2VuAhRrX3VzZXJSZXdhcmRQZXJUb2tlbgAMa191c2VyUmV3YXJkAgxrX3VzZXJSZXdhcmQACWtfYmFsYW5jZQIJa19iYWxhbmNlAA5rX2F2ZXJhZ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N3BXUXYqoF97Ef Next: 2QoWuWcA2umuD9Yu51yKg4ebM7PwtNseQGWN3tSmTdMY Diff:
OldNewDifferences
173173 func getWithdrawLimitLeft (_staker) = {
174174 let currentDate = currentTimestamp()
175175 let lastWithdrawDate = lastWithdrawnDate(_staker)
176- let $t049645228 = if (((currentDate - lastWithdrawDate) > WITHDRAW_PERIOD))
177- then $Tuple2(currentDate, withdrawLimit(_staker))
178- else $Tuple2(lastWithdrawDate, (withdrawLimit(_staker) - withdrawnInPeriod(_staker)))
179- let newLastWithdrawnDate = $t049645228._1
180- let withdrawLimitLeft = $t049645228._2
181- $Tuple2(newLastWithdrawnDate, withdrawLimitLeft)
176+ let $t049645285 = if (((currentDate - lastWithdrawDate) > WITHDRAW_PERIOD))
177+ then $Tuple3(currentDate, withdrawLimit(_staker), 0)
178+ else $Tuple3(lastWithdrawDate, (withdrawLimit(_staker) - withdrawnInPeriod(_staker)), withdrawnInPeriod(_staker))
179+ let newLastWithdrawnDate = $t049645285._1
180+ let withdrawLimitLeft = $t049645285._2
181+ let alreadyWithdrawnInPeriod = $t049645285._3
182+ $Tuple3(newLastWithdrawnDate, withdrawLimitLeft, alreadyWithdrawnInPeriod)
182183 }
183184
184185
214215 func updateReward (_staker,_balanceDelta) = {
215216 let newRewardPerTokenStored = rewardPerToken(_balanceDelta)
216217 let newLastUpdateTime = currentTimestampSec()
217- let $t064246616 = if ((_staker != ""))
218+ let $t065076699 = if ((_staker != ""))
218219 then $Tuple2(earned(_staker, _balanceDelta), newRewardPerTokenStored)
219220 else $Tuple2(0, 0)
220- let stakerEarned = $t064246616._1
221- let stakerRewardPerTokenPaid = $t064246616._2
221+ let stakerEarned = $t065076699._1
222+ let stakerRewardPerTokenPaid = $t065076699._2
222223 $Tuple4(newRewardPerTokenStored, newLastUpdateTime, stakerEarned, stakerRewardPerTokenPaid)
223224 }
224225
292293 else !(initialized()))
293294 then throw("Invalid call to stake")
294295 else {
295- let $t0986910098 = updateReward(_staker, 0)
296- let newRewardPerTokenStored = $t0986910098._1
297- let newLastUpdateTime = $t0986910098._2
298- let stakerEarned = $t0986910098._3
299- let stakerRewardPerTokenPaid = $t0986910098._4
296+ let $t0995210181 = updateReward(_staker, 0)
297+ let newRewardPerTokenStored = $t0995210181._1
298+ let newLastUpdateTime = $t0995210181._2
299+ let stakerEarned = $t0995210181._3
300+ let stakerRewardPerTokenPaid = $t0995210181._4
300301 let currentRate = rate()
301302 let prevAverageRate = averageRate(_staker)
302303 let vAmount = divd(_amount, currentRate)
323324 else !(initialized()))
324325 then throw("Invalid call to unStake")
325326 else {
326- let $t01145111667 = updateReward(_staker, 0)
327- let newRewardPerTokenStored = $t01145111667._1
328- let newLastUpdateTime = $t01145111667._2
329- let stakerEarned = $t01145111667._3
330- let stakerRewardPerTokenPaid = $t01145111667._4
331- let $t01167411815 = getWithdrawLimitLeft(_staker)
332- let newLastWithdrawnDate = $t01167411815._1
333- let withdrawLimitLeft = $t01167411815._2
327+ let $t01153411750 = updateReward(_staker, 0)
328+ let newRewardPerTokenStored = $t01153411750._1
329+ let newLastUpdateTime = $t01153411750._2
330+ let stakerEarned = $t01153411750._3
331+ let stakerRewardPerTokenPaid = $t01153411750._4
332+ let $t01175711924 = getWithdrawLimitLeft(_staker)
333+ let newLastWithdrawnDate = $t01175711924._1
334+ let withdrawLimitLeft = $t01175711924._2
335+ let alreadyWithdrawnInPeriod = $t01175711924._3
334336 let vAmount = divd(amountOfQuoteAsset, rate())
335337 if ((vAmount > withdrawLimitLeft))
336338 then throw("Invalid call to unStake: withdraw over limit")
337339 else {
338- let newWithdrawnInPeriod = (withdrawnInPeriod(_staker) + vAmount)
340+ let newWithdrawnInPeriod = (alreadyWithdrawnInPeriod + vAmount)
339341 if ((amountOfQuoteAsset > freeBalance()))
340342 then throw("Invalid call to unStake: balance too low")
341343 else {
353355 @Callable(i)
354356 func withdrawRewards () = {
355357 let _staker = toString(i.caller)
356- let $t01315313298 = updateReward(_staker, 0)
357- let newRewardPerTokenStored = $t01315313298._1
358- let newLastUpdateTime = $t01315313298._2
359- let stakerEarned = $t01315313298._3
360- let stakerRewardPerTokenPaid = $t01315313298._4
358+ let $t01326013405 = updateReward(_staker, 0)
359+ let newRewardPerTokenStored = $t01326013405._1
360+ let newLastUpdateTime = $t01326013405._2
361+ let stakerEarned = $t01326013405._3
362+ let stakerRewardPerTokenPaid = $t01326013405._4
361363 if (if ((0 >= stakerEarned))
362364 then true
363365 else !(initialized()))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let k_totalSupply = "k_totalSupply"
55
66 let k_rewardBalance = "k_rewardBalance"
77
88 let k_lockedBalance = "k_lockedBalance"
99
1010 let k_freeBalance = "k_freeBalance"
1111
1212 let k_rate = "k_rate"
1313
1414 let k_lastUpdateTime = "k_lastUpdateTime"
1515
1616 let k_rewardPerTokenStored = "k_rewardPerTokenStored"
1717
1818 let k_rewardRate = "k_rewardRate"
1919
2020 let k_periodFinish = "k_periodFinish"
2121
2222 let k_userRewardPerToken = "k_userRewardPerToken"
2323
2424 let k_userReward = "k_userReward"
2525
2626 let k_balance = "k_balance"
2727
2828 let k_average_rate = "k_average_rate"
2929
3030 let k_withdraw_limit = "k_withdraw_limit"
3131
3232 let k_last_withdraw_date = "k_last_withdraw_date"
3333
3434 let k_withdraw_in_period = "k_withdraw_in_period"
3535
3636 let k_initialized = "k_initialized"
3737
3838 let k_coordinatorAddress = "k_coordinatorAddress"
3939
4040 let k_amm = "k_amm"
4141
4242 let k_governance_asset = "k_gov_asset"
4343
4444 let k_quote_asset = "k_quote_asset"
4545
4646 let k_admin_address = "k_admin_address"
4747
4848 let k_manager_address = "k_manager_address"
4949
5050 let k_collateral_address = "k_collateral_address"
5151
5252 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
5353
5454
5555 func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set")
5656
5757
5858 func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
5959
6060
6161 func governanceAsset () = fromBase58String(getStringValue(coordinator(), k_governance_asset))
6262
6363
6464 func adminAddress () = addressFromString(valueOrErrorMessage(getString(coordinator(), k_admin_address), "Admin address not set"))
6565
6666
6767 func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
6868
6969
7070 func managerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_manager_address)), "Manager not set")
7171
7272
7373 let DECIMAL_UNIT = (1 * (((((((10 * 10) * 10) * 10) * 10) * 10) * 10) * 10))
7474
7575 let DURATION = (((7 * 60) * 60) * 24)
7676
7777 let NO_ADDRESS = ""
7878
7979 let NO_STAKER = 0
8080
8181 func usdnFromDecimals (_amount) = (_amount / 100)
8282
8383
8484 func usdnToDecimals (_amount) = (_amount * 100)
8585
8686
8787 func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN)
8888
8989
9090 func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN)
9191
9292
9393 func abs (_x) = if ((_x > 0))
9494 then _x
9595 else -(_x)
9696
9797
9898 func minv (_x,_y) = if ((_x > _y))
9999 then _y
100100 else _x
101101
102102
103103 let WITHDRAW_PERIOD = (86400 * 1000)
104104
105105 let WITHDRAW_PER_PERIOD = divd((1 * DECIMAL_UNIT), (4 * DECIMAL_UNIT))
106106
107107 func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k))
108108
109109
110110 func int0 (k) = valueOrElse(getInteger(this, k), 0)
111111
112112
113113 func int1 (k) = valueOrElse(getInteger(this, k), DECIMAL_UNIT)
114114
115115
116116 func totalSupply () = int0(k_totalSupply)
117117
118118
119119 func rate () = int1(k_rate)
120120
121121
122122 func balanceOf (_staker) = int0(toCompositeKey(k_balance, _staker))
123123
124124
125125 func averageRate (_staker) = int0(toCompositeKey(k_average_rate, _staker))
126126
127127
128128 func withdrawLimit (_staker) = int0(toCompositeKey(k_withdraw_limit, _staker))
129129
130130
131131 func withdrawnInPeriod (_staker) = int0(toCompositeKey(k_withdraw_in_period, _staker))
132132
133133
134134 func lastWithdrawnDate (_staker) = int0(toCompositeKey(k_last_withdraw_date, _staker))
135135
136136
137137 func freeBalance () = int0(k_freeBalance)
138138
139139
140140 func lockedBalance () = int0(k_lockedBalance)
141141
142142
143143 func rewardPerTokenStored () = int0(k_rewardPerTokenStored)
144144
145145
146146 func lastUpdateTime () = int0(k_lastUpdateTime)
147147
148148
149149 func rewardRate () = int0(k_rewardRate)
150150
151151
152152 func periodFinish () = int0(k_periodFinish)
153153
154154
155155 func rewardBalance () = int0(k_rewardBalance)
156156
157157
158158 func rewards (_staker) = int0(toCompositeKey(k_userReward, _staker))
159159
160160
161161 func userRewardPerTokenPaid (_staker) = int0(toCompositeKey(k_userRewardPerToken, _staker))
162162
163163
164164 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
165165
166166
167167 func currentTimestamp () = lastBlock.timestamp
168168
169169
170170 func currentTimestampSec () = (currentTimestamp() / 1000)
171171
172172
173173 func getWithdrawLimitLeft (_staker) = {
174174 let currentDate = currentTimestamp()
175175 let lastWithdrawDate = lastWithdrawnDate(_staker)
176- let $t049645228 = if (((currentDate - lastWithdrawDate) > WITHDRAW_PERIOD))
177- then $Tuple2(currentDate, withdrawLimit(_staker))
178- else $Tuple2(lastWithdrawDate, (withdrawLimit(_staker) - withdrawnInPeriod(_staker)))
179- let newLastWithdrawnDate = $t049645228._1
180- let withdrawLimitLeft = $t049645228._2
181- $Tuple2(newLastWithdrawnDate, withdrawLimitLeft)
176+ let $t049645285 = if (((currentDate - lastWithdrawDate) > WITHDRAW_PERIOD))
177+ then $Tuple3(currentDate, withdrawLimit(_staker), 0)
178+ else $Tuple3(lastWithdrawDate, (withdrawLimit(_staker) - withdrawnInPeriod(_staker)), withdrawnInPeriod(_staker))
179+ let newLastWithdrawnDate = $t049645285._1
180+ let withdrawLimitLeft = $t049645285._2
181+ let alreadyWithdrawnInPeriod = $t049645285._3
182+ $Tuple3(newLastWithdrawnDate, withdrawLimitLeft, alreadyWithdrawnInPeriod)
182183 }
183184
184185
185186 func computeNewRate (_amountOfQuoteAsset) = {
186187 let newRate = if ((totalSupply() > 0))
187188 then divd((freeBalance() + _amountOfQuoteAsset), totalSupply())
188189 else DECIMAL_UNIT
189190 newRate
190191 }
191192
192193
193194 func lastTimeRewardApplicable () = minv(currentTimestampSec(), periodFinish())
194195
195196
196197 func rewardPerToken (_balanceDelta) = if (((totalSupply() + _balanceDelta) == 0))
197198 then rewardPerTokenStored()
198199 else {
199200 let timeInterval = (lastTimeRewardApplicable() - lastUpdateTime())
200201 let actualTimeInterval = if ((0 > timeInterval))
201202 then 0
202203 else timeInterval
203204 let diff = divd((rewardRate() * actualTimeInterval), (totalSupply() + _balanceDelta))
204205 (rewardPerTokenStored() + diff)
205206 }
206207
207208
208209 func earned (_staker,_balanceDelta) = {
209210 let rewardDelta = (rewardPerToken(_balanceDelta) - userRewardPerTokenPaid(_staker))
210211 (muld((balanceOf(_staker) + _balanceDelta), rewardDelta) + rewards(_staker))
211212 }
212213
213214
214215 func updateReward (_staker,_balanceDelta) = {
215216 let newRewardPerTokenStored = rewardPerToken(_balanceDelta)
216217 let newLastUpdateTime = currentTimestampSec()
217- let $t064246616 = if ((_staker != ""))
218+ let $t065076699 = if ((_staker != ""))
218219 then $Tuple2(earned(_staker, _balanceDelta), newRewardPerTokenStored)
219220 else $Tuple2(0, 0)
220- let stakerEarned = $t064246616._1
221- let stakerRewardPerTokenPaid = $t064246616._2
221+ let stakerEarned = $t065076699._1
222+ let stakerRewardPerTokenPaid = $t065076699._2
222223 $Tuple4(newRewardPerTokenStored, newLastUpdateTime, stakerEarned, stakerRewardPerTokenPaid)
223224 }
224225
225226
226227 func updateUserBalance (_user,_change) = [IntegerEntry(toCompositeKey(k_balance, _user), (balanceOf(_user) + _change))]
227228
228229
229230 func setUserWithdrawLimit (_user,_rate) = [IntegerEntry(toCompositeKey(k_withdraw_limit, _user), _rate)]
230231
231232
232233 func setUserAverageRate (_user,_rate) = [IntegerEntry(toCompositeKey(k_average_rate, _user), _rate)]
233234
234235
235236 func updateFreeBalance (_change) = {
236237 let balance = freeBalance()
237238 if (((balance + _change) >= 0))
238239 then [IntegerEntry(k_freeBalance, (balance + _change))]
239240 else throw(((("Vault: can not update free balance. Balance: " + toString(balance)) + " change: ") + toString(_change)))
240241 }
241242
242243
243244 func updateLockedBalance (_change) = {
244245 let balance = lockedBalance()
245246 if (((balance + _change) >= 0))
246247 then [IntegerEntry(k_lockedBalance, (balance + _change))]
247248 else throw(((("Vault: can not update locked balance. Balance: " + toString(balance)) + " change: ") + toString(_change)))
248249 }
249250
250251
251252 func updateTotalSupply (_change) = [IntegerEntry(k_totalSupply, (totalSupply() + _change))]
252253
253254
254255 func updateRate (_rate) = [IntegerEntry(k_rate, _rate)]
255256
256257
257258 func setUserWithdrawParams (_user,_lastWithdrawDate,_withdrawn) = [IntegerEntry(toCompositeKey(k_last_withdraw_date, _user), _lastWithdrawDate), IntegerEntry(toCompositeKey(k_withdraw_in_period, _user), _withdrawn)]
258259
259260
260261 func updateRewardBalance (_delta) = [IntegerEntry(k_rewardBalance, (rewardBalance() + _delta))]
261262
262263
263264 func updateRewardRate (_rewardRate) = [IntegerEntry(k_rewardRate, _rewardRate)]
264265
265266
266267 func updateTime (_lastUpdateTime,_periodFinish) = [IntegerEntry(k_lastUpdateTime, _lastUpdateTime), IntegerEntry(k_periodFinish, _periodFinish)]
267268
268269
269270 func updateRewardPerTokenStored (_rewardPerTokenStored) = [IntegerEntry(k_rewardPerTokenStored, _rewardPerTokenStored)]
270271
271272
272273 func updateUserRewards (_staker,_reward,_userRewardPerToken) = [IntegerEntry(toCompositeKey(k_userReward, _staker), _reward), IntegerEntry(toCompositeKey(k_userRewardPerToken, _staker), _userRewardPerToken)]
273274
274275
275276 @Callable(i)
276277 func initialize (_coordinator) = if (if (initialized())
277278 then true
278279 else (i.caller != this))
279280 then throw("Unable to initialize")
280281 else [StringEntry(k_coordinatorAddress, toString(valueOrErrorMessage(addressFromString(_coordinator), "Invalid coordinator address"))), BooleanEntry(k_initialized, true)]
281282
282283
283284
284285 @Callable(i)
285286 func stake () = {
286287 let _staker = toString(i.caller)
287288 let _amount = usdnToDecimals(i.payments[0].amount)
288289 if (if (if ((i.payments[0].assetId != quoteAsset()))
289290 then true
290291 else (size(i.payments) != 1))
291292 then true
292293 else !(initialized()))
293294 then throw("Invalid call to stake")
294295 else {
295- let $t0986910098 = updateReward(_staker, 0)
296- let newRewardPerTokenStored = $t0986910098._1
297- let newLastUpdateTime = $t0986910098._2
298- let stakerEarned = $t0986910098._3
299- let stakerRewardPerTokenPaid = $t0986910098._4
296+ let $t0995210181 = updateReward(_staker, 0)
297+ let newRewardPerTokenStored = $t0995210181._1
298+ let newLastUpdateTime = $t0995210181._2
299+ let stakerEarned = $t0995210181._3
300+ let stakerRewardPerTokenPaid = $t0995210181._4
300301 let currentRate = rate()
301302 let prevAverageRate = averageRate(_staker)
302303 let vAmount = divd(_amount, currentRate)
303304 let newAverageRate = divd((muld(vAmount, currentRate) + muld(balanceOf(_staker), prevAverageRate)), (vAmount + balanceOf(_staker)))
304305 let newTotalBalance = (vAmount + balanceOf(_staker))
305306 let newWithdrawLimit = muld(newTotalBalance, WITHDRAW_PER_PERIOD)
306307 let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), usdnFromDecimals(_amount))])
307308 if ((stake == stake))
308309 then (((((((updateUserRewards(_staker, stakerEarned, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateFreeBalance(_amount)) ++ updateUserBalance(_staker, vAmount)) ++ setUserAverageRate(_staker, newAverageRate)) ++ setUserWithdrawLimit(_staker, newWithdrawLimit)) ++ updateTotalSupply(vAmount))
309310 else throw("Strict value is not equal to itself.")
310311 }
311312 }
312313
313314
314315
315316 @Callable(i)
316317 func unStake (_amount) = {
317318 let _staker = toString(i.caller)
318319 let amountOfQuoteAsset = usdnToDecimals(_amount)
319320 if (if (if ((i.payments != nil))
320321 then true
321322 else (0 >= amountOfQuoteAsset))
322323 then true
323324 else !(initialized()))
324325 then throw("Invalid call to unStake")
325326 else {
326- let $t01145111667 = updateReward(_staker, 0)
327- let newRewardPerTokenStored = $t01145111667._1
328- let newLastUpdateTime = $t01145111667._2
329- let stakerEarned = $t01145111667._3
330- let stakerRewardPerTokenPaid = $t01145111667._4
331- let $t01167411815 = getWithdrawLimitLeft(_staker)
332- let newLastWithdrawnDate = $t01167411815._1
333- let withdrawLimitLeft = $t01167411815._2
327+ let $t01153411750 = updateReward(_staker, 0)
328+ let newRewardPerTokenStored = $t01153411750._1
329+ let newLastUpdateTime = $t01153411750._2
330+ let stakerEarned = $t01153411750._3
331+ let stakerRewardPerTokenPaid = $t01153411750._4
332+ let $t01175711924 = getWithdrawLimitLeft(_staker)
333+ let newLastWithdrawnDate = $t01175711924._1
334+ let withdrawLimitLeft = $t01175711924._2
335+ let alreadyWithdrawnInPeriod = $t01175711924._3
334336 let vAmount = divd(amountOfQuoteAsset, rate())
335337 if ((vAmount > withdrawLimitLeft))
336338 then throw("Invalid call to unStake: withdraw over limit")
337339 else {
338- let newWithdrawnInPeriod = (withdrawnInPeriod(_staker) + vAmount)
340+ let newWithdrawnInPeriod = (alreadyWithdrawnInPeriod + vAmount)
339341 if ((amountOfQuoteAsset > freeBalance()))
340342 then throw("Invalid call to unStake: balance too low")
341343 else {
342344 let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), usdnFromDecimals(amountOfQuoteAsset)], nil)
343345 if ((unstake == unstake))
344346 then (((((((updateUserRewards(_staker, stakerEarned, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateFreeBalance(-(amountOfQuoteAsset))) ++ updateUserBalance(_staker, -(vAmount))) ++ updateTotalSupply(-(vAmount))) ++ setUserWithdrawParams(_staker, newLastWithdrawnDate, newWithdrawnInPeriod)) ++ [ScriptTransfer(i.caller, usdnFromDecimals(amountOfQuoteAsset), quoteAsset())])
345347 else throw("Strict value is not equal to itself.")
346348 }
347349 }
348350 }
349351 }
350352
351353
352354
353355 @Callable(i)
354356 func withdrawRewards () = {
355357 let _staker = toString(i.caller)
356- let $t01315313298 = updateReward(_staker, 0)
357- let newRewardPerTokenStored = $t01315313298._1
358- let newLastUpdateTime = $t01315313298._2
359- let stakerEarned = $t01315313298._3
360- let stakerRewardPerTokenPaid = $t01315313298._4
358+ let $t01326013405 = updateReward(_staker, 0)
359+ let newRewardPerTokenStored = $t01326013405._1
360+ let newLastUpdateTime = $t01326013405._2
361+ let stakerEarned = $t01326013405._3
362+ let stakerRewardPerTokenPaid = $t01326013405._4
361363 if (if ((0 >= stakerEarned))
362364 then true
363365 else !(initialized()))
364366 then throw("No reward: Vault")
365367 else ((((updateUserRewards(_staker, 0, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateRewardBalance(-(stakerEarned))) ++ [ScriptTransfer(i.caller, stakerEarned, governanceAsset())])
366368 }
367369
368370
369371
370372 @Callable(i)
371373 func addFree () = {
372374 let _amount = usdnToDecimals(i.payments[0].amount)
373375 if (if (if (if ((i.payments[0].assetId != quoteAsset()))
374376 then true
375377 else (size(i.payments) != 1))
376378 then true
377379 else !(initialized()))
378380 then true
379381 else !(if (isWhitelist(toString(i.caller)))
380382 then true
381383 else (i.caller == adminAddress())))
382384 then throw("Invalid addFree params")
383385 else {
384386 let newRate = computeNewRate(_amount)
385387 let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), usdnFromDecimals(_amount))])
386388 if ((stake == stake))
387389 then (updateFreeBalance(_amount) ++ updateRate(newRate))
388390 else throw("Strict value is not equal to itself.")
389391 }
390392 }
391393
392394
393395
394396 @Callable(i)
395397 func addLocked () = {
396398 let _amount = usdnToDecimals(i.payments[0].amount)
397399 if (if (if (if ((i.payments[0].assetId != quoteAsset()))
398400 then true
399401 else (size(i.payments) != 1))
400402 then true
401403 else !(initialized()))
402404 then true
403405 else !(if (isWhitelist(toString(i.caller)))
404406 then true
405407 else (i.caller == adminAddress())))
406408 then throw("Invalid addLocked params")
407409 else {
408410 let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), usdnFromDecimals(_amount))])
409411 if ((unstake == unstake))
410412 then updateLockedBalance(_amount)
411413 else throw("Strict value is not equal to itself.")
412414 }
413415 }
414416
415417
416418
417419 @Callable(i)
418420 func exchangeFreeAndLocked (_amount) = if (if (!(initialized()))
419421 then true
420422 else !(isWhitelist(toString(i.caller))))
421423 then throw("Invalid exchangeFreeAndLocked params")
422424 else {
423425 let amountOfQuoteAsset = usdnToDecimals(_amount)
424426 let newRate = computeNewRate(-(amountOfQuoteAsset))
425427 ((updateLockedBalance(amountOfQuoteAsset) ++ updateFreeBalance(-(amountOfQuoteAsset))) ++ updateRate(newRate))
426428 }
427429
428430
429431
430432 @Callable(i)
431433 func withdrawLocked (_amount) = if (if (if (!(initialized()))
432434 then true
433435 else (0 >= _amount))
434436 then true
435437 else !(isWhitelist(toString(i.caller))))
436438 then throw("Invalid withdrawLocked params")
437439 else {
438440 let amountOfQuoteAsset = usdnToDecimals(_amount)
439441 let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), usdnFromDecimals(amountOfQuoteAsset)], nil)
440442 if ((unstake == unstake))
441443 then (updateLockedBalance(-(amountOfQuoteAsset)) ++ [ScriptTransfer(i.caller, usdnFromDecimals(amountOfQuoteAsset), quoteAsset())])
442444 else throw("Strict value is not equal to itself.")
443445 }
444446
445447
446448
447449 @Callable(i)
448450 func addRewards () = if (if (if ((i.payments[0].assetId != governanceAsset()))
449451 then true
450452 else (size(i.payments) != 1))
451453 then true
452454 else !(initialized()))
453455 then throw("Invalid addRewards params")
454456 else {
455457 let _reward = i.payments[0].amount
456458 let newRewardPerTokenStored = updateReward(NO_ADDRESS, NO_STAKER)._1
457459 let timestamp = currentTimestampSec()
458460 let newRewardRate = if ((timestamp > periodFinish()))
459461 then (_reward / DURATION)
460462 else {
461463 let remainingTime = (periodFinish() - timestamp)
462464 let leftover = (rewardRate() * remainingTime)
463465 ((_reward + leftover) / DURATION)
464466 }
465467 (((updateRewardRate(newRewardRate) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateRewardBalance(_reward)) ++ updateTime(timestamp, (timestamp + DURATION)))
466468 }
467469
468470
469471
470472 @Callable(i)
471473 func ackRewards () = {
472474 let profitResp = invoke(managerAddress(), "claimProfit", [toBase58String(quoteAsset())], nil)
473475 if ((profitResp == profitResp))
474476 then {
475477 let profit = match profitResp {
476478 case p: Int =>
477479 usdnToDecimals(p)
478480 case _ =>
479481 throw("Invalid claimProfit response")
480482 }
481483 let result = if ((profit > 0))
482484 then {
483485 let newRate = computeNewRate(profit)
484486 let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), usdnFromDecimals(profit))])
485487 if ((stake == stake))
486488 then (updateFreeBalance(profit) ++ updateRate(newRate))
487489 else throw("Strict value is not equal to itself.")
488490 }
489491 else nil
490492 if ((result == result))
491493 then result
492494 else throw("Strict value is not equal to itself.")
493495 }
494496 else throw("Strict value is not equal to itself.")
495497 }
496498
497499
498500
499501 @Callable(i)
500502 func view_reward (_staker) = {
501503 let balance = balanceOf(_staker)
502504 let depositedAmount = muld(averageRate(_staker), balance)
503505 let currentAmount = muld(rate(), balance)
504506 let earnedQuote = (currentAmount - depositedAmount)
505507 throw(toString(earnedQuote))
506508 }
507509
508510
509511
510512 @Callable(i)
511513 func view_stakingReward (_staker) = {
512514 let stakerEarned = updateReward(_staker, 0)._3
513515 throw(toString(usdnFromDecimals(stakerEarned)))
514516 }
515517
516518
517519
518520 @Callable(i)
519521 func view_withdrawLimit (_staker) = {
520522 let withdrawLimitLeft = getWithdrawLimitLeft(_staker)._2
521523 let limitInUsdn = usdnFromDecimals(muld(withdrawLimitLeft, rate()))
522524 throw(toString(limitInUsdn))
523525 }
524526
525527
526528 @Verifier(tx)
527529 func verify () = {
528530 let coordinatorStr = getString(this, k_coordinatorAddress)
529531 if (isDefined(coordinatorStr))
530532 then {
531533 let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address)
532534 if (isDefined(admin))
533535 then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false)
534536 else throw("unable to verify: admin not set in coordinator")
535537 }
536538 else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
537539 }
538540

github/deemru/w8io/169f3d6 
83.87 ms