tx · FpUqhCxdVrAckQS3XYrssKBtFUMMbERUEh11x89LsiYz 3N3DnVffnUyZtz2MRbk5U7giN112WempMNd: -0.03000000 Waves 2023.03.21 14:40 [2499731] smart account 3N3DnVffnUyZtz2MRbk5U7giN112WempMNd > SELF 0.00000000 Waves
{ "type": 13, "id": "FpUqhCxdVrAckQS3XYrssKBtFUMMbERUEh11x89LsiYz", "fee": 3000000, "feeAssetId": null, "timestamp": 1679398818605, "version": 2, "chainId": 84, "sender": "3N3DnVffnUyZtz2MRbk5U7giN112WempMNd", "senderPublicKey": "3c1wAgvTRCNXCGMidVnB1j4gTYUqtwHR9tNNu2v4ZUNk", "proofs": [ "5d1TphiuBFqQtvLuw3fnsZXwSqGzTSTGn27pRe4Yty6PcFvtnwjXJXytpSyH7Ha8hiHAYjhxaaZB3mbzRi4ynQ8C" ], "script": "base64:BgKNAQgCEgkKBwgICAEICAgSABIECgIIARIECgIIARIAEgMKAQgSBAoCCAESBAoCCAESBAoCCAESABIGCgQICAgIEgQKAggIEgQKAggIEgMKAQQSAwoBCBIDCgEEEggKBgQIAQgICBIFCgMECAgSBgoEBAgECBIDCgEEEgQKAggEEgQKAggEEgMKAQQSAwoBBCAAEnJlc2VydmVGdW5kQWRkcmVzcwkBB0FkZHJlc3MBARoBVHmRtS8lQqOUUU5RdSZXVulSlMXl+UDs2QALcmVzZXJ2ZUZ1bmQAFAARYWdncmVnYXRvckFkZHJlc3MJAQdBZGRyZXNzAQEaAVR5kbUvJUKjlFFOUXUmV1bpUpTF5flA7NkACW9yYWNsZVN0cgIjM040S2JNbkpIOEZhTTk0anF4TkZlMm95WjhHQjdaOHlWQlAAEXNodXRkb3duV2hpdGVsaXN0CQDMCAIBGgFX1+EjUY58q4ha1dcol3XYiHXTj64jBabhCQDMCAIBGgFXYw0DgaZ/W1TSHLnkKCrzp4A08Ni1jdVlCQDMCAIBGgFXs9WSVEkJmioQ+8b4nxB2q+8/D3KliRWMCQDMCAIBGgFX+Pr6AibAUYvsajtG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SjYHB5cDyaA8C2TpVfH5VohtjTrCFNvwYQ89jx4wHh Diff:
Old | New | Differences | |
---|---|---|---|
237 | 237 | } | |
238 | 238 | ||
239 | 239 | ||
240 | + | func supplyInternal (assetIdStr,assetAmount,address) = if (!(tryGetBoolean("setup_active"))) | |
241 | + | then throw("market is stopped") | |
242 | + | else { | |
243 | + | let $t058215888 = getActualRate(assetIdStr, "sRate") | |
244 | + | let sRate = $t058215888._1 | |
245 | + | let ratesRecalcResult = $t058215888._2 | |
246 | + | let amount = fraction(assetAmount, Scale16, sRate, DOWN) | |
247 | + | let maxSupply = match getString(("setup_maxSupply_" + assetIdStr)) { | |
248 | + | case x: String => | |
249 | + | parseIntValue(x) | |
250 | + | case _ => | |
251 | + | 0 | |
252 | + | } | |
253 | + | let assetPrice = getTokenPrice(assetIdStr) | |
254 | + | let newTotalSupplied = (tryGetInteger(((address + "_supplied_") + assetIdStr)) + amount) | |
255 | + | let rate = getActualRate(assetIdStr, "sRate")._1 | |
256 | + | let assetScale = calcAssetScale(assetIdStr) | |
257 | + | let newTotalSuppliedUsd = fraction(fraction(newTotalSupplied, rate, Scale16), assetPrice._1, assetScale) | |
258 | + | if ((indexOf(tryGetString("setup_tokens"), assetIdStr) == unit)) | |
259 | + | then throw("this asset is not supported by the market") | |
260 | + | else if (if ((maxSupply != 0)) | |
261 | + | then (newTotalSuppliedUsd > maxSupply) | |
262 | + | else false) | |
263 | + | then throw("max total supply for this token reached in the pool") | |
264 | + | else $Tuple2(([IntegerEntry(((address + "_supplied_") + assetIdStr), newTotalSupplied), IntegerEntry(("total_supplied_" + assetIdStr), (tryGetInteger(("total_supplied_" + assetIdStr)) + amount))] ++ ratesRecalcResult), assetAmount) | |
265 | + | } | |
266 | + | ||
267 | + | ||
268 | + | func borrowInternal (assetIdStr,assetAmount,address) = { | |
269 | + | let $t071677234 = getActualRate(assetIdStr, "bRate") | |
270 | + | let bRate = $t071677234._1 | |
271 | + | let ratesRecalcResult = $t071677234._2 | |
272 | + | let amount = fraction(assetAmount, Scale16, bRate, CEILING) | |
273 | + | let collateralValueInv = invoke(this, "getUserCollateral", [false, address, true, ((assetIdStr + ",borrowed,") + toString(amount))], nil) | |
274 | + | if ((collateralValueInv == collateralValueInv)) | |
275 | + | then { | |
276 | + | let collateralValue = match collateralValueInv { | |
277 | + | case x: Int => | |
278 | + | x | |
279 | + | case _ => | |
280 | + | throw("can't get user collateral value") | |
281 | + | } | |
282 | + | if (!(tryGetBoolean("setup_active"))) | |
283 | + | then throw("market is stopped") | |
284 | + | else if ((0 > collateralValue)) | |
285 | + | then throw("you have to supply more to borrow") | |
286 | + | else { | |
287 | + | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
288 | + | let assetBorrowed = tryGetInteger(("total_borrowed_" + assetIdStr)) | |
289 | + | let userAssetBorrowed = tryGetInteger(((address + "_borrowed_") + assetIdStr)) | |
290 | + | if ((amount > (assetSupplied - assetBorrowed))) | |
291 | + | then throw("this amount is not available") | |
292 | + | else $Tuple2(([IntegerEntry(((address + "_borrowed_") + assetIdStr), (userAssetBorrowed + amount)), IntegerEntry(("total_borrowed_" + assetIdStr), (assetBorrowed + amount))] ++ ratesRecalcResult), assetAmount) | |
293 | + | } | |
294 | + | } | |
295 | + | else throw("Strict value is not equal to itself.") | |
296 | + | } | |
297 | + | ||
298 | + | ||
240 | 299 | @Callable(i) | |
241 | - | func supply () = if (!(tryGetBoolean("setup_active"))) | |
242 | - | then throw("market is stopped") | |
243 | - | else if (if ((size(i.payments) != 1)) | |
244 | - | then true | |
245 | - | else (i.payments[0].amount == 0)) | |
246 | - | then throw("1 payment has to be attached") | |
247 | - | else { | |
248 | - | let assetIdStr = getAssetString(i.payments[0].assetId) | |
249 | - | let assetAmount = i.payments[0].amount | |
250 | - | let $t067486815 = getActualRate(assetIdStr, "sRate") | |
251 | - | let sRate = $t067486815._1 | |
252 | - | let ratesRecalcResult = $t067486815._2 | |
253 | - | let amount = fraction(assetAmount, Scale16, sRate, DOWN) | |
254 | - | let address = toString(i.caller) | |
255 | - | let maxSupply = match getString(("setup_maxSupply_" + assetIdStr)) { | |
256 | - | case x: String => | |
257 | - | parseIntValue(x) | |
258 | - | case _ => | |
259 | - | 0 | |
300 | + | func flashPosition (user,sAssetIdStr,bAssetIdStr,bAmount,callbackAddress,callbackFunction,callbackArgs) = { | |
301 | + | let borrowRes = borrowInternal(bAssetIdStr, bAmount, user) | |
302 | + | let bAssetId = getAssetBytes(bAssetIdStr) | |
303 | + | let callback = invoke(addressFromStringValue(callbackAddress), callbackFunction, split(callbackArgs, ","), [AttachedPayment(bAssetId, bAmount)]) | |
304 | + | if ((callback == callback)) | |
305 | + | then { | |
306 | + | let sAmount = { | |
307 | + | let @ = callback | |
308 | + | if ($isInstanceOf(@, "Int")) | |
309 | + | then @ | |
310 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
311 | + | } | |
312 | + | if ((sAmount == sAmount)) | |
313 | + | then { | |
314 | + | let supplyRes = supplyInternal(sAssetIdStr, sAmount, user) | |
315 | + | let collateralValue = { | |
316 | + | let @ = invoke(this, "getUserCollateral", [false, user, true, ((sAssetIdStr + ",supplied,") + toString(sAmount))], nil) | |
317 | + | if ($isInstanceOf(@, "Int")) | |
318 | + | then @ | |
319 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
320 | + | } | |
321 | + | if ((collateralValue == collateralValue)) | |
322 | + | then { | |
323 | + | let borrowValue = { | |
324 | + | let @ = invoke(this, "getUserCollateral", [false, user, true, ((bAssetIdStr + ",borrowed,") + toString(bAmount))], nil) | |
325 | + | if ($isInstanceOf(@, "Int")) | |
326 | + | then @ | |
327 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
328 | + | } | |
329 | + | if ((borrowValue == borrowValue)) | |
330 | + | then if ((borrowValue > collateralValue)) | |
331 | + | then throw("not enough collateral provided") | |
332 | + | else (borrowRes._1 ++ supplyRes._1) | |
333 | + | else throw("Strict value is not equal to itself.") | |
334 | + | } | |
335 | + | else throw("Strict value is not equal to itself.") | |
336 | + | } | |
337 | + | else throw("Strict value is not equal to itself.") | |
260 | 338 | } | |
261 | - | let assetPrice = getTokenPrice(assetIdStr) | |
262 | - | let newTotalSupplied = (tryGetInteger(((address + "_supplied_") + assetIdStr)) + amount) | |
263 | - | let rate = getActualRate(assetIdStr, "sRate")._1 | |
264 | - | let assetScale = calcAssetScale(assetIdStr) | |
265 | - | let newTotalSuppliedUsd = fraction(fraction(newTotalSupplied, rate, Scale16), assetPrice._1, assetScale) | |
266 | - | if ((indexOf(tryGetString("setup_tokens"), assetIdStr) == unit)) | |
267 | - | then throw("this asset is not supported by the market") | |
268 | - | else if (if ((maxSupply != 0)) | |
269 | - | then (newTotalSuppliedUsd > maxSupply) | |
270 | - | else false) | |
271 | - | then throw("max total supply for this token reached in the pool") | |
272 | - | else ([IntegerEntry(((address + "_supplied_") + assetIdStr), newTotalSupplied), IntegerEntry(("total_supplied_" + assetIdStr), (tryGetInteger(("total_supplied_" + assetIdStr)) + amount))] ++ ratesRecalcResult) | |
273 | - | } | |
339 | + | else throw("Strict value is not equal to itself.") | |
340 | + | } | |
341 | + | ||
342 | + | ||
343 | + | ||
344 | + | @Callable(i) | |
345 | + | func supply () = if (if ((size(i.payments) != 1)) | |
346 | + | then true | |
347 | + | else (i.payments[0].amount == 0)) | |
348 | + | then throw("1 payment has to be attached") | |
349 | + | else { | |
350 | + | let assetIdStr = getAssetString(i.payments[0].assetId) | |
351 | + | let assetAmount = i.payments[0].amount | |
352 | + | supplyInternal(assetIdStr, assetAmount, toString(i.caller)) | |
353 | + | } | |
274 | 354 | ||
275 | 355 | ||
276 | 356 | ||
277 | 357 | @Callable(i) | |
278 | 358 | func withdraw (assetIdStr,assetAmount) = { | |
279 | - | let $ | |
280 | - | let sRate = $ | |
281 | - | let ratesRecalcResult = $ | |
359 | + | let $t098579924 = getActualRate(assetIdStr, "sRate") | |
360 | + | let sRate = $t098579924._1 | |
361 | + | let ratesRecalcResult = $t098579924._2 | |
282 | 362 | let amount = fraction(assetAmount, Scale16, sRate, CEILING) | |
283 | 363 | let address = toString(i.caller) | |
284 | 364 | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
312 | 392 | @Callable(i) | |
313 | 393 | func borrow (assetIdStr,assetAmount) = { | |
314 | 394 | let address = toString(i.caller) | |
315 | - | let $t097149781 = getActualRate(assetIdStr, "bRate") | |
316 | - | let bRate = $t097149781._1 | |
317 | - | let ratesRecalcResult = $t097149781._2 | |
318 | - | let amount = fraction(assetAmount, Scale16, bRate, CEILING) | |
319 | - | let collateralValueInv = invoke(this, "getUserCollateral", [false, address, true, ((assetIdStr + ",borrowed,") + toString(amount))], nil) | |
320 | - | if ((collateralValueInv == collateralValueInv)) | |
321 | - | then { | |
322 | - | let collateralValue = match collateralValueInv { | |
323 | - | case x: Int => | |
324 | - | x | |
325 | - | case _ => | |
326 | - | throw("can't get user collateral value") | |
327 | - | } | |
328 | - | if (!(tryGetBoolean("setup_active"))) | |
329 | - | then throw("market is stopped") | |
330 | - | else if ((0 > collateralValue)) | |
331 | - | then throw("you have to supply more to borrow") | |
332 | - | else { | |
333 | - | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
334 | - | let assetBorrowed = tryGetInteger(("total_borrowed_" + assetIdStr)) | |
335 | - | let userAssetBorrowed = tryGetInteger(((address + "_borrowed_") + assetIdStr)) | |
336 | - | if ((amount > (assetSupplied - assetBorrowed))) | |
337 | - | then throw("this amount is not available") | |
338 | - | else ([IntegerEntry(((address + "_borrowed_") + assetIdStr), (userAssetBorrowed + amount)), IntegerEntry(("total_borrowed_" + assetIdStr), (assetBorrowed + amount)), ScriptTransfer(i.caller, assetAmount, getAssetBytes(assetIdStr))] ++ ratesRecalcResult) | |
339 | - | } | |
340 | - | } | |
341 | - | else throw("Strict value is not equal to itself.") | |
395 | + | let res = borrowInternal(assetIdStr, assetAmount, address) | |
396 | + | let amount = res._2 | |
397 | + | (res._1 ++ [ScriptTransfer(i.caller, amount, getAssetBytes(assetIdStr))]) | |
342 | 398 | } | |
343 | 399 | ||
344 | 400 | ||
353 | 409 | else { | |
354 | 410 | let assetIdStr = getAssetString(i.payments[0].assetId) | |
355 | 411 | let assetAmount = i.payments[0].amount | |
356 | - | let $ | |
357 | - | let bRate = $ | |
358 | - | let ratesRecalcResult = $ | |
412 | + | let $t01199112058 = getActualRate(assetIdStr, "bRate") | |
413 | + | let bRate = $t01199112058._1 | |
414 | + | let ratesRecalcResult = $t01199112058._2 | |
359 | 415 | let amount = fraction(assetAmount, Scale16, bRate, CEILING) | |
360 | 416 | let address = toString(i.caller) | |
361 | 417 | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
693 | 749 | let userCollateral = calcUserCollateral(address) | |
694 | 750 | if ((userCollateral == userCollateral)) | |
695 | 751 | then { | |
696 | - | let $ | |
697 | - | let sRate = $ | |
698 | - | let ratesResult = $ | |
699 | - | let $ | |
700 | - | let bRate = $ | |
701 | - | let ratesRecalcResult2 = $ | |
752 | + | let $t02497825040 = getActualRate(sAssetIdStr, "sRate") | |
753 | + | let sRate = $t02497825040._1 | |
754 | + | let ratesResult = $t02497825040._2 | |
755 | + | let $t02504525114 = getActualRate(bAssetIdStr, "bRate") | |
756 | + | let bRate = $t02504525114._1 | |
757 | + | let ratesRecalcResult2 = $t02504525114._2 | |
702 | 758 | let sAssetAmount = fraction(assetAmount, Scale16, sRate) | |
703 | 759 | let currentSPosition = tryGetInteger(((address + "_supplied_") + sAssetIdStr)) | |
704 | 760 | let currentBPositionVal = tryGetInteger(((address + "_borrowed_") + bAssetIdStr)) | |
774 | 830 | let marketAssets = getMarketAssets() | |
775 | 831 | let asset1Num = value(indexOf(marketAssets, bAssetIdStr)) | |
776 | 832 | let asset0Num = value(indexOf(marketAssets, sAssetIdStr)) | |
777 | - | let $ | |
778 | - | let bRate = $ | |
779 | - | let ratesResult = $ | |
833 | + | let $t02826928331 = getActualRate(bAssetIdStr, "bRate") | |
834 | + | let bRate = $t02826928331._1 | |
835 | + | let ratesResult = $t02826928331._2 | |
780 | 836 | let asset1Price = getTokenPrice(bAssetIdStr)._2 | |
781 | 837 | let asset1Scale = calcAssetScale(bAssetIdStr) | |
782 | 838 | let bAmountUsd = fraction(bAssetAmount, asset1Price, asset1Scale) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let reserveFundAddress = Address(base58'3Mzzt65puEs2W9M1m9iFBvMEdfM5bASE1hJ') | |
5 | 5 | ||
6 | 6 | let reserveFund = 20 | |
7 | 7 | ||
8 | 8 | let aggregatorAddress = Address(base58'3Mzzt65puEs2W9M1m9iFBvMEdfM5bASE1hJ') | |
9 | 9 | ||
10 | 10 | let oracleStr = "3N4KbMnJH8FaM94jqxNFe2oyZ8GB7Z8yVBP" | |
11 | 11 | ||
12 | 12 | let shutdownWhitelist = [base58'3PMcMiMEs6w56NRGacksXtFG5zS7doE9fpL', base58'3PAxdDSmN758L5SHSGRC5apEtQE2aApZotG', base58'3PJKmXoHJvVeQXjSJdhtkUcFDtdiQqMbUTD', base58'3PQdNxynJy5mche2kxMVc5shXWzK8Gstq3o', base58'3PHbdpaKzz8EiAngGHaFu2hVuNCdsC67qh3', base58'3P6Ksahs71SiKQgQ4qaZuFAVhqncdi2nvJQ'] | |
13 | 13 | ||
14 | 14 | func verifyLiquidatorRights (address) = !((address != Address(base58'3Mzzt65puEs2W9M1m9iFBvMEdfM5bASE1hJ'))) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func getRateCurve (assetIdStr) = match assetIdStr { | |
18 | 18 | case _ => | |
19 | 19 | if (("FLdC14nUVRyiSYjVrMo3X4g8rXQjLbNRaGAyQAm8V68V" == $match0)) | |
20 | 20 | then $Tuple4(2000000, 25000000, 80000000, 100000000) | |
21 | 21 | else if (("25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT" == $match0)) | |
22 | 22 | then $Tuple4(2000000, 25000000, 80000000, 100000000) | |
23 | 23 | else if (("WAVES" == $match0)) | |
24 | 24 | then $Tuple4(2000000, 30000000, 80000000, 50000000) | |
25 | 25 | else $Tuple4(0, 20000000, 80000000, 80000000) | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | let Scale8 = 100000000 | |
30 | 30 | ||
31 | 31 | let Scale10 = 10000000000 | |
32 | 32 | ||
33 | 33 | let Scale16 = (Scale8 * Scale8) | |
34 | 34 | ||
35 | 35 | let dayBlocks = 1440 | |
36 | 36 | ||
37 | 37 | func liIntToStr (li) = { | |
38 | 38 | func f (accum,next) = ((accum + toString(next)) + ",") | |
39 | 39 | ||
40 | 40 | let $l = li | |
41 | 41 | let $s = size($l) | |
42 | 42 | let $acc0 = "" | |
43 | 43 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
44 | 44 | then $a | |
45 | 45 | else f($a, $l[$i]) | |
46 | 46 | ||
47 | 47 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
48 | 48 | then $a | |
49 | 49 | else throw("List size exceeds 6") | |
50 | 50 | ||
51 | 51 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func tryGetInteger (key) = match getInteger(this, key) { | |
56 | 56 | case b: Int => | |
57 | 57 | b | |
58 | 58 | case _ => | |
59 | 59 | 0 | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
64 | 64 | case b: Boolean => | |
65 | 65 | b | |
66 | 66 | case _ => | |
67 | 67 | false | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func tryGetString (key) = match getString(this, key) { | |
72 | 72 | case b: String => | |
73 | 73 | b | |
74 | 74 | case _ => | |
75 | 75 | "" | |
76 | 76 | } | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func tryGetBinary (key) = match getBinary(this, key) { | |
80 | 80 | case b: ByteVector => | |
81 | 81 | b | |
82 | 82 | case _ => | |
83 | 83 | base58'' | |
84 | 84 | } | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func getAssetString (assetId) = match assetId { | |
88 | 88 | case b: ByteVector => | |
89 | 89 | toBase58String(b) | |
90 | 90 | case _ => | |
91 | 91 | "WAVES" | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func getAssetBytes (assetIdStr) = if ((assetIdStr == "WAVES")) | |
96 | 96 | then unit | |
97 | 97 | else fromBase58String(assetIdStr) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func getBalance (assetIdStr) = if ((assetIdStr == "WAVES")) | |
101 | 101 | then wavesBalance(this).available | |
102 | 102 | else assetBalance(this, fromBase58String(assetIdStr)) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func getMarketAssets () = split(tryGetString("setup_tokens"), ",") | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getAssetsMaxSupply () = { | |
109 | 109 | let s = tryGetString("setup_maxsupply") | |
110 | 110 | if ((s == "")) | |
111 | 111 | then [-1, -1, -1, -1, -1, -1, -1] | |
112 | 112 | else split(s, ",") | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func getOutdatedUr (assetIdStr) = { | |
117 | 117 | let down = fraction(tryGetInteger(("total_supplied_" + assetIdStr)), tryGetInteger((assetIdStr + "_sRate")), Scale16) | |
118 | 118 | if ((down == 0)) | |
119 | 119 | then 0 | |
120 | 120 | else fraction(Scale8, fraction(tryGetInteger(("total_borrowed_" + assetIdStr)), tryGetInteger((assetIdStr + "_bRate")), Scale16), down) | |
121 | 121 | } | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func getInterest (assetIdStr) = { | |
125 | 125 | let ur = getOutdatedUr(assetIdStr) | |
126 | 126 | let curve = getRateCurve(assetIdStr) | |
127 | 127 | let rate = (curve._1 + (if ((curve._3 >= ur)) | |
128 | 128 | then fraction(ur, curve._2, curve._3) | |
129 | 129 | else (curve._2 + fraction((ur - curve._3), curve._4, (100000000 - curve._3))))) | |
130 | 130 | max([fraction(rate, Scale8, (dayBlocks * 365)), 1]) | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func tokenRatesRecalc (assetIdStr) = { | |
135 | 135 | let interest = getInterest(assetIdStr) | |
136 | 136 | let ur = getOutdatedUr(assetIdStr) | |
137 | 137 | let lastRecalcHeight = tryGetInteger("lastRateHeight") | |
138 | 138 | let lastBRate = max([tryGetInteger((assetIdStr + "_bRate")), Scale16]) | |
139 | 139 | let newBRate = (lastBRate + ((height - lastRecalcHeight) * interest)) | |
140 | 140 | let lastSRate = max([tryGetInteger((assetIdStr + "_sRate")), Scale16]) | |
141 | 141 | let newSRate = (lastSRate + ((((height - lastRecalcHeight) * fraction(interest, ur, Scale8)) * (100 - reserveFund)) / 100)) | |
142 | 142 | [IntegerEntry((assetIdStr + "_sRate"), newSRate), IntegerEntry((assetIdStr + "_bRate"), newBRate), IntegerEntry("lastRateHeight", height)] | |
143 | 143 | } | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func getActualRate (assetIdStr,rateType) = { | |
147 | 147 | func f (accum,token) = { | |
148 | 148 | let recalc = tokenRatesRecalc(token) | |
149 | 149 | $Tuple2(if ((token != assetIdStr)) | |
150 | 150 | then accum._1 | |
151 | 151 | else if ((rateType == "sRate")) | |
152 | 152 | then recalc[0].value | |
153 | 153 | else recalc[1].value, (accum._2 ++ recalc)) | |
154 | 154 | } | |
155 | 155 | ||
156 | 156 | let $l = getMarketAssets() | |
157 | 157 | let $s = size($l) | |
158 | 158 | let $acc0 = $Tuple2(0, nil) | |
159 | 159 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
160 | 160 | then $a | |
161 | 161 | else f($a, $l[$i]) | |
162 | 162 | ||
163 | 163 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
164 | 164 | then $a | |
165 | 165 | else throw("List size exceeds 6") | |
166 | 166 | ||
167 | 167 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
168 | 168 | } | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func getUr (assetIdStr) = { | |
172 | 172 | let rates = tokenRatesRecalc(assetIdStr) | |
173 | 173 | let down = fraction(tryGetInteger(("total_supplied_" + assetIdStr)), rates[0].value, Scale16) | |
174 | 174 | fraction(Scale8, fraction(tryGetInteger(("total_borrowed_" + assetIdStr)), rates[1].value, Scale16), down) | |
175 | 175 | } | |
176 | 176 | ||
177 | 177 | ||
178 | 178 | func ratesRecalc () = { | |
179 | 179 | func f (accum,token) = (accum ++ tokenRatesRecalc(token)) | |
180 | 180 | ||
181 | 181 | let $l = getMarketAssets() | |
182 | 182 | let $s = size($l) | |
183 | 183 | let $acc0 = nil | |
184 | 184 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
185 | 185 | then $a | |
186 | 186 | else f($a, $l[$i]) | |
187 | 187 | ||
188 | 188 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
189 | 189 | then $a | |
190 | 190 | else throw("List size exceeds 6") | |
191 | 191 | ||
192 | 192 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
193 | 193 | } | |
194 | 194 | ||
195 | 195 | ||
196 | 196 | func getTokenPrice (assetIdStr) = { | |
197 | 197 | let inv3 = invoke(addressFromStringValue(oracleStr), "getTWAP60", [assetIdStr, false], nil) | |
198 | 198 | if ((inv3 == inv3)) | |
199 | 199 | then { | |
200 | 200 | let data3 = match inv3 { | |
201 | 201 | case x: (Int, Int) => | |
202 | 202 | x | |
203 | 203 | case _ => | |
204 | 204 | throw("error of price oracle") | |
205 | 205 | } | |
206 | 206 | if ((data3 == data3)) | |
207 | 207 | then data3 | |
208 | 208 | else throw("Strict value is not equal to itself.") | |
209 | 209 | } | |
210 | 210 | else throw("Strict value is not equal to itself.") | |
211 | 211 | } | |
212 | 212 | ||
213 | 213 | ||
214 | 214 | func calcAssetScale (assetIdStr) = { | |
215 | 215 | let decimals = if ((assetIdStr == "WAVES")) | |
216 | 216 | then 8 | |
217 | 217 | else value(assetInfo(fromBase58String(assetIdStr))).decimals | |
218 | 218 | pow(10, 0, decimals, 0, 0, DOWN) | |
219 | 219 | } | |
220 | 220 | ||
221 | 221 | ||
222 | 222 | func calcUserCollateral (address) = { | |
223 | 223 | let userCollateralInvoke = invoke(this, "getUserCollateral", [false, address, true, ""], nil) | |
224 | 224 | if ((userCollateralInvoke == userCollateralInvoke)) | |
225 | 225 | then { | |
226 | 226 | let userCollateralValue = match userCollateralInvoke { | |
227 | 227 | case x: Int => | |
228 | 228 | x | |
229 | 229 | case _ => | |
230 | 230 | throw("issue while doing in-dapp invocation") | |
231 | 231 | } | |
232 | 232 | if ((userCollateralValue == userCollateralValue)) | |
233 | 233 | then userCollateralValue | |
234 | 234 | else throw("Strict value is not equal to itself.") | |
235 | 235 | } | |
236 | 236 | else throw("Strict value is not equal to itself.") | |
237 | 237 | } | |
238 | 238 | ||
239 | 239 | ||
240 | + | func supplyInternal (assetIdStr,assetAmount,address) = if (!(tryGetBoolean("setup_active"))) | |
241 | + | then throw("market is stopped") | |
242 | + | else { | |
243 | + | let $t058215888 = getActualRate(assetIdStr, "sRate") | |
244 | + | let sRate = $t058215888._1 | |
245 | + | let ratesRecalcResult = $t058215888._2 | |
246 | + | let amount = fraction(assetAmount, Scale16, sRate, DOWN) | |
247 | + | let maxSupply = match getString(("setup_maxSupply_" + assetIdStr)) { | |
248 | + | case x: String => | |
249 | + | parseIntValue(x) | |
250 | + | case _ => | |
251 | + | 0 | |
252 | + | } | |
253 | + | let assetPrice = getTokenPrice(assetIdStr) | |
254 | + | let newTotalSupplied = (tryGetInteger(((address + "_supplied_") + assetIdStr)) + amount) | |
255 | + | let rate = getActualRate(assetIdStr, "sRate")._1 | |
256 | + | let assetScale = calcAssetScale(assetIdStr) | |
257 | + | let newTotalSuppliedUsd = fraction(fraction(newTotalSupplied, rate, Scale16), assetPrice._1, assetScale) | |
258 | + | if ((indexOf(tryGetString("setup_tokens"), assetIdStr) == unit)) | |
259 | + | then throw("this asset is not supported by the market") | |
260 | + | else if (if ((maxSupply != 0)) | |
261 | + | then (newTotalSuppliedUsd > maxSupply) | |
262 | + | else false) | |
263 | + | then throw("max total supply for this token reached in the pool") | |
264 | + | else $Tuple2(([IntegerEntry(((address + "_supplied_") + assetIdStr), newTotalSupplied), IntegerEntry(("total_supplied_" + assetIdStr), (tryGetInteger(("total_supplied_" + assetIdStr)) + amount))] ++ ratesRecalcResult), assetAmount) | |
265 | + | } | |
266 | + | ||
267 | + | ||
268 | + | func borrowInternal (assetIdStr,assetAmount,address) = { | |
269 | + | let $t071677234 = getActualRate(assetIdStr, "bRate") | |
270 | + | let bRate = $t071677234._1 | |
271 | + | let ratesRecalcResult = $t071677234._2 | |
272 | + | let amount = fraction(assetAmount, Scale16, bRate, CEILING) | |
273 | + | let collateralValueInv = invoke(this, "getUserCollateral", [false, address, true, ((assetIdStr + ",borrowed,") + toString(amount))], nil) | |
274 | + | if ((collateralValueInv == collateralValueInv)) | |
275 | + | then { | |
276 | + | let collateralValue = match collateralValueInv { | |
277 | + | case x: Int => | |
278 | + | x | |
279 | + | case _ => | |
280 | + | throw("can't get user collateral value") | |
281 | + | } | |
282 | + | if (!(tryGetBoolean("setup_active"))) | |
283 | + | then throw("market is stopped") | |
284 | + | else if ((0 > collateralValue)) | |
285 | + | then throw("you have to supply more to borrow") | |
286 | + | else { | |
287 | + | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
288 | + | let assetBorrowed = tryGetInteger(("total_borrowed_" + assetIdStr)) | |
289 | + | let userAssetBorrowed = tryGetInteger(((address + "_borrowed_") + assetIdStr)) | |
290 | + | if ((amount > (assetSupplied - assetBorrowed))) | |
291 | + | then throw("this amount is not available") | |
292 | + | else $Tuple2(([IntegerEntry(((address + "_borrowed_") + assetIdStr), (userAssetBorrowed + amount)), IntegerEntry(("total_borrowed_" + assetIdStr), (assetBorrowed + amount))] ++ ratesRecalcResult), assetAmount) | |
293 | + | } | |
294 | + | } | |
295 | + | else throw("Strict value is not equal to itself.") | |
296 | + | } | |
297 | + | ||
298 | + | ||
240 | 299 | @Callable(i) | |
241 | - | func supply () = if (!(tryGetBoolean("setup_active"))) | |
242 | - | then throw("market is stopped") | |
243 | - | else if (if ((size(i.payments) != 1)) | |
244 | - | then true | |
245 | - | else (i.payments[0].amount == 0)) | |
246 | - | then throw("1 payment has to be attached") | |
247 | - | else { | |
248 | - | let assetIdStr = getAssetString(i.payments[0].assetId) | |
249 | - | let assetAmount = i.payments[0].amount | |
250 | - | let $t067486815 = getActualRate(assetIdStr, "sRate") | |
251 | - | let sRate = $t067486815._1 | |
252 | - | let ratesRecalcResult = $t067486815._2 | |
253 | - | let amount = fraction(assetAmount, Scale16, sRate, DOWN) | |
254 | - | let address = toString(i.caller) | |
255 | - | let maxSupply = match getString(("setup_maxSupply_" + assetIdStr)) { | |
256 | - | case x: String => | |
257 | - | parseIntValue(x) | |
258 | - | case _ => | |
259 | - | 0 | |
300 | + | func flashPosition (user,sAssetIdStr,bAssetIdStr,bAmount,callbackAddress,callbackFunction,callbackArgs) = { | |
301 | + | let borrowRes = borrowInternal(bAssetIdStr, bAmount, user) | |
302 | + | let bAssetId = getAssetBytes(bAssetIdStr) | |
303 | + | let callback = invoke(addressFromStringValue(callbackAddress), callbackFunction, split(callbackArgs, ","), [AttachedPayment(bAssetId, bAmount)]) | |
304 | + | if ((callback == callback)) | |
305 | + | then { | |
306 | + | let sAmount = { | |
307 | + | let @ = callback | |
308 | + | if ($isInstanceOf(@, "Int")) | |
309 | + | then @ | |
310 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
311 | + | } | |
312 | + | if ((sAmount == sAmount)) | |
313 | + | then { | |
314 | + | let supplyRes = supplyInternal(sAssetIdStr, sAmount, user) | |
315 | + | let collateralValue = { | |
316 | + | let @ = invoke(this, "getUserCollateral", [false, user, true, ((sAssetIdStr + ",supplied,") + toString(sAmount))], nil) | |
317 | + | if ($isInstanceOf(@, "Int")) | |
318 | + | then @ | |
319 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
320 | + | } | |
321 | + | if ((collateralValue == collateralValue)) | |
322 | + | then { | |
323 | + | let borrowValue = { | |
324 | + | let @ = invoke(this, "getUserCollateral", [false, user, true, ((bAssetIdStr + ",borrowed,") + toString(bAmount))], nil) | |
325 | + | if ($isInstanceOf(@, "Int")) | |
326 | + | then @ | |
327 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
328 | + | } | |
329 | + | if ((borrowValue == borrowValue)) | |
330 | + | then if ((borrowValue > collateralValue)) | |
331 | + | then throw("not enough collateral provided") | |
332 | + | else (borrowRes._1 ++ supplyRes._1) | |
333 | + | else throw("Strict value is not equal to itself.") | |
334 | + | } | |
335 | + | else throw("Strict value is not equal to itself.") | |
336 | + | } | |
337 | + | else throw("Strict value is not equal to itself.") | |
260 | 338 | } | |
261 | - | let assetPrice = getTokenPrice(assetIdStr) | |
262 | - | let newTotalSupplied = (tryGetInteger(((address + "_supplied_") + assetIdStr)) + amount) | |
263 | - | let rate = getActualRate(assetIdStr, "sRate")._1 | |
264 | - | let assetScale = calcAssetScale(assetIdStr) | |
265 | - | let newTotalSuppliedUsd = fraction(fraction(newTotalSupplied, rate, Scale16), assetPrice._1, assetScale) | |
266 | - | if ((indexOf(tryGetString("setup_tokens"), assetIdStr) == unit)) | |
267 | - | then throw("this asset is not supported by the market") | |
268 | - | else if (if ((maxSupply != 0)) | |
269 | - | then (newTotalSuppliedUsd > maxSupply) | |
270 | - | else false) | |
271 | - | then throw("max total supply for this token reached in the pool") | |
272 | - | else ([IntegerEntry(((address + "_supplied_") + assetIdStr), newTotalSupplied), IntegerEntry(("total_supplied_" + assetIdStr), (tryGetInteger(("total_supplied_" + assetIdStr)) + amount))] ++ ratesRecalcResult) | |
273 | - | } | |
339 | + | else throw("Strict value is not equal to itself.") | |
340 | + | } | |
341 | + | ||
342 | + | ||
343 | + | ||
344 | + | @Callable(i) | |
345 | + | func supply () = if (if ((size(i.payments) != 1)) | |
346 | + | then true | |
347 | + | else (i.payments[0].amount == 0)) | |
348 | + | then throw("1 payment has to be attached") | |
349 | + | else { | |
350 | + | let assetIdStr = getAssetString(i.payments[0].assetId) | |
351 | + | let assetAmount = i.payments[0].amount | |
352 | + | supplyInternal(assetIdStr, assetAmount, toString(i.caller)) | |
353 | + | } | |
274 | 354 | ||
275 | 355 | ||
276 | 356 | ||
277 | 357 | @Callable(i) | |
278 | 358 | func withdraw (assetIdStr,assetAmount) = { | |
279 | - | let $ | |
280 | - | let sRate = $ | |
281 | - | let ratesRecalcResult = $ | |
359 | + | let $t098579924 = getActualRate(assetIdStr, "sRate") | |
360 | + | let sRate = $t098579924._1 | |
361 | + | let ratesRecalcResult = $t098579924._2 | |
282 | 362 | let amount = fraction(assetAmount, Scale16, sRate, CEILING) | |
283 | 363 | let address = toString(i.caller) | |
284 | 364 | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
285 | 365 | let assetBorrowed = tryGetInteger(("total_borrowed_" + assetIdStr)) | |
286 | 366 | let userAssetSupplied = tryGetInteger(((address + "_supplied_") + assetIdStr)) | |
287 | 367 | let userAssetBorrowed = tryGetInteger(((address + "_borrowed_") + assetIdStr)) | |
288 | 368 | let collateralValueInv = invoke(this, "getUserCollateral", [false, address, true, ((assetIdStr + ",supplied,") + toString(-(amount)))], nil) | |
289 | 369 | if ((collateralValueInv == collateralValueInv)) | |
290 | 370 | then { | |
291 | 371 | let collateralValue = match collateralValueInv { | |
292 | 372 | case x: Int => | |
293 | 373 | x | |
294 | 374 | case _ => | |
295 | 375 | throw("can't get user collateral value") | |
296 | 376 | } | |
297 | 377 | if (!(tryGetBoolean("setup_active"))) | |
298 | 378 | then throw("market is stopped") | |
299 | 379 | else if ((0 > collateralValue)) | |
300 | 380 | then throw("you dont have enough collateral for this operation") | |
301 | 381 | else if ((amount > (assetSupplied - assetBorrowed))) | |
302 | 382 | then throw("this amount is not available on the market") | |
303 | 383 | else if ((amount > (userAssetSupplied - userAssetBorrowed))) | |
304 | 384 | then throw("this amount is not available for this user") | |
305 | 385 | else ([IntegerEntry(((address + "_supplied_") + assetIdStr), (tryGetInteger(((address + "_supplied_") + assetIdStr)) - amount)), IntegerEntry(("total_supplied_" + assetIdStr), (tryGetInteger(("total_supplied_" + assetIdStr)) - amount)), ScriptTransfer(i.caller, assetAmount, getAssetBytes(assetIdStr))] ++ ratesRecalcResult) | |
306 | 386 | } | |
307 | 387 | else throw("Strict value is not equal to itself.") | |
308 | 388 | } | |
309 | 389 | ||
310 | 390 | ||
311 | 391 | ||
312 | 392 | @Callable(i) | |
313 | 393 | func borrow (assetIdStr,assetAmount) = { | |
314 | 394 | let address = toString(i.caller) | |
315 | - | let $t097149781 = getActualRate(assetIdStr, "bRate") | |
316 | - | let bRate = $t097149781._1 | |
317 | - | let ratesRecalcResult = $t097149781._2 | |
318 | - | let amount = fraction(assetAmount, Scale16, bRate, CEILING) | |
319 | - | let collateralValueInv = invoke(this, "getUserCollateral", [false, address, true, ((assetIdStr + ",borrowed,") + toString(amount))], nil) | |
320 | - | if ((collateralValueInv == collateralValueInv)) | |
321 | - | then { | |
322 | - | let collateralValue = match collateralValueInv { | |
323 | - | case x: Int => | |
324 | - | x | |
325 | - | case _ => | |
326 | - | throw("can't get user collateral value") | |
327 | - | } | |
328 | - | if (!(tryGetBoolean("setup_active"))) | |
329 | - | then throw("market is stopped") | |
330 | - | else if ((0 > collateralValue)) | |
331 | - | then throw("you have to supply more to borrow") | |
332 | - | else { | |
333 | - | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
334 | - | let assetBorrowed = tryGetInteger(("total_borrowed_" + assetIdStr)) | |
335 | - | let userAssetBorrowed = tryGetInteger(((address + "_borrowed_") + assetIdStr)) | |
336 | - | if ((amount > (assetSupplied - assetBorrowed))) | |
337 | - | then throw("this amount is not available") | |
338 | - | else ([IntegerEntry(((address + "_borrowed_") + assetIdStr), (userAssetBorrowed + amount)), IntegerEntry(("total_borrowed_" + assetIdStr), (assetBorrowed + amount)), ScriptTransfer(i.caller, assetAmount, getAssetBytes(assetIdStr))] ++ ratesRecalcResult) | |
339 | - | } | |
340 | - | } | |
341 | - | else throw("Strict value is not equal to itself.") | |
395 | + | let res = borrowInternal(assetIdStr, assetAmount, address) | |
396 | + | let amount = res._2 | |
397 | + | (res._1 ++ [ScriptTransfer(i.caller, amount, getAssetBytes(assetIdStr))]) | |
342 | 398 | } | |
343 | 399 | ||
344 | 400 | ||
345 | 401 | ||
346 | 402 | @Callable(i) | |
347 | 403 | func repay () = if (!(tryGetBoolean("setup_active"))) | |
348 | 404 | then throw("market is stopped") | |
349 | 405 | else if (if ((size(i.payments) != 1)) | |
350 | 406 | then true | |
351 | 407 | else (i.payments[0].amount == 0)) | |
352 | 408 | then throw("1 payment has to be attached") | |
353 | 409 | else { | |
354 | 410 | let assetIdStr = getAssetString(i.payments[0].assetId) | |
355 | 411 | let assetAmount = i.payments[0].amount | |
356 | - | let $ | |
357 | - | let bRate = $ | |
358 | - | let ratesRecalcResult = $ | |
412 | + | let $t01199112058 = getActualRate(assetIdStr, "bRate") | |
413 | + | let bRate = $t01199112058._1 | |
414 | + | let ratesRecalcResult = $t01199112058._2 | |
359 | 415 | let amount = fraction(assetAmount, Scale16, bRate, CEILING) | |
360 | 416 | let address = toString(i.caller) | |
361 | 417 | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
362 | 418 | let assetBorrowed = tryGetInteger(("total_borrowed_" + assetIdStr)) | |
363 | 419 | let userAssetBorrowed = tryGetInteger(((address + "_borrowed_") + assetIdStr)) | |
364 | 420 | let amountLeft = (userAssetBorrowed - amount) | |
365 | 421 | let repayAmount = if ((amountLeft >= 0)) | |
366 | 422 | then amount | |
367 | 423 | else userAssetBorrowed | |
368 | 424 | if ((indexOf(tryGetString("setup_tokens"), assetIdStr) == unit)) | |
369 | 425 | then throw("this asset is not supported by the market") | |
370 | 426 | else (([IntegerEntry(((address + "_borrowed_") + assetIdStr), (userAssetBorrowed - repayAmount)), IntegerEntry(("total_borrowed_" + assetIdStr), (assetBorrowed - repayAmount))] ++ ratesRecalcResult) ++ (if ((amountLeft >= 0)) | |
371 | 427 | then nil | |
372 | 428 | else [ScriptTransfer(i.caller, -(amountLeft), i.payments[0].assetId)])) | |
373 | 429 | } | |
374 | 430 | ||
375 | 431 | ||
376 | 432 | ||
377 | 433 | @Callable(i) | |
378 | 434 | func stakeTokenAll (assetIdStr) = if ((i.caller != this)) | |
379 | 435 | then throw("only for internal smart contract invocations") | |
380 | 436 | else { | |
381 | 437 | let amount = getBalance(assetIdStr) | |
382 | 438 | let inv = invoke(this, "stakeToken", [assetIdStr, amount], nil) | |
383 | 439 | if ((inv == inv)) | |
384 | 440 | then nil | |
385 | 441 | else throw("Strict value is not equal to itself.") | |
386 | 442 | } | |
387 | 443 | ||
388 | 444 | ||
389 | 445 | ||
390 | 446 | @Callable(i) | |
391 | 447 | func stakeToken (assetIdStr,amount) = if ((i.caller != this)) | |
392 | 448 | then throw("only for internal smart contract invocations") | |
393 | 449 | else if ((assetIdStr == "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p")) | |
394 | 450 | then { | |
395 | 451 | let amountStaked = tryGetInteger("autostake_amount_DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p") | |
396 | 452 | let inv = invoke(Address(base58'3PNikM6yp4NqcSU8guxQtmR5onr2D4e8yTJ'), "stake", nil, [AttachedPayment(base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p', amount)]) | |
397 | 453 | if ((inv == inv)) | |
398 | 454 | then [IntegerEntry("autostake_amount_DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p", (amountStaked + amount))] | |
399 | 455 | else throw("Strict value is not equal to itself.") | |
400 | 456 | } | |
401 | 457 | else if ((assetIdStr == "8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91")) | |
402 | 458 | then { | |
403 | 459 | let amountStaked = tryGetInteger("autostake_amount_8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91") | |
404 | 460 | let inv = invoke(Address(base58'3PQTM38wDmAY9vWonK6ha7QL3PAycLz5oPP'), "stake", nil, [AttachedPayment(base58'8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91', amount)]) | |
405 | 461 | if ((inv == inv)) | |
406 | 462 | then [IntegerEntry("autostake_amount_8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91", (amountStaked + amount))] | |
407 | 463 | else throw("Strict value is not equal to itself.") | |
408 | 464 | } | |
409 | 465 | else if ((assetIdStr == "At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL")) | |
410 | 466 | then { | |
411 | 467 | let amountStaked = tryGetInteger("autostake_amount_At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL") | |
412 | 468 | let inv = invoke(Address(base58'3PBiotFpqjRMkkeFBccnQNUXUopy7KFez5C'), "stake", nil, [AttachedPayment(base58'At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL', amount)]) | |
413 | 469 | if ((inv == inv)) | |
414 | 470 | then [IntegerEntry("autostake_amount_At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL", (amountStaked + amount))] | |
415 | 471 | else throw("Strict value is not equal to itself.") | |
416 | 472 | } | |
417 | 473 | else nil | |
418 | 474 | ||
419 | 475 | ||
420 | 476 | ||
421 | 477 | @Callable(i) | |
422 | 478 | func unstakeToken (assetIdStr,amount) = if ((i.caller != this)) | |
423 | 479 | then throw("only for internal smart contract invocations") | |
424 | 480 | else if ((assetIdStr == "8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91")) | |
425 | 481 | then { | |
426 | 482 | let amountStaked = tryGetInteger("autostake_amount_8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91") | |
427 | 483 | let inv = invoke(Address(base58'3PQTM38wDmAY9vWonK6ha7QL3PAycLz5oPP'), "unStake", [amount], nil) | |
428 | 484 | if ((inv == inv)) | |
429 | 485 | then [IntegerEntry("autostake_amount_8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91", (amountStaked - amount))] | |
430 | 486 | else throw("Strict value is not equal to itself.") | |
431 | 487 | } | |
432 | 488 | else if ((assetIdStr == "At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL")) | |
433 | 489 | then { | |
434 | 490 | let amountStaked = tryGetInteger("autostake_amount_At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL") | |
435 | 491 | let inv = invoke(Address(base58'3PBiotFpqjRMkkeFBccnQNUXUopy7KFez5C'), "unstake", [amount], nil) | |
436 | 492 | if ((inv == inv)) | |
437 | 493 | then { | |
438 | 494 | let bal0 = getBalance("At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL") | |
439 | 495 | if ((bal0 == bal0)) | |
440 | 496 | then { | |
441 | 497 | let inv2 = invoke(Address(base58'3PQrVbTVpqXHqpVKftkNdjy3zZAh4dsRzN6'), "gnsbtRewardsSYSREADONLY", [toString(this)], nil) | |
442 | 498 | if ((inv2 == inv2)) | |
443 | 499 | then { | |
444 | 500 | let topupRewards = match inv2 { | |
445 | 501 | case x: List[Any] => | |
446 | 502 | let secondEl = x[1] | |
447 | 503 | match secondEl { | |
448 | 504 | case secondEl: String => | |
449 | 505 | let usdnValue = parseIntValue(split(split(secondEl, "_")[1], ":")[1]) | |
450 | 506 | let wavesValue = parseIntValue(split(split(secondEl, "_")[0], ":")[1]) | |
451 | 507 | if (if ((usdnValue != 0)) | |
452 | 508 | then true | |
453 | 509 | else (wavesValue != 0)) | |
454 | 510 | then { | |
455 | 511 | let usdnBal0 = getBalance("DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p") | |
456 | 512 | if ((usdnBal0 == usdnBal0)) | |
457 | 513 | then { | |
458 | 514 | let wavesBal0 = getBalance("WAVES") | |
459 | 515 | if ((wavesBal0 == wavesBal0)) | |
460 | 516 | then { | |
461 | 517 | let inv3 = invoke(Address(base58'3PBiotFpqjRMkkeFBccnQNUXUopy7KFez5C'), "claimRewards", nil, nil) | |
462 | 518 | if ((inv3 == inv3)) | |
463 | 519 | then { | |
464 | 520 | let wavesBal1 = getBalance("WAVES") | |
465 | 521 | if ((wavesBal1 == wavesBal1)) | |
466 | 522 | then { | |
467 | 523 | let inv4 = invoke(Address(base58'3PLiXyywNThdvf3vVEUxwc7TJTucjZvuegh'), "swap", ["DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p", 0], [AttachedPayment(unit, (wavesBal1 - wavesBal0))]) | |
468 | 524 | if ((inv4 == inv4)) | |
469 | 525 | then { | |
470 | 526 | let usdnBal1 = getBalance("DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p") | |
471 | 527 | if ((usdnBal1 == usdnBal1)) | |
472 | 528 | then { | |
473 | 529 | let inv5 = invoke(Address(base58'3P7r93vXHuusageNJVGwzqaz3WMotAu49Yz'), "swap", ["At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL", 0], [AttachedPayment(base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p', (usdnBal1 - usdnBal0))]) | |
474 | 530 | if ((inv5 == inv5)) | |
475 | 531 | then { | |
476 | 532 | let inv6 = invoke(this, "addInterest", ["At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL", (getBalance("At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL") - bal0)], nil) | |
477 | 533 | if ((inv6 == inv6)) | |
478 | 534 | then 2 | |
479 | 535 | else throw("Strict value is not equal to itself.") | |
480 | 536 | } | |
481 | 537 | else throw("Strict value is not equal to itself.") | |
482 | 538 | } | |
483 | 539 | else throw("Strict value is not equal to itself.") | |
484 | 540 | } | |
485 | 541 | else throw("Strict value is not equal to itself.") | |
486 | 542 | } | |
487 | 543 | else throw("Strict value is not equal to itself.") | |
488 | 544 | } | |
489 | 545 | else throw("Strict value is not equal to itself.") | |
490 | 546 | } | |
491 | 547 | else throw("Strict value is not equal to itself.") | |
492 | 548 | } | |
493 | 549 | else throw("Strict value is not equal to itself.") | |
494 | 550 | } | |
495 | 551 | else 1 | |
496 | 552 | case _ => | |
497 | 553 | 1 | |
498 | 554 | } | |
499 | 555 | case _ => | |
500 | 556 | 0 | |
501 | 557 | } | |
502 | 558 | if ((topupRewards == topupRewards)) | |
503 | 559 | then [IntegerEntry("autostake_amount_At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL", (amountStaked - amount))] | |
504 | 560 | else throw("Strict value is not equal to itself.") | |
505 | 561 | } | |
506 | 562 | else throw("Strict value is not equal to itself.") | |
507 | 563 | } | |
508 | 564 | else throw("Strict value is not equal to itself.") | |
509 | 565 | } | |
510 | 566 | else throw("Strict value is not equal to itself.") | |
511 | 567 | } | |
512 | 568 | else nil | |
513 | 569 | ||
514 | 570 | ||
515 | 571 | ||
516 | 572 | @Callable(i) | |
517 | 573 | func addInterest (assetIdStr,amount) = if ((i.caller != this)) | |
518 | 574 | then throw("only for self invocation") | |
519 | 575 | else { | |
520 | 576 | let earned = tryGetInteger(("autostake_lastEarned_" + assetIdStr)) | |
521 | 577 | let lastHeight = tryGetInteger(("autostake_lastBlock_" + assetIdStr)) | |
522 | 578 | let cleanAmount = fraction(amount, 80, 100) | |
523 | 579 | let stateChanges = if (if ((lastHeight == height)) | |
524 | 580 | then true | |
525 | 581 | else (amount == 0)) | |
526 | 582 | then nil | |
527 | 583 | else [IntegerEntry(("autostake_preLastEarned_" + assetIdStr), earned), IntegerEntry(("autostake_preLastBlock_" + assetIdStr), lastHeight), IntegerEntry(("autostake_lastEarned_" + assetIdStr), (earned + cleanAmount)), IntegerEntry(("autostake_lastBlock_" + assetIdStr), height)] | |
528 | 584 | (stateChanges ++ [IntegerEntry((assetIdStr + "_sRate"), (tryGetInteger((assetIdStr + "_sRate")) + fraction(Scale16, cleanAmount, tryGetInteger(("total_supplied_" + assetIdStr)))))]) | |
529 | 585 | } | |
530 | 586 | ||
531 | 587 | ||
532 | 588 | ||
533 | 589 | @Callable(i) | |
534 | 590 | func addInterestEXTERNAL () = { | |
535 | 591 | let amount = fraction(i.payments[0].amount, 80, 100) | |
536 | 592 | let assetId = i.payments[0].assetId | |
537 | 593 | let assetIdStr = getAssetString(assetId) | |
538 | 594 | let earned = tryGetInteger(("autostake_lastEarned_" + assetIdStr)) | |
539 | 595 | let lastHeight = tryGetInteger(("autostake_lastBlock_" + assetIdStr)) | |
540 | 596 | let stateChanges = if (if ((lastHeight == height)) | |
541 | 597 | then true | |
542 | 598 | else (amount == 0)) | |
543 | 599 | then nil | |
544 | 600 | else [IntegerEntry(("autostake_preLastEarned_" + assetIdStr), earned), IntegerEntry(("autostake_preLastBlock_" + assetIdStr), lastHeight), IntegerEntry(("autostake_lastEarned_" + assetIdStr), (earned + amount)), IntegerEntry(("autostake_lastBlock_" + assetIdStr), height)] | |
545 | 601 | (stateChanges ++ [IntegerEntry((assetIdStr + "_sRate"), (tryGetInteger((assetIdStr + "_sRate")) + fraction(Scale16, amount, tryGetInteger(("total_supplied_" + assetIdStr)))))]) | |
546 | 602 | } | |
547 | 603 | ||
548 | 604 | ||
549 | 605 | ||
550 | 606 | @Callable(i) | |
551 | 607 | func preInit (tokens,ltvs,lts,penalties) = { | |
552 | 608 | func f (accum,token) = (accum ++ [IntegerEntry((token + "_bRate"), Scale16), IntegerEntry((token + "_sRate"), Scale16)]) | |
553 | 609 | ||
554 | 610 | if ((i.caller != this)) | |
555 | 611 | then throw("admin only") | |
556 | 612 | else { | |
557 | 613 | let rates = { | |
558 | 614 | let $l = split(tokens, ",") | |
559 | 615 | let $s = size($l) | |
560 | 616 | let $acc0 = nil | |
561 | 617 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
562 | 618 | then $a | |
563 | 619 | else f($a, $l[$i]) | |
564 | 620 | ||
565 | 621 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
566 | 622 | then $a | |
567 | 623 | else throw("List size exceeds 6") | |
568 | 624 | ||
569 | 625 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
570 | 626 | } | |
571 | 627 | ([StringEntry("setup_tokens", tokens), StringEntry("setup_ltvs", ltvs), StringEntry("setup_lts", lts), StringEntry("setup_penalties", penalties), BooleanEntry("setup_active", true)] ++ rates) | |
572 | 628 | } | |
573 | 629 | } | |
574 | 630 | ||
575 | 631 | ||
576 | 632 | ||
577 | 633 | @Callable(i) | |
578 | 634 | func updateParameter (key,val) = if (if ((i.caller != this)) | |
579 | 635 | then (i.caller != Address(base58'3P3o9cLTV2u9N4nYNKRYL6gy6cUEU9DwXW8')) | |
580 | 636 | else false) | |
581 | 637 | then throw("admin only") | |
582 | 638 | else [IntegerEntry(key, parseIntValue(val))] | |
583 | 639 | ||
584 | 640 | ||
585 | 641 | ||
586 | 642 | @Callable(i) | |
587 | 643 | func updateString (key,val) = if (if ((i.caller != this)) | |
588 | 644 | then (i.caller != Address(base58'3P3o9cLTV2u9N4nYNKRYL6gy6cUEU9DwXW8')) | |
589 | 645 | else false) | |
590 | 646 | then throw("admin only") | |
591 | 647 | else [StringEntry(key, val)] | |
592 | 648 | ||
593 | 649 | ||
594 | 650 | ||
595 | 651 | @Callable(i) | |
596 | 652 | func claimToReserveFund (debug) = { | |
597 | 653 | let assets = getMarketAssets() | |
598 | 654 | let rates = getActualRate(assets[0], "sRate")._2 | |
599 | 655 | let li = [0, 1, 2, 3, 4, 5] | |
600 | 656 | func f (accum,n) = if ((n >= size(assets))) | |
601 | 657 | then accum | |
602 | 658 | else { | |
603 | 659 | let assetIdStr = assets[n] | |
604 | 660 | let autostakeAmount = tryGetString(("autostake_amount_" + assetIdStr)) | |
605 | 661 | let amount = ((((getBalance(assetIdStr) + tryGetInteger(("autostake_amount_" + assetIdStr))) + (if ((autostakeAmount != "")) | |
606 | 662 | then parseIntValue(autostakeAmount) | |
607 | 663 | else 0)) + fraction(tryGetInteger(("total_borrowed_" + assetIdStr)), rates[((n * 3) + 1)].value, Scale16)) - fraction(tryGetInteger(("total_supplied_" + assetIdStr)), rates[(n * 3)].value, Scale16)) | |
608 | 664 | let inv = if ((tryGetInteger(("autostake_amount_" + assetIdStr)) > 0)) | |
609 | 665 | then invoke(this, "unstakeToken", [assetIdStr, max([amount, 0])], nil) | |
610 | 666 | else 0 | |
611 | 667 | if ((inv == inv)) | |
612 | 668 | then (accum ++ [amount]) | |
613 | 669 | else throw("Strict value is not equal to itself.") | |
614 | 670 | } | |
615 | 671 | ||
616 | 672 | let parameter = { | |
617 | 673 | let $l = li | |
618 | 674 | let $s = size($l) | |
619 | 675 | let $acc0 = nil | |
620 | 676 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
621 | 677 | then $a | |
622 | 678 | else f($a, $l[$i]) | |
623 | 679 | ||
624 | 680 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
625 | 681 | then $a | |
626 | 682 | else throw("List size exceeds 6") | |
627 | 683 | ||
628 | 684 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
629 | 685 | } | |
630 | 686 | func f2 (accum,n) = if ((n >= size(assets))) | |
631 | 687 | then accum | |
632 | 688 | else { | |
633 | 689 | let assetIdStr = assets[n] | |
634 | 690 | (accum ++ [ScriptTransfer(reserveFundAddress, max([parameter[n], 0]), getAssetBytes(assetIdStr))]) | |
635 | 691 | } | |
636 | 692 | ||
637 | 693 | if (debug) | |
638 | 694 | then throw(liIntToStr(parameter)) | |
639 | 695 | else $Tuple2({ | |
640 | 696 | let $l = li | |
641 | 697 | let $s = size($l) | |
642 | 698 | let $acc0 = nil | |
643 | 699 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
644 | 700 | then $a | |
645 | 701 | else f2($a, $l[$i]) | |
646 | 702 | ||
647 | 703 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
648 | 704 | then $a | |
649 | 705 | else throw("List size exceeds 6") | |
650 | 706 | ||
651 | 707 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
652 | 708 | }, parameter) | |
653 | 709 | } | |
654 | 710 | ||
655 | 711 | ||
656 | 712 | ||
657 | 713 | @Callable(i) | |
658 | 714 | func reSetup (assetIdStr) = { | |
659 | 715 | let lastResetup = tryGetInteger("resetup_lastUpdate") | |
660 | 716 | if ((dayBlocks > (height - lastResetup))) | |
661 | 717 | then throw("can be updated only once per day") | |
662 | 718 | else { | |
663 | 719 | let lts = split(tryGetString("setup_lts"), ",") | |
664 | 720 | let assets = getMarketAssets() | |
665 | 721 | let ur = getUr(assetIdStr) | |
666 | 722 | let tempLT = tryGetInteger((("setup_" + assetIdStr) + "_tempLT")) | |
667 | 723 | let lt = parseIntValue(assets[value(indexOf(assets, assetIdStr))]) | |
668 | 724 | if ((ur > 90000000)) | |
669 | 725 | then [IntegerEntry((("setup_" + assetIdStr) + "_tempLT"), fraction(tempLT, 9975, 10000))] | |
670 | 726 | else if (if ((lt > tempLT)) | |
671 | 727 | then (90000000 > ur) | |
672 | 728 | else false) | |
673 | 729 | then [IntegerEntry((("setup_" + assetIdStr) + "_tempLT"), fraction(tempLT, 10025, 10000))] | |
674 | 730 | else nil | |
675 | 731 | } | |
676 | 732 | } | |
677 | 733 | ||
678 | 734 | ||
679 | 735 | ||
680 | 736 | @Callable(i) | |
681 | 737 | func shutdown (shutdown) = if ((indexOf(shutdownWhitelist, i.caller.bytes) == unit)) | |
682 | 738 | then throw("user not in a whitelist") | |
683 | 739 | else [BooleanEntry("setup_active", !(shutdown))] | |
684 | 740 | ||
685 | 741 | ||
686 | 742 | ||
687 | 743 | @Callable(i) | |
688 | 744 | func liquidate (debug,address,assetAmount,sAssetIdStr,bAssetIdStr,routeStr) = if (!(verifyLiquidatorRights(i.caller))) | |
689 | 745 | then throw("temporarily available for whitelist only") | |
690 | 746 | else if (!(tryGetBoolean("setup_active"))) | |
691 | 747 | then throw("market is stopped") | |
692 | 748 | else { | |
693 | 749 | let userCollateral = calcUserCollateral(address) | |
694 | 750 | if ((userCollateral == userCollateral)) | |
695 | 751 | then { | |
696 | - | let $ | |
697 | - | let sRate = $ | |
698 | - | let ratesResult = $ | |
699 | - | let $ | |
700 | - | let bRate = $ | |
701 | - | let ratesRecalcResult2 = $ | |
752 | + | let $t02497825040 = getActualRate(sAssetIdStr, "sRate") | |
753 | + | let sRate = $t02497825040._1 | |
754 | + | let ratesResult = $t02497825040._2 | |
755 | + | let $t02504525114 = getActualRate(bAssetIdStr, "bRate") | |
756 | + | let bRate = $t02504525114._1 | |
757 | + | let ratesRecalcResult2 = $t02504525114._2 | |
702 | 758 | let sAssetAmount = fraction(assetAmount, Scale16, sRate) | |
703 | 759 | let currentSPosition = tryGetInteger(((address + "_supplied_") + sAssetIdStr)) | |
704 | 760 | let currentBPositionVal = tryGetInteger(((address + "_borrowed_") + bAssetIdStr)) | |
705 | 761 | let currentBPosition = if ((currentBPositionVal > 0)) | |
706 | 762 | then currentBPositionVal | |
707 | 763 | else throw("user has no borrow in this token") | |
708 | 764 | if ((userCollateral > 0)) | |
709 | 765 | then throw("user can't be liquidated") | |
710 | 766 | else if ((sAssetAmount > currentSPosition)) | |
711 | 767 | then throw("position to liquidate is bigger than user's supply") | |
712 | 768 | else { | |
713 | 769 | let balance0Before = getBalance(sAssetIdStr) | |
714 | 770 | if ((balance0Before == balance0Before)) | |
715 | 771 | then { | |
716 | 772 | let balance1Before = getBalance(bAssetIdStr) | |
717 | 773 | if ((balance1Before == balance1Before)) | |
718 | 774 | then { | |
719 | 775 | let exchangeInvoke = invoke(aggregatorAddress, "swap", [routeStr, 0], [AttachedPayment(getAssetBytes(sAssetIdStr), assetAmount)]) | |
720 | 776 | if ((exchangeInvoke == exchangeInvoke)) | |
721 | 777 | then { | |
722 | 778 | let asset0Sold = (balance0Before - getBalance(sAssetIdStr)) | |
723 | 779 | if ((asset0Sold == asset0Sold)) | |
724 | 780 | then { | |
725 | 781 | let asset1Bought = (getBalance(bAssetIdStr) - balance1Before) | |
726 | 782 | if ((asset1Bought == asset1Bought)) | |
727 | 783 | then { | |
728 | 784 | let asset0Price = getTokenPrice(sAssetIdStr)._1 | |
729 | 785 | let asset0Scale = calcAssetScale(sAssetIdStr) | |
730 | 786 | let asset0Usd = fraction(asset0Sold, asset0Price, asset0Scale) | |
731 | 787 | let asset1Price = getTokenPrice(bAssetIdStr)._2 | |
732 | 788 | let asset1Scale = calcAssetScale(bAssetIdStr) | |
733 | 789 | let asset1Usd = fraction(asset1Bought, asset1Price, asset1Scale) | |
734 | 790 | let penalty = parseIntValue(split(tryGetString("setup_penalties"), ",")[value(indexOf(getMarketAssets(), bAssetIdStr))]) | |
735 | 791 | let liquidationProfit = (asset1Usd - fraction(asset0Usd, (Scale8 - penalty), Scale8)) | |
736 | 792 | let sAssetChange = fraction(asset0Sold, Scale16, sRate) | |
737 | 793 | let bAssetChange = fraction(fraction(asset1Bought, Scale16, bRate), (Scale8 - fraction(liquidationProfit, Scale8, asset1Usd)), Scale8) | |
738 | 794 | if ((asset0Sold > assetAmount)) | |
739 | 795 | then throw("more assets exchanged than expected") | |
740 | 796 | else if ((0 > liquidationProfit)) | |
741 | 797 | then throw("price impact is bigger than liquidation penalty") | |
742 | 798 | else [IntegerEntry(((address + "_supplied_") + sAssetIdStr), (currentSPosition - sAssetChange)), IntegerEntry(((address + "_borrowed_") + bAssetIdStr), (currentBPosition - bAssetChange)), IntegerEntry(("total_supplied_" + sAssetIdStr), (tryGetInteger(("total_supplied_" + sAssetIdStr)) - sAssetChange)), IntegerEntry(("total_borrowed_" + bAssetIdStr), (tryGetInteger(("total_borrowed_" + bAssetIdStr)) - bAssetChange))] | |
743 | 799 | } | |
744 | 800 | else throw("Strict value is not equal to itself.") | |
745 | 801 | } | |
746 | 802 | else throw("Strict value is not equal to itself.") | |
747 | 803 | } | |
748 | 804 | else throw("Strict value is not equal to itself.") | |
749 | 805 | } | |
750 | 806 | else throw("Strict value is not equal to itself.") | |
751 | 807 | } | |
752 | 808 | else throw("Strict value is not equal to itself.") | |
753 | 809 | } | |
754 | 810 | } | |
755 | 811 | else throw("Strict value is not equal to itself.") | |
756 | 812 | } | |
757 | 813 | ||
758 | 814 | ||
759 | 815 | ||
760 | 816 | @Callable(i) | |
761 | 817 | func liquidateV2 (debug,address,sAssetIdStr) = if (!(verifyLiquidatorRights(i.caller))) | |
762 | 818 | then throw("temporarily available for whitelist only") | |
763 | 819 | else if (!(tryGetBoolean("setup_active"))) | |
764 | 820 | then throw("market is stopped") | |
765 | 821 | else { | |
766 | 822 | let bAssetId = i.payments[0].assetId | |
767 | 823 | let bAssetIdStr = getAssetString(bAssetId) | |
768 | 824 | let bAssetAmount = i.payments[0].amount | |
769 | 825 | let userCollateral = calcUserCollateral(address) | |
770 | 826 | if ((userCollateral == userCollateral)) | |
771 | 827 | then if ((userCollateral > 0)) | |
772 | 828 | then throw("user can't be liquidated") | |
773 | 829 | else { | |
774 | 830 | let marketAssets = getMarketAssets() | |
775 | 831 | let asset1Num = value(indexOf(marketAssets, bAssetIdStr)) | |
776 | 832 | let asset0Num = value(indexOf(marketAssets, sAssetIdStr)) | |
777 | - | let $ | |
778 | - | let bRate = $ | |
779 | - | let ratesResult = $ | |
833 | + | let $t02826928331 = getActualRate(bAssetIdStr, "bRate") | |
834 | + | let bRate = $t02826928331._1 | |
835 | + | let ratesResult = $t02826928331._2 | |
780 | 836 | let asset1Price = getTokenPrice(bAssetIdStr)._2 | |
781 | 837 | let asset1Scale = calcAssetScale(bAssetIdStr) | |
782 | 838 | let bAmountUsd = fraction(bAssetAmount, asset1Price, asset1Scale) | |
783 | 839 | let penalty = parseIntValue(value(split(tryGetString("setup_penalties"), ",")[asset1Num])) | |
784 | 840 | let asset0Price = getTokenPrice(sAssetIdStr)._1 | |
785 | 841 | let asset0Scale = calcAssetScale(sAssetIdStr) | |
786 | 842 | let sAmountUsd = fraction(bAmountUsd, (Scale8 + penalty), Scale8) | |
787 | 843 | let sAssetAmount = fraction(sAmountUsd, asset0Scale, asset0Price) | |
788 | 844 | let bAmount = fraction(bAssetAmount, Scale16, bRate) | |
789 | 845 | let sAmount = fraction(sAssetAmount, Scale16, ratesResult[((asset0Num * 3) + 1)].value) | |
790 | 846 | let currentSPosition = tryGetInteger(((address + "_supplied_") + sAssetIdStr)) | |
791 | 847 | let currentBPositionVal = tryGetInteger(((address + "_borrowed_") + bAssetIdStr)) | |
792 | 848 | let currentBPosition = if ((currentBPositionVal > 0)) | |
793 | 849 | then currentBPositionVal | |
794 | 850 | else throw("user has no borrow in this token") | |
795 | 851 | if ((sAmount > currentSPosition)) | |
796 | 852 | then throw("position to liquidate is bigger than user's supply") | |
797 | 853 | else if (debug) | |
798 | 854 | then throw("liquidation will pass") | |
799 | 855 | else ([ScriptTransfer(i.caller, sAssetAmount, getAssetBytes(sAssetIdStr)), IntegerEntry(((address + "_supplied_") + sAssetIdStr), (currentSPosition - sAmount)), IntegerEntry(((address + "_borrowed_") + bAssetIdStr), (currentBPosition - bAmount)), IntegerEntry(("total_supplied_" + sAssetIdStr), (tryGetInteger(("total_supplied_" + sAssetIdStr)) - sAmount)), IntegerEntry(("total_borrowed_" + bAssetIdStr), (tryGetInteger(("total_borrowed_" + bAssetIdStr)) - bAmount))] ++ ratesResult) | |
800 | 856 | } | |
801 | 857 | else throw("Strict value is not equal to itself.") | |
802 | 858 | } | |
803 | 859 | ||
804 | 860 | ||
805 | 861 | ||
806 | 862 | @Callable(i) | |
807 | 863 | func getUserCollateral (debug,address,minusBorrowed,afterChange) = { | |
808 | 864 | let assets = getMarketAssets() | |
809 | 865 | let ltvs = split(tryGetString("setup_ltvs"), ",") | |
810 | 866 | let lts = split(tryGetString("setup_lts"), ",") | |
811 | 867 | let rates = getActualRate(assets[0], "sRate")._2 | |
812 | 868 | let changeHandler = split(afterChange, ",") | |
813 | 869 | func f (accum,next) = if ((next >= size(assets))) | |
814 | 870 | then accum | |
815 | 871 | else { | |
816 | 872 | let userSupplied = tryGetInteger(((address + "_supplied_") + assets[next])) | |
817 | 873 | let userBorrowed = tryGetInteger(((address + "_borrowed_") + assets[next])) | |
818 | 874 | let needTokenAccounting = if ((afterChange == "")) | |
819 | 875 | then if (if ((userBorrowed != 0)) | |
820 | 876 | then true | |
821 | 877 | else (userSupplied != 0)) | |
822 | 878 | then true | |
823 | 879 | else false | |
824 | 880 | else true | |
825 | 881 | if (needTokenAccounting) | |
826 | 882 | then { | |
827 | 883 | let assetScale = calcAssetScale(assets[next]) | |
828 | 884 | let assetPrice = getTokenPrice(assets[next]) | |
829 | 885 | ((accum + fraction(fraction(fraction((userSupplied + (if (if (if ((afterChange != "")) | |
830 | 886 | then (changeHandler[0] == assets[next]) | |
831 | 887 | else false) | |
832 | 888 | then (changeHandler[1] == "supplied") | |
833 | 889 | else false) | |
834 | 890 | then parseIntValue(changeHandler[2]) | |
835 | 891 | else 0)), rates[(next * 3)].value, Scale16), parseIntValue(ltvs[next]), Scale8), assetPrice._1, assetScale)) - (if (minusBorrowed) | |
836 | 892 | then fraction(fraction(fraction((userBorrowed + (if (if (if ((afterChange != "")) | |
837 | 893 | then (changeHandler[0] == assets[next]) | |
838 | 894 | else false) | |
839 | 895 | then (changeHandler[1] == "borrowed") | |
840 | 896 | else false) | |
841 | 897 | then parseIntValue(changeHandler[2]) | |
842 | 898 | else 0)), rates[((next * 3) + 1)].value, Scale16), Scale8, parseIntValue(lts[next])), assetPrice._2, assetScale) | |
843 | 899 | else 0)) | |
844 | 900 | } | |
845 | 901 | else accum | |
846 | 902 | } | |
847 | 903 | ||
848 | 904 | let result = { | |
849 | 905 | let $l = [0, 1, 2, 3, 4, 5] | |
850 | 906 | let $s = size($l) | |
851 | 907 | let $acc0 = 0 | |
852 | 908 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
853 | 909 | then $a | |
854 | 910 | else f($a, $l[$i]) | |
855 | 911 | ||
856 | 912 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
857 | 913 | then $a | |
858 | 914 | else throw("List size exceeds 6") | |
859 | 915 | ||
860 | 916 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
861 | 917 | } | |
862 | 918 | if (debug) | |
863 | 919 | then throw(toString(result)) | |
864 | 920 | else $Tuple2(rates, result) | |
865 | 921 | } | |
866 | 922 | ||
867 | 923 | ||
868 | 924 | ||
869 | 925 | @Callable(i) | |
870 | 926 | func getPrices (debug) = { | |
871 | 927 | let assets = getMarketAssets() | |
872 | 928 | func f (accum,next) = if ((next >= size(assets))) | |
873 | 929 | then accum | |
874 | 930 | else { | |
875 | 931 | let assetPrice = getTokenPrice(assets[next]) | |
876 | 932 | ((((accum + toString(assetPrice._1)) + ",") + toString(assetPrice._2)) + "|") | |
877 | 933 | } | |
878 | 934 | ||
879 | 935 | let result = { | |
880 | 936 | let $l = [0, 1, 2, 3, 4, 5] | |
881 | 937 | let $s = size($l) | |
882 | 938 | let $acc0 = "" | |
883 | 939 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
884 | 940 | then $a | |
885 | 941 | else f($a, $l[$i]) | |
886 | 942 | ||
887 | 943 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
888 | 944 | then $a | |
889 | 945 | else throw("List size exceeds 6") | |
890 | 946 | ||
891 | 947 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
892 | 948 | } | |
893 | 949 | if (debug) | |
894 | 950 | then throw(result) | |
895 | 951 | else $Tuple2(nil, result) | |
896 | 952 | } | |
897 | 953 | ||
898 | 954 | ||
899 | 955 | ||
900 | 956 | @Callable(i) | |
901 | 957 | func calculateUtilizationRatio (assetIdStr,debug) = if (debug) | |
902 | 958 | then throw(toString(getUr(assetIdStr))) | |
903 | 959 | else $Tuple2(nil, getUr(assetIdStr)) | |
904 | 960 | ||
905 | 961 | ||
906 | 962 | ||
907 | 963 | @Callable(i) | |
908 | 964 | func calculateOutdatedUR (assetIdStr,debug) = if (debug) | |
909 | 965 | then throw(toString(getOutdatedUr(assetIdStr))) | |
910 | 966 | else $Tuple2(nil, getOutdatedUr(assetIdStr)) | |
911 | 967 | ||
912 | 968 | ||
913 | 969 | ||
914 | 970 | @Callable(i) | |
915 | 971 | func calculateTokenRates (debug) = { | |
916 | 972 | func f (accum,assetIdStr) = { | |
917 | 973 | let rates = tokenRatesRecalc(assetIdStr) | |
918 | 974 | $Tuple2(((((accum._1 + toString(rates[1].value)) + "|") + toString(rates[0].value)) + ","), (accum._2 ++ rates)) | |
919 | 975 | } | |
920 | 976 | ||
921 | 977 | let parameter = { | |
922 | 978 | let $l = getMarketAssets() | |
923 | 979 | let $s = size($l) | |
924 | 980 | let $acc0 = $Tuple2("", nil) | |
925 | 981 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
926 | 982 | then $a | |
927 | 983 | else f($a, $l[$i]) | |
928 | 984 | ||
929 | 985 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
930 | 986 | then $a | |
931 | 987 | else throw("List size exceeds 6") | |
932 | 988 | ||
933 | 989 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
934 | 990 | } | |
935 | 991 | if (debug) | |
936 | 992 | then throw(parameter._1) | |
937 | 993 | else $Tuple2(parameter._2, parameter._1) | |
938 | 994 | } | |
939 | 995 | ||
940 | 996 | ||
941 | 997 | ||
942 | 998 | @Callable(i) | |
943 | 999 | func calculateTokensInterest (debug) = { | |
944 | 1000 | func f (accum,assetIdStr) = { | |
945 | 1001 | let rate = fraction(getInterest(assetIdStr), dayBlocks, Scale8) | |
946 | 1002 | ((accum + toString(rate)) + ",") | |
947 | 1003 | } | |
948 | 1004 | ||
949 | 1005 | let parameter = { | |
950 | 1006 | let $l = getMarketAssets() | |
951 | 1007 | let $s = size($l) | |
952 | 1008 | let $acc0 = "" | |
953 | 1009 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
954 | 1010 | then $a | |
955 | 1011 | else f($a, $l[$i]) | |
956 | 1012 | ||
957 | 1013 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
958 | 1014 | then $a | |
959 | 1015 | else throw("List size exceeds 6") | |
960 | 1016 | ||
961 | 1017 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
962 | 1018 | } | |
963 | 1019 | if (debug) | |
964 | 1020 | then throw(parameter) | |
965 | 1021 | else $Tuple2(nil, parameter) | |
966 | 1022 | } | |
967 | 1023 | ||
968 | 1024 | ||
969 | 1025 | @Verifier(tx) | |
970 | 1026 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
971 | 1027 |
github/deemru/w8io/169f3d6 99.20 ms ◑