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+Pr6AibAUYvsajt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gSjYHB5cDyaA8C2TpVfH5VohtjTrCFNvwYQ89jx4wHh Diff:
OldNewDifferences
237237 }
238238
239239
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+
240299 @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.")
260338 }
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+ }
274354
275355
276356
277357 @Callable(i)
278358 func withdraw (assetIdStr,assetAmount) = {
279- let $t080758142 = getActualRate(assetIdStr, "sRate")
280- let sRate = $t080758142._1
281- let ratesRecalcResult = $t080758142._2
359+ let $t098579924 = getActualRate(assetIdStr, "sRate")
360+ let sRate = $t098579924._1
361+ let ratesRecalcResult = $t098579924._2
282362 let amount = fraction(assetAmount, Scale16, sRate, CEILING)
283363 let address = toString(i.caller)
284364 let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr))
312392 @Callable(i)
313393 func borrow (assetIdStr,assetAmount) = {
314394 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))])
342398 }
343399
344400
353409 else {
354410 let assetIdStr = getAssetString(i.payments[0].assetId)
355411 let assetAmount = i.payments[0].amount
356- let $t01128611353 = getActualRate(assetIdStr, "bRate")
357- let bRate = $t01128611353._1
358- let ratesRecalcResult = $t01128611353._2
412+ let $t01199112058 = getActualRate(assetIdStr, "bRate")
413+ let bRate = $t01199112058._1
414+ let ratesRecalcResult = $t01199112058._2
359415 let amount = fraction(assetAmount, Scale16, bRate, CEILING)
360416 let address = toString(i.caller)
361417 let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr))
693749 let userCollateral = calcUserCollateral(address)
694750 if ((userCollateral == userCollateral))
695751 then {
696- let $t02427324335 = getActualRate(sAssetIdStr, "sRate")
697- let sRate = $t02427324335._1
698- let ratesResult = $t02427324335._2
699- let $t02434024409 = getActualRate(bAssetIdStr, "bRate")
700- let bRate = $t02434024409._1
701- let ratesRecalcResult2 = $t02434024409._2
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
702758 let sAssetAmount = fraction(assetAmount, Scale16, sRate)
703759 let currentSPosition = tryGetInteger(((address + "_supplied_") + sAssetIdStr))
704760 let currentBPositionVal = tryGetInteger(((address + "_borrowed_") + bAssetIdStr))
774830 let marketAssets = getMarketAssets()
775831 let asset1Num = value(indexOf(marketAssets, bAssetIdStr))
776832 let asset0Num = value(indexOf(marketAssets, sAssetIdStr))
777- let $t02756427626 = getActualRate(bAssetIdStr, "bRate")
778- let bRate = $t02756427626._1
779- let ratesResult = $t02756427626._2
833+ let $t02826928331 = getActualRate(bAssetIdStr, "bRate")
834+ let bRate = $t02826928331._1
835+ let ratesResult = $t02826928331._2
780836 let asset1Price = getTokenPrice(bAssetIdStr)._2
781837 let asset1Scale = calcAssetScale(bAssetIdStr)
782838 let bAmountUsd = fraction(bAssetAmount, asset1Price, asset1Scale)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let reserveFundAddress = Address(base58'3Mzzt65puEs2W9M1m9iFBvMEdfM5bASE1hJ')
55
66 let reserveFund = 20
77
88 let aggregatorAddress = Address(base58'3Mzzt65puEs2W9M1m9iFBvMEdfM5bASE1hJ')
99
1010 let oracleStr = "3N4KbMnJH8FaM94jqxNFe2oyZ8GB7Z8yVBP"
1111
1212 let shutdownWhitelist = [base58'3PMcMiMEs6w56NRGacksXtFG5zS7doE9fpL', base58'3PAxdDSmN758L5SHSGRC5apEtQE2aApZotG', base58'3PJKmXoHJvVeQXjSJdhtkUcFDtdiQqMbUTD', base58'3PQdNxynJy5mche2kxMVc5shXWzK8Gstq3o', base58'3PHbdpaKzz8EiAngGHaFu2hVuNCdsC67qh3', base58'3P6Ksahs71SiKQgQ4qaZuFAVhqncdi2nvJQ']
1313
1414 func verifyLiquidatorRights (address) = !((address != Address(base58'3Mzzt65puEs2W9M1m9iFBvMEdfM5bASE1hJ')))
1515
1616
1717 func getRateCurve (assetIdStr) = match assetIdStr {
1818 case _ =>
1919 if (("FLdC14nUVRyiSYjVrMo3X4g8rXQjLbNRaGAyQAm8V68V" == $match0))
2020 then $Tuple4(2000000, 25000000, 80000000, 100000000)
2121 else if (("25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT" == $match0))
2222 then $Tuple4(2000000, 25000000, 80000000, 100000000)
2323 else if (("WAVES" == $match0))
2424 then $Tuple4(2000000, 30000000, 80000000, 50000000)
2525 else $Tuple4(0, 20000000, 80000000, 80000000)
2626 }
2727
2828
2929 let Scale8 = 100000000
3030
3131 let Scale10 = 10000000000
3232
3333 let Scale16 = (Scale8 * Scale8)
3434
3535 let dayBlocks = 1440
3636
3737 func liIntToStr (li) = {
3838 func f (accum,next) = ((accum + toString(next)) + ",")
3939
4040 let $l = li
4141 let $s = size($l)
4242 let $acc0 = ""
4343 func $f0_1 ($a,$i) = if (($i >= $s))
4444 then $a
4545 else f($a, $l[$i])
4646
4747 func $f0_2 ($a,$i) = if (($i >= $s))
4848 then $a
4949 else throw("List size exceeds 6")
5050
5151 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
5252 }
5353
5454
5555 func tryGetInteger (key) = match getInteger(this, key) {
5656 case b: Int =>
5757 b
5858 case _ =>
5959 0
6060 }
6161
6262
6363 func tryGetBoolean (key) = match getBoolean(this, key) {
6464 case b: Boolean =>
6565 b
6666 case _ =>
6767 false
6868 }
6969
7070
7171 func tryGetString (key) = match getString(this, key) {
7272 case b: String =>
7373 b
7474 case _ =>
7575 ""
7676 }
7777
7878
7979 func tryGetBinary (key) = match getBinary(this, key) {
8080 case b: ByteVector =>
8181 b
8282 case _ =>
8383 base58''
8484 }
8585
8686
8787 func getAssetString (assetId) = match assetId {
8888 case b: ByteVector =>
8989 toBase58String(b)
9090 case _ =>
9191 "WAVES"
9292 }
9393
9494
9595 func getAssetBytes (assetIdStr) = if ((assetIdStr == "WAVES"))
9696 then unit
9797 else fromBase58String(assetIdStr)
9898
9999
100100 func getBalance (assetIdStr) = if ((assetIdStr == "WAVES"))
101101 then wavesBalance(this).available
102102 else assetBalance(this, fromBase58String(assetIdStr))
103103
104104
105105 func getMarketAssets () = split(tryGetString("setup_tokens"), ",")
106106
107107
108108 func getAssetsMaxSupply () = {
109109 let s = tryGetString("setup_maxsupply")
110110 if ((s == ""))
111111 then [-1, -1, -1, -1, -1, -1, -1]
112112 else split(s, ",")
113113 }
114114
115115
116116 func getOutdatedUr (assetIdStr) = {
117117 let down = fraction(tryGetInteger(("total_supplied_" + assetIdStr)), tryGetInteger((assetIdStr + "_sRate")), Scale16)
118118 if ((down == 0))
119119 then 0
120120 else fraction(Scale8, fraction(tryGetInteger(("total_borrowed_" + assetIdStr)), tryGetInteger((assetIdStr + "_bRate")), Scale16), down)
121121 }
122122
123123
124124 func getInterest (assetIdStr) = {
125125 let ur = getOutdatedUr(assetIdStr)
126126 let curve = getRateCurve(assetIdStr)
127127 let rate = (curve._1 + (if ((curve._3 >= ur))
128128 then fraction(ur, curve._2, curve._3)
129129 else (curve._2 + fraction((ur - curve._3), curve._4, (100000000 - curve._3)))))
130130 max([fraction(rate, Scale8, (dayBlocks * 365)), 1])
131131 }
132132
133133
134134 func tokenRatesRecalc (assetIdStr) = {
135135 let interest = getInterest(assetIdStr)
136136 let ur = getOutdatedUr(assetIdStr)
137137 let lastRecalcHeight = tryGetInteger("lastRateHeight")
138138 let lastBRate = max([tryGetInteger((assetIdStr + "_bRate")), Scale16])
139139 let newBRate = (lastBRate + ((height - lastRecalcHeight) * interest))
140140 let lastSRate = max([tryGetInteger((assetIdStr + "_sRate")), Scale16])
141141 let newSRate = (lastSRate + ((((height - lastRecalcHeight) * fraction(interest, ur, Scale8)) * (100 - reserveFund)) / 100))
142142 [IntegerEntry((assetIdStr + "_sRate"), newSRate), IntegerEntry((assetIdStr + "_bRate"), newBRate), IntegerEntry("lastRateHeight", height)]
143143 }
144144
145145
146146 func getActualRate (assetIdStr,rateType) = {
147147 func f (accum,token) = {
148148 let recalc = tokenRatesRecalc(token)
149149 $Tuple2(if ((token != assetIdStr))
150150 then accum._1
151151 else if ((rateType == "sRate"))
152152 then recalc[0].value
153153 else recalc[1].value, (accum._2 ++ recalc))
154154 }
155155
156156 let $l = getMarketAssets()
157157 let $s = size($l)
158158 let $acc0 = $Tuple2(0, nil)
159159 func $f0_1 ($a,$i) = if (($i >= $s))
160160 then $a
161161 else f($a, $l[$i])
162162
163163 func $f0_2 ($a,$i) = if (($i >= $s))
164164 then $a
165165 else throw("List size exceeds 6")
166166
167167 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
168168 }
169169
170170
171171 func getUr (assetIdStr) = {
172172 let rates = tokenRatesRecalc(assetIdStr)
173173 let down = fraction(tryGetInteger(("total_supplied_" + assetIdStr)), rates[0].value, Scale16)
174174 fraction(Scale8, fraction(tryGetInteger(("total_borrowed_" + assetIdStr)), rates[1].value, Scale16), down)
175175 }
176176
177177
178178 func ratesRecalc () = {
179179 func f (accum,token) = (accum ++ tokenRatesRecalc(token))
180180
181181 let $l = getMarketAssets()
182182 let $s = size($l)
183183 let $acc0 = nil
184184 func $f0_1 ($a,$i) = if (($i >= $s))
185185 then $a
186186 else f($a, $l[$i])
187187
188188 func $f0_2 ($a,$i) = if (($i >= $s))
189189 then $a
190190 else throw("List size exceeds 6")
191191
192192 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
193193 }
194194
195195
196196 func getTokenPrice (assetIdStr) = {
197197 let inv3 = invoke(addressFromStringValue(oracleStr), "getTWAP60", [assetIdStr, false], nil)
198198 if ((inv3 == inv3))
199199 then {
200200 let data3 = match inv3 {
201201 case x: (Int, Int) =>
202202 x
203203 case _ =>
204204 throw("error of price oracle")
205205 }
206206 if ((data3 == data3))
207207 then data3
208208 else throw("Strict value is not equal to itself.")
209209 }
210210 else throw("Strict value is not equal to itself.")
211211 }
212212
213213
214214 func calcAssetScale (assetIdStr) = {
215215 let decimals = if ((assetIdStr == "WAVES"))
216216 then 8
217217 else value(assetInfo(fromBase58String(assetIdStr))).decimals
218218 pow(10, 0, decimals, 0, 0, DOWN)
219219 }
220220
221221
222222 func calcUserCollateral (address) = {
223223 let userCollateralInvoke = invoke(this, "getUserCollateral", [false, address, true, ""], nil)
224224 if ((userCollateralInvoke == userCollateralInvoke))
225225 then {
226226 let userCollateralValue = match userCollateralInvoke {
227227 case x: Int =>
228228 x
229229 case _ =>
230230 throw("issue while doing in-dapp invocation")
231231 }
232232 if ((userCollateralValue == userCollateralValue))
233233 then userCollateralValue
234234 else throw("Strict value is not equal to itself.")
235235 }
236236 else throw("Strict value is not equal to itself.")
237237 }
238238
239239
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+
240299 @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.")
260338 }
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+ }
274354
275355
276356
277357 @Callable(i)
278358 func withdraw (assetIdStr,assetAmount) = {
279- let $t080758142 = getActualRate(assetIdStr, "sRate")
280- let sRate = $t080758142._1
281- let ratesRecalcResult = $t080758142._2
359+ let $t098579924 = getActualRate(assetIdStr, "sRate")
360+ let sRate = $t098579924._1
361+ let ratesRecalcResult = $t098579924._2
282362 let amount = fraction(assetAmount, Scale16, sRate, CEILING)
283363 let address = toString(i.caller)
284364 let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr))
285365 let assetBorrowed = tryGetInteger(("total_borrowed_" + assetIdStr))
286366 let userAssetSupplied = tryGetInteger(((address + "_supplied_") + assetIdStr))
287367 let userAssetBorrowed = tryGetInteger(((address + "_borrowed_") + assetIdStr))
288368 let collateralValueInv = invoke(this, "getUserCollateral", [false, address, true, ((assetIdStr + ",supplied,") + toString(-(amount)))], nil)
289369 if ((collateralValueInv == collateralValueInv))
290370 then {
291371 let collateralValue = match collateralValueInv {
292372 case x: Int =>
293373 x
294374 case _ =>
295375 throw("can't get user collateral value")
296376 }
297377 if (!(tryGetBoolean("setup_active")))
298378 then throw("market is stopped")
299379 else if ((0 > collateralValue))
300380 then throw("you dont have enough collateral for this operation")
301381 else if ((amount > (assetSupplied - assetBorrowed)))
302382 then throw("this amount is not available on the market")
303383 else if ((amount > (userAssetSupplied - userAssetBorrowed)))
304384 then throw("this amount is not available for this user")
305385 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)
306386 }
307387 else throw("Strict value is not equal to itself.")
308388 }
309389
310390
311391
312392 @Callable(i)
313393 func borrow (assetIdStr,assetAmount) = {
314394 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))])
342398 }
343399
344400
345401
346402 @Callable(i)
347403 func repay () = if (!(tryGetBoolean("setup_active")))
348404 then throw("market is stopped")
349405 else if (if ((size(i.payments) != 1))
350406 then true
351407 else (i.payments[0].amount == 0))
352408 then throw("1 payment has to be attached")
353409 else {
354410 let assetIdStr = getAssetString(i.payments[0].assetId)
355411 let assetAmount = i.payments[0].amount
356- let $t01128611353 = getActualRate(assetIdStr, "bRate")
357- let bRate = $t01128611353._1
358- let ratesRecalcResult = $t01128611353._2
412+ let $t01199112058 = getActualRate(assetIdStr, "bRate")
413+ let bRate = $t01199112058._1
414+ let ratesRecalcResult = $t01199112058._2
359415 let amount = fraction(assetAmount, Scale16, bRate, CEILING)
360416 let address = toString(i.caller)
361417 let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr))
362418 let assetBorrowed = tryGetInteger(("total_borrowed_" + assetIdStr))
363419 let userAssetBorrowed = tryGetInteger(((address + "_borrowed_") + assetIdStr))
364420 let amountLeft = (userAssetBorrowed - amount)
365421 let repayAmount = if ((amountLeft >= 0))
366422 then amount
367423 else userAssetBorrowed
368424 if ((indexOf(tryGetString("setup_tokens"), assetIdStr) == unit))
369425 then throw("this asset is not supported by the market")
370426 else (([IntegerEntry(((address + "_borrowed_") + assetIdStr), (userAssetBorrowed - repayAmount)), IntegerEntry(("total_borrowed_" + assetIdStr), (assetBorrowed - repayAmount))] ++ ratesRecalcResult) ++ (if ((amountLeft >= 0))
371427 then nil
372428 else [ScriptTransfer(i.caller, -(amountLeft), i.payments[0].assetId)]))
373429 }
374430
375431
376432
377433 @Callable(i)
378434 func stakeTokenAll (assetIdStr) = if ((i.caller != this))
379435 then throw("only for internal smart contract invocations")
380436 else {
381437 let amount = getBalance(assetIdStr)
382438 let inv = invoke(this, "stakeToken", [assetIdStr, amount], nil)
383439 if ((inv == inv))
384440 then nil
385441 else throw("Strict value is not equal to itself.")
386442 }
387443
388444
389445
390446 @Callable(i)
391447 func stakeToken (assetIdStr,amount) = if ((i.caller != this))
392448 then throw("only for internal smart contract invocations")
393449 else if ((assetIdStr == "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p"))
394450 then {
395451 let amountStaked = tryGetInteger("autostake_amount_DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p")
396452 let inv = invoke(Address(base58'3PNikM6yp4NqcSU8guxQtmR5onr2D4e8yTJ'), "stake", nil, [AttachedPayment(base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p', amount)])
397453 if ((inv == inv))
398454 then [IntegerEntry("autostake_amount_DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p", (amountStaked + amount))]
399455 else throw("Strict value is not equal to itself.")
400456 }
401457 else if ((assetIdStr == "8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91"))
402458 then {
403459 let amountStaked = tryGetInteger("autostake_amount_8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91")
404460 let inv = invoke(Address(base58'3PQTM38wDmAY9vWonK6ha7QL3PAycLz5oPP'), "stake", nil, [AttachedPayment(base58'8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91', amount)])
405461 if ((inv == inv))
406462 then [IntegerEntry("autostake_amount_8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91", (amountStaked + amount))]
407463 else throw("Strict value is not equal to itself.")
408464 }
409465 else if ((assetIdStr == "At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL"))
410466 then {
411467 let amountStaked = tryGetInteger("autostake_amount_At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL")
412468 let inv = invoke(Address(base58'3PBiotFpqjRMkkeFBccnQNUXUopy7KFez5C'), "stake", nil, [AttachedPayment(base58'At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL', amount)])
413469 if ((inv == inv))
414470 then [IntegerEntry("autostake_amount_At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL", (amountStaked + amount))]
415471 else throw("Strict value is not equal to itself.")
416472 }
417473 else nil
418474
419475
420476
421477 @Callable(i)
422478 func unstakeToken (assetIdStr,amount) = if ((i.caller != this))
423479 then throw("only for internal smart contract invocations")
424480 else if ((assetIdStr == "8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91"))
425481 then {
426482 let amountStaked = tryGetInteger("autostake_amount_8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91")
427483 let inv = invoke(Address(base58'3PQTM38wDmAY9vWonK6ha7QL3PAycLz5oPP'), "unStake", [amount], nil)
428484 if ((inv == inv))
429485 then [IntegerEntry("autostake_amount_8t4DPWTwPzpatHA9AkTxWAB47THnYzBsDnoY7fQqbG91", (amountStaked - amount))]
430486 else throw("Strict value is not equal to itself.")
431487 }
432488 else if ((assetIdStr == "At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL"))
433489 then {
434490 let amountStaked = tryGetInteger("autostake_amount_At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL")
435491 let inv = invoke(Address(base58'3PBiotFpqjRMkkeFBccnQNUXUopy7KFez5C'), "unstake", [amount], nil)
436492 if ((inv == inv))
437493 then {
438494 let bal0 = getBalance("At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL")
439495 if ((bal0 == bal0))
440496 then {
441497 let inv2 = invoke(Address(base58'3PQrVbTVpqXHqpVKftkNdjy3zZAh4dsRzN6'), "gnsbtRewardsSYSREADONLY", [toString(this)], nil)
442498 if ((inv2 == inv2))
443499 then {
444500 let topupRewards = match inv2 {
445501 case x: List[Any] =>
446502 let secondEl = x[1]
447503 match secondEl {
448504 case secondEl: String =>
449505 let usdnValue = parseIntValue(split(split(secondEl, "_")[1], ":")[1])
450506 let wavesValue = parseIntValue(split(split(secondEl, "_")[0], ":")[1])
451507 if (if ((usdnValue != 0))
452508 then true
453509 else (wavesValue != 0))
454510 then {
455511 let usdnBal0 = getBalance("DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p")
456512 if ((usdnBal0 == usdnBal0))
457513 then {
458514 let wavesBal0 = getBalance("WAVES")
459515 if ((wavesBal0 == wavesBal0))
460516 then {
461517 let inv3 = invoke(Address(base58'3PBiotFpqjRMkkeFBccnQNUXUopy7KFez5C'), "claimRewards", nil, nil)
462518 if ((inv3 == inv3))
463519 then {
464520 let wavesBal1 = getBalance("WAVES")
465521 if ((wavesBal1 == wavesBal1))
466522 then {
467523 let inv4 = invoke(Address(base58'3PLiXyywNThdvf3vVEUxwc7TJTucjZvuegh'), "swap", ["DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p", 0], [AttachedPayment(unit, (wavesBal1 - wavesBal0))])
468524 if ((inv4 == inv4))
469525 then {
470526 let usdnBal1 = getBalance("DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p")
471527 if ((usdnBal1 == usdnBal1))
472528 then {
473529 let inv5 = invoke(Address(base58'3P7r93vXHuusageNJVGwzqaz3WMotAu49Yz'), "swap", ["At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL", 0], [AttachedPayment(base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p', (usdnBal1 - usdnBal0))])
474530 if ((inv5 == inv5))
475531 then {
476532 let inv6 = invoke(this, "addInterest", ["At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL", (getBalance("At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL") - bal0)], nil)
477533 if ((inv6 == inv6))
478534 then 2
479535 else throw("Strict value is not equal to itself.")
480536 }
481537 else throw("Strict value is not equal to itself.")
482538 }
483539 else throw("Strict value is not equal to itself.")
484540 }
485541 else throw("Strict value is not equal to itself.")
486542 }
487543 else throw("Strict value is not equal to itself.")
488544 }
489545 else throw("Strict value is not equal to itself.")
490546 }
491547 else throw("Strict value is not equal to itself.")
492548 }
493549 else throw("Strict value is not equal to itself.")
494550 }
495551 else 1
496552 case _ =>
497553 1
498554 }
499555 case _ =>
500556 0
501557 }
502558 if ((topupRewards == topupRewards))
503559 then [IntegerEntry("autostake_amount_At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL", (amountStaked - amount))]
504560 else throw("Strict value is not equal to itself.")
505561 }
506562 else throw("Strict value is not equal to itself.")
507563 }
508564 else throw("Strict value is not equal to itself.")
509565 }
510566 else throw("Strict value is not equal to itself.")
511567 }
512568 else nil
513569
514570
515571
516572 @Callable(i)
517573 func addInterest (assetIdStr,amount) = if ((i.caller != this))
518574 then throw("only for self invocation")
519575 else {
520576 let earned = tryGetInteger(("autostake_lastEarned_" + assetIdStr))
521577 let lastHeight = tryGetInteger(("autostake_lastBlock_" + assetIdStr))
522578 let cleanAmount = fraction(amount, 80, 100)
523579 let stateChanges = if (if ((lastHeight == height))
524580 then true
525581 else (amount == 0))
526582 then nil
527583 else [IntegerEntry(("autostake_preLastEarned_" + assetIdStr), earned), IntegerEntry(("autostake_preLastBlock_" + assetIdStr), lastHeight), IntegerEntry(("autostake_lastEarned_" + assetIdStr), (earned + cleanAmount)), IntegerEntry(("autostake_lastBlock_" + assetIdStr), height)]
528584 (stateChanges ++ [IntegerEntry((assetIdStr + "_sRate"), (tryGetInteger((assetIdStr + "_sRate")) + fraction(Scale16, cleanAmount, tryGetInteger(("total_supplied_" + assetIdStr)))))])
529585 }
530586
531587
532588
533589 @Callable(i)
534590 func addInterestEXTERNAL () = {
535591 let amount = fraction(i.payments[0].amount, 80, 100)
536592 let assetId = i.payments[0].assetId
537593 let assetIdStr = getAssetString(assetId)
538594 let earned = tryGetInteger(("autostake_lastEarned_" + assetIdStr))
539595 let lastHeight = tryGetInteger(("autostake_lastBlock_" + assetIdStr))
540596 let stateChanges = if (if ((lastHeight == height))
541597 then true
542598 else (amount == 0))
543599 then nil
544600 else [IntegerEntry(("autostake_preLastEarned_" + assetIdStr), earned), IntegerEntry(("autostake_preLastBlock_" + assetIdStr), lastHeight), IntegerEntry(("autostake_lastEarned_" + assetIdStr), (earned + amount)), IntegerEntry(("autostake_lastBlock_" + assetIdStr), height)]
545601 (stateChanges ++ [IntegerEntry((assetIdStr + "_sRate"), (tryGetInteger((assetIdStr + "_sRate")) + fraction(Scale16, amount, tryGetInteger(("total_supplied_" + assetIdStr)))))])
546602 }
547603
548604
549605
550606 @Callable(i)
551607 func preInit (tokens,ltvs,lts,penalties) = {
552608 func f (accum,token) = (accum ++ [IntegerEntry((token + "_bRate"), Scale16), IntegerEntry((token + "_sRate"), Scale16)])
553609
554610 if ((i.caller != this))
555611 then throw("admin only")
556612 else {
557613 let rates = {
558614 let $l = split(tokens, ",")
559615 let $s = size($l)
560616 let $acc0 = nil
561617 func $f0_1 ($a,$i) = if (($i >= $s))
562618 then $a
563619 else f($a, $l[$i])
564620
565621 func $f0_2 ($a,$i) = if (($i >= $s))
566622 then $a
567623 else throw("List size exceeds 6")
568624
569625 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
570626 }
571627 ([StringEntry("setup_tokens", tokens), StringEntry("setup_ltvs", ltvs), StringEntry("setup_lts", lts), StringEntry("setup_penalties", penalties), BooleanEntry("setup_active", true)] ++ rates)
572628 }
573629 }
574630
575631
576632
577633 @Callable(i)
578634 func updateParameter (key,val) = if (if ((i.caller != this))
579635 then (i.caller != Address(base58'3P3o9cLTV2u9N4nYNKRYL6gy6cUEU9DwXW8'))
580636 else false)
581637 then throw("admin only")
582638 else [IntegerEntry(key, parseIntValue(val))]
583639
584640
585641
586642 @Callable(i)
587643 func updateString (key,val) = if (if ((i.caller != this))
588644 then (i.caller != Address(base58'3P3o9cLTV2u9N4nYNKRYL6gy6cUEU9DwXW8'))
589645 else false)
590646 then throw("admin only")
591647 else [StringEntry(key, val)]
592648
593649
594650
595651 @Callable(i)
596652 func claimToReserveFund (debug) = {
597653 let assets = getMarketAssets()
598654 let rates = getActualRate(assets[0], "sRate")._2
599655 let li = [0, 1, 2, 3, 4, 5]
600656 func f (accum,n) = if ((n >= size(assets)))
601657 then accum
602658 else {
603659 let assetIdStr = assets[n]
604660 let autostakeAmount = tryGetString(("autostake_amount_" + assetIdStr))
605661 let amount = ((((getBalance(assetIdStr) + tryGetInteger(("autostake_amount_" + assetIdStr))) + (if ((autostakeAmount != ""))
606662 then parseIntValue(autostakeAmount)
607663 else 0)) + fraction(tryGetInteger(("total_borrowed_" + assetIdStr)), rates[((n * 3) + 1)].value, Scale16)) - fraction(tryGetInteger(("total_supplied_" + assetIdStr)), rates[(n * 3)].value, Scale16))
608664 let inv = if ((tryGetInteger(("autostake_amount_" + assetIdStr)) > 0))
609665 then invoke(this, "unstakeToken", [assetIdStr, max([amount, 0])], nil)
610666 else 0
611667 if ((inv == inv))
612668 then (accum ++ [amount])
613669 else throw("Strict value is not equal to itself.")
614670 }
615671
616672 let parameter = {
617673 let $l = li
618674 let $s = size($l)
619675 let $acc0 = nil
620676 func $f0_1 ($a,$i) = if (($i >= $s))
621677 then $a
622678 else f($a, $l[$i])
623679
624680 func $f0_2 ($a,$i) = if (($i >= $s))
625681 then $a
626682 else throw("List size exceeds 6")
627683
628684 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
629685 }
630686 func f2 (accum,n) = if ((n >= size(assets)))
631687 then accum
632688 else {
633689 let assetIdStr = assets[n]
634690 (accum ++ [ScriptTransfer(reserveFundAddress, max([parameter[n], 0]), getAssetBytes(assetIdStr))])
635691 }
636692
637693 if (debug)
638694 then throw(liIntToStr(parameter))
639695 else $Tuple2({
640696 let $l = li
641697 let $s = size($l)
642698 let $acc0 = nil
643699 func $f1_1 ($a,$i) = if (($i >= $s))
644700 then $a
645701 else f2($a, $l[$i])
646702
647703 func $f1_2 ($a,$i) = if (($i >= $s))
648704 then $a
649705 else throw("List size exceeds 6")
650706
651707 $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6)
652708 }, parameter)
653709 }
654710
655711
656712
657713 @Callable(i)
658714 func reSetup (assetIdStr) = {
659715 let lastResetup = tryGetInteger("resetup_lastUpdate")
660716 if ((dayBlocks > (height - lastResetup)))
661717 then throw("can be updated only once per day")
662718 else {
663719 let lts = split(tryGetString("setup_lts"), ",")
664720 let assets = getMarketAssets()
665721 let ur = getUr(assetIdStr)
666722 let tempLT = tryGetInteger((("setup_" + assetIdStr) + "_tempLT"))
667723 let lt = parseIntValue(assets[value(indexOf(assets, assetIdStr))])
668724 if ((ur > 90000000))
669725 then [IntegerEntry((("setup_" + assetIdStr) + "_tempLT"), fraction(tempLT, 9975, 10000))]
670726 else if (if ((lt > tempLT))
671727 then (90000000 > ur)
672728 else false)
673729 then [IntegerEntry((("setup_" + assetIdStr) + "_tempLT"), fraction(tempLT, 10025, 10000))]
674730 else nil
675731 }
676732 }
677733
678734
679735
680736 @Callable(i)
681737 func shutdown (shutdown) = if ((indexOf(shutdownWhitelist, i.caller.bytes) == unit))
682738 then throw("user not in a whitelist")
683739 else [BooleanEntry("setup_active", !(shutdown))]
684740
685741
686742
687743 @Callable(i)
688744 func liquidate (debug,address,assetAmount,sAssetIdStr,bAssetIdStr,routeStr) = if (!(verifyLiquidatorRights(i.caller)))
689745 then throw("temporarily available for whitelist only")
690746 else if (!(tryGetBoolean("setup_active")))
691747 then throw("market is stopped")
692748 else {
693749 let userCollateral = calcUserCollateral(address)
694750 if ((userCollateral == userCollateral))
695751 then {
696- let $t02427324335 = getActualRate(sAssetIdStr, "sRate")
697- let sRate = $t02427324335._1
698- let ratesResult = $t02427324335._2
699- let $t02434024409 = getActualRate(bAssetIdStr, "bRate")
700- let bRate = $t02434024409._1
701- let ratesRecalcResult2 = $t02434024409._2
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
702758 let sAssetAmount = fraction(assetAmount, Scale16, sRate)
703759 let currentSPosition = tryGetInteger(((address + "_supplied_") + sAssetIdStr))
704760 let currentBPositionVal = tryGetInteger(((address + "_borrowed_") + bAssetIdStr))
705761 let currentBPosition = if ((currentBPositionVal > 0))
706762 then currentBPositionVal
707763 else throw("user has no borrow in this token")
708764 if ((userCollateral > 0))
709765 then throw("user can't be liquidated")
710766 else if ((sAssetAmount > currentSPosition))
711767 then throw("position to liquidate is bigger than user's supply")
712768 else {
713769 let balance0Before = getBalance(sAssetIdStr)
714770 if ((balance0Before == balance0Before))
715771 then {
716772 let balance1Before = getBalance(bAssetIdStr)
717773 if ((balance1Before == balance1Before))
718774 then {
719775 let exchangeInvoke = invoke(aggregatorAddress, "swap", [routeStr, 0], [AttachedPayment(getAssetBytes(sAssetIdStr), assetAmount)])
720776 if ((exchangeInvoke == exchangeInvoke))
721777 then {
722778 let asset0Sold = (balance0Before - getBalance(sAssetIdStr))
723779 if ((asset0Sold == asset0Sold))
724780 then {
725781 let asset1Bought = (getBalance(bAssetIdStr) - balance1Before)
726782 if ((asset1Bought == asset1Bought))
727783 then {
728784 let asset0Price = getTokenPrice(sAssetIdStr)._1
729785 let asset0Scale = calcAssetScale(sAssetIdStr)
730786 let asset0Usd = fraction(asset0Sold, asset0Price, asset0Scale)
731787 let asset1Price = getTokenPrice(bAssetIdStr)._2
732788 let asset1Scale = calcAssetScale(bAssetIdStr)
733789 let asset1Usd = fraction(asset1Bought, asset1Price, asset1Scale)
734790 let penalty = parseIntValue(split(tryGetString("setup_penalties"), ",")[value(indexOf(getMarketAssets(), bAssetIdStr))])
735791 let liquidationProfit = (asset1Usd - fraction(asset0Usd, (Scale8 - penalty), Scale8))
736792 let sAssetChange = fraction(asset0Sold, Scale16, sRate)
737793 let bAssetChange = fraction(fraction(asset1Bought, Scale16, bRate), (Scale8 - fraction(liquidationProfit, Scale8, asset1Usd)), Scale8)
738794 if ((asset0Sold > assetAmount))
739795 then throw("more assets exchanged than expected")
740796 else if ((0 > liquidationProfit))
741797 then throw("price impact is bigger than liquidation penalty")
742798 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))]
743799 }
744800 else throw("Strict value is not equal to itself.")
745801 }
746802 else throw("Strict value is not equal to itself.")
747803 }
748804 else throw("Strict value is not equal to itself.")
749805 }
750806 else throw("Strict value is not equal to itself.")
751807 }
752808 else throw("Strict value is not equal to itself.")
753809 }
754810 }
755811 else throw("Strict value is not equal to itself.")
756812 }
757813
758814
759815
760816 @Callable(i)
761817 func liquidateV2 (debug,address,sAssetIdStr) = if (!(verifyLiquidatorRights(i.caller)))
762818 then throw("temporarily available for whitelist only")
763819 else if (!(tryGetBoolean("setup_active")))
764820 then throw("market is stopped")
765821 else {
766822 let bAssetId = i.payments[0].assetId
767823 let bAssetIdStr = getAssetString(bAssetId)
768824 let bAssetAmount = i.payments[0].amount
769825 let userCollateral = calcUserCollateral(address)
770826 if ((userCollateral == userCollateral))
771827 then if ((userCollateral > 0))
772828 then throw("user can't be liquidated")
773829 else {
774830 let marketAssets = getMarketAssets()
775831 let asset1Num = value(indexOf(marketAssets, bAssetIdStr))
776832 let asset0Num = value(indexOf(marketAssets, sAssetIdStr))
777- let $t02756427626 = getActualRate(bAssetIdStr, "bRate")
778- let bRate = $t02756427626._1
779- let ratesResult = $t02756427626._2
833+ let $t02826928331 = getActualRate(bAssetIdStr, "bRate")
834+ let bRate = $t02826928331._1
835+ let ratesResult = $t02826928331._2
780836 let asset1Price = getTokenPrice(bAssetIdStr)._2
781837 let asset1Scale = calcAssetScale(bAssetIdStr)
782838 let bAmountUsd = fraction(bAssetAmount, asset1Price, asset1Scale)
783839 let penalty = parseIntValue(value(split(tryGetString("setup_penalties"), ",")[asset1Num]))
784840 let asset0Price = getTokenPrice(sAssetIdStr)._1
785841 let asset0Scale = calcAssetScale(sAssetIdStr)
786842 let sAmountUsd = fraction(bAmountUsd, (Scale8 + penalty), Scale8)
787843 let sAssetAmount = fraction(sAmountUsd, asset0Scale, asset0Price)
788844 let bAmount = fraction(bAssetAmount, Scale16, bRate)
789845 let sAmount = fraction(sAssetAmount, Scale16, ratesResult[((asset0Num * 3) + 1)].value)
790846 let currentSPosition = tryGetInteger(((address + "_supplied_") + sAssetIdStr))
791847 let currentBPositionVal = tryGetInteger(((address + "_borrowed_") + bAssetIdStr))
792848 let currentBPosition = if ((currentBPositionVal > 0))
793849 then currentBPositionVal
794850 else throw("user has no borrow in this token")
795851 if ((sAmount > currentSPosition))
796852 then throw("position to liquidate is bigger than user's supply")
797853 else if (debug)
798854 then throw("liquidation will pass")
799855 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)
800856 }
801857 else throw("Strict value is not equal to itself.")
802858 }
803859
804860
805861
806862 @Callable(i)
807863 func getUserCollateral (debug,address,minusBorrowed,afterChange) = {
808864 let assets = getMarketAssets()
809865 let ltvs = split(tryGetString("setup_ltvs"), ",")
810866 let lts = split(tryGetString("setup_lts"), ",")
811867 let rates = getActualRate(assets[0], "sRate")._2
812868 let changeHandler = split(afterChange, ",")
813869 func f (accum,next) = if ((next >= size(assets)))
814870 then accum
815871 else {
816872 let userSupplied = tryGetInteger(((address + "_supplied_") + assets[next]))
817873 let userBorrowed = tryGetInteger(((address + "_borrowed_") + assets[next]))
818874 let needTokenAccounting = if ((afterChange == ""))
819875 then if (if ((userBorrowed != 0))
820876 then true
821877 else (userSupplied != 0))
822878 then true
823879 else false
824880 else true
825881 if (needTokenAccounting)
826882 then {
827883 let assetScale = calcAssetScale(assets[next])
828884 let assetPrice = getTokenPrice(assets[next])
829885 ((accum + fraction(fraction(fraction((userSupplied + (if (if (if ((afterChange != ""))
830886 then (changeHandler[0] == assets[next])
831887 else false)
832888 then (changeHandler[1] == "supplied")
833889 else false)
834890 then parseIntValue(changeHandler[2])
835891 else 0)), rates[(next * 3)].value, Scale16), parseIntValue(ltvs[next]), Scale8), assetPrice._1, assetScale)) - (if (minusBorrowed)
836892 then fraction(fraction(fraction((userBorrowed + (if (if (if ((afterChange != ""))
837893 then (changeHandler[0] == assets[next])
838894 else false)
839895 then (changeHandler[1] == "borrowed")
840896 else false)
841897 then parseIntValue(changeHandler[2])
842898 else 0)), rates[((next * 3) + 1)].value, Scale16), Scale8, parseIntValue(lts[next])), assetPrice._2, assetScale)
843899 else 0))
844900 }
845901 else accum
846902 }
847903
848904 let result = {
849905 let $l = [0, 1, 2, 3, 4, 5]
850906 let $s = size($l)
851907 let $acc0 = 0
852908 func $f0_1 ($a,$i) = if (($i >= $s))
853909 then $a
854910 else f($a, $l[$i])
855911
856912 func $f0_2 ($a,$i) = if (($i >= $s))
857913 then $a
858914 else throw("List size exceeds 6")
859915
860916 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
861917 }
862918 if (debug)
863919 then throw(toString(result))
864920 else $Tuple2(rates, result)
865921 }
866922
867923
868924
869925 @Callable(i)
870926 func getPrices (debug) = {
871927 let assets = getMarketAssets()
872928 func f (accum,next) = if ((next >= size(assets)))
873929 then accum
874930 else {
875931 let assetPrice = getTokenPrice(assets[next])
876932 ((((accum + toString(assetPrice._1)) + ",") + toString(assetPrice._2)) + "|")
877933 }
878934
879935 let result = {
880936 let $l = [0, 1, 2, 3, 4, 5]
881937 let $s = size($l)
882938 let $acc0 = ""
883939 func $f0_1 ($a,$i) = if (($i >= $s))
884940 then $a
885941 else f($a, $l[$i])
886942
887943 func $f0_2 ($a,$i) = if (($i >= $s))
888944 then $a
889945 else throw("List size exceeds 6")
890946
891947 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
892948 }
893949 if (debug)
894950 then throw(result)
895951 else $Tuple2(nil, result)
896952 }
897953
898954
899955
900956 @Callable(i)
901957 func calculateUtilizationRatio (assetIdStr,debug) = if (debug)
902958 then throw(toString(getUr(assetIdStr)))
903959 else $Tuple2(nil, getUr(assetIdStr))
904960
905961
906962
907963 @Callable(i)
908964 func calculateOutdatedUR (assetIdStr,debug) = if (debug)
909965 then throw(toString(getOutdatedUr(assetIdStr)))
910966 else $Tuple2(nil, getOutdatedUr(assetIdStr))
911967
912968
913969
914970 @Callable(i)
915971 func calculateTokenRates (debug) = {
916972 func f (accum,assetIdStr) = {
917973 let rates = tokenRatesRecalc(assetIdStr)
918974 $Tuple2(((((accum._1 + toString(rates[1].value)) + "|") + toString(rates[0].value)) + ","), (accum._2 ++ rates))
919975 }
920976
921977 let parameter = {
922978 let $l = getMarketAssets()
923979 let $s = size($l)
924980 let $acc0 = $Tuple2("", nil)
925981 func $f0_1 ($a,$i) = if (($i >= $s))
926982 then $a
927983 else f($a, $l[$i])
928984
929985 func $f0_2 ($a,$i) = if (($i >= $s))
930986 then $a
931987 else throw("List size exceeds 6")
932988
933989 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
934990 }
935991 if (debug)
936992 then throw(parameter._1)
937993 else $Tuple2(parameter._2, parameter._1)
938994 }
939995
940996
941997
942998 @Callable(i)
943999 func calculateTokensInterest (debug) = {
9441000 func f (accum,assetIdStr) = {
9451001 let rate = fraction(getInterest(assetIdStr), dayBlocks, Scale8)
9461002 ((accum + toString(rate)) + ",")
9471003 }
9481004
9491005 let parameter = {
9501006 let $l = getMarketAssets()
9511007 let $s = size($l)
9521008 let $acc0 = ""
9531009 func $f0_1 ($a,$i) = if (($i >= $s))
9541010 then $a
9551011 else f($a, $l[$i])
9561012
9571013 func $f0_2 ($a,$i) = if (($i >= $s))
9581014 then $a
9591015 else throw("List size exceeds 6")
9601016
9611017 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
9621018 }
9631019 if (debug)
9641020 then throw(parameter)
9651021 else $Tuple2(nil, parameter)
9661022 }
9671023
9681024
9691025 @Verifier(tx)
9701026 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
9711027

github/deemru/w8io/169f3d6 
106.44 ms