tx · 5rrx4aBRqmU2D1DuZFeo3eVmfN1sEi69KHAJcXW5CAUJ 3P4uA5etnZi4AmBabKinq2bMiWU8KcnHZdH: -0.01800000 Waves 2022.11.01 20:17 [3363699] smart account 3P4uA5etnZi4AmBabKinq2bMiWU8KcnHZdH > SELF 0.00000000 Waves
{ "type": 13, "id": "5rrx4aBRqmU2D1DuZFeo3eVmfN1sEi69KHAJcXW5CAUJ", "fee": 1800000, "feeAssetId": null, "timestamp": 1667323079442, "version": 2, "chainId": 87, "sender": "3P4uA5etnZi4AmBabKinq2bMiWU8KcnHZdH", "senderPublicKey": "8DxbUxhy23djr6kUEE1Jzp7oVJXBsHNaATLRiABpkSde", "proofs": [ "BRsqeDwfzZUc4PvCL47aaPaMEUpAaSfWi9raC3Vpgw27GADAERyqbjsKrdW3n4Pz5eTCaMGM1W3fcx7dyTrutub" ], "script": "base64:BgJXCAISBgoECAgICBIECgIICBIAEgQKAggBEgQKAggBEgASCAoGBAgBCAgIEgYKBAQIBAgSAwoBBBIECgIIBBIECgIIBBIDCgEEEgMKAQQSAwoBCBIDCgEEFgAGU2NhbGU4AIDC1y8AB1NjYWxlMTAAgMivoCUAB1NjYWxlMTYJAGgCBQZTY2FsZTgFBlNjYWxlOAALcmVzZXJ2ZUZ1bmQAFAAJZGF5QmxvY2tzAKALAQ10cnlHZXRJbnRlZ2VyAQNrZXkEByRtYXRjaDAJAJoIAgUEdGhpcwUDa2V5AwkAAQIFByRtYXRjaDACA0ludAQBYgUHJG1hdGNoMAUBYgAAAQ10cnlHZXRCb29sZWFuAQNrZXkEByRtYXRjaDAJAJsIAgUEdGhpcwUDa2V5AwkAAQIFByRtYXRjaDACB0Jvb2xlYW4EAWIFByRtYXRjaDAFAWIHAQx0cnlHZXRTdHJpbmcBA2tleQQHJG1hdGNoMAkAnQgCBQR0aGlzBQNrZXkDCQABAgUHJG1hdGNoMAIGU3RyaW5nBAFiBQckbWF0Y2gwBQFiAgABDmdldEFzc2V0U3RyaW5nAQdhc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MJAQV2YWx1ZQEJAM8IAgUGYXNzZXRzBQphc3NldElkU3RyAwkAZgIFAnVyAICV9SoJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgkArAICAgZzZXR1cF8FCmFzc2V0SWRTdHICB190ZW1wTFQJAGsDBQZ0ZW1wTFQA900AkE4FA25pbAMDCQBmAgUCbHQFBnRlbXBMVAkAZgIAgJX1KgUCdXIHCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQCsAgIJAKwCAgIGc2V0dXBfBQphc3NldElkU3RyAgdfdGVtcExUCQBrAwUGdGVtcExUAKlOAJBOBQNuaWwFA25pbAFpAQhzaHV0ZG93bgEIc2h1dGRvd24ECXdoaXRlbGlzdAkAzAgCARoBV9fhI1GOfKuIWtXXKJd12Ih104+uIwWm4QkAzAgCARoBV2MNA4Gmf1tU0hy55Cgq86eANPDYtY3VZQkAzAgCARoBV7PVklRJCZoqEPvG+J8QdqvvPw9ypYkVjAkAzAgCARoBV/j6+gImwFGL7Go7RjNJ0hxxsHWL+aTKmgkAzAgCARoBV6Hfrr5FnbmGEdOYYnGJhfRbeUsgh/NHawkAzAgCARoBVzA5HNGkZhg7fn/j2N6i/bhnmP9XTREmnQUDbmlsAwkAAAIJAM8IAgUJd2hpdGVsaXN0CAgFAWkGY2FsbGVyBWJ5dGVzBQR1bml0CQACAQIXdXNlciBub3QgaW4gYSB3aGl0ZWxpc3QJAMwIAgkBDEJvb2xlYW5FbnRyeQICDHNldHVwX2FjdGl2ZQkBASEBBQhzaHV0ZG93bgUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tlef0/gMk=", "height": 3363699, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GHxftqxfNNfx395BWRsEsQRG8mFzUU8eZDX7hPC3yKUY Next: 4dKACxKswcTTi43ubzRZasaE23XVHoAeB6YkxmB39UYD Diff:
Old | New | Differences | |
---|---|---|---|
153 | 153 | ||
154 | 154 | ||
155 | 155 | func getTokenPrice (assetIdStr) = { | |
156 | - | let inv = invoke(addressFromStringValue("3P5BTtdj32Sd1Dyh1Mdw33xQAAckSfMfnKf"), "getTWAP60", [assetIdStr, false], nil) | |
157 | - | if ((inv == inv)) | |
158 | - | then match inv { | |
159 | - | case x: (Int, Int) => | |
160 | - | x | |
161 | - | case _ => | |
162 | - | throw("error of price oracle") | |
163 | - | } | |
156 | + | let inv1 = invoke(addressFromStringValue("3P5BTtdj32Sd1Dyh1Mdw33xQAAckSfMfnKf"), "getTWAP60", [assetIdStr, false], nil) | |
157 | + | if ((inv1 == inv1)) | |
158 | + | then { | |
159 | + | let inv2 = invoke(addressFromStringValue("3P8pvmcBi9JeBrnPgWDTaPWrWmGzxiDkpTu"), "getTWAP60", [assetIdStr, false], nil) | |
160 | + | if ((inv2 == inv2)) | |
161 | + | then { | |
162 | + | let data1 = match inv1 { | |
163 | + | case x: (Int, Int) => | |
164 | + | x | |
165 | + | case _ => | |
166 | + | throw("error of price oracle") | |
167 | + | } | |
168 | + | if ((data1 == data1)) | |
169 | + | then { | |
170 | + | let data2 = match inv2 { | |
171 | + | case x: (Int, Int) => | |
172 | + | x | |
173 | + | case _ => | |
174 | + | throw("error of price oracle") | |
175 | + | } | |
176 | + | if ((data2 == data2)) | |
177 | + | then $Tuple2(min([data1._1, data2._1]), max([data1._2, data2._2])) | |
178 | + | else throw("Strict value is not equal to itself.") | |
179 | + | } | |
180 | + | else throw("Strict value is not equal to itself.") | |
181 | + | } | |
182 | + | else throw("Strict value is not equal to itself.") | |
183 | + | } | |
164 | 184 | else throw("Strict value is not equal to itself.") | |
165 | 185 | } | |
166 | 186 | ||
235 | 255 | else { | |
236 | 256 | let assetIdStr = getAssetString(i.payments[0].assetId) | |
237 | 257 | let assetAmount = i.payments[0].amount | |
238 | - | let $ | |
239 | - | let sRate = $ | |
240 | - | let ratesRecalcResult = $ | |
258 | + | let $t065496616 = getActualRate(assetIdStr, "sRate") | |
259 | + | let sRate = $t065496616._1 | |
260 | + | let ratesRecalcResult = $t065496616._2 | |
241 | 261 | let amount = fraction(assetAmount, Scale16, sRate, DOWN) | |
242 | 262 | let address = toString(i.caller) | |
243 | 263 | if ((indexOf(tryGetString("setup_tokens"), assetIdStr) == unit)) | |
249 | 269 | ||
250 | 270 | @Callable(i) | |
251 | 271 | func withdraw (assetIdStr,assetAmount) = { | |
252 | - | let $ | |
253 | - | let sRate = $ | |
254 | - | let ratesRecalcResult = $ | |
272 | + | let $t071877254 = getActualRate(assetIdStr, "sRate") | |
273 | + | let sRate = $t071877254._1 | |
274 | + | let ratesRecalcResult = $t071877254._2 | |
255 | 275 | let amount = fraction(assetAmount, Scale16, sRate, HALFUP) | |
256 | 276 | let address = toString(i.caller) | |
257 | 277 | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
285 | 305 | @Callable(i) | |
286 | 306 | func borrow (assetIdStr,assetAmount) = { | |
287 | 307 | let address = toString(i.caller) | |
288 | - | let $ | |
289 | - | let bRate = $ | |
290 | - | let ratesRecalcResult = $ | |
308 | + | let $t087468813 = getActualRate(assetIdStr, "bRate") | |
309 | + | let bRate = $t087468813._1 | |
310 | + | let ratesRecalcResult = $t087468813._2 | |
291 | 311 | let amount = fraction(assetAmount, Scale16, bRate, CEILING) | |
292 | 312 | let collateralValueInv = invoke(this, "getUserCollateral", [false, address, true, ((assetIdStr + ",borrowed,") + toString(amount))], nil) | |
293 | 313 | if ((collateralValueInv == collateralValueInv)) | |
326 | 346 | else { | |
327 | 347 | let assetIdStr = getAssetString(i.payments[0].assetId) | |
328 | 348 | let assetAmount = i.payments[0].amount | |
329 | - | let $ | |
330 | - | let bRate = $ | |
331 | - | let ratesRecalcResult = $ | |
349 | + | let $t01023710304 = getActualRate(assetIdStr, "bRate") | |
350 | + | let bRate = $t01023710304._1 | |
351 | + | let ratesRecalcResult = $t01023710304._2 | |
332 | 352 | let amount = fraction(assetAmount, Scale16, bRate) | |
333 | 353 | let address = toString(i.caller) | |
334 | 354 | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
356 | 376 | let userCollateral = calcUserCollateral(address) | |
357 | 377 | if ((userCollateral == userCollateral)) | |
358 | 378 | then { | |
359 | - | let $ | |
360 | - | let sRate = $ | |
361 | - | let ratesRecalcResult1 = $ | |
362 | - | let $ | |
363 | - | let bRate = $ | |
364 | - | let ratesRecalcResult2 = $ | |
379 | + | let $t01166811737 = getActualRate(sAssetIdStr, "sRate") | |
380 | + | let sRate = $t01166811737._1 | |
381 | + | let ratesRecalcResult1 = $t01166811737._2 | |
382 | + | let $t01174211811 = getActualRate(bAssetIdStr, "bRate") | |
383 | + | let bRate = $t01174211811._1 | |
384 | + | let ratesRecalcResult2 = $t01174211811._2 | |
365 | 385 | let sAssetAmount = fraction(assetAmount, Scale16, sRate) | |
366 | 386 | let currentSPosition = tryGetInteger(((address + "_supplied_") + sAssetIdStr)) | |
367 | 387 | let currentBPosition = tryGetInteger(((address + "_borrowed_") + bAssetIdStr)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let Scale8 = 100000000 | |
5 | 5 | ||
6 | 6 | let Scale10 = 10000000000 | |
7 | 7 | ||
8 | 8 | let Scale16 = (Scale8 * Scale8) | |
9 | 9 | ||
10 | 10 | let reserveFund = 20 | |
11 | 11 | ||
12 | 12 | let dayBlocks = 1440 | |
13 | 13 | ||
14 | 14 | func tryGetInteger (key) = match getInteger(this, key) { | |
15 | 15 | case b: Int => | |
16 | 16 | b | |
17 | 17 | case _ => | |
18 | 18 | 0 | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
23 | 23 | case b: Boolean => | |
24 | 24 | b | |
25 | 25 | case _ => | |
26 | 26 | false | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func tryGetString (key) = match getString(this, key) { | |
31 | 31 | case b: String => | |
32 | 32 | b | |
33 | 33 | case _ => | |
34 | 34 | "" | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func getAssetString (assetId) = match assetId { | |
39 | 39 | case b: ByteVector => | |
40 | 40 | toBase58String(b) | |
41 | 41 | case _ => | |
42 | 42 | "WAVES" | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getAssetBytes (assetIdStr) = if ((assetIdStr == "WAVES")) | |
47 | 47 | then unit | |
48 | 48 | else fromBase58String(assetIdStr) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func getBalance (assetIdStr) = if ((assetIdStr == "WAVES")) | |
52 | 52 | then wavesBalance(this).available | |
53 | 53 | else assetBalance(this, fromBase58String(assetIdStr)) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func getMarketAssets () = split(tryGetString("setup_tokens"), ",") | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func getOutdatedUr (assetIdStr) = { | |
60 | 60 | let down = fraction(tryGetInteger(("total_supplied_" + assetIdStr)), tryGetInteger((assetIdStr + "_sRate")), Scale16) | |
61 | 61 | if ((down == 0)) | |
62 | 62 | then 0 | |
63 | 63 | else fraction(Scale8, fraction(tryGetInteger(("total_borrowed_" + assetIdStr)), tryGetInteger((assetIdStr + "_bRate")), Scale16), down) | |
64 | 64 | } | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func getRateCurve (assetIdStr) = match assetIdStr { | |
68 | 68 | case _ => | |
69 | 69 | if (("34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ" == $match0)) | |
70 | 70 | then $Tuple4(2000000, 25000000, 80000000, 100000000) | |
71 | 71 | else if (("DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p" == $match0)) | |
72 | 72 | then $Tuple4(2000000, 25000000, 80000000, 100000000) | |
73 | 73 | else if (("Ajso6nTTjptu2UHLx6hfSXVtHFtRBJCkKYd5SAyj7zf5" == $match0)) | |
74 | 74 | then $Tuple4(2000000, 40000000, 80000000, 150000000) | |
75 | 75 | else if (("HEB8Qaw9xrWpWs8tHsiATYGBWDBtP2S7kcPALrMu43AS" == $match0)) | |
76 | 76 | then $Tuple4(0, 20000000, 80000000, 40000000) | |
77 | 77 | else if (("WAVES" == $match0)) | |
78 | 78 | then $Tuple4(2000000, 30000000, 80000000, 50000000) | |
79 | 79 | else $Tuple4(0, 20000000, 80000000, 80000000) | |
80 | 80 | } | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func getInterest (assetIdStr) = { | |
84 | 84 | let ur = getOutdatedUr(assetIdStr) | |
85 | 85 | let curve = getRateCurve(assetIdStr) | |
86 | 86 | let rate = (curve._1 + (if ((curve._3 >= ur)) | |
87 | 87 | then fraction(ur, curve._2, curve._3) | |
88 | 88 | else (curve._2 + fraction((ur - curve._3), (curve._4 - curve._2), (100000000 - curve._3))))) | |
89 | 89 | max([fraction(rate, Scale8, (dayBlocks * 365)), 1]) | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func tokenRatesRecalc (assetIdStr) = { | |
94 | 94 | let interest = getInterest(assetIdStr) | |
95 | 95 | let ur = getOutdatedUr(assetIdStr) | |
96 | 96 | let lastRecalcHeight = tryGetInteger("lastRateHeight") | |
97 | 97 | let lastBRate = max([tryGetInteger((assetIdStr + "_bRate")), Scale16]) | |
98 | 98 | let newBRate = (lastBRate + ((height - lastRecalcHeight) * interest)) | |
99 | 99 | let lastSRate = max([tryGetInteger((assetIdStr + "_sRate")), Scale16]) | |
100 | 100 | let newSRate = (lastSRate + ((((height - lastRecalcHeight) * fraction(interest, ur, Scale8)) * (100 - reserveFund)) / 100)) | |
101 | 101 | [IntegerEntry((assetIdStr + "_sRate"), newSRate), IntegerEntry((assetIdStr + "_bRate"), newBRate), IntegerEntry("lastRateHeight", height)] | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func getActualRate (assetIdStr,rateType) = { | |
106 | 106 | func f (accum,token) = { | |
107 | 107 | let recalc = tokenRatesRecalc(token) | |
108 | 108 | $Tuple2(if ((token != assetIdStr)) | |
109 | 109 | then accum._1 | |
110 | 110 | else if ((rateType == "sRate")) | |
111 | 111 | then recalc[0].value | |
112 | 112 | else recalc[1].value, (accum._2 ++ recalc)) | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | let $l = getMarketAssets() | |
116 | 116 | let $s = size($l) | |
117 | 117 | let $acc0 = $Tuple2(0, nil) | |
118 | 118 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
119 | 119 | then $a | |
120 | 120 | else f($a, $l[$i]) | |
121 | 121 | ||
122 | 122 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
123 | 123 | then $a | |
124 | 124 | else throw("List size exceeds 6") | |
125 | 125 | ||
126 | 126 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
127 | 127 | } | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func getUr (assetIdStr) = { | |
131 | 131 | let rates = tokenRatesRecalc(assetIdStr) | |
132 | 132 | let down = fraction(tryGetInteger(("total_supplied_" + assetIdStr)), rates[0].value, Scale16) | |
133 | 133 | fraction(Scale8, fraction(tryGetInteger(("total_borrowed_" + assetIdStr)), rates[1].value, Scale16), down) | |
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func ratesRecalc () = { | |
138 | 138 | func f (accum,token) = (accum ++ tokenRatesRecalc(token)) | |
139 | 139 | ||
140 | 140 | let $l = getMarketAssets() | |
141 | 141 | let $s = size($l) | |
142 | 142 | let $acc0 = nil | |
143 | 143 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
144 | 144 | then $a | |
145 | 145 | else f($a, $l[$i]) | |
146 | 146 | ||
147 | 147 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
148 | 148 | then $a | |
149 | 149 | else throw("List size exceeds 6") | |
150 | 150 | ||
151 | 151 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
152 | 152 | } | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | func getTokenPrice (assetIdStr) = { | |
156 | - | let inv = invoke(addressFromStringValue("3P5BTtdj32Sd1Dyh1Mdw33xQAAckSfMfnKf"), "getTWAP60", [assetIdStr, false], nil) | |
157 | - | if ((inv == inv)) | |
158 | - | then match inv { | |
159 | - | case x: (Int, Int) => | |
160 | - | x | |
161 | - | case _ => | |
162 | - | throw("error of price oracle") | |
163 | - | } | |
156 | + | let inv1 = invoke(addressFromStringValue("3P5BTtdj32Sd1Dyh1Mdw33xQAAckSfMfnKf"), "getTWAP60", [assetIdStr, false], nil) | |
157 | + | if ((inv1 == inv1)) | |
158 | + | then { | |
159 | + | let inv2 = invoke(addressFromStringValue("3P8pvmcBi9JeBrnPgWDTaPWrWmGzxiDkpTu"), "getTWAP60", [assetIdStr, false], nil) | |
160 | + | if ((inv2 == inv2)) | |
161 | + | then { | |
162 | + | let data1 = match inv1 { | |
163 | + | case x: (Int, Int) => | |
164 | + | x | |
165 | + | case _ => | |
166 | + | throw("error of price oracle") | |
167 | + | } | |
168 | + | if ((data1 == data1)) | |
169 | + | then { | |
170 | + | let data2 = match inv2 { | |
171 | + | case x: (Int, Int) => | |
172 | + | x | |
173 | + | case _ => | |
174 | + | throw("error of price oracle") | |
175 | + | } | |
176 | + | if ((data2 == data2)) | |
177 | + | then $Tuple2(min([data1._1, data2._1]), max([data1._2, data2._2])) | |
178 | + | else throw("Strict value is not equal to itself.") | |
179 | + | } | |
180 | + | else throw("Strict value is not equal to itself.") | |
181 | + | } | |
182 | + | else throw("Strict value is not equal to itself.") | |
183 | + | } | |
164 | 184 | else throw("Strict value is not equal to itself.") | |
165 | 185 | } | |
166 | 186 | ||
167 | 187 | ||
168 | 188 | func calcAssetScale (assetIdStr) = { | |
169 | 189 | let decimals = if ((assetIdStr == "WAVES")) | |
170 | 190 | then 8 | |
171 | 191 | else value(assetInfo(fromBase58String(assetIdStr))).decimals | |
172 | 192 | pow(10, 0, decimals, 0, 0, DOWN) | |
173 | 193 | } | |
174 | 194 | ||
175 | 195 | ||
176 | 196 | func calcUserCollateral (address) = { | |
177 | 197 | let userCollateralInvoke = invoke(this, "getUserCollateral", [false, address, true, ""], nil) | |
178 | 198 | if ((userCollateralInvoke == userCollateralInvoke)) | |
179 | 199 | then { | |
180 | 200 | let userCollateralValue = match userCollateralInvoke { | |
181 | 201 | case x: Int => | |
182 | 202 | x | |
183 | 203 | case _ => | |
184 | 204 | throw("issue while doing in-dapp invocation") | |
185 | 205 | } | |
186 | 206 | if ((userCollateralValue == userCollateralValue)) | |
187 | 207 | then userCollateralValue | |
188 | 208 | else throw("Strict value is not equal to itself.") | |
189 | 209 | } | |
190 | 210 | else throw("Strict value is not equal to itself.") | |
191 | 211 | } | |
192 | 212 | ||
193 | 213 | ||
194 | 214 | @Callable(i) | |
195 | 215 | func preInit (tokens,ltvs,lts,penalties) = { | |
196 | 216 | func f (accum,token) = (accum ++ [IntegerEntry((token + "_bRate"), Scale16), IntegerEntry((token + "_sRate"), Scale16)]) | |
197 | 217 | ||
198 | 218 | if ((i.caller != this)) | |
199 | 219 | then throw("admin only") | |
200 | 220 | else { | |
201 | 221 | let rates = { | |
202 | 222 | let $l = split(tokens, ",") | |
203 | 223 | let $s = size($l) | |
204 | 224 | let $acc0 = nil | |
205 | 225 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
206 | 226 | then $a | |
207 | 227 | else f($a, $l[$i]) | |
208 | 228 | ||
209 | 229 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
210 | 230 | then $a | |
211 | 231 | else throw("List size exceeds 6") | |
212 | 232 | ||
213 | 233 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
214 | 234 | } | |
215 | 235 | ([StringEntry("setup_tokens", tokens), StringEntry("setup_ltvs", ltvs), StringEntry("setup_lts", lts), StringEntry("setup_penalties", penalties), BooleanEntry("setup_active", true)] ++ rates) | |
216 | 236 | } | |
217 | 237 | } | |
218 | 238 | ||
219 | 239 | ||
220 | 240 | ||
221 | 241 | @Callable(i) | |
222 | 242 | func updateParameter (key,val) = if ((i.caller != this)) | |
223 | 243 | then throw("admin only") | |
224 | 244 | else [StringEntry(key, val)] | |
225 | 245 | ||
226 | 246 | ||
227 | 247 | ||
228 | 248 | @Callable(i) | |
229 | 249 | func supply () = if (!(tryGetBoolean("setup_active"))) | |
230 | 250 | then throw("market is stopped") | |
231 | 251 | else if (if ((size(i.payments) != 1)) | |
232 | 252 | then true | |
233 | 253 | else (i.payments[0].amount == 0)) | |
234 | 254 | then throw("1 payment has to be attached") | |
235 | 255 | else { | |
236 | 256 | let assetIdStr = getAssetString(i.payments[0].assetId) | |
237 | 257 | let assetAmount = i.payments[0].amount | |
238 | - | let $ | |
239 | - | let sRate = $ | |
240 | - | let ratesRecalcResult = $ | |
258 | + | let $t065496616 = getActualRate(assetIdStr, "sRate") | |
259 | + | let sRate = $t065496616._1 | |
260 | + | let ratesRecalcResult = $t065496616._2 | |
241 | 261 | let amount = fraction(assetAmount, Scale16, sRate, DOWN) | |
242 | 262 | let address = toString(i.caller) | |
243 | 263 | if ((indexOf(tryGetString("setup_tokens"), assetIdStr) == unit)) | |
244 | 264 | then throw("this asset is not supported by the market") | |
245 | 265 | else ([IntegerEntry(((address + "_supplied_") + assetIdStr), (tryGetInteger(((address + "_supplied_") + assetIdStr)) + amount)), IntegerEntry(("total_supplied_" + assetIdStr), (tryGetInteger(("total_supplied_" + assetIdStr)) + amount))] ++ ratesRecalcResult) | |
246 | 266 | } | |
247 | 267 | ||
248 | 268 | ||
249 | 269 | ||
250 | 270 | @Callable(i) | |
251 | 271 | func withdraw (assetIdStr,assetAmount) = { | |
252 | - | let $ | |
253 | - | let sRate = $ | |
254 | - | let ratesRecalcResult = $ | |
272 | + | let $t071877254 = getActualRate(assetIdStr, "sRate") | |
273 | + | let sRate = $t071877254._1 | |
274 | + | let ratesRecalcResult = $t071877254._2 | |
255 | 275 | let amount = fraction(assetAmount, Scale16, sRate, HALFUP) | |
256 | 276 | let address = toString(i.caller) | |
257 | 277 | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
258 | 278 | let assetBorrowed = tryGetInteger(("total_borrowed_" + assetIdStr)) | |
259 | 279 | let userAssetSupplied = tryGetInteger(((address + "_supplied_") + assetIdStr)) | |
260 | 280 | let userAssetBorrowed = tryGetInteger(((address + "_borrowed_") + assetIdStr)) | |
261 | 281 | let collateralValueInv = invoke(this, "getUserCollateral", [false, address, true, ((assetIdStr + ",supplied,") + toString(-(amount)))], nil) | |
262 | 282 | if ((collateralValueInv == collateralValueInv)) | |
263 | 283 | then { | |
264 | 284 | let collateralValue = match collateralValueInv { | |
265 | 285 | case x: Int => | |
266 | 286 | x | |
267 | 287 | case _ => | |
268 | 288 | throw("can't get user collateral value") | |
269 | 289 | } | |
270 | 290 | if (!(tryGetBoolean("setup_active"))) | |
271 | 291 | then throw("market is stopped") | |
272 | 292 | else if ((0 > collateralValue)) | |
273 | 293 | then throw("you dont have enough collateral for this operation") | |
274 | 294 | else if ((amount > (assetSupplied - assetBorrowed))) | |
275 | 295 | then throw("this amount is not available on the market") | |
276 | 296 | else if ((amount > (userAssetSupplied - userAssetBorrowed))) | |
277 | 297 | then throw("this amount is not available for this user") | |
278 | 298 | 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) | |
279 | 299 | } | |
280 | 300 | else throw("Strict value is not equal to itself.") | |
281 | 301 | } | |
282 | 302 | ||
283 | 303 | ||
284 | 304 | ||
285 | 305 | @Callable(i) | |
286 | 306 | func borrow (assetIdStr,assetAmount) = { | |
287 | 307 | let address = toString(i.caller) | |
288 | - | let $ | |
289 | - | let bRate = $ | |
290 | - | let ratesRecalcResult = $ | |
308 | + | let $t087468813 = getActualRate(assetIdStr, "bRate") | |
309 | + | let bRate = $t087468813._1 | |
310 | + | let ratesRecalcResult = $t087468813._2 | |
291 | 311 | let amount = fraction(assetAmount, Scale16, bRate, CEILING) | |
292 | 312 | let collateralValueInv = invoke(this, "getUserCollateral", [false, address, true, ((assetIdStr + ",borrowed,") + toString(amount))], nil) | |
293 | 313 | if ((collateralValueInv == collateralValueInv)) | |
294 | 314 | then { | |
295 | 315 | let collateralValue = match collateralValueInv { | |
296 | 316 | case x: Int => | |
297 | 317 | x | |
298 | 318 | case _ => | |
299 | 319 | throw("can't get user collateral value") | |
300 | 320 | } | |
301 | 321 | if (!(tryGetBoolean("setup_active"))) | |
302 | 322 | then throw("market is stopped") | |
303 | 323 | else if ((0 > collateralValue)) | |
304 | 324 | then throw("you have to supply more to borrow") | |
305 | 325 | else { | |
306 | 326 | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
307 | 327 | let assetBorrowed = tryGetInteger(("total_borrowed_" + assetIdStr)) | |
308 | 328 | let userAssetBorrowed = tryGetInteger(((address + "_borrowed_") + assetIdStr)) | |
309 | 329 | if ((amount > (assetSupplied - assetBorrowed))) | |
310 | 330 | then throw("this amount is not available") | |
311 | 331 | else ([IntegerEntry(((address + "_borrowed_") + assetIdStr), (userAssetBorrowed + amount)), IntegerEntry(("total_borrowed_" + assetIdStr), (assetBorrowed + amount)), ScriptTransfer(i.caller, assetAmount, getAssetBytes(assetIdStr))] ++ ratesRecalcResult) | |
312 | 332 | } | |
313 | 333 | } | |
314 | 334 | else throw("Strict value is not equal to itself.") | |
315 | 335 | } | |
316 | 336 | ||
317 | 337 | ||
318 | 338 | ||
319 | 339 | @Callable(i) | |
320 | 340 | func repay () = if (!(tryGetBoolean("setup_active"))) | |
321 | 341 | then throw("market is stopped") | |
322 | 342 | else if (if ((size(i.payments) != 1)) | |
323 | 343 | then true | |
324 | 344 | else (i.payments[0].amount == 0)) | |
325 | 345 | then throw("1 payment has to be attached") | |
326 | 346 | else { | |
327 | 347 | let assetIdStr = getAssetString(i.payments[0].assetId) | |
328 | 348 | let assetAmount = i.payments[0].amount | |
329 | - | let $ | |
330 | - | let bRate = $ | |
331 | - | let ratesRecalcResult = $ | |
349 | + | let $t01023710304 = getActualRate(assetIdStr, "bRate") | |
350 | + | let bRate = $t01023710304._1 | |
351 | + | let ratesRecalcResult = $t01023710304._2 | |
332 | 352 | let amount = fraction(assetAmount, Scale16, bRate) | |
333 | 353 | let address = toString(i.caller) | |
334 | 354 | let assetSupplied = tryGetInteger(("total_supplied_" + assetIdStr)) | |
335 | 355 | let assetBorrowed = tryGetInteger(("total_borrowed_" + assetIdStr)) | |
336 | 356 | let userAssetBorrowed = tryGetInteger(((address + "_borrowed_") + assetIdStr)) | |
337 | 357 | let amountLeft = (userAssetBorrowed - amount) | |
338 | 358 | let repayAmount = if ((amountLeft >= 0)) | |
339 | 359 | then amount | |
340 | 360 | else userAssetBorrowed | |
341 | 361 | if ((indexOf(tryGetString("setup_tokens"), assetIdStr) == unit)) | |
342 | 362 | then throw("this asset is not supported by the market") | |
343 | 363 | else (([IntegerEntry(((address + "_borrowed_") + assetIdStr), (userAssetBorrowed - repayAmount)), IntegerEntry(("total_borrowed_" + assetIdStr), (assetBorrowed - repayAmount))] ++ ratesRecalcResult) ++ (if ((amountLeft >= 0)) | |
344 | 364 | then nil | |
345 | 365 | else [ScriptTransfer(i.caller, -(amountLeft), i.payments[0].assetId)])) | |
346 | 366 | } | |
347 | 367 | ||
348 | 368 | ||
349 | 369 | ||
350 | 370 | @Callable(i) | |
351 | 371 | func liquidate (debug,address,assetAmount,sAssetIdStr,bAssetIdStr,routeStr) = if ((i.caller != Address(base58'3PCqdm1mAoQqR46oZotFanmqb5CLUvrKEo2'))) | |
352 | 372 | then throw("temporarily listed for whitelist only") | |
353 | 373 | else if (!(tryGetBoolean("setup_active"))) | |
354 | 374 | then throw("market is stopped") | |
355 | 375 | else { | |
356 | 376 | let userCollateral = calcUserCollateral(address) | |
357 | 377 | if ((userCollateral == userCollateral)) | |
358 | 378 | then { | |
359 | - | let $ | |
360 | - | let sRate = $ | |
361 | - | let ratesRecalcResult1 = $ | |
362 | - | let $ | |
363 | - | let bRate = $ | |
364 | - | let ratesRecalcResult2 = $ | |
379 | + | let $t01166811737 = getActualRate(sAssetIdStr, "sRate") | |
380 | + | let sRate = $t01166811737._1 | |
381 | + | let ratesRecalcResult1 = $t01166811737._2 | |
382 | + | let $t01174211811 = getActualRate(bAssetIdStr, "bRate") | |
383 | + | let bRate = $t01174211811._1 | |
384 | + | let ratesRecalcResult2 = $t01174211811._2 | |
365 | 385 | let sAssetAmount = fraction(assetAmount, Scale16, sRate) | |
366 | 386 | let currentSPosition = tryGetInteger(((address + "_supplied_") + sAssetIdStr)) | |
367 | 387 | let currentBPosition = tryGetInteger(((address + "_borrowed_") + bAssetIdStr)) | |
368 | 388 | if ((userCollateral > 0)) | |
369 | 389 | then throw("user can't be liquidated") | |
370 | 390 | else if ((sAssetAmount > currentSPosition)) | |
371 | 391 | then throw("position to liquidate is bigger than user's supply") | |
372 | 392 | else { | |
373 | 393 | let aggregatorAddress = Address(base58'3PGFHzVGT4NTigwCKP1NcwoXkodVZwvBuuU') | |
374 | 394 | let balance0Before = getBalance(sAssetIdStr) | |
375 | 395 | if ((balance0Before == balance0Before)) | |
376 | 396 | then { | |
377 | 397 | let balance1Before = getBalance(bAssetIdStr) | |
378 | 398 | if ((balance1Before == balance1Before)) | |
379 | 399 | then { | |
380 | 400 | let exchangeInvoke = invoke(aggregatorAddress, "swap", [routeStr, 0], [AttachedPayment(getAssetBytes(sAssetIdStr), assetAmount)]) | |
381 | 401 | if ((exchangeInvoke == exchangeInvoke)) | |
382 | 402 | then { | |
383 | 403 | let asset0Sold = (balance0Before - getBalance(sAssetIdStr)) | |
384 | 404 | if ((asset0Sold == asset0Sold)) | |
385 | 405 | then { | |
386 | 406 | let asset1Bought = (getBalance(bAssetIdStr) - balance1Before) | |
387 | 407 | if ((asset1Bought == asset1Bought)) | |
388 | 408 | then { | |
389 | 409 | let asset0Price = getTokenPrice(sAssetIdStr)._2 | |
390 | 410 | let asset0Scale = calcAssetScale(sAssetIdStr) | |
391 | 411 | let asset0Usd = fraction(asset0Sold, asset0Price, asset0Scale) | |
392 | 412 | let asset1Price = getTokenPrice(bAssetIdStr)._1 | |
393 | 413 | let asset1Scale = calcAssetScale(bAssetIdStr) | |
394 | 414 | let asset1Usd = fraction(asset1Bought, asset1Price, asset1Scale) | |
395 | 415 | let penalty = parseIntValue(split(tryGetString("setup_penalties"), ",")[value(indexOf(getMarketAssets(), bAssetIdStr))]) | |
396 | 416 | let liquidationProfit = (asset1Usd - fraction(asset0Usd, (Scale8 - penalty), Scale8)) | |
397 | 417 | let sAssetChange = fraction(asset0Sold, Scale16, sRate) | |
398 | 418 | let bAssetChange = fraction(asset1Bought, Scale16, bRate) | |
399 | 419 | if ((asset0Sold > assetAmount)) | |
400 | 420 | then throw("more assets exchanged than expected") | |
401 | 421 | else if ((0 > liquidationProfit)) | |
402 | 422 | then throw("price impact is bigger than liquidation penalty") | |
403 | 423 | 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)), ScriptTransfer(i.caller, liquidationProfit, getAssetBytes(bAssetIdStr))] | |
404 | 424 | } | |
405 | 425 | else throw("Strict value is not equal to itself.") | |
406 | 426 | } | |
407 | 427 | else throw("Strict value is not equal to itself.") | |
408 | 428 | } | |
409 | 429 | else throw("Strict value is not equal to itself.") | |
410 | 430 | } | |
411 | 431 | else throw("Strict value is not equal to itself.") | |
412 | 432 | } | |
413 | 433 | else throw("Strict value is not equal to itself.") | |
414 | 434 | } | |
415 | 435 | } | |
416 | 436 | else throw("Strict value is not equal to itself.") | |
417 | 437 | } | |
418 | 438 | ||
419 | 439 | ||
420 | 440 | ||
421 | 441 | @Callable(i) | |
422 | 442 | func getUserCollateral (debug,address,minusBorrowed,afterChange) = { | |
423 | 443 | let assets = getMarketAssets() | |
424 | 444 | let ltvs = split(tryGetString("setup_ltvs"), ",") | |
425 | 445 | let lts = split(tryGetString("setup_lts"), ",") | |
426 | 446 | let rates = getActualRate(assets[0], "sRate")._2 | |
427 | 447 | let changeHandler = split(afterChange, ",") | |
428 | 448 | func f (accum,next) = if ((next >= size(assets))) | |
429 | 449 | then accum | |
430 | 450 | else { | |
431 | 451 | let decimals = if ((assets[next] == "WAVES")) | |
432 | 452 | then 8 | |
433 | 453 | else value(assetInfo(fromBase58String(assets[next]))).decimals | |
434 | 454 | let assetScale = pow(10, 0, decimals, 0, 0, DOWN) | |
435 | 455 | let assetPrice = getTokenPrice(assets[next]) | |
436 | 456 | ((accum + fraction(fraction(fraction((tryGetInteger(((address + "_supplied_") + assets[next])) + (if (if (if ((afterChange != "")) | |
437 | 457 | then (changeHandler[0] == assets[next]) | |
438 | 458 | else false) | |
439 | 459 | then (changeHandler[1] == "supplied") | |
440 | 460 | else false) | |
441 | 461 | then parseIntValue(changeHandler[2]) | |
442 | 462 | else 0)), rates[(next * 3)].value, Scale16), parseIntValue(ltvs[next]), Scale8), assetPrice._1, assetScale)) - (if (minusBorrowed) | |
443 | 463 | then fraction(fraction(fraction((tryGetInteger(((address + "_borrowed_") + assets[next])) + (if (if (if ((afterChange != "")) | |
444 | 464 | then (changeHandler[0] == assets[next]) | |
445 | 465 | else false) | |
446 | 466 | then (changeHandler[1] == "borrowed") | |
447 | 467 | else false) | |
448 | 468 | then parseIntValue(changeHandler[2]) | |
449 | 469 | else 0)), rates[((next * 3) + 1)].value, Scale16), Scale8, parseIntValue(lts[next])), assetPrice._2, assetScale) | |
450 | 470 | else 0)) | |
451 | 471 | } | |
452 | 472 | ||
453 | 473 | let result = { | |
454 | 474 | let $l = [0, 1, 2, 3, 4, 5] | |
455 | 475 | let $s = size($l) | |
456 | 476 | let $acc0 = 0 | |
457 | 477 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
458 | 478 | then $a | |
459 | 479 | else f($a, $l[$i]) | |
460 | 480 | ||
461 | 481 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
462 | 482 | then $a | |
463 | 483 | else throw("List size exceeds 6") | |
464 | 484 | ||
465 | 485 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
466 | 486 | } | |
467 | 487 | if (debug) | |
468 | 488 | then throw(toString(result)) | |
469 | 489 | else $Tuple2(rates, result) | |
470 | 490 | } | |
471 | 491 | ||
472 | 492 | ||
473 | 493 | ||
474 | 494 | @Callable(i) | |
475 | 495 | func getPrices (debug) = { | |
476 | 496 | let assets = getMarketAssets() | |
477 | 497 | func f (accum,next) = if ((next >= size(assets))) | |
478 | 498 | then accum | |
479 | 499 | else { | |
480 | 500 | let assetPrice = getTokenPrice(assets[next]) | |
481 | 501 | ((((accum + toString(assetPrice._1)) + ",") + toString(assetPrice._2)) + "|") | |
482 | 502 | } | |
483 | 503 | ||
484 | 504 | let result = { | |
485 | 505 | let $l = [0, 1, 2, 3, 4, 5] | |
486 | 506 | let $s = size($l) | |
487 | 507 | let $acc0 = "" | |
488 | 508 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
489 | 509 | then $a | |
490 | 510 | else f($a, $l[$i]) | |
491 | 511 | ||
492 | 512 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
493 | 513 | then $a | |
494 | 514 | else throw("List size exceeds 6") | |
495 | 515 | ||
496 | 516 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
497 | 517 | } | |
498 | 518 | if (debug) | |
499 | 519 | then throw(result) | |
500 | 520 | else $Tuple2(nil, result) | |
501 | 521 | } | |
502 | 522 | ||
503 | 523 | ||
504 | 524 | ||
505 | 525 | @Callable(i) | |
506 | 526 | func calculateUtilizationRatio (assetIdStr,debug) = if (debug) | |
507 | 527 | then throw(toString(getUr(assetIdStr))) | |
508 | 528 | else $Tuple2(nil, getUr(assetIdStr)) | |
509 | 529 | ||
510 | 530 | ||
511 | 531 | ||
512 | 532 | @Callable(i) | |
513 | 533 | func calculateOutdatedUR (assetIdStr,debug) = if (debug) | |
514 | 534 | then throw(toString(getOutdatedUr(assetIdStr))) | |
515 | 535 | else $Tuple2(nil, getOutdatedUr(assetIdStr)) | |
516 | 536 | ||
517 | 537 | ||
518 | 538 | ||
519 | 539 | @Callable(i) | |
520 | 540 | func calculateTokenRates (debug) = { | |
521 | 541 | func f (accum,assetIdStr) = { | |
522 | 542 | let rates = tokenRatesRecalc(assetIdStr) | |
523 | 543 | $Tuple2(((((accum._1 + toString(rates[1].value)) + "|") + toString(rates[0].value)) + ","), (accum._2 ++ rates)) | |
524 | 544 | } | |
525 | 545 | ||
526 | 546 | let parameter = { | |
527 | 547 | let $l = getMarketAssets() | |
528 | 548 | let $s = size($l) | |
529 | 549 | let $acc0 = $Tuple2("", nil) | |
530 | 550 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
531 | 551 | then $a | |
532 | 552 | else f($a, $l[$i]) | |
533 | 553 | ||
534 | 554 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
535 | 555 | then $a | |
536 | 556 | else throw("List size exceeds 6") | |
537 | 557 | ||
538 | 558 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
539 | 559 | } | |
540 | 560 | if (debug) | |
541 | 561 | then throw(parameter._1) | |
542 | 562 | else $Tuple2(parameter._2, parameter._1) | |
543 | 563 | } | |
544 | 564 | ||
545 | 565 | ||
546 | 566 | ||
547 | 567 | @Callable(i) | |
548 | 568 | func calculateTokensInterest (debug) = { | |
549 | 569 | func f (accum,assetIdStr) = { | |
550 | 570 | let rate = fraction(getInterest(assetIdStr), dayBlocks, Scale8) | |
551 | 571 | ((accum + toString(rate)) + ",") | |
552 | 572 | } | |
553 | 573 | ||
554 | 574 | let parameter = { | |
555 | 575 | let $l = getMarketAssets() | |
556 | 576 | let $s = size($l) | |
557 | 577 | let $acc0 = "" | |
558 | 578 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
559 | 579 | then $a | |
560 | 580 | else f($a, $l[$i]) | |
561 | 581 | ||
562 | 582 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
563 | 583 | then $a | |
564 | 584 | else throw("List size exceeds 6") | |
565 | 585 | ||
566 | 586 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
567 | 587 | } | |
568 | 588 | if (debug) | |
569 | 589 | then throw(parameter) | |
570 | 590 | else $Tuple2(nil, parameter) | |
571 | 591 | } | |
572 | 592 | ||
573 | 593 | ||
574 | 594 | ||
575 | 595 | @Callable(i) | |
576 | 596 | func reSetup (assetIdStr) = { | |
577 | 597 | let lastResetup = tryGetInteger("resetup_lastUpdate") | |
578 | 598 | if ((dayBlocks > (height - lastResetup))) | |
579 | 599 | then throw("can be updated only once per day") | |
580 | 600 | else { | |
581 | 601 | let lts = split(tryGetString("setup_lts"), ",") | |
582 | 602 | let assets = getMarketAssets() | |
583 | 603 | let ur = getUr(assetIdStr) | |
584 | 604 | let tempLT = tryGetInteger((("setup_" + assetIdStr) + "_tempLT")) | |
585 | 605 | let lt = parseIntValue(assets[value(indexOf(assets, assetIdStr))]) | |
586 | 606 | if ((ur > 90000000)) | |
587 | 607 | then [IntegerEntry((("setup_" + assetIdStr) + "_tempLT"), fraction(tempLT, 9975, 10000))] | |
588 | 608 | else if (if ((lt > tempLT)) | |
589 | 609 | then (90000000 > ur) | |
590 | 610 | else false) | |
591 | 611 | then [IntegerEntry((("setup_" + assetIdStr) + "_tempLT"), fraction(tempLT, 10025, 10000))] | |
592 | 612 | else nil | |
593 | 613 | } | |
594 | 614 | } | |
595 | 615 | ||
596 | 616 | ||
597 | 617 | ||
598 | 618 | @Callable(i) | |
599 | 619 | func shutdown (shutdown) = { | |
600 | 620 | let whitelist = [base58'3PMcMiMEs6w56NRGacksXtFG5zS7doE9fpL', base58'3PAxdDSmN758L5SHSGRC5apEtQE2aApZotG', base58'3PJKmXoHJvVeQXjSJdhtkUcFDtdiQqMbUTD', base58'3PQdNxynJy5mche2kxMVc5shXWzK8Gstq3o', base58'3PGgoUsQX3a5zGCc4e2nEnDCWAkzJ1jASzv', base58'3P6Ksahs71SiKQgQ4qaZuFAVhqncdi2nvJQ'] | |
601 | 621 | if ((indexOf(whitelist, i.caller.bytes) == unit)) | |
602 | 622 | then throw("user not in a whitelist") | |
603 | 623 | else [BooleanEntry("setup_active", !(shutdown))] | |
604 | 624 | } | |
605 | 625 | ||
606 | 626 | ||
607 | 627 | @Verifier(tx) | |
608 | 628 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
609 | 629 |
github/deemru/w8io/fabc49c 93.42 ms ◑