tx · CePWAsvbqcM4ypm1268t74p7MsF7Bo5GFNqxSfGUZCej

3NADcxHXbecCheinqFbvhDjfzZhsMFZJUuH:  -0.03700000 Waves

2022.11.28 14:22 [2336885] smart account 3NADcxHXbecCheinqFbvhDjfzZhsMFZJUuH > SELF 0.00000000 Waves

{ "type": 13, "id": "CePWAsvbqcM4ypm1268t74p7MsF7Bo5GFNqxSfGUZCej", "fee": 3700000, "feeAssetId": null, "timestamp": 1669634598015, "version": 2, "chainId": 84, "sender": "3NADcxHXbecCheinqFbvhDjfzZhsMFZJUuH", "senderPublicKey": "DKfzQgvVdTqPHgGbdZptWYA8G5xVfmSMAwL3UnhwQmdy", "proofs": [ "2Rw7p4gTGkNiqaoL5aY6aj8ndaih57dENX44XsGJX65TegRnz7FPexJvkoKfjoPUpEB2AJQbguwM7BDKAcPv6vTP" ], "script": "base64:BgImCAISAwoBCBIAEgMKAQESABIAEgMKAQESAwoBARIDCgEIEgMKAQg5AA1rX3RvdGFsU3VwcGx5Ag1rX3RvdGFsU3VwcGx5AA9rX2xvY2tlZEJhbGFuY2UCD2tfbG9ja2VkQmFsYW5jZQANa19mcmVlQmFsYW5jZQINa19mcmVlQmFsYW5jZQAGa19yYXRlAgZrX3JhdGUACWtfYmFsYW5jZQIJa19iYWxhbmNlAA5rX2F2ZXJhZ2VfcmF0ZQIOa19hdmVyYWdlX3JhdGUAEGtfd2l0aGRyYXdfbGltaXQCEGtfd2l0aGRyYXdfbGltaXQAFGtfbGFzdF93aXRoZHJhd19kYXRlAhRrX2xhc3Rfd2l0aGRyYXdfZGF0ZQAUa193aXRoZHJhd19pbl9wZXJpb2QCFGtfd2l0aGRyYXdfaW5fcGVyaW9kAA1rX2luaXRpYWxpemVkAg1rX2luaXRpYWxpemVkABRrX2Nvb3JkaW5hdG9yQWRkcmVzcwIUa19jb29yZGluYXRvckFkZHJlc3MABWtfYW1tAgVrX2FtbQANa19xdW90ZV9hc3NldAINa19xdW90ZV9hc3NldAASa19hZG1pbl9wd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"height": 2336885, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: A23uyJcPFbSeJSK1YvxF1druv295S4vMd9oPuLYTUvMJ Next: 7Sn8aJWrWUwG7L5o8ps4qXkCqXcDXAsBujNT1dxt1J8j Diff:
OldNewDifferences
1313
1414 let k_average_rate = "k_average_rate"
1515
16-let k_withdraw_rate = "k_withdraw_rate"
16+let k_withdraw_limit = "k_withdraw_limit"
17+
18+let k_last_withdraw_date = "k_last_withdraw_date"
19+
20+let k_withdraw_in_period = "k_withdraw_in_period"
1721
1822 let k_initialized = "k_initialized"
1923
8084 else _x
8185
8286
87+let WITHDRAW_PERIOD = (86400 * 1000)
88+
89+let WITHDRAW_PER_PERIOD = divd((1 * DECIMAL_UNIT), (4 * DECIMAL_UNIT))
90+
8391 func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k))
8492
8593
101109 func averageRate (_staker) = int0(toCompositeKey(k_average_rate, _staker))
102110
103111
112+func withdrawLimit (_staker) = int0(toCompositeKey(k_withdraw_limit, _staker))
113+
114+
115+func withdrawnInPeriod (_staker) = int0(toCompositeKey(k_withdraw_in_period, _staker))
116+
117+
118+func lastWithdrawnDate (_staker) = int0(toCompositeKey(k_last_withdraw_date, _staker))
119+
120+
104121 func freeBalance () = int0(k_freeBalance)
105122
106123
110127 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
111128
112129
130+func getWithdrawLimitLeft (_staker) = {
131+ let currentDate = lastBlock.timestamp
132+ let lastWithdrawDate = lastWithdrawnDate(_staker)
133+ let $t043274591 = if (((currentDate - lastWithdrawDate) > WITHDRAW_PERIOD))
134+ then $Tuple2(currentDate, withdrawLimit(_staker))
135+ else $Tuple2(lastWithdrawDate, (withdrawLimit(_staker) - withdrawnInPeriod(_staker)))
136+ let newLastWithdrawnDate = $t043274591._1
137+ let withdrawLimitLeft = $t043274591._2
138+ $Tuple2(newLastWithdrawnDate, withdrawLimitLeft)
139+ }
140+
141+
113142 func updateUserBalance (_user,_change) = [IntegerEntry(toCompositeKey(k_balance, _user), (balanceOf(_user) + _change))]
114143
115144
116-func updateUserAverageRate (_user,_rate) = [IntegerEntry(toCompositeKey(k_average_rate, _user), _rate)]
145+func setUserWithdrawLimit (_user,_rate) = [IntegerEntry(toCompositeKey(k_withdraw_limit, _user), _rate)]
146+
147+
148+func setUserAverageRate (_user,_rate) = [IntegerEntry(toCompositeKey(k_average_rate, _user), _rate)]
117149
118150
119151 func updateFreeBalance (_change) = [IntegerEntry(k_freeBalance, (freeBalance() + _change))]
128160 func updateRate (_rate) = [IntegerEntry(k_rate, _rate)]
129161
130162
163+func setUserWithdrawParams (_user,_lastWithdrawDate,_withdrawn) = [IntegerEntry(toCompositeKey(k_last_withdraw_date, _user), _lastWithdrawDate), IntegerEntry(toCompositeKey(k_withdraw_in_period, _user), _withdrawn)]
164+
165+
131166 @Callable(i)
132167 func initialize (_coordinator) = if (initialized())
133168 then throw("Already initialized")
138173 @Callable(i)
139174 func stake () = {
140175 let _staker = toString(i.caller)
141- let _amount = i.payments[0].amount
176+ let _amount = usdnToDecimals(i.payments[0].amount)
142177 if (if ((i.payments[0].assetId != quoteAsset()))
143178 then true
144179 else !(initialized()))
146181 else {
147182 let currentRate = rate()
148183 let prevAverageRate = averageRate(_staker)
149- let vAmount = divd(usdnToDecimals(_amount), currentRate)
184+ let vAmount = divd(_amount, currentRate)
150185 let newAverageRate = divd((muld(vAmount, currentRate) + muld(balanceOf(_staker), prevAverageRate)), (currentRate + prevAverageRate))
151- let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
152- if ((unstake == unstake))
153- then (((updateFreeBalance(_amount) ++ updateUserBalance(_staker, vAmount)) ++ updateUserAverageRate(_staker, newAverageRate)) ++ updateTotalSupply(vAmount))
186+ let newTotalBalance = (vAmount + balanceOf(_staker))
187+ let newWithdrawLimit = muld(newTotalBalance, WITHDRAW_PER_PERIOD)
188+ let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), usdnFromDecimals(_amount))])
189+ if ((stake == stake))
190+ then ((((updateFreeBalance(_amount) ++ updateUserBalance(_staker, vAmount)) ++ setUserAverageRate(_staker, newAverageRate)) ++ setUserWithdrawLimit(_staker, newWithdrawLimit)) ++ updateTotalSupply(vAmount))
154191 else throw("Strict value is not equal to itself.")
155192 }
156193 }
158195
159196
160197 @Callable(i)
161-func unStake (_vAmount) = {
198+func unStake (_amount) = {
162199 let _staker = toString(i.caller)
163- if (if (if ((_vAmount > balanceOf(_staker)))
164- then true
165- else (i.payments != nil))
200+ let amountOfQuoteAsset = usdnToDecimals(_amount)
201+ if (if ((i.payments != nil))
166202 then true
167203 else !(initialized()))
168204 then throw("Invalid call to unStake")
169205 else {
170- let amountOfQuoteAsset = muld(_vAmount, rate())
171- if ((freeBalance() > amountOfQuoteAsset))
172- then throw("Balance to low")
206+ let $t076047745 = getWithdrawLimitLeft(_staker)
207+ let newLastWithdrawnDate = $t076047745._1
208+ let withdrawLimitLeft = $t076047745._2
209+ let vAmount = divd(amountOfQuoteAsset, rate())
210+ if ((vAmount > withdrawLimitLeft))
211+ then throw("Invalid call to unStake: withdraw over limit")
173212 else {
174- let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), usdnFromDecimals(amountOfQuoteAsset)], nil)
175- if ((unstake == unstake))
176- then (((updateFreeBalance(-(amountOfQuoteAsset)) ++ updateUserBalance(_staker, -(_vAmount))) ++ updateTotalSupply(-(_vAmount))) ++ [ScriptTransfer(i.caller, usdnFromDecimals(amountOfQuoteAsset), quoteAsset())])
177- else throw("Strict value is not equal to itself.")
213+ let newWithdrawnInPeriod = (withdrawnInPeriod(_staker) + vAmount)
214+ if ((amountOfQuoteAsset > freeBalance()))
215+ then throw("Invalid call to unStake: balance too low")
216+ else {
217+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), usdnFromDecimals(amountOfQuoteAsset)], nil)
218+ if ((unstake == unstake))
219+ then ((((updateFreeBalance(-(amountOfQuoteAsset)) ++ updateUserBalance(_staker, -(vAmount))) ++ updateTotalSupply(-(vAmount))) ++ setUserWithdrawParams(_staker, newLastWithdrawnDate, newWithdrawnInPeriod)) ++ [ScriptTransfer(i.caller, usdnFromDecimals(amountOfQuoteAsset), quoteAsset())])
220+ else throw("Strict value is not equal to itself.")
221+ }
178222 }
179223 }
180224 }
183227
184228 @Callable(i)
185229 func addFree () = {
186- let _amount = i.payments[0].amount
230+ let _amount = usdnToDecimals(i.payments[0].amount)
187231 if (if (if ((i.payments[0].assetId != quoteAsset()))
188232 then true
189233 else !(initialized()))
193237 else (i.caller == adminAddress())))
194238 then throw("Invalid addFree params")
195239 else {
196- let amountOfQuoteAsset = usdnToDecimals(_amount)
197240 let newRate = if ((totalSupply() > 0))
198- then divd((freeBalance() + amountOfQuoteAsset), totalSupply())
241+ then divd((freeBalance() + _amount), totalSupply())
199242 else DECIMAL_UNIT
200- let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
243+ let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), usdnFromDecimals(_amount))])
201244 if ((unstake == unstake))
202- then (updateFreeBalance(amountOfQuoteAsset) ++ updateRate(newRate))
245+ then (updateFreeBalance(_amount) ++ updateRate(newRate))
203246 else throw("Strict value is not equal to itself.")
204247 }
205248 }
208251
209252 @Callable(i)
210253 func addLocked () = {
211- let _amount = i.payments[0].amount
254+ let _amount = usdnToDecimals(i.payments[0].amount)
212255 if (if (if ((i.payments[0].assetId != quoteAsset()))
213256 then true
214257 else !(initialized()))
218261 else (i.caller == adminAddress())))
219262 then throw("Invalid addLocked params")
220263 else {
221- let amountOfQuoteAsset = usdnToDecimals(_amount)
222- let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
264+ let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), usdnFromDecimals(_amount))])
223265 if ((unstake == unstake))
224- then updateLockedBalance(amountOfQuoteAsset)
266+ then updateLockedBalance(_amount)
225267 else throw("Strict value is not equal to itself.")
226268 }
227269 }
254296 then throw("Invalid withdrawLocked params")
255297 else {
256298 let amountOfQuoteAsset = usdnToDecimals(_amount)
257- let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), _amount], nil)
299+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), usdnFromDecimals(amountOfQuoteAsset)], nil)
258300 if ((unstake == unstake))
259- then (updateLockedBalance(-(amountOfQuoteAsset)) ++ [ScriptTransfer(i.caller, _amount, quoteAsset())])
301+ then (updateLockedBalance(-(amountOfQuoteAsset)) ++ [ScriptTransfer(i.caller, usdnFromDecimals(amountOfQuoteAsset), quoteAsset())])
260302 else throw("Strict value is not equal to itself.")
261303 }
262304
263305
264306
265307 @Callable(i)
266-func view_reward (_trader) = {
267- let balance = balanceOf(_trader)
268- let depositedAmount = muld(averageRate(_trader), balance)
308+func view_reward (_staker) = {
309+ let balance = balanceOf(_staker)
310+ let depositedAmount = muld(averageRate(_staker), balance)
269311 let currentAmount = muld(rate(), balance)
270312 let earned = (currentAmount - depositedAmount)
271313 throw(toString(earned))
314+ }
315+
316+
317+
318+@Callable(i)
319+func view_withdrawLimit (_staker) = {
320+ let withdrawLimitLeft = getWithdrawLimitLeft(_staker)._2
321+ let limitInUsdn = usdnFromDecimals(muld(withdrawLimitLeft, rate()))
322+ throw(toString(limitInUsdn))
272323 }
273324
274325
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let k_totalSupply = "k_totalSupply"
55
66 let k_lockedBalance = "k_lockedBalance"
77
88 let k_freeBalance = "k_freeBalance"
99
1010 let k_rate = "k_rate"
1111
1212 let k_balance = "k_balance"
1313
1414 let k_average_rate = "k_average_rate"
1515
16-let k_withdraw_rate = "k_withdraw_rate"
16+let k_withdraw_limit = "k_withdraw_limit"
17+
18+let k_last_withdraw_date = "k_last_withdraw_date"
19+
20+let k_withdraw_in_period = "k_withdraw_in_period"
1721
1822 let k_initialized = "k_initialized"
1923
2024 let k_coordinatorAddress = "k_coordinatorAddress"
2125
2226 let k_amm = "k_amm"
2327
2428 let k_quote_asset = "k_quote_asset"
2529
2630 let k_admin_public_key = "k_admin_public_key"
2731
2832 let k_admin_address = "k_admin_address"
2933
3034 let k_manager_address = "k_manager_address"
3135
3236 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
3337
3438
3539 func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set")
3640
3741
3842 func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
3943
4044
4145 func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key))
4246
4347
4448 func adminAddress () = addressFromString(valueOrErrorMessage(getString(coordinator(), k_admin_address), "Admin address not set"))
4549
4650
4751 func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
4852
4953
5054 func managerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_manager_address)), "Manager not set")
5155
5256
5357 let DECIMAL_UNIT = (1 * (((((((10 * 10) * 10) * 10) * 10) * 10) * 10) * 10))
5458
5559 let DURATION = ((60 * 60) * 24)
5660
5761 let NO_ADDRESS = ""
5862
5963 let NO_STAKER = 0
6064
6165 func usdnFromDecimals (_amount) = (_amount / 100)
6266
6367
6468 func usdnToDecimals (_amount) = (_amount * 100)
6569
6670
6771 func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN)
6872
6973
7074 func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN)
7175
7276
7377 func abs (_x) = if ((_x > 0))
7478 then _x
7579 else -(_x)
7680
7781
7882 func minv (_x,_y) = if ((_x > _y))
7983 then _y
8084 else _x
8185
8286
87+let WITHDRAW_PERIOD = (86400 * 1000)
88+
89+let WITHDRAW_PER_PERIOD = divd((1 * DECIMAL_UNIT), (4 * DECIMAL_UNIT))
90+
8391 func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k))
8492
8593
8694 func int0 (k) = valueOrElse(getInteger(this, k), 0)
8795
8896
8997 func int1 (k) = valueOrElse(getInteger(this, k), DECIMAL_UNIT)
9098
9199
92100 func totalSupply () = int0(k_totalSupply)
93101
94102
95103 func rate () = int1(k_rate)
96104
97105
98106 func balanceOf (_staker) = int0(toCompositeKey(k_balance, _staker))
99107
100108
101109 func averageRate (_staker) = int0(toCompositeKey(k_average_rate, _staker))
102110
103111
112+func withdrawLimit (_staker) = int0(toCompositeKey(k_withdraw_limit, _staker))
113+
114+
115+func withdrawnInPeriod (_staker) = int0(toCompositeKey(k_withdraw_in_period, _staker))
116+
117+
118+func lastWithdrawnDate (_staker) = int0(toCompositeKey(k_last_withdraw_date, _staker))
119+
120+
104121 func freeBalance () = int0(k_freeBalance)
105122
106123
107124 func lockedBalance () = int0(k_lockedBalance)
108125
109126
110127 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
111128
112129
130+func getWithdrawLimitLeft (_staker) = {
131+ let currentDate = lastBlock.timestamp
132+ let lastWithdrawDate = lastWithdrawnDate(_staker)
133+ let $t043274591 = if (((currentDate - lastWithdrawDate) > WITHDRAW_PERIOD))
134+ then $Tuple2(currentDate, withdrawLimit(_staker))
135+ else $Tuple2(lastWithdrawDate, (withdrawLimit(_staker) - withdrawnInPeriod(_staker)))
136+ let newLastWithdrawnDate = $t043274591._1
137+ let withdrawLimitLeft = $t043274591._2
138+ $Tuple2(newLastWithdrawnDate, withdrawLimitLeft)
139+ }
140+
141+
113142 func updateUserBalance (_user,_change) = [IntegerEntry(toCompositeKey(k_balance, _user), (balanceOf(_user) + _change))]
114143
115144
116-func updateUserAverageRate (_user,_rate) = [IntegerEntry(toCompositeKey(k_average_rate, _user), _rate)]
145+func setUserWithdrawLimit (_user,_rate) = [IntegerEntry(toCompositeKey(k_withdraw_limit, _user), _rate)]
146+
147+
148+func setUserAverageRate (_user,_rate) = [IntegerEntry(toCompositeKey(k_average_rate, _user), _rate)]
117149
118150
119151 func updateFreeBalance (_change) = [IntegerEntry(k_freeBalance, (freeBalance() + _change))]
120152
121153
122154 func updateLockedBalance (_change) = [IntegerEntry(k_lockedBalance, (lockedBalance() + _change))]
123155
124156
125157 func updateTotalSupply (_change) = [IntegerEntry(k_totalSupply, (totalSupply() + _change))]
126158
127159
128160 func updateRate (_rate) = [IntegerEntry(k_rate, _rate)]
129161
130162
163+func setUserWithdrawParams (_user,_lastWithdrawDate,_withdrawn) = [IntegerEntry(toCompositeKey(k_last_withdraw_date, _user), _lastWithdrawDate), IntegerEntry(toCompositeKey(k_withdraw_in_period, _user), _withdrawn)]
164+
165+
131166 @Callable(i)
132167 func initialize (_coordinator) = if (initialized())
133168 then throw("Already initialized")
134169 else [StringEntry(k_coordinatorAddress, _coordinator), BooleanEntry(k_initialized, true)]
135170
136171
137172
138173 @Callable(i)
139174 func stake () = {
140175 let _staker = toString(i.caller)
141- let _amount = i.payments[0].amount
176+ let _amount = usdnToDecimals(i.payments[0].amount)
142177 if (if ((i.payments[0].assetId != quoteAsset()))
143178 then true
144179 else !(initialized()))
145180 then throw("Invalid call to stake")
146181 else {
147182 let currentRate = rate()
148183 let prevAverageRate = averageRate(_staker)
149- let vAmount = divd(usdnToDecimals(_amount), currentRate)
184+ let vAmount = divd(_amount, currentRate)
150185 let newAverageRate = divd((muld(vAmount, currentRate) + muld(balanceOf(_staker), prevAverageRate)), (currentRate + prevAverageRate))
151- let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
152- if ((unstake == unstake))
153- then (((updateFreeBalance(_amount) ++ updateUserBalance(_staker, vAmount)) ++ updateUserAverageRate(_staker, newAverageRate)) ++ updateTotalSupply(vAmount))
186+ let newTotalBalance = (vAmount + balanceOf(_staker))
187+ let newWithdrawLimit = muld(newTotalBalance, WITHDRAW_PER_PERIOD)
188+ let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), usdnFromDecimals(_amount))])
189+ if ((stake == stake))
190+ then ((((updateFreeBalance(_amount) ++ updateUserBalance(_staker, vAmount)) ++ setUserAverageRate(_staker, newAverageRate)) ++ setUserWithdrawLimit(_staker, newWithdrawLimit)) ++ updateTotalSupply(vAmount))
154191 else throw("Strict value is not equal to itself.")
155192 }
156193 }
157194
158195
159196
160197 @Callable(i)
161-func unStake (_vAmount) = {
198+func unStake (_amount) = {
162199 let _staker = toString(i.caller)
163- if (if (if ((_vAmount > balanceOf(_staker)))
164- then true
165- else (i.payments != nil))
200+ let amountOfQuoteAsset = usdnToDecimals(_amount)
201+ if (if ((i.payments != nil))
166202 then true
167203 else !(initialized()))
168204 then throw("Invalid call to unStake")
169205 else {
170- let amountOfQuoteAsset = muld(_vAmount, rate())
171- if ((freeBalance() > amountOfQuoteAsset))
172- then throw("Balance to low")
206+ let $t076047745 = getWithdrawLimitLeft(_staker)
207+ let newLastWithdrawnDate = $t076047745._1
208+ let withdrawLimitLeft = $t076047745._2
209+ let vAmount = divd(amountOfQuoteAsset, rate())
210+ if ((vAmount > withdrawLimitLeft))
211+ then throw("Invalid call to unStake: withdraw over limit")
173212 else {
174- let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), usdnFromDecimals(amountOfQuoteAsset)], nil)
175- if ((unstake == unstake))
176- then (((updateFreeBalance(-(amountOfQuoteAsset)) ++ updateUserBalance(_staker, -(_vAmount))) ++ updateTotalSupply(-(_vAmount))) ++ [ScriptTransfer(i.caller, usdnFromDecimals(amountOfQuoteAsset), quoteAsset())])
177- else throw("Strict value is not equal to itself.")
213+ let newWithdrawnInPeriod = (withdrawnInPeriod(_staker) + vAmount)
214+ if ((amountOfQuoteAsset > freeBalance()))
215+ then throw("Invalid call to unStake: balance too low")
216+ else {
217+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), usdnFromDecimals(amountOfQuoteAsset)], nil)
218+ if ((unstake == unstake))
219+ then ((((updateFreeBalance(-(amountOfQuoteAsset)) ++ updateUserBalance(_staker, -(vAmount))) ++ updateTotalSupply(-(vAmount))) ++ setUserWithdrawParams(_staker, newLastWithdrawnDate, newWithdrawnInPeriod)) ++ [ScriptTransfer(i.caller, usdnFromDecimals(amountOfQuoteAsset), quoteAsset())])
220+ else throw("Strict value is not equal to itself.")
221+ }
178222 }
179223 }
180224 }
181225
182226
183227
184228 @Callable(i)
185229 func addFree () = {
186- let _amount = i.payments[0].amount
230+ let _amount = usdnToDecimals(i.payments[0].amount)
187231 if (if (if ((i.payments[0].assetId != quoteAsset()))
188232 then true
189233 else !(initialized()))
190234 then true
191235 else !(if (isWhitelist(toString(i.caller)))
192236 then true
193237 else (i.caller == adminAddress())))
194238 then throw("Invalid addFree params")
195239 else {
196- let amountOfQuoteAsset = usdnToDecimals(_amount)
197240 let newRate = if ((totalSupply() > 0))
198- then divd((freeBalance() + amountOfQuoteAsset), totalSupply())
241+ then divd((freeBalance() + _amount), totalSupply())
199242 else DECIMAL_UNIT
200- let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
243+ let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), usdnFromDecimals(_amount))])
201244 if ((unstake == unstake))
202- then (updateFreeBalance(amountOfQuoteAsset) ++ updateRate(newRate))
245+ then (updateFreeBalance(_amount) ++ updateRate(newRate))
203246 else throw("Strict value is not equal to itself.")
204247 }
205248 }
206249
207250
208251
209252 @Callable(i)
210253 func addLocked () = {
211- let _amount = i.payments[0].amount
254+ let _amount = usdnToDecimals(i.payments[0].amount)
212255 if (if (if ((i.payments[0].assetId != quoteAsset()))
213256 then true
214257 else !(initialized()))
215258 then true
216259 else !(if (isWhitelist(toString(i.caller)))
217260 then true
218261 else (i.caller == adminAddress())))
219262 then throw("Invalid addLocked params")
220263 else {
221- let amountOfQuoteAsset = usdnToDecimals(_amount)
222- let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
264+ let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), usdnFromDecimals(_amount))])
223265 if ((unstake == unstake))
224- then updateLockedBalance(amountOfQuoteAsset)
266+ then updateLockedBalance(_amount)
225267 else throw("Strict value is not equal to itself.")
226268 }
227269 }
228270
229271
230272
231273 @Callable(i)
232274 func exchangeFreeAndLocked (_amount) = if (if (!(initialized()))
233275 then true
234276 else !(if (isWhitelist(toString(i.caller)))
235277 then true
236278 else (i.caller == adminAddress())))
237279 then throw("Invalid exchangeFreeAndLocked params")
238280 else {
239281 let amountOfQuoteAsset = usdnToDecimals(_amount)
240282 let newRate = if ((totalSupply() > 0))
241283 then divd((freeBalance() - amountOfQuoteAsset), totalSupply())
242284 else DECIMAL_UNIT
243285 ((updateLockedBalance(amountOfQuoteAsset) ++ updateFreeBalance(-(amountOfQuoteAsset))) ++ updateRate(newRate))
244286 }
245287
246288
247289
248290 @Callable(i)
249291 func withdrawLocked (_amount) = if (if (if (!(initialized()))
250292 then true
251293 else (0 >= _amount))
252294 then true
253295 else !(isWhitelist(toString(i.caller))))
254296 then throw("Invalid withdrawLocked params")
255297 else {
256298 let amountOfQuoteAsset = usdnToDecimals(_amount)
257- let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), _amount], nil)
299+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), usdnFromDecimals(amountOfQuoteAsset)], nil)
258300 if ((unstake == unstake))
259- then (updateLockedBalance(-(amountOfQuoteAsset)) ++ [ScriptTransfer(i.caller, _amount, quoteAsset())])
301+ then (updateLockedBalance(-(amountOfQuoteAsset)) ++ [ScriptTransfer(i.caller, usdnFromDecimals(amountOfQuoteAsset), quoteAsset())])
260302 else throw("Strict value is not equal to itself.")
261303 }
262304
263305
264306
265307 @Callable(i)
266-func view_reward (_trader) = {
267- let balance = balanceOf(_trader)
268- let depositedAmount = muld(averageRate(_trader), balance)
308+func view_reward (_staker) = {
309+ let balance = balanceOf(_staker)
310+ let depositedAmount = muld(averageRate(_staker), balance)
269311 let currentAmount = muld(rate(), balance)
270312 let earned = (currentAmount - depositedAmount)
271313 throw(toString(earned))
314+ }
315+
316+
317+
318+@Callable(i)
319+func view_withdrawLimit (_staker) = {
320+ let withdrawLimitLeft = getWithdrawLimitLeft(_staker)._2
321+ let limitInUsdn = usdnFromDecimals(muld(withdrawLimitLeft, rate()))
322+ throw(toString(limitInUsdn))
272323 }
273324
274325
275326 @Verifier(tx)
276327 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey())
277328

github/deemru/w8io/169f3d6 
54.36 ms