tx · GwRSX1SpJmxbDdxkSQkgetXEFHgTYBUUg7ey2P6yPKQ4

3N9Fi37D7EoAveMhpdBFPB8NEUn4bwXEV4G:  -0.03700000 Waves

2023.08.04 17:35 [2695966] smart account 3N9Fi37D7EoAveMhpdBFPB8NEUn4bwXEV4G > SELF 0.00000000 Waves

{ "type": 13, "id": "GwRSX1SpJmxbDdxkSQkgetXEFHgTYBUUg7ey2P6yPKQ4", "fee": 3700000, "feeAssetId": null, "timestamp": 1691159751778, "version": 2, "chainId": 84, "sender": "3N9Fi37D7EoAveMhpdBFPB8NEUn4bwXEV4G", "senderPublicKey": "7SdMpYYBFTqnnyr31oEmHeJfFTa3aGnwocRuvfEhpyoh", "proofs": [ "3sDcLbAx86AnNK2C5giGWfEzf6Sy3s8Ei1tmoS21nrnJw7bycmo2E7sVyLGULSNjUu4pndeQw1eSG5zoF2wCZxqu" ], "script": "base64:BgI7CAISABIAEgUKAwEBARIGCgQICAgIEgMKAQgSBgoECAEBARIECgIIARIECgIIARIECgIIARIFCgMBCAg3AA1rX2luaXRpYWxpemVkAg1rX2luaXRpYWxpemVkAAhrX3BhdXNlZAIIa19wYXVzZWQABWtfZmVlAgVrX2ZlZQAIa19yZWJhdGUCCGtfcmViYXRlABVrX2ZlZVRvU3Rha2Vyc1BlcmNlbnQCFWtfZmVlVG9TdGFrZXJzUGVyY2VudAAUa19jb29yZGluYXRvckFkZHJlc3MCFGtfY29vcmRpbmF0b3JBZGRyZXNzAA5rX3Jld2FyZF9hc3NldAIOa19yZXdhcmRfYXNzZXQADmtfc3dhcF9hZGRyZXNzAg5rX3N3YXBfYWRkcmVzcwARa19zdGFraW5nX2FkZHJlc3MCEWtfc3Rha2luZ19hZGRyZXNzAA9rX2V4Y2Vzc0JhbGFuY2UCD2tfZXhjZXNzQmFsYW5jZQANa19mcmVlQmFsYW5jZQINa19mcmVlQmFsYW5jZQAUa19tYXhTcG90VXRpbGl6YXRpb24CFGtfbWF4U3BvdFV0aWxpemF0aW9uABBr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YW5jZVVTRAkAzAgCCQCkAwEFC3ByaWNlSW1wYWN0BQNuaWwCASwJAAIBBQRkYXRhCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAQOY29vcmRpbmF0b3JTdHIJAJ0IAgUEdGhpcwUUa19jb29yZGluYXRvckFkZHJlc3MDCQEJaXNEZWZpbmVkAQUOY29vcmRpbmF0b3JTdHIEBWFkbWluCQCdCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEJAQV2YWx1ZQEFDmNvb3JkaW5hdG9yU3RyBQ9rX2FkbWluX2FkZHJlc3MDCQEJaXNEZWZpbmVkAQUFYWRtaW4JAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQkBBXZhbHVlAQUFYWRtaW4JAKwCAgkArAICCQCsAgICB3N0YXR1c18JAKUIAQUEdGhpcwIBXwkA2AQBCAUCdHgCaWQHCQACAQIudW5hYmxlIHRvIHZlcmlmeTogYWRtaW4gbm90IHNldCBpbiBjb29yZGluYXRvcgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleVdkAxE=", "height": 2695966, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CmwuR2kWyenmUFDs9cwBVzwkYLEAT532bZ5Rir33Ro38 Next: none Diff:
OldNewDifferences
217217 let s1 = invoke(sellMarket, "swapToQuote", [sourceAmountInAmmDecimals, 0], nil)
218218 if ((s1 == s1))
219219 then {
220- let usdAmount = match s1 {
221- case t: Int =>
220+ let $t072777442 = match s1 {
221+ case t: (Int, Int) =>
222222 t
223223 case _ =>
224224 throw("Invalid swapToQuote result")
225225 }
226+ let usdAmount = $t072777442._1
227+ let usdPriceImpact = $t072777442._2
226228 let buyMarket = getMarket(_targetAsset)
227229 let s2 = invoke(buyMarket, "swapToBase", [usdAmount, 0], nil)
228230 if ((s2 == s2))
229231 then {
230- let targetAmount = match s2 {
231- case t: Int =>
232- if ((targetDecimals == 8))
233- then (t * 100)
232+ let $t075768081 = match s2 {
233+ case t: (Int, Int) =>
234+ let _targetAmount = if ((targetDecimals == 8))
235+ then (t._1 * 100)
234236 else if ((targetDecimals == 6))
235- then t
237+ then t._1
236238 else throw("Invalid decimals (target)")
239+ let _targetPriceImpact = t._2
240+ $Tuple2(_targetAmount, _targetPriceImpact)
237241 case _ =>
238242 throw("Invalid swapToBase result")
239243 }
244+ let targetAmount = $t075768081._1
245+ let targetPriceImpact = $t075768081._2
240246 let vaultToAdd = getVault(_assetId)
241- let $t078628027 = getImbalanceCostUSD(vaultToAdd, sellMarket, sourceDecimals, _amount)
242- let addImbalanceUSD = $t078628027._1
243- let addVaultBalanceUSD = $t078628027._2
247+ let $t081228287 = getImbalanceCostUSD(vaultToAdd, sellMarket, sourceDecimals, _amount)
248+ let addImbalanceUSD = $t081228287._1
249+ let addVaultBalanceUSD = $t081228287._2
244250 let vaultToRemove = getVault(_targetAsset)
245- let $t080758311 = getImbalanceCostUSD(vaultToRemove, buyMarket, targetDecimals, -(targetAmount))
246- let removeImbalanceUSD = $t080758311._1
247- let removeVaultBalanceUSD = $t080758311._2
251+ let $t083358571 = getImbalanceCostUSD(vaultToRemove, buyMarket, targetDecimals, -(targetAmount))
252+ let removeImbalanceUSD = $t083358571._1
253+ let removeVaultBalanceUSD = $t083358571._2
248254 let resultImbalanceInUSD = (addImbalanceUSD + removeImbalanceUSD)
249255 let baseFee = fee()
250256 let totalLiquid = (addVaultBalanceUSD + removeVaultBalanceUSD)
251- let $t084658948 = if ((0 > resultImbalanceInUSD))
257+ let $t087259208 = if ((0 > resultImbalanceInUSD))
252258 then {
253259 let rebateRate = divd(abs(resultImbalanceInUSD), totalLiquid)
254260 let rebate = muld(feeRebate(), rebateRate)
263269 let actualFee = (baseFee + tax)
264270 $Tuple3(actualFee, 0, tax)
265271 }
266- let actualFee = $t084658948._1
267- let rebate = $t084658948._2
268- let tax = $t084658948._3
272+ let actualFee = $t087259208._1
273+ let rebate = $t087259208._2
274+ let tax = $t087259208._3
269275 let feeInTargetToken = muld(targetAmount, actualFee)
270276 let resultTargetAssetAmount = (targetAmount - feeInTargetToken)
271- $Tuple13(targetAmount, feeInTargetToken, resultTargetAssetAmount, baseFee, actualFee, rebate, tax, vaultToRemove, vaultToAdd, addImbalanceUSD, addVaultBalanceUSD, removeImbalanceUSD, removeVaultBalanceUSD)
277+ let priceImpact = (usdPriceImpact + targetPriceImpact)
278+ $Tuple14(targetAmount, feeInTargetToken, resultTargetAssetAmount, baseFee, actualFee, rebate, tax, vaultToRemove, vaultToAdd, addImbalanceUSD, addVaultBalanceUSD, removeImbalanceUSD, removeVaultBalanceUSD, priceImpact)
272279 }
273280 else throw("Strict value is not equal to itself.")
274281 }
282289 let maxPriceSpread = getMaxPriceSpread(_amm)
283290 let actualLiquidityInBaseAsset = muld(vaultReserve, vaultUtilization)
284291 let newBaseAssetAmount = divd((actualLiquidityInBaseAsset - muld(maxPriceSpread, actualLiquidityInBaseAsset)), maxPriceSpread)
285- let $t098339919 = getOldProjectedLiquidityAndTerminalPrice(_amm)
286- if (($t098339919 == $t098339919))
292+ let $t01020310289 = getOldProjectedLiquidityAndTerminalPrice(_amm)
293+ if (($t01020310289 == $t01020310289))
287294 then {
288- let q = $t098339919._3
289- let price = $t098339919._2
290- let oldBaseAssetAmount = $t098339919._1
295+ let q = $t01020310289._3
296+ let price = $t01020310289._2
297+ let oldBaseAssetAmount = $t01020310289._1
291298 let baseAssetAmountDelta = (newBaseAssetAmount - oldBaseAssetAmount)
292299 let quoteAssetChange = divd(muld(baseAssetAmountDelta, price), q)
293300 $Tuple2(baseAssetAmountDelta, quoteAssetChange)
391398 else true
392399 if ((checkNotSameAsset == checkNotSameAsset))
393400 then {
394- let $t01361013929 = estimateSwap(_amount, assetId, _targetAsset)
395- if (($t01361013929 == $t01361013929))
401+ let $t01398014299 = estimateSwap(_amount, assetId, _targetAsset)
402+ if (($t01398014299 == $t01398014299))
396403 then {
397- let vaultToAdd = $t01361013929._9
398- let vaultToRemove = $t01361013929._8
399- let tax = $t01361013929._7
400- let rebate = $t01361013929._6
401- let actualFee = $t01361013929._5
402- let baseFee = $t01361013929._4
403- let resultTargetAssetAmount = $t01361013929._3
404- let feeInTargetToken = $t01361013929._2
405- let targetAmount = $t01361013929._1
404+ let vaultToAdd = $t01398014299._9
405+ let vaultToRemove = $t01398014299._8
406+ let tax = $t01398014299._7
407+ let rebate = $t01398014299._6
408+ let actualFee = $t01398014299._5
409+ let baseFee = $t01398014299._4
410+ let resultTargetAssetAmount = $t01398014299._3
411+ let feeInTargetToken = $t01398014299._2
412+ let targetAmount = $t01398014299._1
406413 let doDeposit = invoke(vaultToAdd, "repay", nil, [i.payments[0]])
407414 if ((doDeposit == doDeposit))
408415 then {
463470 then if ((i.caller != vault))
464471 then throw("Invalid notifyVaultBalanceChange params")
465472 else {
466- let $t01584415960 = estimateProjectedLiquidity(value(vault), value(market), _change)
467- if (($t01584415960 == $t01584415960))
473+ let $t01621416330 = estimateProjectedLiquidity(value(vault), value(market), _change)
474+ if (($t01621416330 == $t01621416330))
468475 then {
469- let quoteAssetChange = $t01584415960._2
470- let baseAssetAmountDelta = $t01584415960._1
476+ let quoteAssetChange = $t01621416330._2
477+ let baseAssetAmountDelta = $t01621416330._1
471478 let result = invoke(value(market), "changeLiquidity", [quoteAssetChange], nil)
472479 if ((result == result))
473480 then nil
484491 func view_estimateProjectedLiquidity (_asset,_change) = {
485492 let market = getMarket(_asset)
486493 let vault = getVault(_asset)
487- let $t01624816348 = estimateProjectedLiquidity(vault, market, _change)
488- if (($t01624816348 == $t01624816348))
494+ let $t01661816718 = estimateProjectedLiquidity(vault, market, _change)
495+ if (($t01661816718 == $t01661816718))
489496 then {
490- let quoteAssetChange = $t01624816348._2
491- let baseAssetAmountDelta = $t01624816348._1
497+ let quoteAssetChange = $t01661816718._2
498+ let baseAssetAmountDelta = $t01661816718._1
492499 let data = makeString([toString(baseAssetAmountDelta), toString(quoteAssetChange)], ",")
493500 throw(data)
494501 }
499506
500507 @Callable(i)
501508 func view_estimateSwap (_sourceAmount,_sourceAsset,_targetAsset) = {
502- let $t01659116916 = estimateSwap(_sourceAmount, _sourceAsset, _targetAsset)
503- if (($t01659116916 == $t01659116916))
509+ let $t01696117303 = estimateSwap(_sourceAmount, _sourceAsset, _targetAsset)
510+ if (($t01696117303 == $t01696117303))
504511 then {
505- let removeVaultBalanceUSD = $t01659116916._13
506- let removeImbalanceUSD = $t01659116916._12
507- let addVaultBalanceUSD = $t01659116916._11
508- let addImbalanceUSD = $t01659116916._10
509- let vaultToAdd = $t01659116916._9
510- let vaultToRemove = $t01659116916._8
511- let tax = $t01659116916._7
512- let rebate = $t01659116916._6
513- let actualFee = $t01659116916._5
514- let baseFee = $t01659116916._4
515- let resultTargetAssetAmount = $t01659116916._3
516- let feeInTargetToken = $t01659116916._2
517- let targetAmount = $t01659116916._1
518- let data = makeString([toString(targetAmount), toString(feeInTargetToken), toString(resultTargetAssetAmount), toString(baseFee), toString(actualFee), toString(rebate), toString(tax), toString(addImbalanceUSD), toString(addVaultBalanceUSD), toString(removeImbalanceUSD), toString(removeVaultBalanceUSD)], ",")
512+ let priceImpact = $t01696117303._14
513+ let removeVaultBalanceUSD = $t01696117303._13
514+ let removeImbalanceUSD = $t01696117303._12
515+ let addVaultBalanceUSD = $t01696117303._11
516+ let addImbalanceUSD = $t01696117303._10
517+ let vaultToAdd = $t01696117303._9
518+ let vaultToRemove = $t01696117303._8
519+ let tax = $t01696117303._7
520+ let rebate = $t01696117303._6
521+ let actualFee = $t01696117303._5
522+ let baseFee = $t01696117303._4
523+ let resultTargetAssetAmount = $t01696117303._3
524+ let feeInTargetToken = $t01696117303._2
525+ let targetAmount = $t01696117303._1
526+ let data = makeString([toString(targetAmount), toString(feeInTargetToken), toString(resultTargetAssetAmount), toString(baseFee), toString(actualFee), toString(rebate), toString(tax), toString(addImbalanceUSD), toString(addVaultBalanceUSD), toString(removeImbalanceUSD), toString(removeVaultBalanceUSD), toString(priceImpact)], ",")
519527 throw(data)
520528 }
521529 else throw("Strict value is not equal to itself.")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let k_initialized = "k_initialized"
55
66 let k_paused = "k_paused"
77
88 let k_fee = "k_fee"
99
1010 let k_rebate = "k_rebate"
1111
1212 let k_feeToStakersPercent = "k_feeToStakersPercent"
1313
1414 let k_coordinatorAddress = "k_coordinatorAddress"
1515
1616 let k_reward_asset = "k_reward_asset"
1717
1818 let k_swap_address = "k_swap_address"
1919
2020 let k_staking_address = "k_staking_address"
2121
2222 let k_excessBalance = "k_excessBalance"
2323
2424 let k_freeBalance = "k_freeBalance"
2525
2626 let k_maxSpotUtilization = "k_maxSpotUtilization"
2727
2828 let k_maxPriceSpread = "k_maxPriceSpread"
2929
3030 let k_baseAssetReserve = "k_bsAstR"
3131
3232 let k_quoteAssetWeight = "k_qtAstW"
3333
3434 let k_totalPositionSize = "k_totalPositionSize"
3535
3636 let k_amm = "k_amm"
3737
3838 let k_vault = "k_vault"
3939
4040 let k_amm_data = "k_amm_data"
4141
4242 let k_asset_vault = "k_asset_vault"
4343
4444 let k_asset_amm = "k_asset_amm"
4545
4646 let k_admin_address = "k_admin_address"
4747
4848 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
4949
5050
5151 func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set")
5252
5353
5454 func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address))
5555
5656
5757 func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Staking not set")
5858
5959
6060 func rewardAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_reward_asset), "Reward asset not set"))
6161
6262
6363 func swapAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_swap_address), "Swap address not set")), "Swap address invalid")
6464
6565
6666 func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address")))
6767
6868
6969 let DECIMAL_NUMBERS = 6
7070
7171 let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10))
7272
7373 func s (_x) = (toString(_x) + ",")
7474
7575
7676 func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN)
7777
7878
7979 func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN)
8080
8181
8282 func abs (_x) = if ((_x > 0))
8383 then _x
8484 else -(_x)
8585
8686
8787 func vmax (_x,_y) = if ((_x >= _y))
8888 then _x
8989 else _y
9090
9191
9292 func vmin (_x,_y) = if ((_y >= _x))
9393 then _x
9494 else _y
9595
9696
9797 func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k))
9898
9999
100100 func fee () = int(k_fee)
101101
102102
103103 func feeRebate () = int(k_rebate)
104104
105105
106106 func feeToStakersPercent () = int(k_feeToStakersPercent)
107107
108108
109109 func getMarketMaybe (_assetId) = {
110110 let addressStr = getString(this, toCompositeKey(k_asset_amm, _assetId))
111111 if (isDefined(addressStr))
112112 then valueOrErrorMessage(addressFromString(value(addressStr)), ("Invalid vault address for: " + _assetId))
113113 else unit
114114 }
115115
116116
117117 func getVaultMaybe (_assetId) = {
118118 let addressStr = getString(this, toCompositeKey(k_asset_vault, _assetId))
119119 if (isDefined(addressStr))
120120 then valueOrErrorMessage(addressFromString(value(addressStr)), ("Invalid market address for: " + _assetId))
121121 else unit
122122 }
123123
124124
125125 func getMarket (_assetId) = valueOrErrorMessage(getMarketMaybe(_assetId), ("No market for: " + _assetId))
126126
127127
128128 func getVault (_assetId) = valueOrErrorMessage(getVaultMaybe(_assetId), ("No vault for: " + _assetId))
129129
130130
131131 func getExcessBalance (_vault) = valueOrElse(getInteger(_vault, k_excessBalance), 0)
132132
133133
134134 func getFreeBalance (_vault) = valueOrElse(getInteger(_vault, k_freeBalance), 0)
135135
136136
137137 func getMaxUtilization (_vault) = valueOrErrorMessage(getInteger(_vault, k_maxSpotUtilization), ("Max spot utilization not set for: " + toString(_vault)))
138138
139139
140140 func getMaxPriceSpread (_amm) = valueOrErrorMessage(getInteger(_amm, k_maxPriceSpread), ("Max price spread not set for: " + toString(_amm)))
141141
142142
143143 func getOldProjectedLiquidityAndTerminalPrice (_amm) = {
144144 let sync = invoke(_amm, "syncTerminalPriceToOracle", nil, nil)
145145 if ((sync == sync))
146146 then {
147147 let priceR = invoke(_amm, "computeTerminalAmmPrice", nil, nil)
148148 if ((priceR == priceR))
149149 then {
150150 let price = match priceR {
151151 case t: Int =>
152152 t
153153 case _ =>
154154 throw(("Invalid computeTerminalAmmPrice result for " + toString(_amm)))
155155 }
156156 let currentBaseAssetAmount = valueOrErrorMessage(getInteger(_amm, k_baseAssetReserve), ((("Key " + k_baseAssetReserve) + " not set for ") + toString(_amm)))
157157 if ((currentBaseAssetAmount == currentBaseAssetAmount))
158158 then {
159159 let baseAssetAmountDelta = valueOrElse(getInteger(_amm, k_totalPositionSize), 0)
160160 if ((baseAssetAmountDelta == baseAssetAmountDelta))
161161 then {
162162 let quoteAssetWeight = valueOrElse(getInteger(_amm, k_quoteAssetWeight), DECIMAL_UNIT)
163163 if ((quoteAssetWeight == quoteAssetWeight))
164164 then $Tuple3((currentBaseAssetAmount + baseAssetAmountDelta), price, quoteAssetWeight)
165165 else throw("Strict value is not equal to itself.")
166166 }
167167 else throw("Strict value is not equal to itself.")
168168 }
169169 else throw("Strict value is not equal to itself.")
170170 }
171171 else throw("Strict value is not equal to itself.")
172172 }
173173 else throw("Strict value is not equal to itself.")
174174 }
175175
176176
177177 func getImbalanceCostUSD (_vault,_amm,_decimals,_amount) = {
178178 let amount = if ((_decimals == 8))
179179 then _amount
180180 else if ((_decimals == 6))
181181 then (_amount * 100)
182182 else throw("Invalid decimals")
183183 let oldImbalance = getExcessBalance(_vault)
184184 let newImbalance = (oldImbalance + amount)
185185 let imbalanceDeltaInAmmDecimals = ((abs(newImbalance) - abs(oldImbalance)) / 100)
186186 let priceR = invoke(_amm, "computeSpotPrice", nil, nil)
187187 if ((priceR == priceR))
188188 then {
189189 let price = match priceR {
190190 case t: Int =>
191191 t
192192 case _ =>
193193 throw(("Invalid computeSpotPrice result for " + toString(_amm)))
194194 }
195195 let imbalanceDeltaInUSD = muld(imbalanceDeltaInAmmDecimals, price)
196196 let freeBalanceInAmmDecimal = (getFreeBalance(_vault) / 100)
197197 let vaultBalanceInUSD = muld(freeBalanceInAmmDecimal, price)
198198 $Tuple2(imbalanceDeltaInUSD, vaultBalanceInUSD)
199199 }
200200 else throw("Strict value is not equal to itself.")
201201 }
202202
203203
204204 func estimateSwap (_amount,_assetId,_targetAsset) = {
205205 let sourceDecimals = if ((_assetId == "WAVES"))
206206 then 8
207207 else valueOrErrorMessage(assetInfo(fromBase58String(_assetId)), ("Invalid asset: " + _assetId)).decimals
208208 let targetDecimals = if ((_targetAsset == "WAVES"))
209209 then 8
210210 else valueOrErrorMessage(assetInfo(fromBase58String(_targetAsset)), ("Invalid asset: " + _targetAsset)).decimals
211211 let sourceAmountInAmmDecimals = if ((sourceDecimals == 8))
212212 then (_amount / 100)
213213 else if ((sourceDecimals == 6))
214214 then _amount
215215 else throw("Invalid decimals (source)")
216216 let sellMarket = getMarket(_assetId)
217217 let s1 = invoke(sellMarket, "swapToQuote", [sourceAmountInAmmDecimals, 0], nil)
218218 if ((s1 == s1))
219219 then {
220- let usdAmount = match s1 {
221- case t: Int =>
220+ let $t072777442 = match s1 {
221+ case t: (Int, Int) =>
222222 t
223223 case _ =>
224224 throw("Invalid swapToQuote result")
225225 }
226+ let usdAmount = $t072777442._1
227+ let usdPriceImpact = $t072777442._2
226228 let buyMarket = getMarket(_targetAsset)
227229 let s2 = invoke(buyMarket, "swapToBase", [usdAmount, 0], nil)
228230 if ((s2 == s2))
229231 then {
230- let targetAmount = match s2 {
231- case t: Int =>
232- if ((targetDecimals == 8))
233- then (t * 100)
232+ let $t075768081 = match s2 {
233+ case t: (Int, Int) =>
234+ let _targetAmount = if ((targetDecimals == 8))
235+ then (t._1 * 100)
234236 else if ((targetDecimals == 6))
235- then t
237+ then t._1
236238 else throw("Invalid decimals (target)")
239+ let _targetPriceImpact = t._2
240+ $Tuple2(_targetAmount, _targetPriceImpact)
237241 case _ =>
238242 throw("Invalid swapToBase result")
239243 }
244+ let targetAmount = $t075768081._1
245+ let targetPriceImpact = $t075768081._2
240246 let vaultToAdd = getVault(_assetId)
241- let $t078628027 = getImbalanceCostUSD(vaultToAdd, sellMarket, sourceDecimals, _amount)
242- let addImbalanceUSD = $t078628027._1
243- let addVaultBalanceUSD = $t078628027._2
247+ let $t081228287 = getImbalanceCostUSD(vaultToAdd, sellMarket, sourceDecimals, _amount)
248+ let addImbalanceUSD = $t081228287._1
249+ let addVaultBalanceUSD = $t081228287._2
244250 let vaultToRemove = getVault(_targetAsset)
245- let $t080758311 = getImbalanceCostUSD(vaultToRemove, buyMarket, targetDecimals, -(targetAmount))
246- let removeImbalanceUSD = $t080758311._1
247- let removeVaultBalanceUSD = $t080758311._2
251+ let $t083358571 = getImbalanceCostUSD(vaultToRemove, buyMarket, targetDecimals, -(targetAmount))
252+ let removeImbalanceUSD = $t083358571._1
253+ let removeVaultBalanceUSD = $t083358571._2
248254 let resultImbalanceInUSD = (addImbalanceUSD + removeImbalanceUSD)
249255 let baseFee = fee()
250256 let totalLiquid = (addVaultBalanceUSD + removeVaultBalanceUSD)
251- let $t084658948 = if ((0 > resultImbalanceInUSD))
257+ let $t087259208 = if ((0 > resultImbalanceInUSD))
252258 then {
253259 let rebateRate = divd(abs(resultImbalanceInUSD), totalLiquid)
254260 let rebate = muld(feeRebate(), rebateRate)
255261 let actualFee = if ((rebate > baseFee))
256262 then 0
257263 else (baseFee - rebate)
258264 $Tuple3(actualFee, rebate, 0)
259265 }
260266 else {
261267 let taxRate = divd(abs(resultImbalanceInUSD), totalLiquid)
262268 let tax = muld(feeRebate(), taxRate)
263269 let actualFee = (baseFee + tax)
264270 $Tuple3(actualFee, 0, tax)
265271 }
266- let actualFee = $t084658948._1
267- let rebate = $t084658948._2
268- let tax = $t084658948._3
272+ let actualFee = $t087259208._1
273+ let rebate = $t087259208._2
274+ let tax = $t087259208._3
269275 let feeInTargetToken = muld(targetAmount, actualFee)
270276 let resultTargetAssetAmount = (targetAmount - feeInTargetToken)
271- $Tuple13(targetAmount, feeInTargetToken, resultTargetAssetAmount, baseFee, actualFee, rebate, tax, vaultToRemove, vaultToAdd, addImbalanceUSD, addVaultBalanceUSD, removeImbalanceUSD, removeVaultBalanceUSD)
277+ let priceImpact = (usdPriceImpact + targetPriceImpact)
278+ $Tuple14(targetAmount, feeInTargetToken, resultTargetAssetAmount, baseFee, actualFee, rebate, tax, vaultToRemove, vaultToAdd, addImbalanceUSD, addVaultBalanceUSD, removeImbalanceUSD, removeVaultBalanceUSD, priceImpact)
272279 }
273280 else throw("Strict value is not equal to itself.")
274281 }
275282 else throw("Strict value is not equal to itself.")
276283 }
277284
278285
279286 func estimateProjectedLiquidity (_vault,_amm,_change) = {
280287 let vaultReserve = ((getFreeBalance(_vault) / 100) + (_change / 100))
281288 let vaultUtilization = (getMaxUtilization(_vault) / 100)
282289 let maxPriceSpread = getMaxPriceSpread(_amm)
283290 let actualLiquidityInBaseAsset = muld(vaultReserve, vaultUtilization)
284291 let newBaseAssetAmount = divd((actualLiquidityInBaseAsset - muld(maxPriceSpread, actualLiquidityInBaseAsset)), maxPriceSpread)
285- let $t098339919 = getOldProjectedLiquidityAndTerminalPrice(_amm)
286- if (($t098339919 == $t098339919))
292+ let $t01020310289 = getOldProjectedLiquidityAndTerminalPrice(_amm)
293+ if (($t01020310289 == $t01020310289))
287294 then {
288- let q = $t098339919._3
289- let price = $t098339919._2
290- let oldBaseAssetAmount = $t098339919._1
295+ let q = $t01020310289._3
296+ let price = $t01020310289._2
297+ let oldBaseAssetAmount = $t01020310289._1
291298 let baseAssetAmountDelta = (newBaseAssetAmount - oldBaseAssetAmount)
292299 let quoteAssetChange = divd(muld(baseAssetAmountDelta, price), q)
293300 $Tuple2(baseAssetAmountDelta, quoteAssetChange)
294301 }
295302 else throw("Strict value is not equal to itself.")
296303 }
297304
298305
299306 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
300307
301308
302309 func updateSettings (_fee,_rebate,_feeToStakersPercent) = [IntegerEntry(k_fee, _fee), IntegerEntry(k_rebate, _rebate), IntegerEntry(k_feeToStakersPercent, _feeToStakersPercent)]
303310
304311
305312 @Callable(i)
306313 func pause () = if ((i.caller != adminAddress()))
307314 then throw("Invalid pause params")
308315 else [BooleanEntry(k_paused, true)]
309316
310317
311318
312319 @Callable(i)
313320 func unpause () = if ((i.caller != adminAddress()))
314321 then throw("Invalid unpause params")
315322 else [BooleanEntry(k_paused, false)]
316323
317324
318325
319326 @Callable(i)
320327 func changeSettings (_fee,_rebate,_feeToStakersPercent) = if (if (if (if (if (if ((0 >= _fee))
321328 then true
322329 else (0 >= _rebate))
323330 then true
324331 else (0 >= _feeToStakersPercent))
325332 then true
326333 else (_feeToStakersPercent > DECIMAL_UNIT))
327334 then true
328335 else !(initialized()))
329336 then true
330337 else (i.caller != adminAddress()))
331338 then throw("Invalid changeSettings params")
332339 else updateSettings(_fee, _rebate, _feeToStakersPercent)
333340
334341
335342
336343 @Callable(i)
337344 func addAmm (_ammAddress,_vaultAddress,_vaultAsset,_data) = if ((i.caller != adminAddress()))
338345 then throw("Invalid addAmm params")
339346 else {
340347 let ammAddress = getAddressIfValid(_ammAddress)
341348 if ((ammAddress == ammAddress))
342349 then {
343350 let vaultAddress = getAddressIfValid(_vaultAddress)
344351 if ((vaultAddress == vaultAddress))
345352 then [BooleanEntry(toCompositeKey(k_amm, _ammAddress), true), BooleanEntry(toCompositeKey(k_vault, _vaultAddress), true), StringEntry(toCompositeKey(k_asset_vault, _vaultAsset), _vaultAddress), StringEntry(toCompositeKey(k_asset_amm, _vaultAsset), _ammAddress), StringEntry(toCompositeKey(k_amm_data, _ammAddress), _data)]
346353 else throw("Strict value is not equal to itself.")
347354 }
348355 else throw("Strict value is not equal to itself.")
349356 }
350357
351358
352359
353360 @Callable(i)
354361 func removeAmm (_ammAddress) = if ((i.caller != adminAddress()))
355362 then throw("Invalid removeAmm params")
356363 else [DeleteEntry(toCompositeKey(k_amm, _ammAddress))]
357364
358365
359366
360367 @Callable(i)
361368 func initialize (_coordinator,_fee,_rebate,_feeToStakersPercent) = if (if (if (if (if (if ((0 >= _fee))
362369 then true
363370 else (0 >= _rebate))
364371 then true
365372 else (0 >= _feeToStakersPercent))
366373 then true
367374 else (_feeToStakersPercent > DECIMAL_UNIT))
368375 then true
369376 else initialized())
370377 then true
371378 else (i.caller != this))
372379 then throw("Invalid initialize parameters")
373380 else (updateSettings(_fee, _rebate, _feeToStakersPercent) ++ [BooleanEntry(k_initialized, true), StringEntry(k_coordinatorAddress, toString(addressFromStringValue(_coordinator)))])
374381
375382
376383
377384 @Callable(i)
378385 func swap (_targetAsset,_minTargetAmount) = {
379386 let checkPaymentCount = if ((size(i.payments) != 1))
380387 then throw("Invalid swap params: payment count")
381388 else true
382389 if ((checkPaymentCount == checkPaymentCount))
383390 then {
384391 let _amount = i.payments[0].amount
385392 let _assetId = i.payments[0].assetId
386393 let assetId = if (isDefined(_assetId))
387394 then toBase58String(value(_assetId))
388395 else "WAVES"
389396 let checkNotSameAsset = if ((_targetAsset == assetId))
390397 then throw("Invalid swap params: same asset")
391398 else true
392399 if ((checkNotSameAsset == checkNotSameAsset))
393400 then {
394- let $t01361013929 = estimateSwap(_amount, assetId, _targetAsset)
395- if (($t01361013929 == $t01361013929))
401+ let $t01398014299 = estimateSwap(_amount, assetId, _targetAsset)
402+ if (($t01398014299 == $t01398014299))
396403 then {
397- let vaultToAdd = $t01361013929._9
398- let vaultToRemove = $t01361013929._8
399- let tax = $t01361013929._7
400- let rebate = $t01361013929._6
401- let actualFee = $t01361013929._5
402- let baseFee = $t01361013929._4
403- let resultTargetAssetAmount = $t01361013929._3
404- let feeInTargetToken = $t01361013929._2
405- let targetAmount = $t01361013929._1
404+ let vaultToAdd = $t01398014299._9
405+ let vaultToRemove = $t01398014299._8
406+ let tax = $t01398014299._7
407+ let rebate = $t01398014299._6
408+ let actualFee = $t01398014299._5
409+ let baseFee = $t01398014299._4
410+ let resultTargetAssetAmount = $t01398014299._3
411+ let feeInTargetToken = $t01398014299._2
412+ let targetAmount = $t01398014299._1
406413 let doDeposit = invoke(vaultToAdd, "repay", nil, [i.payments[0]])
407414 if ((doDeposit == doDeposit))
408415 then {
409416 let doWithdraw = invoke(vaultToRemove, "borrow", [targetAmount], nil)
410417 if ((doWithdraw == doWithdraw))
411418 then {
412419 let targetAsset = if ((_targetAsset == "WAVES"))
413420 then unit
414421 else fromBase58String(_targetAsset)
415422 let stakerFeeInTargetToken = muld(feeInTargetToken, feeToStakersPercent())
416423 let lpFeeInTargetToken = (feeInTargetToken - stakerFeeInTargetToken)
417424 let doCollectFee = invoke(vaultToRemove, "addFree", nil, [AttachedPayment(targetAsset, lpFeeInTargetToken)])
418425 if ((doCollectFee == doCollectFee))
419426 then {
420427 let rewards = if (if ((targetAsset == rewardAsset()))
421428 then true
422429 else (stakerFeeInTargetToken == 0))
423430 then stakerFeeInTargetToken
424431 else {
425432 let doSwap = invoke(swapAddress(), "swap", [toBase58String(rewardAsset()), 0], [AttachedPayment(targetAsset, stakerFeeInTargetToken)])
426433 if ((doSwap == doSwap))
427434 then {
428435 let rewards = assetBalance(this, rewardAsset())
429436 if ((rewards == rewards))
430437 then rewards
431438 else throw("Strict value is not equal to itself.")
432439 }
433440 else throw("Strict value is not equal to itself.")
434441 }
435442 if ((rewards == rewards))
436443 then if ((_minTargetAmount > resultTargetAssetAmount))
437444 then throw(((("Can not swap due to slippage: " + toString(resultTargetAssetAmount)) + " < ") + toString(_minTargetAmount)))
438445 else $Tuple2([ScriptTransfer(i.caller, resultTargetAssetAmount, targetAsset), ScriptTransfer(stakingAddress(), rewards, rewardAsset())], $Tuple6(_amount, resultTargetAssetAmount, baseFee, actualFee, rebate, tax))
439446 else throw("Strict value is not equal to itself.")
440447 }
441448 else throw("Strict value is not equal to itself.")
442449 }
443450 else throw("Strict value is not equal to itself.")
444451 }
445452 else throw("Strict value is not equal to itself.")
446453 }
447454 else throw("Strict value is not equal to itself.")
448455 }
449456 else throw("Strict value is not equal to itself.")
450457 }
451458 else throw("Strict value is not equal to itself.")
452459 }
453460
454461
455462
456463 @Callable(i)
457464 func notifyVaultBalanceChange (_asset,_change) = {
458465 let market = getMarketMaybe(_asset)
459466 let vault = getVaultMaybe(_asset)
460467 if (if (isDefined(market))
461468 then isDefined(vault)
462469 else false)
463470 then if ((i.caller != vault))
464471 then throw("Invalid notifyVaultBalanceChange params")
465472 else {
466- let $t01584415960 = estimateProjectedLiquidity(value(vault), value(market), _change)
467- if (($t01584415960 == $t01584415960))
473+ let $t01621416330 = estimateProjectedLiquidity(value(vault), value(market), _change)
474+ if (($t01621416330 == $t01621416330))
468475 then {
469- let quoteAssetChange = $t01584415960._2
470- let baseAssetAmountDelta = $t01584415960._1
476+ let quoteAssetChange = $t01621416330._2
477+ let baseAssetAmountDelta = $t01621416330._1
471478 let result = invoke(value(market), "changeLiquidity", [quoteAssetChange], nil)
472479 if ((result == result))
473480 then nil
474481 else throw("Strict value is not equal to itself.")
475482 }
476483 else throw("Strict value is not equal to itself.")
477484 }
478485 else nil
479486 }
480487
481488
482489
483490 @Callable(i)
484491 func view_estimateProjectedLiquidity (_asset,_change) = {
485492 let market = getMarket(_asset)
486493 let vault = getVault(_asset)
487- let $t01624816348 = estimateProjectedLiquidity(vault, market, _change)
488- if (($t01624816348 == $t01624816348))
494+ let $t01661816718 = estimateProjectedLiquidity(vault, market, _change)
495+ if (($t01661816718 == $t01661816718))
489496 then {
490- let quoteAssetChange = $t01624816348._2
491- let baseAssetAmountDelta = $t01624816348._1
497+ let quoteAssetChange = $t01661816718._2
498+ let baseAssetAmountDelta = $t01661816718._1
492499 let data = makeString([toString(baseAssetAmountDelta), toString(quoteAssetChange)], ",")
493500 throw(data)
494501 }
495502 else throw("Strict value is not equal to itself.")
496503 }
497504
498505
499506
500507 @Callable(i)
501508 func view_estimateSwap (_sourceAmount,_sourceAsset,_targetAsset) = {
502- let $t01659116916 = estimateSwap(_sourceAmount, _sourceAsset, _targetAsset)
503- if (($t01659116916 == $t01659116916))
509+ let $t01696117303 = estimateSwap(_sourceAmount, _sourceAsset, _targetAsset)
510+ if (($t01696117303 == $t01696117303))
504511 then {
505- let removeVaultBalanceUSD = $t01659116916._13
506- let removeImbalanceUSD = $t01659116916._12
507- let addVaultBalanceUSD = $t01659116916._11
508- let addImbalanceUSD = $t01659116916._10
509- let vaultToAdd = $t01659116916._9
510- let vaultToRemove = $t01659116916._8
511- let tax = $t01659116916._7
512- let rebate = $t01659116916._6
513- let actualFee = $t01659116916._5
514- let baseFee = $t01659116916._4
515- let resultTargetAssetAmount = $t01659116916._3
516- let feeInTargetToken = $t01659116916._2
517- let targetAmount = $t01659116916._1
518- let data = makeString([toString(targetAmount), toString(feeInTargetToken), toString(resultTargetAssetAmount), toString(baseFee), toString(actualFee), toString(rebate), toString(tax), toString(addImbalanceUSD), toString(addVaultBalanceUSD), toString(removeImbalanceUSD), toString(removeVaultBalanceUSD)], ",")
512+ let priceImpact = $t01696117303._14
513+ let removeVaultBalanceUSD = $t01696117303._13
514+ let removeImbalanceUSD = $t01696117303._12
515+ let addVaultBalanceUSD = $t01696117303._11
516+ let addImbalanceUSD = $t01696117303._10
517+ let vaultToAdd = $t01696117303._9
518+ let vaultToRemove = $t01696117303._8
519+ let tax = $t01696117303._7
520+ let rebate = $t01696117303._6
521+ let actualFee = $t01696117303._5
522+ let baseFee = $t01696117303._4
523+ let resultTargetAssetAmount = $t01696117303._3
524+ let feeInTargetToken = $t01696117303._2
525+ let targetAmount = $t01696117303._1
526+ let data = makeString([toString(targetAmount), toString(feeInTargetToken), toString(resultTargetAssetAmount), toString(baseFee), toString(actualFee), toString(rebate), toString(tax), toString(addImbalanceUSD), toString(addVaultBalanceUSD), toString(removeImbalanceUSD), toString(removeVaultBalanceUSD), toString(priceImpact)], ",")
519527 throw(data)
520528 }
521529 else throw("Strict value is not equal to itself.")
522530 }
523531
524532
525533 @Verifier(tx)
526534 func verify () = {
527535 let coordinatorStr = getString(this, k_coordinatorAddress)
528536 if (isDefined(coordinatorStr))
529537 then {
530538 let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address)
531539 if (isDefined(admin))
532540 then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false)
533541 else throw("unable to verify: admin not set in coordinator")
534542 }
535543 else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
536544 }
537545

github/deemru/w8io/026f985 
125.10 ms