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:BgI7CAISABIAEgUKAwEBARIGCgQICAgIEgMKAQgSBgoECAEBARIECgIIARIECgIIARIECgIIARIFCgMBCAg3AA1rX2luaXRpYWxpemVkAg1rX2luaXRpYWxpemVkAAhrX3BhdXNlZAIIa19wYXVzZWQABWtfZmVlAgVrX2ZlZQAIa19yZWJhdGUCCGtfcmViYXRlABVrX2ZlZVRvU3Rha2Vyc1BlcmNlbnQCFWtfZmVlVG9TdGFrZXJzUGVyY2VudAAUa19jb29yZGluYXRvckFkZHJlc3MCFGtfY29vcmRpbmF0b3JBZGRyZXNzAA5rX3Jld2FyZF9hc3NldAIOa19yZXdhcmRfYXNzZXQADmtfc3dhcF9hZGRyZXNzAg5rX3N3YXBfYWRkcmVzcwARa19zdGFraW5nX2FkZHJlc3MCEWtfc3Rha2luZ19hZGRyZXNzAA9rX2V4Y2Vzc0JhbGFuY2UCD2tfZXhjZXNzQmFsYW5jZQANa19mcmVlQmFsYW5jZQINa19mcmVlQmFsYW5jZQAUa19tYXhTcG90VXRpbGl6YXRpb24CFGtfbWF4U3BvdFV0aWxpemF0aW9uABBrX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W5jZVVTRAkAzAgCCQCkAwEFC3ByaWNlSW1wYWN0BQNuaWwCASwJAAIBBQRkYXRhCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAQOY29vcmRpbmF0b3JTdHIJAJ0IAgUEdGhpcwUUa19jb29yZGluYXRvckFkZHJlc3MDCQEJaXNEZWZpbmVkAQUOY29vcmRpbmF0b3JTdHIEBWFkbWluCQCdCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEJAQV2YWx1ZQEFDmNvb3JkaW5hdG9yU3RyBQ9rX2FkbWluX2FkZHJlc3MDCQEJaXNEZWZpbmVkAQUFYWRtaW4JAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQkBBXZhbHVlAQUFYWRtaW4JAKwCAgkArAICCQCsAgICB3N0YXR1c18JAKUIAQUEdGhpcwIBXwkA2AQBCAUCdHgCaWQHCQACAQIudW5hYmxlIHRvIHZlcmlmeTogYWRtaW4gbm90IHNldCBpbiBjb29yZGluYXRvcgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleVdkAxE=", "height": 2695966, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CmwuR2kWyenmUFDs9cwBVzwkYLEAT532bZ5Rir33Ro38 Next: none Diff:
Old | New | Differences | |
---|---|---|---|
217 | 217 | let s1 = invoke(sellMarket, "swapToQuote", [sourceAmountInAmmDecimals, 0], nil) | |
218 | 218 | if ((s1 == s1)) | |
219 | 219 | then { | |
220 | - | let | |
221 | - | case t: Int => | |
220 | + | let $t072777442 = match s1 { | |
221 | + | case t: (Int, Int) => | |
222 | 222 | t | |
223 | 223 | case _ => | |
224 | 224 | throw("Invalid swapToQuote result") | |
225 | 225 | } | |
226 | + | let usdAmount = $t072777442._1 | |
227 | + | let usdPriceImpact = $t072777442._2 | |
226 | 228 | let buyMarket = getMarket(_targetAsset) | |
227 | 229 | let s2 = invoke(buyMarket, "swapToBase", [usdAmount, 0], nil) | |
228 | 230 | if ((s2 == s2)) | |
229 | 231 | then { | |
230 | - | let | |
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) | |
234 | 236 | else if ((targetDecimals == 6)) | |
235 | - | then t | |
237 | + | then t._1 | |
236 | 238 | else throw("Invalid decimals (target)") | |
239 | + | let _targetPriceImpact = t._2 | |
240 | + | $Tuple2(_targetAmount, _targetPriceImpact) | |
237 | 241 | case _ => | |
238 | 242 | throw("Invalid swapToBase result") | |
239 | 243 | } | |
244 | + | let targetAmount = $t075768081._1 | |
245 | + | let targetPriceImpact = $t075768081._2 | |
240 | 246 | let vaultToAdd = getVault(_assetId) | |
241 | - | let $ | |
242 | - | let addImbalanceUSD = $ | |
243 | - | let addVaultBalanceUSD = $ | |
247 | + | let $t081228287 = getImbalanceCostUSD(vaultToAdd, sellMarket, sourceDecimals, _amount) | |
248 | + | let addImbalanceUSD = $t081228287._1 | |
249 | + | let addVaultBalanceUSD = $t081228287._2 | |
244 | 250 | let vaultToRemove = getVault(_targetAsset) | |
245 | - | let $ | |
246 | - | let removeImbalanceUSD = $ | |
247 | - | let removeVaultBalanceUSD = $ | |
251 | + | let $t083358571 = getImbalanceCostUSD(vaultToRemove, buyMarket, targetDecimals, -(targetAmount)) | |
252 | + | let removeImbalanceUSD = $t083358571._1 | |
253 | + | let removeVaultBalanceUSD = $t083358571._2 | |
248 | 254 | let resultImbalanceInUSD = (addImbalanceUSD + removeImbalanceUSD) | |
249 | 255 | let baseFee = fee() | |
250 | 256 | let totalLiquid = (addVaultBalanceUSD + removeVaultBalanceUSD) | |
251 | - | let $ | |
257 | + | let $t087259208 = if ((0 > resultImbalanceInUSD)) | |
252 | 258 | then { | |
253 | 259 | let rebateRate = divd(abs(resultImbalanceInUSD), totalLiquid) | |
254 | 260 | let rebate = muld(feeRebate(), rebateRate) | |
263 | 269 | let actualFee = (baseFee + tax) | |
264 | 270 | $Tuple3(actualFee, 0, tax) | |
265 | 271 | } | |
266 | - | let actualFee = $ | |
267 | - | let rebate = $ | |
268 | - | let tax = $ | |
272 | + | let actualFee = $t087259208._1 | |
273 | + | let rebate = $t087259208._2 | |
274 | + | let tax = $t087259208._3 | |
269 | 275 | let feeInTargetToken = muld(targetAmount, actualFee) | |
270 | 276 | 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) | |
272 | 279 | } | |
273 | 280 | else throw("Strict value is not equal to itself.") | |
274 | 281 | } | |
282 | 289 | let maxPriceSpread = getMaxPriceSpread(_amm) | |
283 | 290 | let actualLiquidityInBaseAsset = muld(vaultReserve, vaultUtilization) | |
284 | 291 | let newBaseAssetAmount = divd((actualLiquidityInBaseAsset - muld(maxPriceSpread, actualLiquidityInBaseAsset)), maxPriceSpread) | |
285 | - | let $ | |
286 | - | if (($ | |
292 | + | let $t01020310289 = getOldProjectedLiquidityAndTerminalPrice(_amm) | |
293 | + | if (($t01020310289 == $t01020310289)) | |
287 | 294 | then { | |
288 | - | let q = $ | |
289 | - | let price = $ | |
290 | - | let oldBaseAssetAmount = $ | |
295 | + | let q = $t01020310289._3 | |
296 | + | let price = $t01020310289._2 | |
297 | + | let oldBaseAssetAmount = $t01020310289._1 | |
291 | 298 | let baseAssetAmountDelta = (newBaseAssetAmount - oldBaseAssetAmount) | |
292 | 299 | let quoteAssetChange = divd(muld(baseAssetAmountDelta, price), q) | |
293 | 300 | $Tuple2(baseAssetAmountDelta, quoteAssetChange) | |
391 | 398 | else true | |
392 | 399 | if ((checkNotSameAsset == checkNotSameAsset)) | |
393 | 400 | then { | |
394 | - | let $ | |
395 | - | if (($ | |
401 | + | let $t01398014299 = estimateSwap(_amount, assetId, _targetAsset) | |
402 | + | if (($t01398014299 == $t01398014299)) | |
396 | 403 | then { | |
397 | - | let vaultToAdd = $ | |
398 | - | let vaultToRemove = $ | |
399 | - | let tax = $ | |
400 | - | let rebate = $ | |
401 | - | let actualFee = $ | |
402 | - | let baseFee = $ | |
403 | - | let resultTargetAssetAmount = $ | |
404 | - | let feeInTargetToken = $ | |
405 | - | let targetAmount = $ | |
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 | |
406 | 413 | let doDeposit = invoke(vaultToAdd, "repay", nil, [i.payments[0]]) | |
407 | 414 | if ((doDeposit == doDeposit)) | |
408 | 415 | then { | |
463 | 470 | then if ((i.caller != vault)) | |
464 | 471 | then throw("Invalid notifyVaultBalanceChange params") | |
465 | 472 | else { | |
466 | - | let $ | |
467 | - | if (($ | |
473 | + | let $t01621416330 = estimateProjectedLiquidity(value(vault), value(market), _change) | |
474 | + | if (($t01621416330 == $t01621416330)) | |
468 | 475 | then { | |
469 | - | let quoteAssetChange = $ | |
470 | - | let baseAssetAmountDelta = $ | |
476 | + | let quoteAssetChange = $t01621416330._2 | |
477 | + | let baseAssetAmountDelta = $t01621416330._1 | |
471 | 478 | let result = invoke(value(market), "changeLiquidity", [quoteAssetChange], nil) | |
472 | 479 | if ((result == result)) | |
473 | 480 | then nil | |
484 | 491 | func view_estimateProjectedLiquidity (_asset,_change) = { | |
485 | 492 | let market = getMarket(_asset) | |
486 | 493 | let vault = getVault(_asset) | |
487 | - | let $ | |
488 | - | if (($ | |
494 | + | let $t01661816718 = estimateProjectedLiquidity(vault, market, _change) | |
495 | + | if (($t01661816718 == $t01661816718)) | |
489 | 496 | then { | |
490 | - | let quoteAssetChange = $ | |
491 | - | let baseAssetAmountDelta = $ | |
497 | + | let quoteAssetChange = $t01661816718._2 | |
498 | + | let baseAssetAmountDelta = $t01661816718._1 | |
492 | 499 | let data = makeString([toString(baseAssetAmountDelta), toString(quoteAssetChange)], ",") | |
493 | 500 | throw(data) | |
494 | 501 | } | |
499 | 506 | ||
500 | 507 | @Callable(i) | |
501 | 508 | func view_estimateSwap (_sourceAmount,_sourceAsset,_targetAsset) = { | |
502 | - | let $ | |
503 | - | if (($ | |
509 | + | let $t01696117303 = estimateSwap(_sourceAmount, _sourceAsset, _targetAsset) | |
510 | + | if (($t01696117303 == $t01696117303)) | |
504 | 511 | 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)], ",") | |
519 | 527 | throw(data) | |
520 | 528 | } | |
521 | 529 | else throw("Strict value is not equal to itself.") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let k_initialized = "k_initialized" | |
5 | 5 | ||
6 | 6 | let k_paused = "k_paused" | |
7 | 7 | ||
8 | 8 | let k_fee = "k_fee" | |
9 | 9 | ||
10 | 10 | let k_rebate = "k_rebate" | |
11 | 11 | ||
12 | 12 | let k_feeToStakersPercent = "k_feeToStakersPercent" | |
13 | 13 | ||
14 | 14 | let k_coordinatorAddress = "k_coordinatorAddress" | |
15 | 15 | ||
16 | 16 | let k_reward_asset = "k_reward_asset" | |
17 | 17 | ||
18 | 18 | let k_swap_address = "k_swap_address" | |
19 | 19 | ||
20 | 20 | let k_staking_address = "k_staking_address" | |
21 | 21 | ||
22 | 22 | let k_excessBalance = "k_excessBalance" | |
23 | 23 | ||
24 | 24 | let k_freeBalance = "k_freeBalance" | |
25 | 25 | ||
26 | 26 | let k_maxSpotUtilization = "k_maxSpotUtilization" | |
27 | 27 | ||
28 | 28 | let k_maxPriceSpread = "k_maxPriceSpread" | |
29 | 29 | ||
30 | 30 | let k_baseAssetReserve = "k_bsAstR" | |
31 | 31 | ||
32 | 32 | let k_quoteAssetWeight = "k_qtAstW" | |
33 | 33 | ||
34 | 34 | let k_totalPositionSize = "k_totalPositionSize" | |
35 | 35 | ||
36 | 36 | let k_amm = "k_amm" | |
37 | 37 | ||
38 | 38 | let k_vault = "k_vault" | |
39 | 39 | ||
40 | 40 | let k_amm_data = "k_amm_data" | |
41 | 41 | ||
42 | 42 | let k_asset_vault = "k_asset_vault" | |
43 | 43 | ||
44 | 44 | let k_asset_amm = "k_asset_amm" | |
45 | 45 | ||
46 | 46 | let k_admin_address = "k_admin_address" | |
47 | 47 | ||
48 | 48 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set") | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address)) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Staking not set") | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func rewardAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_reward_asset), "Reward asset not set")) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func swapAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_swap_address), "Swap address not set")), "Swap address invalid") | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | let DECIMAL_NUMBERS = 6 | |
70 | 70 | ||
71 | 71 | let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
72 | 72 | ||
73 | 73 | func s (_x) = (toString(_x) + ",") | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN) | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN) | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func abs (_x) = if ((_x > 0)) | |
83 | 83 | then _x | |
84 | 84 | else -(_x) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func vmax (_x,_y) = if ((_x >= _y)) | |
88 | 88 | then _x | |
89 | 89 | else _y | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func vmin (_x,_y) = if ((_y >= _x)) | |
93 | 93 | then _x | |
94 | 94 | else _y | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k)) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func fee () = int(k_fee) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func feeRebate () = int(k_rebate) | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func feeToStakersPercent () = int(k_feeToStakersPercent) | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func getMarketMaybe (_assetId) = { | |
110 | 110 | let addressStr = getString(this, toCompositeKey(k_asset_amm, _assetId)) | |
111 | 111 | if (isDefined(addressStr)) | |
112 | 112 | then valueOrErrorMessage(addressFromString(value(addressStr)), ("Invalid vault address for: " + _assetId)) | |
113 | 113 | else unit | |
114 | 114 | } | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func getVaultMaybe (_assetId) = { | |
118 | 118 | let addressStr = getString(this, toCompositeKey(k_asset_vault, _assetId)) | |
119 | 119 | if (isDefined(addressStr)) | |
120 | 120 | then valueOrErrorMessage(addressFromString(value(addressStr)), ("Invalid market address for: " + _assetId)) | |
121 | 121 | else unit | |
122 | 122 | } | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | func getMarket (_assetId) = valueOrErrorMessage(getMarketMaybe(_assetId), ("No market for: " + _assetId)) | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | func getVault (_assetId) = valueOrErrorMessage(getVaultMaybe(_assetId), ("No vault for: " + _assetId)) | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func getExcessBalance (_vault) = valueOrElse(getInteger(_vault, k_excessBalance), 0) | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func getFreeBalance (_vault) = valueOrElse(getInteger(_vault, k_freeBalance), 0) | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func getMaxUtilization (_vault) = valueOrErrorMessage(getInteger(_vault, k_maxSpotUtilization), ("Max spot utilization not set for: " + toString(_vault))) | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func getMaxPriceSpread (_amm) = valueOrErrorMessage(getInteger(_amm, k_maxPriceSpread), ("Max price spread not set for: " + toString(_amm))) | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | func getOldProjectedLiquidityAndTerminalPrice (_amm) = { | |
144 | 144 | let sync = invoke(_amm, "syncTerminalPriceToOracle", nil, nil) | |
145 | 145 | if ((sync == sync)) | |
146 | 146 | then { | |
147 | 147 | let priceR = invoke(_amm, "computeTerminalAmmPrice", nil, nil) | |
148 | 148 | if ((priceR == priceR)) | |
149 | 149 | then { | |
150 | 150 | let price = match priceR { | |
151 | 151 | case t: Int => | |
152 | 152 | t | |
153 | 153 | case _ => | |
154 | 154 | throw(("Invalid computeTerminalAmmPrice result for " + toString(_amm))) | |
155 | 155 | } | |
156 | 156 | let currentBaseAssetAmount = valueOrErrorMessage(getInteger(_amm, k_baseAssetReserve), ((("Key " + k_baseAssetReserve) + " not set for ") + toString(_amm))) | |
157 | 157 | if ((currentBaseAssetAmount == currentBaseAssetAmount)) | |
158 | 158 | then { | |
159 | 159 | let baseAssetAmountDelta = valueOrElse(getInteger(_amm, k_totalPositionSize), 0) | |
160 | 160 | if ((baseAssetAmountDelta == baseAssetAmountDelta)) | |
161 | 161 | then { | |
162 | 162 | let quoteAssetWeight = valueOrElse(getInteger(_amm, k_quoteAssetWeight), DECIMAL_UNIT) | |
163 | 163 | if ((quoteAssetWeight == quoteAssetWeight)) | |
164 | 164 | then $Tuple3((currentBaseAssetAmount + baseAssetAmountDelta), price, quoteAssetWeight) | |
165 | 165 | else throw("Strict value is not equal to itself.") | |
166 | 166 | } | |
167 | 167 | else throw("Strict value is not equal to itself.") | |
168 | 168 | } | |
169 | 169 | else throw("Strict value is not equal to itself.") | |
170 | 170 | } | |
171 | 171 | else throw("Strict value is not equal to itself.") | |
172 | 172 | } | |
173 | 173 | else throw("Strict value is not equal to itself.") | |
174 | 174 | } | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func getImbalanceCostUSD (_vault,_amm,_decimals,_amount) = { | |
178 | 178 | let amount = if ((_decimals == 8)) | |
179 | 179 | then _amount | |
180 | 180 | else if ((_decimals == 6)) | |
181 | 181 | then (_amount * 100) | |
182 | 182 | else throw("Invalid decimals") | |
183 | 183 | let oldImbalance = getExcessBalance(_vault) | |
184 | 184 | let newImbalance = (oldImbalance + amount) | |
185 | 185 | let imbalanceDeltaInAmmDecimals = ((abs(newImbalance) - abs(oldImbalance)) / 100) | |
186 | 186 | let priceR = invoke(_amm, "computeSpotPrice", nil, nil) | |
187 | 187 | if ((priceR == priceR)) | |
188 | 188 | then { | |
189 | 189 | let price = match priceR { | |
190 | 190 | case t: Int => | |
191 | 191 | t | |
192 | 192 | case _ => | |
193 | 193 | throw(("Invalid computeSpotPrice result for " + toString(_amm))) | |
194 | 194 | } | |
195 | 195 | let imbalanceDeltaInUSD = muld(imbalanceDeltaInAmmDecimals, price) | |
196 | 196 | let freeBalanceInAmmDecimal = (getFreeBalance(_vault) / 100) | |
197 | 197 | let vaultBalanceInUSD = muld(freeBalanceInAmmDecimal, price) | |
198 | 198 | $Tuple2(imbalanceDeltaInUSD, vaultBalanceInUSD) | |
199 | 199 | } | |
200 | 200 | else throw("Strict value is not equal to itself.") | |
201 | 201 | } | |
202 | 202 | ||
203 | 203 | ||
204 | 204 | func estimateSwap (_amount,_assetId,_targetAsset) = { | |
205 | 205 | let sourceDecimals = if ((_assetId == "WAVES")) | |
206 | 206 | then 8 | |
207 | 207 | else valueOrErrorMessage(assetInfo(fromBase58String(_assetId)), ("Invalid asset: " + _assetId)).decimals | |
208 | 208 | let targetDecimals = if ((_targetAsset == "WAVES")) | |
209 | 209 | then 8 | |
210 | 210 | else valueOrErrorMessage(assetInfo(fromBase58String(_targetAsset)), ("Invalid asset: " + _targetAsset)).decimals | |
211 | 211 | let sourceAmountInAmmDecimals = if ((sourceDecimals == 8)) | |
212 | 212 | then (_amount / 100) | |
213 | 213 | else if ((sourceDecimals == 6)) | |
214 | 214 | then _amount | |
215 | 215 | else throw("Invalid decimals (source)") | |
216 | 216 | let sellMarket = getMarket(_assetId) | |
217 | 217 | let s1 = invoke(sellMarket, "swapToQuote", [sourceAmountInAmmDecimals, 0], nil) | |
218 | 218 | if ((s1 == s1)) | |
219 | 219 | then { | |
220 | - | let | |
221 | - | case t: Int => | |
220 | + | let $t072777442 = match s1 { | |
221 | + | case t: (Int, Int) => | |
222 | 222 | t | |
223 | 223 | case _ => | |
224 | 224 | throw("Invalid swapToQuote result") | |
225 | 225 | } | |
226 | + | let usdAmount = $t072777442._1 | |
227 | + | let usdPriceImpact = $t072777442._2 | |
226 | 228 | let buyMarket = getMarket(_targetAsset) | |
227 | 229 | let s2 = invoke(buyMarket, "swapToBase", [usdAmount, 0], nil) | |
228 | 230 | if ((s2 == s2)) | |
229 | 231 | then { | |
230 | - | let | |
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) | |
234 | 236 | else if ((targetDecimals == 6)) | |
235 | - | then t | |
237 | + | then t._1 | |
236 | 238 | else throw("Invalid decimals (target)") | |
239 | + | let _targetPriceImpact = t._2 | |
240 | + | $Tuple2(_targetAmount, _targetPriceImpact) | |
237 | 241 | case _ => | |
238 | 242 | throw("Invalid swapToBase result") | |
239 | 243 | } | |
244 | + | let targetAmount = $t075768081._1 | |
245 | + | let targetPriceImpact = $t075768081._2 | |
240 | 246 | let vaultToAdd = getVault(_assetId) | |
241 | - | let $ | |
242 | - | let addImbalanceUSD = $ | |
243 | - | let addVaultBalanceUSD = $ | |
247 | + | let $t081228287 = getImbalanceCostUSD(vaultToAdd, sellMarket, sourceDecimals, _amount) | |
248 | + | let addImbalanceUSD = $t081228287._1 | |
249 | + | let addVaultBalanceUSD = $t081228287._2 | |
244 | 250 | let vaultToRemove = getVault(_targetAsset) | |
245 | - | let $ | |
246 | - | let removeImbalanceUSD = $ | |
247 | - | let removeVaultBalanceUSD = $ | |
251 | + | let $t083358571 = getImbalanceCostUSD(vaultToRemove, buyMarket, targetDecimals, -(targetAmount)) | |
252 | + | let removeImbalanceUSD = $t083358571._1 | |
253 | + | let removeVaultBalanceUSD = $t083358571._2 | |
248 | 254 | let resultImbalanceInUSD = (addImbalanceUSD + removeImbalanceUSD) | |
249 | 255 | let baseFee = fee() | |
250 | 256 | let totalLiquid = (addVaultBalanceUSD + removeVaultBalanceUSD) | |
251 | - | let $ | |
257 | + | let $t087259208 = if ((0 > resultImbalanceInUSD)) | |
252 | 258 | then { | |
253 | 259 | let rebateRate = divd(abs(resultImbalanceInUSD), totalLiquid) | |
254 | 260 | let rebate = muld(feeRebate(), rebateRate) | |
255 | 261 | let actualFee = if ((rebate > baseFee)) | |
256 | 262 | then 0 | |
257 | 263 | else (baseFee - rebate) | |
258 | 264 | $Tuple3(actualFee, rebate, 0) | |
259 | 265 | } | |
260 | 266 | else { | |
261 | 267 | let taxRate = divd(abs(resultImbalanceInUSD), totalLiquid) | |
262 | 268 | let tax = muld(feeRebate(), taxRate) | |
263 | 269 | let actualFee = (baseFee + tax) | |
264 | 270 | $Tuple3(actualFee, 0, tax) | |
265 | 271 | } | |
266 | - | let actualFee = $ | |
267 | - | let rebate = $ | |
268 | - | let tax = $ | |
272 | + | let actualFee = $t087259208._1 | |
273 | + | let rebate = $t087259208._2 | |
274 | + | let tax = $t087259208._3 | |
269 | 275 | let feeInTargetToken = muld(targetAmount, actualFee) | |
270 | 276 | 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) | |
272 | 279 | } | |
273 | 280 | else throw("Strict value is not equal to itself.") | |
274 | 281 | } | |
275 | 282 | else throw("Strict value is not equal to itself.") | |
276 | 283 | } | |
277 | 284 | ||
278 | 285 | ||
279 | 286 | func estimateProjectedLiquidity (_vault,_amm,_change) = { | |
280 | 287 | let vaultReserve = ((getFreeBalance(_vault) / 100) + (_change / 100)) | |
281 | 288 | let vaultUtilization = (getMaxUtilization(_vault) / 100) | |
282 | 289 | let maxPriceSpread = getMaxPriceSpread(_amm) | |
283 | 290 | let actualLiquidityInBaseAsset = muld(vaultReserve, vaultUtilization) | |
284 | 291 | let newBaseAssetAmount = divd((actualLiquidityInBaseAsset - muld(maxPriceSpread, actualLiquidityInBaseAsset)), maxPriceSpread) | |
285 | - | let $ | |
286 | - | if (($ | |
292 | + | let $t01020310289 = getOldProjectedLiquidityAndTerminalPrice(_amm) | |
293 | + | if (($t01020310289 == $t01020310289)) | |
287 | 294 | then { | |
288 | - | let q = $ | |
289 | - | let price = $ | |
290 | - | let oldBaseAssetAmount = $ | |
295 | + | let q = $t01020310289._3 | |
296 | + | let price = $t01020310289._2 | |
297 | + | let oldBaseAssetAmount = $t01020310289._1 | |
291 | 298 | let baseAssetAmountDelta = (newBaseAssetAmount - oldBaseAssetAmount) | |
292 | 299 | let quoteAssetChange = divd(muld(baseAssetAmountDelta, price), q) | |
293 | 300 | $Tuple2(baseAssetAmountDelta, quoteAssetChange) | |
294 | 301 | } | |
295 | 302 | else throw("Strict value is not equal to itself.") | |
296 | 303 | } | |
297 | 304 | ||
298 | 305 | ||
299 | 306 | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
300 | 307 | ||
301 | 308 | ||
302 | 309 | func updateSettings (_fee,_rebate,_feeToStakersPercent) = [IntegerEntry(k_fee, _fee), IntegerEntry(k_rebate, _rebate), IntegerEntry(k_feeToStakersPercent, _feeToStakersPercent)] | |
303 | 310 | ||
304 | 311 | ||
305 | 312 | @Callable(i) | |
306 | 313 | func pause () = if ((i.caller != adminAddress())) | |
307 | 314 | then throw("Invalid pause params") | |
308 | 315 | else [BooleanEntry(k_paused, true)] | |
309 | 316 | ||
310 | 317 | ||
311 | 318 | ||
312 | 319 | @Callable(i) | |
313 | 320 | func unpause () = if ((i.caller != adminAddress())) | |
314 | 321 | then throw("Invalid unpause params") | |
315 | 322 | else [BooleanEntry(k_paused, false)] | |
316 | 323 | ||
317 | 324 | ||
318 | 325 | ||
319 | 326 | @Callable(i) | |
320 | 327 | func changeSettings (_fee,_rebate,_feeToStakersPercent) = if (if (if (if (if (if ((0 >= _fee)) | |
321 | 328 | then true | |
322 | 329 | else (0 >= _rebate)) | |
323 | 330 | then true | |
324 | 331 | else (0 >= _feeToStakersPercent)) | |
325 | 332 | then true | |
326 | 333 | else (_feeToStakersPercent > DECIMAL_UNIT)) | |
327 | 334 | then true | |
328 | 335 | else !(initialized())) | |
329 | 336 | then true | |
330 | 337 | else (i.caller != adminAddress())) | |
331 | 338 | then throw("Invalid changeSettings params") | |
332 | 339 | else updateSettings(_fee, _rebate, _feeToStakersPercent) | |
333 | 340 | ||
334 | 341 | ||
335 | 342 | ||
336 | 343 | @Callable(i) | |
337 | 344 | func addAmm (_ammAddress,_vaultAddress,_vaultAsset,_data) = if ((i.caller != adminAddress())) | |
338 | 345 | then throw("Invalid addAmm params") | |
339 | 346 | else { | |
340 | 347 | let ammAddress = getAddressIfValid(_ammAddress) | |
341 | 348 | if ((ammAddress == ammAddress)) | |
342 | 349 | then { | |
343 | 350 | let vaultAddress = getAddressIfValid(_vaultAddress) | |
344 | 351 | if ((vaultAddress == vaultAddress)) | |
345 | 352 | 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)] | |
346 | 353 | else throw("Strict value is not equal to itself.") | |
347 | 354 | } | |
348 | 355 | else throw("Strict value is not equal to itself.") | |
349 | 356 | } | |
350 | 357 | ||
351 | 358 | ||
352 | 359 | ||
353 | 360 | @Callable(i) | |
354 | 361 | func removeAmm (_ammAddress) = if ((i.caller != adminAddress())) | |
355 | 362 | then throw("Invalid removeAmm params") | |
356 | 363 | else [DeleteEntry(toCompositeKey(k_amm, _ammAddress))] | |
357 | 364 | ||
358 | 365 | ||
359 | 366 | ||
360 | 367 | @Callable(i) | |
361 | 368 | func initialize (_coordinator,_fee,_rebate,_feeToStakersPercent) = if (if (if (if (if (if ((0 >= _fee)) | |
362 | 369 | then true | |
363 | 370 | else (0 >= _rebate)) | |
364 | 371 | then true | |
365 | 372 | else (0 >= _feeToStakersPercent)) | |
366 | 373 | then true | |
367 | 374 | else (_feeToStakersPercent > DECIMAL_UNIT)) | |
368 | 375 | then true | |
369 | 376 | else initialized()) | |
370 | 377 | then true | |
371 | 378 | else (i.caller != this)) | |
372 | 379 | then throw("Invalid initialize parameters") | |
373 | 380 | else (updateSettings(_fee, _rebate, _feeToStakersPercent) ++ [BooleanEntry(k_initialized, true), StringEntry(k_coordinatorAddress, toString(addressFromStringValue(_coordinator)))]) | |
374 | 381 | ||
375 | 382 | ||
376 | 383 | ||
377 | 384 | @Callable(i) | |
378 | 385 | func swap (_targetAsset,_minTargetAmount) = { | |
379 | 386 | let checkPaymentCount = if ((size(i.payments) != 1)) | |
380 | 387 | then throw("Invalid swap params: payment count") | |
381 | 388 | else true | |
382 | 389 | if ((checkPaymentCount == checkPaymentCount)) | |
383 | 390 | then { | |
384 | 391 | let _amount = i.payments[0].amount | |
385 | 392 | let _assetId = i.payments[0].assetId | |
386 | 393 | let assetId = if (isDefined(_assetId)) | |
387 | 394 | then toBase58String(value(_assetId)) | |
388 | 395 | else "WAVES" | |
389 | 396 | let checkNotSameAsset = if ((_targetAsset == assetId)) | |
390 | 397 | then throw("Invalid swap params: same asset") | |
391 | 398 | else true | |
392 | 399 | if ((checkNotSameAsset == checkNotSameAsset)) | |
393 | 400 | then { | |
394 | - | let $ | |
395 | - | if (($ | |
401 | + | let $t01398014299 = estimateSwap(_amount, assetId, _targetAsset) | |
402 | + | if (($t01398014299 == $t01398014299)) | |
396 | 403 | then { | |
397 | - | let vaultToAdd = $ | |
398 | - | let vaultToRemove = $ | |
399 | - | let tax = $ | |
400 | - | let rebate = $ | |
401 | - | let actualFee = $ | |
402 | - | let baseFee = $ | |
403 | - | let resultTargetAssetAmount = $ | |
404 | - | let feeInTargetToken = $ | |
405 | - | let targetAmount = $ | |
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 | |
406 | 413 | let doDeposit = invoke(vaultToAdd, "repay", nil, [i.payments[0]]) | |
407 | 414 | if ((doDeposit == doDeposit)) | |
408 | 415 | then { | |
409 | 416 | let doWithdraw = invoke(vaultToRemove, "borrow", [targetAmount], nil) | |
410 | 417 | if ((doWithdraw == doWithdraw)) | |
411 | 418 | then { | |
412 | 419 | let targetAsset = if ((_targetAsset == "WAVES")) | |
413 | 420 | then unit | |
414 | 421 | else fromBase58String(_targetAsset) | |
415 | 422 | let stakerFeeInTargetToken = muld(feeInTargetToken, feeToStakersPercent()) | |
416 | 423 | let lpFeeInTargetToken = (feeInTargetToken - stakerFeeInTargetToken) | |
417 | 424 | let doCollectFee = invoke(vaultToRemove, "addFree", nil, [AttachedPayment(targetAsset, lpFeeInTargetToken)]) | |
418 | 425 | if ((doCollectFee == doCollectFee)) | |
419 | 426 | then { | |
420 | 427 | let rewards = if (if ((targetAsset == rewardAsset())) | |
421 | 428 | then true | |
422 | 429 | else (stakerFeeInTargetToken == 0)) | |
423 | 430 | then stakerFeeInTargetToken | |
424 | 431 | else { | |
425 | 432 | let doSwap = invoke(swapAddress(), "swap", [toBase58String(rewardAsset()), 0], [AttachedPayment(targetAsset, stakerFeeInTargetToken)]) | |
426 | 433 | if ((doSwap == doSwap)) | |
427 | 434 | then { | |
428 | 435 | let rewards = assetBalance(this, rewardAsset()) | |
429 | 436 | if ((rewards == rewards)) | |
430 | 437 | then rewards | |
431 | 438 | else throw("Strict value is not equal to itself.") | |
432 | 439 | } | |
433 | 440 | else throw("Strict value is not equal to itself.") | |
434 | 441 | } | |
435 | 442 | if ((rewards == rewards)) | |
436 | 443 | then if ((_minTargetAmount > resultTargetAssetAmount)) | |
437 | 444 | then throw(((("Can not swap due to slippage: " + toString(resultTargetAssetAmount)) + " < ") + toString(_minTargetAmount))) | |
438 | 445 | else $Tuple2([ScriptTransfer(i.caller, resultTargetAssetAmount, targetAsset), ScriptTransfer(stakingAddress(), rewards, rewardAsset())], $Tuple6(_amount, resultTargetAssetAmount, baseFee, actualFee, rebate, tax)) | |
439 | 446 | else throw("Strict value is not equal to itself.") | |
440 | 447 | } | |
441 | 448 | else throw("Strict value is not equal to itself.") | |
442 | 449 | } | |
443 | 450 | else throw("Strict value is not equal to itself.") | |
444 | 451 | } | |
445 | 452 | else throw("Strict value is not equal to itself.") | |
446 | 453 | } | |
447 | 454 | else throw("Strict value is not equal to itself.") | |
448 | 455 | } | |
449 | 456 | else throw("Strict value is not equal to itself.") | |
450 | 457 | } | |
451 | 458 | else throw("Strict value is not equal to itself.") | |
452 | 459 | } | |
453 | 460 | ||
454 | 461 | ||
455 | 462 | ||
456 | 463 | @Callable(i) | |
457 | 464 | func notifyVaultBalanceChange (_asset,_change) = { | |
458 | 465 | let market = getMarketMaybe(_asset) | |
459 | 466 | let vault = getVaultMaybe(_asset) | |
460 | 467 | if (if (isDefined(market)) | |
461 | 468 | then isDefined(vault) | |
462 | 469 | else false) | |
463 | 470 | then if ((i.caller != vault)) | |
464 | 471 | then throw("Invalid notifyVaultBalanceChange params") | |
465 | 472 | else { | |
466 | - | let $ | |
467 | - | if (($ | |
473 | + | let $t01621416330 = estimateProjectedLiquidity(value(vault), value(market), _change) | |
474 | + | if (($t01621416330 == $t01621416330)) | |
468 | 475 | then { | |
469 | - | let quoteAssetChange = $ | |
470 | - | let baseAssetAmountDelta = $ | |
476 | + | let quoteAssetChange = $t01621416330._2 | |
477 | + | let baseAssetAmountDelta = $t01621416330._1 | |
471 | 478 | let result = invoke(value(market), "changeLiquidity", [quoteAssetChange], nil) | |
472 | 479 | if ((result == result)) | |
473 | 480 | then nil | |
474 | 481 | else throw("Strict value is not equal to itself.") | |
475 | 482 | } | |
476 | 483 | else throw("Strict value is not equal to itself.") | |
477 | 484 | } | |
478 | 485 | else nil | |
479 | 486 | } | |
480 | 487 | ||
481 | 488 | ||
482 | 489 | ||
483 | 490 | @Callable(i) | |
484 | 491 | func view_estimateProjectedLiquidity (_asset,_change) = { | |
485 | 492 | let market = getMarket(_asset) | |
486 | 493 | let vault = getVault(_asset) | |
487 | - | let $ | |
488 | - | if (($ | |
494 | + | let $t01661816718 = estimateProjectedLiquidity(vault, market, _change) | |
495 | + | if (($t01661816718 == $t01661816718)) | |
489 | 496 | then { | |
490 | - | let quoteAssetChange = $ | |
491 | - | let baseAssetAmountDelta = $ | |
497 | + | let quoteAssetChange = $t01661816718._2 | |
498 | + | let baseAssetAmountDelta = $t01661816718._1 | |
492 | 499 | let data = makeString([toString(baseAssetAmountDelta), toString(quoteAssetChange)], ",") | |
493 | 500 | throw(data) | |
494 | 501 | } | |
495 | 502 | else throw("Strict value is not equal to itself.") | |
496 | 503 | } | |
497 | 504 | ||
498 | 505 | ||
499 | 506 | ||
500 | 507 | @Callable(i) | |
501 | 508 | func view_estimateSwap (_sourceAmount,_sourceAsset,_targetAsset) = { | |
502 | - | let $ | |
503 | - | if (($ | |
509 | + | let $t01696117303 = estimateSwap(_sourceAmount, _sourceAsset, _targetAsset) | |
510 | + | if (($t01696117303 == $t01696117303)) | |
504 | 511 | 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)], ",") | |
519 | 527 | throw(data) | |
520 | 528 | } | |
521 | 529 | else throw("Strict value is not equal to itself.") | |
522 | 530 | } | |
523 | 531 | ||
524 | 532 | ||
525 | 533 | @Verifier(tx) | |
526 | 534 | func verify () = { | |
527 | 535 | let coordinatorStr = getString(this, k_coordinatorAddress) | |
528 | 536 | if (isDefined(coordinatorStr)) | |
529 | 537 | then { | |
530 | 538 | let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address) | |
531 | 539 | if (isDefined(admin)) | |
532 | 540 | then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false) | |
533 | 541 | else throw("unable to verify: admin not set in coordinator") | |
534 | 542 | } | |
535 | 543 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
536 | 544 | } | |
537 | 545 |
github/deemru/w8io/026f985 125.10 ms ◑