tx · 2V66ayuceomPtycJq1dZKenYVewFUuAR3XRcxwPU6bi4

3NBEuUXKfGqe1ZKUfx8b8YsguJKYLhy2bTJ:  -0.03700000 Waves

2023.05.24 17:20 [2592174] smart account 3NBEuUXKfGqe1ZKUfx8b8YsguJKYLhy2bTJ > SELF 0.00000000 Waves

{ "type": 13, "id": "2V66ayuceomPtycJq1dZKenYVewFUuAR3XRcxwPU6bi4", "fee": 3700000, "feeAssetId": null, "timestamp": 1684938025304, "version": 2, "chainId": 84, "sender": "3NBEuUXKfGqe1ZKUfx8b8YsguJKYLhy2bTJ", "senderPublicKey": "2NgVCitn1k18yzwhrzdQXHDEygzSkjbXS4A1koTt14db", "proofs": [ "5fa3V6PYiN6To2eG2WM5XYLqmND33YA5KzbCCndTjx8qVQcGa4EkvdsNwNV3PqQhYb2S42c2so9ArmF2qgWZYFDe" ], "script": "base64:BgI8CAISABIFCgMICAESABIDCgEBEgASABIAEgMKAQESAwoBARIDCgEBEgASABIAEgMKAQgSAwoBCBIDCgEIYAANa190b3RhbFN1cHBseQINa190b3RhbFN1cHBseQAPa19yZXdhcmRCYWxhbmNlAg9rX3Jld2FyZEJhbGFuY2UAD2tfbG9ja2VkQmFsYW5jZQIPa19sb2NrZWRCYWxhbmNlAA1rX2ZyZWVCYWxhbmNlAg1rX2ZyZWVCYWxhbmNlAA9rX2V4Y2Vzc0JhbGFuY2UCD2tfZXhjZXNzQmFsYW5jZQAMa192YXVsdEFzc2V0AgxrX3ZhdWx0QXNzZXQAFGtfdmF1bHRBc3NldERlY2ltYWxzAhRrX3ZhdWx0QXNzZXREZWNpbWFscwAUa19tYXhTcG90VXRpbGl6YXRpb24CFGtfbWF4U3BvdFV0aWxpemF0aW9uAAZrX3JhdGUCBmtfcmF0ZQAQa19sYXN0VXBkYXRlVGltZQIQa19sYXN0VXBkYXRlVGltZQAWa19yZXdhcmRQZXJUb2tlblN0b3JlZAIWa19yZXdhcmRQZXJUb2tlblN0b3JlZAAMa19yZXdhcmRSYX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ZVJld2FyZAIFB19zdGFrZXIAAAJfMwkAAgEJAKQDAQkBEWFzc2V0RnJvbURlY2ltYWxzAQUMc3Rha2VyRWFybmVkAWkBEnZpZXdfd2l0aGRyYXdMaW1pdAEHX3N0YWtlcgQRd2l0aGRyYXdMaW1pdExlZnQICQEUZ2V0V2l0aGRyYXdMaW1pdExlZnQBBQdfc3Rha2VyAl8yBAxsaW1pdEluQXNzZXQJARFhc3NldEZyb21EZWNpbWFscwEJAQRtdWxkAgURd2l0aGRyYXdMaW1pdExlZnQJAQRyYXRlAAkAAgEJAKQDAQUMbGltaXRJbkFzc2V0AQJ0eAEGdmVyaWZ5AAQOY29vcmRpbmF0b3JTdHIJAJ0IAgUEdGhpcwUUa19jb29yZGluYXRvckFkZHJlc3MDCQEJaXNEZWZpbmVkAQUOY29vcmRpbmF0b3JTdHIEBWFkbWluCQCdCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEJAQV2YWx1ZQEFDmNvb3JkaW5hdG9yU3RyBQ9rX2FkbWluX2FkZHJlc3MDCQEJaXNEZWZpbmVkAQUFYWRtaW4JAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQkBBXZhbHVlAQUFYWRtaW4JAKwCAgkArAICCQCsAgICB3N0YXR1c18JAKUIAQUEdGhpcwIBXwkA2AQBCAUCdHgCaWQHCQACAQIudW5hYmxlIHRvIHZlcmlmeTogYWRtaW4gbm90IHNldCBpbiBjb29yZGluYXRvcgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleWZxXM4=", "height": 2592174, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4Q8aTwvsuvBCZwaVPcpBpxNRzQVB8Ga495FPtbZjN6o7 Next: J8nzxg7GTPk9bJgsLU4fEaJbhJofYdLkKkpk7jfqxesv Diff:
OldNewDifferences
6969
7070
7171 func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
72+
73+
74+func spotAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_spot_address), "Spot address not set")), "Spot address invalid")
7275
7376
7477 func governanceAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_governance_asset), "Governance asset not set"))
217220 func getWithdrawLimitLeft (_staker) = {
218221 let currentDate = currentTimestamp()
219222 let lastWithdrawDate = lastWithdrawnDate(_staker)
220- let $t062676588 = if (((currentDate - lastWithdrawDate) > WITHDRAW_PERIOD))
223+ let $t062656586 = if (((currentDate - lastWithdrawDate) > WITHDRAW_PERIOD))
221224 then $Tuple3(currentDate, withdrawLimit(_staker), 0)
222225 else $Tuple3(lastWithdrawDate, (withdrawLimit(_staker) - withdrawnInPeriod(_staker)), withdrawnInPeriod(_staker))
223- let newLastWithdrawnDate = $t062676588._1
224- let withdrawLimitLeft = $t062676588._2
225- let alreadyWithdrawnInPeriod = $t062676588._3
226+ let newLastWithdrawnDate = $t062656586._1
227+ let withdrawLimitLeft = $t062656586._2
228+ let alreadyWithdrawnInPeriod = $t062656586._3
226229 $Tuple3(newLastWithdrawnDate, withdrawLimitLeft, alreadyWithdrawnInPeriod)
227230 }
228231
259262 func updateReward (_staker,_balanceDelta) = {
260263 let newRewardPerTokenStored = rewardPerToken(_balanceDelta)
261264 let newLastUpdateTime = currentTimestampSec()
262- let $t078108002 = if ((_staker != ""))
265+ let $t078088000 = if ((_staker != ""))
263266 then $Tuple2(earned(_staker, _balanceDelta), newRewardPerTokenStored)
264267 else $Tuple2(0, 0)
265- let stakerEarned = $t078108002._1
266- let stakerRewardPerTokenPaid = $t078108002._2
268+ let stakerEarned = $t078088000._1
269+ let stakerRewardPerTokenPaid = $t078088000._2
267270 $Tuple4(newRewardPerTokenStored, newLastUpdateTime, stakerEarned, stakerRewardPerTokenPaid)
268271 }
269272
376379 else !(initialized()))
377380 then throw("Invalid call to stake")
378381 else {
379- let $t01314713376 = updateReward(_staker, 0)
380- let newRewardPerTokenStored = $t01314713376._1
381- let newLastUpdateTime = $t01314713376._2
382- let stakerEarned = $t01314713376._3
383- let stakerRewardPerTokenPaid = $t01314713376._4
382+ let $t01314513374 = updateReward(_staker, 0)
383+ let newRewardPerTokenStored = $t01314513374._1
384+ let newLastUpdateTime = $t01314513374._2
385+ let stakerEarned = $t01314513374._3
386+ let stakerRewardPerTokenPaid = $t01314513374._4
384387 let currentRate = rate()
385388 let prevAverageRate = averageRate(_staker)
386389 let vAmount = divd(_amount, currentRate)
389392 let newWithdrawLimit = muld(newTotalBalance, WITHDRAW_PER_PERIOD)
390393 let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(vaultAsset(), assetFromDecimals(_amount))])
391394 if ((stake == stake))
392- then (((((((updateUserRewards(_staker, stakerEarned, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateFreeBalance(_amount)) ++ updateUserBalance(_staker, vAmount)) ++ setUserAverageRate(_staker, newAverageRate)) ++ setUserWithdrawLimit(_staker, newWithdrawLimit)) ++ updateTotalSupply(vAmount))
395+ then {
396+ let notify = invoke(spotAddress(), "notifyVaultBalanceChange", [vaultAssetStr(), _amount], nil)
397+ if ((notify == notify))
398+ then (((((((updateUserRewards(_staker, stakerEarned, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateFreeBalance(_amount)) ++ updateUserBalance(_staker, vAmount)) ++ setUserAverageRate(_staker, newAverageRate)) ++ setUserWithdrawLimit(_staker, newWithdrawLimit)) ++ updateTotalSupply(vAmount))
399+ else throw("Strict value is not equal to itself.")
400+ }
393401 else throw("Strict value is not equal to itself.")
394402 }
395403 }
407415 else !(initialized()))
408416 then throw("Invalid call to unStake")
409417 else {
410- let $t01488415100 = updateReward(_staker, 0)
411- let newRewardPerTokenStored = $t01488415100._1
412- let newLastUpdateTime = $t01488415100._2
413- let stakerEarned = $t01488415100._3
414- let stakerRewardPerTokenPaid = $t01488415100._4
415- let $t01510715274 = getWithdrawLimitLeft(_staker)
416- let newLastWithdrawnDate = $t01510715274._1
417- let withdrawLimitLeft = $t01510715274._2
418- let alreadyWithdrawnInPeriod = $t01510715274._3
418+ let $t01487415090 = updateReward(_staker, 0)
419+ let newRewardPerTokenStored = $t01487415090._1
420+ let newLastUpdateTime = $t01487415090._2
421+ let stakerEarned = $t01487415090._3
422+ let stakerRewardPerTokenPaid = $t01487415090._4
423+ let $t01509715264 = getWithdrawLimitLeft(_staker)
424+ let newLastWithdrawnDate = $t01509715264._1
425+ let withdrawLimitLeft = $t01509715264._2
426+ let alreadyWithdrawnInPeriod = $t01509715264._3
419427 let vAmount = divd(amountOfQuoteAsset, rate())
420428 if ((vAmount > withdrawLimitLeft))
421429 then throw("Invalid call to unStake: withdraw over limit")
426434 else {
427435 let unstake = invoke(managerAddress(), "withdraw", [vaultAssetStr(), assetFromDecimals(amountOfQuoteAsset)], nil)
428436 if ((unstake == unstake))
429- then (((((((updateUserRewards(_staker, stakerEarned, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateFreeBalance(-(amountOfQuoteAsset))) ++ updateUserBalance(_staker, -(vAmount))) ++ updateTotalSupply(-(vAmount))) ++ setUserWithdrawParams(_staker, newLastWithdrawnDate, newWithdrawnInPeriod)) ++ [ScriptTransfer(i.caller, assetFromDecimals(amountOfQuoteAsset), vaultAsset())])
437+ then {
438+ let notify = invoke(spotAddress(), "notifyVaultBalanceChange", [vaultAssetStr(), -(amountOfQuoteAsset)], nil)
439+ if ((notify == notify))
440+ then (((((((updateUserRewards(_staker, stakerEarned, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateFreeBalance(-(amountOfQuoteAsset))) ++ updateUserBalance(_staker, -(vAmount))) ++ updateTotalSupply(-(vAmount))) ++ setUserWithdrawParams(_staker, newLastWithdrawnDate, newWithdrawnInPeriod)) ++ [ScriptTransfer(i.caller, assetFromDecimals(amountOfQuoteAsset), vaultAsset())])
441+ else throw("Strict value is not equal to itself.")
442+ }
430443 else throw("Strict value is not equal to itself.")
431444 }
432445 }
438451 @Callable(i)
439452 func withdrawRewards () = {
440453 let _staker = toString(i.caller)
441- let $t01679116936 = updateReward(_staker, 0)
442- let newRewardPerTokenStored = $t01679116936._1
443- let newLastUpdateTime = $t01679116936._2
444- let stakerEarned = $t01679116936._3
445- let stakerRewardPerTokenPaid = $t01679116936._4
454+ let $t01676916914 = updateReward(_staker, 0)
455+ let newRewardPerTokenStored = $t01676916914._1
456+ let newLastUpdateTime = $t01676916914._2
457+ let stakerEarned = $t01676916914._3
458+ let stakerRewardPerTokenPaid = $t01676916914._4
446459 if (if ((0 >= stakerEarned))
447460 then true
448461 else !(initialized()))
461474 then true
462475 else !(initialized()))
463476 then true
464- else !(if (isWhitelist(toString(i.caller)))
477+ else !(if (if (isWhitelist(toString(i.caller)))
478+ then true
479+ else (i.caller == spotAddress()))
465480 then true
466481 else (i.caller == adminAddress())))
467482 then throw("Invalid addFree params")
528543 then (updateLockedBalance(-(amountOfQuoteAsset)) ++ [ScriptTransfer(i.caller, assetFromDecimals(amountOfQuoteAsset), vaultAsset())])
529544 else throw("Strict value is not equal to itself.")
530545 }
546+
547+
548+
549+@Callable(i)
550+func borrow (_amount) = if (if (if (!(initialized()))
551+ then true
552+ else (0 >= _amount))
553+ then true
554+ else !((i.caller == spotAddress())))
555+ then throw("Invalid borrow params")
556+ else {
557+ let amountOfQuoteAsset = assetToDecimals(_amount)
558+ let unstake = invoke(managerAddress(), "withdraw", [vaultAssetStr(), assetFromDecimals(amountOfQuoteAsset)], nil)
559+ if ((unstake == unstake))
560+ then (updateExcessBalance(-(amountOfQuoteAsset)) ++ [ScriptTransfer(i.caller, assetFromDecimals(amountOfQuoteAsset), vaultAsset())])
561+ else throw("Strict value is not equal to itself.")
562+ }
563+
564+
565+
566+@Callable(i)
567+func repay () = {
568+ let _amount = assetToDecimals(i.payments[0].amount)
569+ if (if (if (if ((i.payments[0].assetId != vaultAsset()))
570+ then true
571+ else (size(i.payments) != 1))
572+ then true
573+ else !(initialized()))
574+ then true
575+ else !(if ((i.caller == spotAddress()))
576+ then true
577+ else (i.caller == adminAddress())))
578+ then throw("Invalid repay params")
579+ else {
580+ let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(vaultAsset(), assetFromDecimals(_amount))])
581+ if ((unstake == unstake))
582+ then updateExcessBalance(_amount)
583+ else throw("Strict value is not equal to itself.")
584+ }
585+ }
531586
532587
533588
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_excessBalance = "k_excessBalance"
1313
1414 let k_vaultAsset = "k_vaultAsset"
1515
1616 let k_vaultAssetDecimals = "k_vaultAssetDecimals"
1717
1818 let k_maxSpotUtilization = "k_maxSpotUtilization"
1919
2020 let k_rate = "k_rate"
2121
2222 let k_lastUpdateTime = "k_lastUpdateTime"
2323
2424 let k_rewardPerTokenStored = "k_rewardPerTokenStored"
2525
2626 let k_rewardRate = "k_rewardRate"
2727
2828 let k_periodFinish = "k_periodFinish"
2929
3030 let k_userRewardPerToken = "k_userRewardPerToken"
3131
3232 let k_userReward = "k_userReward"
3333
3434 let k_balance = "k_balance"
3535
3636 let k_average_rate = "k_average_rate"
3737
3838 let k_withdraw_limit = "k_withdraw_limit"
3939
4040 let k_last_withdraw_date = "k_last_withdraw_date"
4141
4242 let k_withdraw_in_period = "k_withdraw_in_period"
4343
4444 let k_initialized = "k_initialized"
4545
4646 let k_coordinatorAddress = "k_coordinatorAddress"
4747
4848 let k_amm = "k_amm"
4949
5050 let k_governance_asset = "k_gov_asset"
5151
5252 let k_quote_asset = "k_quote_asset"
5353
5454 let k_admin_address = "k_admin_address"
5555
5656 let k_manager_address = "k_manager_address"
5757
5858 let k_spot_address = "k_spot_address"
5959
6060 let k_collateral_address = "k_collateral_address"
6161
6262 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
6363
6464
6565 func coordinator () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, k_coordinatorAddress), "Coordinator not set")), "Coordinator address invalid")
6666
6767
6868 func adminAddress () = addressFromString(valueOrErrorMessage(getString(coordinator(), k_admin_address), "Admin address not set"))
6969
7070
7171 func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
72+
73+
74+func spotAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_spot_address), "Spot address not set")), "Spot address invalid")
7275
7376
7477 func governanceAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_governance_asset), "Governance asset not set"))
7578
7679
7780 func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
7881
7982
8083 func vaultAssetStr () = valueOrErrorMessage(getString(this, k_vaultAsset), "Vault asset not set")
8184
8285
8386 func vaultAsset () = {
8487 let _assetIdStr = vaultAssetStr()
8588 if ((_assetIdStr == "WAVES"))
8689 then unit
8790 else fromBase58String(_assetIdStr)
8891 }
8992
9093
9194 func vaultAssetDecimals () = valueOrErrorMessage(getInteger(this, k_vaultAssetDecimals), "Vault asset decimals not set")
9295
9396
9497 func managerAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_manager_address), "Manager address not set")), "Manager address invalid")
9598
9699
97100 let DECIMAL_UNIT = (1 * (((((((10 * 10) * 10) * 10) * 10) * 10) * 10) * 10))
98101
99102 let DURATION = (((7 * 60) * 60) * 24)
100103
101104 let NO_ADDRESS = ""
102105
103106 let NO_STAKER = 0
104107
105108 func assetFromDecimals (_amount) = {
106109 let assetDecimals = vaultAssetDecimals()
107110 if ((assetDecimals == 6))
108111 then (_amount / 100)
109112 else if ((assetDecimals == 8))
110113 then _amount
111114 else throw("Invalid asset decimals")
112115 }
113116
114117
115118 func assetToDecimals (_amount) = {
116119 let assetDecimals = vaultAssetDecimals()
117120 if ((assetDecimals == 6))
118121 then (_amount * 100)
119122 else if ((assetDecimals == 8))
120123 then _amount
121124 else throw("Invalid asset decimals")
122125 }
123126
124127
125128 func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN)
126129
127130
128131 func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN)
129132
130133
131134 func abs (_x) = if ((_x > 0))
132135 then _x
133136 else -(_x)
134137
135138
136139 func minv (_x,_y) = if ((_x > _y))
137140 then _y
138141 else _x
139142
140143
141144 let WITHDRAW_PERIOD = (86400 * 1000)
142145
143146 let WITHDRAW_PER_PERIOD = divd((1 * DECIMAL_UNIT), (4 * DECIMAL_UNIT))
144147
145148 func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k))
146149
147150
148151 func int0 (k) = valueOrElse(getInteger(this, k), 0)
149152
150153
151154 func int1 (k) = valueOrElse(getInteger(this, k), DECIMAL_UNIT)
152155
153156
154157 func totalSupply () = int0(k_totalSupply)
155158
156159
157160 func rate () = int1(k_rate)
158161
159162
160163 func balanceOf (_staker) = int0(toCompositeKey(k_balance, _staker))
161164
162165
163166 func averageRate (_staker) = int0(toCompositeKey(k_average_rate, _staker))
164167
165168
166169 func withdrawLimit (_staker) = int0(toCompositeKey(k_withdraw_limit, _staker))
167170
168171
169172 func withdrawnInPeriod (_staker) = int0(toCompositeKey(k_withdraw_in_period, _staker))
170173
171174
172175 func lastWithdrawnDate (_staker) = int0(toCompositeKey(k_last_withdraw_date, _staker))
173176
174177
175178 func freeBalance () = int0(k_freeBalance)
176179
177180
178181 func lockedBalance () = int0(k_lockedBalance)
179182
180183
181184 func excessBalance () = int0(k_excessBalance)
182185
183186
184187 func rewardPerTokenStored () = int0(k_rewardPerTokenStored)
185188
186189
187190 func lastUpdateTime () = int0(k_lastUpdateTime)
188191
189192
190193 func rewardRate () = int0(k_rewardRate)
191194
192195
193196 func periodFinish () = int0(k_periodFinish)
194197
195198
196199 func rewardBalance () = int0(k_rewardBalance)
197200
198201
199202 func rewards (_staker) = int0(toCompositeKey(k_userReward, _staker))
200203
201204
202205 func userRewardPerTokenPaid (_staker) = int0(toCompositeKey(k_userRewardPerToken, _staker))
203206
204207
205208 func maxSpotUtilization () = int0(k_maxSpotUtilization)
206209
207210
208211 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
209212
210213
211214 func currentTimestamp () = lastBlock.timestamp
212215
213216
214217 func currentTimestampSec () = (currentTimestamp() / 1000)
215218
216219
217220 func getWithdrawLimitLeft (_staker) = {
218221 let currentDate = currentTimestamp()
219222 let lastWithdrawDate = lastWithdrawnDate(_staker)
220- let $t062676588 = if (((currentDate - lastWithdrawDate) > WITHDRAW_PERIOD))
223+ let $t062656586 = if (((currentDate - lastWithdrawDate) > WITHDRAW_PERIOD))
221224 then $Tuple3(currentDate, withdrawLimit(_staker), 0)
222225 else $Tuple3(lastWithdrawDate, (withdrawLimit(_staker) - withdrawnInPeriod(_staker)), withdrawnInPeriod(_staker))
223- let newLastWithdrawnDate = $t062676588._1
224- let withdrawLimitLeft = $t062676588._2
225- let alreadyWithdrawnInPeriod = $t062676588._3
226+ let newLastWithdrawnDate = $t062656586._1
227+ let withdrawLimitLeft = $t062656586._2
228+ let alreadyWithdrawnInPeriod = $t062656586._3
226229 $Tuple3(newLastWithdrawnDate, withdrawLimitLeft, alreadyWithdrawnInPeriod)
227230 }
228231
229232
230233 func computeNewRate (_amountOfQuoteAsset) = {
231234 let newRate = if ((totalSupply() > 0))
232235 then divd((freeBalance() + _amountOfQuoteAsset), totalSupply())
233236 else DECIMAL_UNIT
234237 newRate
235238 }
236239
237240
238241 func lastTimeRewardApplicable () = minv(currentTimestampSec(), periodFinish())
239242
240243
241244 func rewardPerToken (_balanceDelta) = if (((totalSupply() + _balanceDelta) == 0))
242245 then rewardPerTokenStored()
243246 else {
244247 let timeInterval = (lastTimeRewardApplicable() - lastUpdateTime())
245248 let actualTimeInterval = if ((0 > timeInterval))
246249 then 0
247250 else timeInterval
248251 let diff = divd((rewardRate() * actualTimeInterval), (totalSupply() + _balanceDelta))
249252 (rewardPerTokenStored() + diff)
250253 }
251254
252255
253256 func earned (_staker,_balanceDelta) = {
254257 let rewardDelta = (rewardPerToken(_balanceDelta) - userRewardPerTokenPaid(_staker))
255258 (muld((balanceOf(_staker) + _balanceDelta), rewardDelta) + rewards(_staker))
256259 }
257260
258261
259262 func updateReward (_staker,_balanceDelta) = {
260263 let newRewardPerTokenStored = rewardPerToken(_balanceDelta)
261264 let newLastUpdateTime = currentTimestampSec()
262- let $t078108002 = if ((_staker != ""))
265+ let $t078088000 = if ((_staker != ""))
263266 then $Tuple2(earned(_staker, _balanceDelta), newRewardPerTokenStored)
264267 else $Tuple2(0, 0)
265- let stakerEarned = $t078108002._1
266- let stakerRewardPerTokenPaid = $t078108002._2
268+ let stakerEarned = $t078088000._1
269+ let stakerRewardPerTokenPaid = $t078088000._2
267270 $Tuple4(newRewardPerTokenStored, newLastUpdateTime, stakerEarned, stakerRewardPerTokenPaid)
268271 }
269272
270273
271274 func updateUserBalance (_user,_change) = if (((balanceOf(_user) + _change) >= 0))
272275 then [IntegerEntry(toCompositeKey(k_balance, _user), (balanceOf(_user) + _change))]
273276 else throw(((("Vault: can not update user balance. Balance: " + toString(balanceOf(_user))) + " change: ") + toString(_change)))
274277
275278
276279 func setUserWithdrawLimit (_user,_rate) = [IntegerEntry(toCompositeKey(k_withdraw_limit, _user), _rate)]
277280
278281
279282 func setUserAverageRate (_user,_rate) = [IntegerEntry(toCompositeKey(k_average_rate, _user), _rate)]
280283
281284
282285 func updateFreeBalance (_change) = {
283286 let balance = freeBalance()
284287 if (((balance + _change) >= 0))
285288 then [IntegerEntry(k_freeBalance, (balance + _change))]
286289 else throw(((("Vault: can not update free balance. Balance: " + toString(balance)) + " change: ") + toString(_change)))
287290 }
288291
289292
290293 func updateLockedBalance (_change) = {
291294 let balance = lockedBalance()
292295 if (((balance + _change) >= 0))
293296 then [IntegerEntry(k_lockedBalance, (balance + _change))]
294297 else throw(((("Vault: can not update locked balance. Balance: " + toString(balance)) + " change: ") + toString(_change)))
295298 }
296299
297300
298301 func updateExcessBalance (_change) = {
299302 let newImbalance = (excessBalance() + _change)
300303 let utilizationRate = divd(abs(newImbalance), freeBalance())
301304 if ((maxSpotUtilization() > utilizationRate))
302305 then [IntegerEntry(k_excessBalance, newImbalance)]
303306 else throw(((((((("Vault: can not update excess balance. Balance: " + toString(excessBalance())) + " change: ") + toString(_change)) + " utilization rate: ") + toString(utilizationRate)) + " max utilization rate: ") + toString(maxSpotUtilization())))
304307 }
305308
306309
307310 func updateTotalSupply (_change) = [IntegerEntry(k_totalSupply, (totalSupply() + _change))]
308311
309312
310313 func updateRate (_rate) = [IntegerEntry(k_rate, _rate)]
311314
312315
313316 func setUserWithdrawParams (_user,_lastWithdrawDate,_withdrawn) = [IntegerEntry(toCompositeKey(k_last_withdraw_date, _user), _lastWithdrawDate), IntegerEntry(toCompositeKey(k_withdraw_in_period, _user), _withdrawn)]
314317
315318
316319 func updateRewardBalance (_delta) = [IntegerEntry(k_rewardBalance, (rewardBalance() + _delta))]
317320
318321
319322 func updateRewardRate (_rewardRate) = [IntegerEntry(k_rewardRate, _rewardRate)]
320323
321324
322325 func updateTime (_lastUpdateTime,_periodFinish) = [IntegerEntry(k_lastUpdateTime, _lastUpdateTime), IntegerEntry(k_periodFinish, _periodFinish)]
323326
324327
325328 func updateRewardPerTokenStored (_rewardPerTokenStored) = [IntegerEntry(k_rewardPerTokenStored, _rewardPerTokenStored)]
326329
327330
328331 func updateUserRewards (_staker,_reward,_userRewardPerToken) = [IntegerEntry(toCompositeKey(k_userReward, _staker), _reward), IntegerEntry(toCompositeKey(k_userRewardPerToken, _staker), _userRewardPerToken)]
329332
330333
331334 @Callable(i)
332335 func migrate () = if ((i.caller != adminAddress()))
333336 then throw("Invalid migrate parameters")
334337 else {
335338 let _vaultAsset = toBase58String(quoteAsset())
336339 let assetDecimals = if ((_vaultAsset == "WAVES"))
337340 then 8
338341 else {
339342 let info = valueOrErrorMessage(assetInfo(fromBase58String(_vaultAsset)), ("Invalid token id: " + _vaultAsset))
340343 info.decimals
341344 }
342345 [StringEntry(k_vaultAsset, _vaultAsset), IntegerEntry(k_vaultAssetDecimals, assetDecimals), IntegerEntry(k_maxSpotUtilization, 0)]
343346 }
344347
345348
346349
347350 @Callable(i)
348351 func initialize (_coordinator,_vaultAsset,_maxSpotUtilization) = if (if (if (if (initialized())
349352 then true
350353 else (i.caller != this))
351354 then true
352355 else (0 > _maxSpotUtilization))
353356 then true
354357 else (_maxSpotUtilization > DECIMAL_UNIT))
355358 then throw("Unable to initialize")
356359 else {
357360 let assetDecimals = if ((_vaultAsset == "WAVES"))
358361 then 8
359362 else {
360363 let info = valueOrErrorMessage(assetInfo(fromBase58String(_vaultAsset)), ("Invalid token id: " + _vaultAsset))
361364 info.decimals
362365 }
363366 [StringEntry(k_coordinatorAddress, toString(valueOrErrorMessage(addressFromString(_coordinator), "Invalid coordinator address"))), StringEntry(k_vaultAsset, _vaultAsset), IntegerEntry(k_vaultAssetDecimals, assetDecimals), IntegerEntry(k_maxSpotUtilization, _maxSpotUtilization), BooleanEntry(k_initialized, true)]
364367 }
365368
366369
367370
368371 @Callable(i)
369372 func stake () = {
370373 let _staker = toString(i.caller)
371374 let _amount = assetToDecimals(i.payments[0].amount)
372375 if (if (if ((i.payments[0].assetId != vaultAsset()))
373376 then true
374377 else (size(i.payments) != 1))
375378 then true
376379 else !(initialized()))
377380 then throw("Invalid call to stake")
378381 else {
379- let $t01314713376 = updateReward(_staker, 0)
380- let newRewardPerTokenStored = $t01314713376._1
381- let newLastUpdateTime = $t01314713376._2
382- let stakerEarned = $t01314713376._3
383- let stakerRewardPerTokenPaid = $t01314713376._4
382+ let $t01314513374 = updateReward(_staker, 0)
383+ let newRewardPerTokenStored = $t01314513374._1
384+ let newLastUpdateTime = $t01314513374._2
385+ let stakerEarned = $t01314513374._3
386+ let stakerRewardPerTokenPaid = $t01314513374._4
384387 let currentRate = rate()
385388 let prevAverageRate = averageRate(_staker)
386389 let vAmount = divd(_amount, currentRate)
387390 let newAverageRate = divd((muld(vAmount, currentRate) + muld(balanceOf(_staker), prevAverageRate)), (vAmount + balanceOf(_staker)))
388391 let newTotalBalance = (vAmount + balanceOf(_staker))
389392 let newWithdrawLimit = muld(newTotalBalance, WITHDRAW_PER_PERIOD)
390393 let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(vaultAsset(), assetFromDecimals(_amount))])
391394 if ((stake == stake))
392- then (((((((updateUserRewards(_staker, stakerEarned, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateFreeBalance(_amount)) ++ updateUserBalance(_staker, vAmount)) ++ setUserAverageRate(_staker, newAverageRate)) ++ setUserWithdrawLimit(_staker, newWithdrawLimit)) ++ updateTotalSupply(vAmount))
395+ then {
396+ let notify = invoke(spotAddress(), "notifyVaultBalanceChange", [vaultAssetStr(), _amount], nil)
397+ if ((notify == notify))
398+ then (((((((updateUserRewards(_staker, stakerEarned, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateFreeBalance(_amount)) ++ updateUserBalance(_staker, vAmount)) ++ setUserAverageRate(_staker, newAverageRate)) ++ setUserWithdrawLimit(_staker, newWithdrawLimit)) ++ updateTotalSupply(vAmount))
399+ else throw("Strict value is not equal to itself.")
400+ }
393401 else throw("Strict value is not equal to itself.")
394402 }
395403 }
396404
397405
398406
399407 @Callable(i)
400408 func unStake (_amount) = {
401409 let _staker = toString(i.caller)
402410 let amountOfQuoteAsset = assetToDecimals(_amount)
403411 if (if (if ((i.payments != nil))
404412 then true
405413 else (0 >= amountOfQuoteAsset))
406414 then true
407415 else !(initialized()))
408416 then throw("Invalid call to unStake")
409417 else {
410- let $t01488415100 = updateReward(_staker, 0)
411- let newRewardPerTokenStored = $t01488415100._1
412- let newLastUpdateTime = $t01488415100._2
413- let stakerEarned = $t01488415100._3
414- let stakerRewardPerTokenPaid = $t01488415100._4
415- let $t01510715274 = getWithdrawLimitLeft(_staker)
416- let newLastWithdrawnDate = $t01510715274._1
417- let withdrawLimitLeft = $t01510715274._2
418- let alreadyWithdrawnInPeriod = $t01510715274._3
418+ let $t01487415090 = updateReward(_staker, 0)
419+ let newRewardPerTokenStored = $t01487415090._1
420+ let newLastUpdateTime = $t01487415090._2
421+ let stakerEarned = $t01487415090._3
422+ let stakerRewardPerTokenPaid = $t01487415090._4
423+ let $t01509715264 = getWithdrawLimitLeft(_staker)
424+ let newLastWithdrawnDate = $t01509715264._1
425+ let withdrawLimitLeft = $t01509715264._2
426+ let alreadyWithdrawnInPeriod = $t01509715264._3
419427 let vAmount = divd(amountOfQuoteAsset, rate())
420428 if ((vAmount > withdrawLimitLeft))
421429 then throw("Invalid call to unStake: withdraw over limit")
422430 else {
423431 let newWithdrawnInPeriod = (alreadyWithdrawnInPeriod + vAmount)
424432 if ((amountOfQuoteAsset > freeBalance()))
425433 then throw("Invalid call to unStake: balance too low")
426434 else {
427435 let unstake = invoke(managerAddress(), "withdraw", [vaultAssetStr(), assetFromDecimals(amountOfQuoteAsset)], nil)
428436 if ((unstake == unstake))
429- then (((((((updateUserRewards(_staker, stakerEarned, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateFreeBalance(-(amountOfQuoteAsset))) ++ updateUserBalance(_staker, -(vAmount))) ++ updateTotalSupply(-(vAmount))) ++ setUserWithdrawParams(_staker, newLastWithdrawnDate, newWithdrawnInPeriod)) ++ [ScriptTransfer(i.caller, assetFromDecimals(amountOfQuoteAsset), vaultAsset())])
437+ then {
438+ let notify = invoke(spotAddress(), "notifyVaultBalanceChange", [vaultAssetStr(), -(amountOfQuoteAsset)], nil)
439+ if ((notify == notify))
440+ then (((((((updateUserRewards(_staker, stakerEarned, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateFreeBalance(-(amountOfQuoteAsset))) ++ updateUserBalance(_staker, -(vAmount))) ++ updateTotalSupply(-(vAmount))) ++ setUserWithdrawParams(_staker, newLastWithdrawnDate, newWithdrawnInPeriod)) ++ [ScriptTransfer(i.caller, assetFromDecimals(amountOfQuoteAsset), vaultAsset())])
441+ else throw("Strict value is not equal to itself.")
442+ }
430443 else throw("Strict value is not equal to itself.")
431444 }
432445 }
433446 }
434447 }
435448
436449
437450
438451 @Callable(i)
439452 func withdrawRewards () = {
440453 let _staker = toString(i.caller)
441- let $t01679116936 = updateReward(_staker, 0)
442- let newRewardPerTokenStored = $t01679116936._1
443- let newLastUpdateTime = $t01679116936._2
444- let stakerEarned = $t01679116936._3
445- let stakerRewardPerTokenPaid = $t01679116936._4
454+ let $t01676916914 = updateReward(_staker, 0)
455+ let newRewardPerTokenStored = $t01676916914._1
456+ let newLastUpdateTime = $t01676916914._2
457+ let stakerEarned = $t01676916914._3
458+ let stakerRewardPerTokenPaid = $t01676916914._4
446459 if (if ((0 >= stakerEarned))
447460 then true
448461 else !(initialized()))
449462 then throw("No reward: Vault")
450463 else ((((updateUserRewards(_staker, 0, stakerRewardPerTokenPaid) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateTime(newLastUpdateTime, periodFinish())) ++ updateRewardBalance(-(stakerEarned))) ++ [ScriptTransfer(i.caller, stakerEarned, governanceAsset())])
451464 }
452465
453466
454467
455468 @Callable(i)
456469 func addFree () = {
457470 let _amount = assetToDecimals(i.payments[0].amount)
458471 if (if (if (if ((i.payments[0].assetId != vaultAsset()))
459472 then true
460473 else (size(i.payments) != 1))
461474 then true
462475 else !(initialized()))
463476 then true
464- else !(if (isWhitelist(toString(i.caller)))
477+ else !(if (if (isWhitelist(toString(i.caller)))
478+ then true
479+ else (i.caller == spotAddress()))
465480 then true
466481 else (i.caller == adminAddress())))
467482 then throw("Invalid addFree params")
468483 else {
469484 let newRate = computeNewRate(_amount)
470485 let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(vaultAsset(), assetFromDecimals(_amount))])
471486 if ((stake == stake))
472487 then (updateFreeBalance(_amount) ++ updateRate(newRate))
473488 else throw("Strict value is not equal to itself.")
474489 }
475490 }
476491
477492
478493
479494 @Callable(i)
480495 func addLocked () = {
481496 let _amount = assetToDecimals(i.payments[0].amount)
482497 if (if (if (if ((i.payments[0].assetId != vaultAsset()))
483498 then true
484499 else (size(i.payments) != 1))
485500 then true
486501 else !(initialized()))
487502 then true
488503 else !(if (isWhitelist(toString(i.caller)))
489504 then true
490505 else (i.caller == adminAddress())))
491506 then throw("Invalid addLocked params")
492507 else {
493508 let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(vaultAsset(), assetFromDecimals(_amount))])
494509 if ((unstake == unstake))
495510 then updateLockedBalance(_amount)
496511 else throw("Strict value is not equal to itself.")
497512 }
498513 }
499514
500515
501516
502517 @Callable(i)
503518 func exchangeFreeAndLocked (_amount) = if (if (!(initialized()))
504519 then true
505520 else if (!(isWhitelist(toString(i.caller))))
506521 then (i.caller != adminAddress())
507522 else false)
508523 then throw("Invalid exchangeFreeAndLocked params")
509524 else {
510525 let amountOfQuoteAsset = assetToDecimals(_amount)
511526 let newRate = computeNewRate(-(amountOfQuoteAsset))
512527 ((updateLockedBalance(amountOfQuoteAsset) ++ updateFreeBalance(-(amountOfQuoteAsset))) ++ updateRate(newRate))
513528 }
514529
515530
516531
517532 @Callable(i)
518533 func withdrawLocked (_amount) = if (if (if (!(initialized()))
519534 then true
520535 else (0 >= _amount))
521536 then true
522537 else !(isWhitelist(toString(i.caller))))
523538 then throw("Invalid withdrawLocked params")
524539 else {
525540 let amountOfQuoteAsset = assetToDecimals(_amount)
526541 let unstake = invoke(managerAddress(), "withdraw", [vaultAssetStr(), assetFromDecimals(amountOfQuoteAsset)], nil)
527542 if ((unstake == unstake))
528543 then (updateLockedBalance(-(amountOfQuoteAsset)) ++ [ScriptTransfer(i.caller, assetFromDecimals(amountOfQuoteAsset), vaultAsset())])
529544 else throw("Strict value is not equal to itself.")
530545 }
546+
547+
548+
549+@Callable(i)
550+func borrow (_amount) = if (if (if (!(initialized()))
551+ then true
552+ else (0 >= _amount))
553+ then true
554+ else !((i.caller == spotAddress())))
555+ then throw("Invalid borrow params")
556+ else {
557+ let amountOfQuoteAsset = assetToDecimals(_amount)
558+ let unstake = invoke(managerAddress(), "withdraw", [vaultAssetStr(), assetFromDecimals(amountOfQuoteAsset)], nil)
559+ if ((unstake == unstake))
560+ then (updateExcessBalance(-(amountOfQuoteAsset)) ++ [ScriptTransfer(i.caller, assetFromDecimals(amountOfQuoteAsset), vaultAsset())])
561+ else throw("Strict value is not equal to itself.")
562+ }
563+
564+
565+
566+@Callable(i)
567+func repay () = {
568+ let _amount = assetToDecimals(i.payments[0].amount)
569+ if (if (if (if ((i.payments[0].assetId != vaultAsset()))
570+ then true
571+ else (size(i.payments) != 1))
572+ then true
573+ else !(initialized()))
574+ then true
575+ else !(if ((i.caller == spotAddress()))
576+ then true
577+ else (i.caller == adminAddress())))
578+ then throw("Invalid repay params")
579+ else {
580+ let unstake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(vaultAsset(), assetFromDecimals(_amount))])
581+ if ((unstake == unstake))
582+ then updateExcessBalance(_amount)
583+ else throw("Strict value is not equal to itself.")
584+ }
585+ }
531586
532587
533588
534589 @Callable(i)
535590 func addRewards () = if (if (if ((i.payments[0].assetId != governanceAsset()))
536591 then true
537592 else (size(i.payments) != 1))
538593 then true
539594 else !(initialized()))
540595 then throw("Invalid addRewards params")
541596 else {
542597 let _reward = i.payments[0].amount
543598 let newRewardPerTokenStored = updateReward(NO_ADDRESS, NO_STAKER)._1
544599 let timestamp = currentTimestampSec()
545600 let newRewardRate = if ((timestamp > periodFinish()))
546601 then (_reward / DURATION)
547602 else {
548603 let remainingTime = (periodFinish() - timestamp)
549604 let leftover = (rewardRate() * remainingTime)
550605 ((_reward + leftover) / DURATION)
551606 }
552607 (((updateRewardRate(newRewardRate) ++ updateRewardPerTokenStored(newRewardPerTokenStored)) ++ updateRewardBalance(_reward)) ++ updateTime(timestamp, (timestamp + DURATION)))
553608 }
554609
555610
556611
557612 @Callable(i)
558613 func ackRewards () = {
559614 let profitResp = invoke(managerAddress(), "claimProfit", [vaultAssetStr()], nil)
560615 if ((profitResp == profitResp))
561616 then {
562617 let profit = match profitResp {
563618 case p: Int =>
564619 assetToDecimals(p)
565620 case _ =>
566621 throw("Invalid claimProfit response")
567622 }
568623 let result = if ((profit > 0))
569624 then {
570625 let newRate = computeNewRate(profit)
571626 let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(vaultAsset(), assetFromDecimals(profit))])
572627 if ((stake == stake))
573628 then (updateFreeBalance(profit) ++ updateRate(newRate))
574629 else throw("Strict value is not equal to itself.")
575630 }
576631 else nil
577632 if ((result == result))
578633 then result
579634 else throw("Strict value is not equal to itself.")
580635 }
581636 else throw("Strict value is not equal to itself.")
582637 }
583638
584639
585640
586641 @Callable(i)
587642 func view_reward (_staker) = {
588643 let balance = balanceOf(_staker)
589644 let depositedAmount = muld(averageRate(_staker), balance)
590645 let currentAmount = muld(rate(), balance)
591646 let earnedQuote = (currentAmount - depositedAmount)
592647 throw(toString(earnedQuote))
593648 }
594649
595650
596651
597652 @Callable(i)
598653 func view_stakingReward (_staker) = {
599654 let stakerEarned = updateReward(_staker, 0)._3
600655 throw(toString(assetFromDecimals(stakerEarned)))
601656 }
602657
603658
604659
605660 @Callable(i)
606661 func view_withdrawLimit (_staker) = {
607662 let withdrawLimitLeft = getWithdrawLimitLeft(_staker)._2
608663 let limitInAsset = assetFromDecimals(muld(withdrawLimitLeft, rate()))
609664 throw(toString(limitInAsset))
610665 }
611666
612667
613668 @Verifier(tx)
614669 func verify () = {
615670 let coordinatorStr = getString(this, k_coordinatorAddress)
616671 if (isDefined(coordinatorStr))
617672 then {
618673 let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address)
619674 if (isDefined(admin))
620675 then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false)
621676 else throw("unable to verify: admin not set in coordinator")
622677 }
623678 else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
624679 }
625680

github/deemru/w8io/026f985 
69.92 ms