tx · 58S5VFz1Fvx81Ufu1dckojkxjLNBcHvcMx2Gx9ZTVwvk

3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo:  -0.04000000 Waves

2021.09.07 16:30 [1692685] smart account 3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo > SELF 0.00000000 Waves

{ "type": 13, "id": "58S5VFz1Fvx81Ufu1dckojkxjLNBcHvcMx2Gx9ZTVwvk", "fee": 4000000, "feeAssetId": null, "timestamp": 1631021461135, "version": 2, "chainId": 84, "sender": "3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo", "senderPublicKey": "CD4N2SBeZVBUwmtsqwfmQ3ZKnBP3AxpZCvJ5QkHytUed", "proofs": [ "3HJN4crrE2e7zFgeC1DNYXBGdAFrvnNyvrUSL6B7cQjq2ErYAr47oAYooGahNvSP4eR6Tt2R5ykrTXyNYsuA2ugm" ], "script": "base64:AAIFAAAAAAAAAEQIAhIAEgQKAggYEgMKAQgSAwoBCBIECgIIBBIDCgEIEgMKAQgSBgoECAgICBIFCgMICAESAwoBCBIFCgMICAESAwoBCAAAAA8AAAAABmNvbmZpZwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAAGY29uZmlnAgAAAAAAAAAABWFkbWluCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAZjb25maWcCAAAABWFkbWluAgAAAAAAAAAABXBvb2xzCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAAVwb29scwIAAAAAAQAAAAdpc0FkbWluAAAAAQAAAA1jYWxsZXJBZGRyZXNzAwkAAAAAAAACBQAAAA1jYWxsZXJBZGRyZXNzCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQA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AAAckbWF0Y2gwAgAAAANJbnQEAAAAAXQFAAAAByRtYXRjaDAJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAF0CQACWQAAAAEFAAAAB3Rva2VuSWQFAAAAA25pbAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAF0BQAAAAckbWF0Y2gwBQAAAANuaWwJAAACAAAAAQIAAAAYSW5jb3JyZWN0IGludm9rZSByZXN1bHQhCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAABtCb3Jyb3cgZXhjZWVkcyB1c2VyIGhlYWx0aCEJAAACAAAAAQIAAAAXQXNzZXRJZHMgZG9lcyBub3QgbWF0Y2gJAAACAAAAAQIAAAAXUG9vbCBhZGRyZXNzIG5vdCBmb3VuZCEAAAABaQEAAAAKZGVsZXRlRGF0YQAAAAEAAAAEbmFtZQkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAARuYW1lBQAAAANuaWwAAAAA/pklUg==", "height": 1692685, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 59iroGMSmdiPPrq3WA3euMj4yabWeyG5ij8cPhQVfgTd Next: 4eoxz9iBHJD55uHwwMF8nD9vy8JtDrcigMLnBiGLNQN9 Diff:
OldNewDifferences
127127 let user = toBase58String(i.caller.bytes)
128128 let bcBcu = calcBorrowCBorrowCU(user, 0, "", 0, "")
129129 let userHealth = calcHealthFactor(bcBcu._1, bcBcu._2)
130-[writeInteger((user + "_health"), userHealth)]
130+[writeInteger((user + "_BC"), bcBcu._1), writeInteger((user + "_BCU"), bcBcu._2), writeInteger((user + "_health"), userHealth)]
131131 }
132132
133133
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let config = valueOrElse(getStringValue(this, "config"), "")
55
66 let admin = valueOrElse(getStringValue(addressFromStringValue(config), "admin"), "")
77
88 let pools = valueOrElse(getStringValue(this, "pools"), "")
99
1010 func isAdmin (callerAddress) = if ((callerAddress == addressFromStringValue(admin)))
1111 then true
1212 else false
1313
1414
1515 func checkPool (poolAdd) = if (contains(pools, poolAdd))
1616 then true
1717 else false
1818
1919
2020 func writeString (key,stringValue) = StringEntry(key, stringValue)
2121
2222
2323 func writeInteger (key,integerValue) = IntegerEntry(key, integerValue)
2424
2525
2626 func checkPoolLiquidity (poolAddress,amount) = {
2727 let totalSupply = getIntegerValue(addressFromStringValue(poolAddress), "totalSupply")
2828 let totalBorrow = getIntegerValue(addressFromStringValue(poolAddress), "totalBorrow")
2929 let availableLiquidity = (totalSupply - totalBorrow)
3030 if ((availableLiquidity >= amount))
3131 then true
3232 else false
3333 }
3434
3535
3636 func getHealthParameter (user,poolAddress,newDebtAmount,newDebtId,collateralAmount,collateralId) = {
3737 let result = invoke(addressFromStringValue(poolAddress), "getUserHealthParameter", [user, collateralAmount, collateralId, newDebtAmount, newDebtId], nil)
3838 match result {
3939 case t: (Int, Int) =>
4040 t
4141 case _ =>
4242 throw("Return value has the wrong data type")
4343 }
4444 }
4545
4646
4747 func calcHealthFactor (borrowCapacity,borrowCapacityUsed) = if ((borrowCapacity > 0))
4848 then fraction((borrowCapacity - borrowCapacityUsed), 1000, borrowCapacity)
4949 else 0
5050
5151
5252 func calcBorrowCBorrowCU (user,newDebtAmount,newDebtId,collateralAmount,collateralId) = {
5353 let poolList = split(pools, ";")
5454 let listSize = size(poolList)
5555 func foldPools (accum,next) = {
5656 let healthParams = getHealthParameter(user, next, newDebtAmount, newDebtId, collateralAmount, collateralId)
5757 match healthParams {
5858 case t: (Int, Int) =>
5959 $Tuple2((accum._1 + healthParams._1), (accum._2 + healthParams._2))
6060 case e =>
6161 throw("Test")
6262 }
6363 }
6464
6565 let $list23512385 = poolList
6666 let $size23512385 = size($list23512385)
6767 let $acc023512385 = $Tuple2(0, 0)
6868 if (($size23512385 == 0))
6969 then $acc023512385
7070 else {
7171 let $acc123512385 = foldPools($acc023512385, $list23512385[0])
7272 if (($size23512385 == 1))
7373 then $acc123512385
7474 else {
7575 let $acc223512385 = foldPools($acc123512385, $list23512385[1])
7676 if (($size23512385 == 2))
7777 then $acc223512385
7878 else {
7979 let $acc323512385 = foldPools($acc223512385, $list23512385[2])
8080 throw("List size exceed 2")
8181 }
8282 }
8383 }
8484 }
8585
8686
8787 func checkUserHealth (user,newDebtAmount,newDebtId,collateralAmount,collateralId) = {
8888 let bcBcu = calcBorrowCBorrowCU(user, newDebtAmount, newDebtId, collateralAmount, collateralId)
8989 let userHealth = calcHealthFactor(bcBcu._1, bcBcu._2)
9090 if ((userHealth >= 0))
9191 then true
9292 else false
9393 }
9494
9595
9696 func checkUserBorrow (user,poolAddress,borrowAsset) = {
9797 let poolAsset = getString(addressFromStringValue(poolAddress), "assetId")
9898 if ((poolAsset == borrowAsset))
9999 then {
100100 let userBorrow = valueOrElse(getInteger(addressFromStringValue(poolAddress), (user + "_borrow")), 0)
101101 if ((userBorrow > 0))
102102 then true
103103 else false
104104 }
105105 else throw("AssetIds do not match!")
106106 }
107107
108108
109109 func checkUserCollateral (user,poolAddress) = {
110110 let userCollateral = valueOrElse(getInteger(addressFromStringValue(poolAddress), (user + "_locked")), 0)
111111 if ((userCollateral > 0))
112112 then true
113113 else false
114114 }
115115
116116
117117 func calcEqualCollateral (liquidationAmount,liquidationPrice,liquidationMantissa,collateralPrice,collateralMantissa,penalty) = {
118118 let baseFactor = 1000
119119 let liquidationUSD = fraction(liquidationAmount, liquidationPrice, liquidationMantissa)
120120 let penaltyUSD = fraction(liquidationUSD, penalty, baseFactor)
121121 fraction((liquidationUSD + penaltyUSD), collateralMantissa, collateralPrice)
122122 }
123123
124124
125125 @Callable(i)
126126 func checkUserHealthTest () = {
127127 let user = toBase58String(i.caller.bytes)
128128 let bcBcu = calcBorrowCBorrowCU(user, 0, "", 0, "")
129129 let userHealth = calcHealthFactor(bcBcu._1, bcBcu._2)
130-[writeInteger((user + "_health"), userHealth)]
130+[writeInteger((user + "_BC"), bcBcu._1), writeInteger((user + "_BCU"), bcBcu._2), writeInteger((user + "_health"), userHealth)]
131131 }
132132
133133
134134
135135 @Callable(i)
136136 func setup (configAddress,pools) = if (if (!(isDefined(getString(this, "config"))))
137137 then !(isDefined(getString(this, "pools")))
138138 else false)
139139 then [writeString("config", configAddress), writeString("pools", makeString(pools, ";"))]
140140 else throw("Admin and config address already definied!")
141141
142142
143143
144144 @Callable(i)
145145 func addPool (poolAddress) = if (isAdmin(i.caller))
146146 then {
147147 let poolList = split(pools, ";")
148148 if ((containsElement(poolList, poolAddress) == false))
149149 then {
150150 let newPools = (poolList :+ poolAddress)
151151 [writeString("pools", makeString(newPools, ";"))]
152152 }
153153 else throw("Pool already exists!")
154154 }
155155 else throw("Address does not match with admin address!")
156156
157157
158158
159159 @Callable(i)
160160 func updateConfig (configAddress) = if (isAdmin(i.caller))
161161 then [writeString("config", configAddress)]
162162 else throw("Address does not match with admin address!")
163163
164164
165165
166166 @Callable(i)
167167 func depositAt (poolAddress,isCollateral) = if (checkPool(poolAddress))
168168 then if ((size(i.payments) > 0))
169169 then {
170170 let user = toBase58String(i.caller.bytes)
171171 let tokenAmount = invoke(addressFromStringValue(poolAddress), "deposit", [user, isCollateral], i.payments)
172172 if ((tokenAmount == tokenAmount))
173173 then {
174174 let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
175175 match tokenAmount {
176176 case t: Int =>
177177 [ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
178178 case t: String =>
179179 nil
180180 case _ =>
181181 throw("Incorrect invoke result!")
182182 }
183183 }
184184 else throw("Strict value is not equal to itself.")
185185 }
186186 else throw("No payment attached!")
187187 else throw("Pool address not found!")
188188
189189
190190
191191 @Callable(i)
192192 func withdrawFrom (poolAddress) = if (checkPool(poolAddress))
193193 then {
194194 let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
195195 if ((fromBase58String(dTokenId) == i.payments[0].assetId))
196196 then if ((size(i.payments) > 0))
197197 then {
198198 let user = toBase58String(i.caller.bytes)
199199 let tokenAmount = invoke(addressFromStringValue(poolAddress), "withdraw", [user], i.payments)
200200 if ((tokenAmount == tokenAmount))
201201 then {
202202 let tokenId = getStringValue(addressFromStringValue(poolAddress), "assetId")
203203 match tokenAmount {
204204 case t: Int =>
205205 if ((tokenId == "WAVES"))
206206 then [ScriptTransfer(i.caller, t, unit)]
207207 else [ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
208208 case t: String =>
209209 nil
210210 case _ =>
211211 throw("Incorrect invoke result!")
212212 }
213213 }
214214 else throw("Strict value is not equal to itself.")
215215 }
216216 else throw("No payment attached!")
217217 else throw("AssetIds does not match")
218218 }
219219 else throw("Pool address not found!")
220220
221221
222222
223223 @Callable(i)
224224 func repayTo (poolAddress) = if (checkPool(poolAddress))
225225 then {
226226 let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId")
227227 if ((fromBase58String(poolAsset) == i.payments[0].assetId))
228228 then if ((size(i.payments) > 0))
229229 then {
230230 let user = toBase58String(i.caller.bytes)
231231 let amount = invoke(addressFromStringValue(poolAddress), "repay", [user], i.payments)
232232 if ((amount == amount))
233233 then {
234234 let assetId = getStringValue(addressFromStringValue(poolAddress), "assetId")
235235 match amount {
236236 case t: Int =>
237237 if ((assetId == "WAVES"))
238238 then [ScriptTransfer(i.caller, t, unit)]
239239 else [ScriptTransfer(i.caller, t, fromBase58String(assetId))]
240240 case t: String =>
241241 nil
242242 case _ =>
243243 throw("Incorrect invoke result!")
244244 }
245245 }
246246 else throw("Strict value is not equal to itself.")
247247 }
248248 else throw("No payment attached!")
249249 else throw("AssetIds does not match")
250250 }
251251 else throw("Pool address not found!")
252252
253253
254254
255255 @Callable(i)
256256 func liquidateAt (userToLiquidate,liquidationPool,collateralPool,collateralAsset) = {
257257 let closeFactor = getIntegerValue(addressFromStringValue(config), "closeFactor")
258258 let penalty = getIntegerValue(addressFromStringValue(config), (collateralAsset + "_Penalty"))
259259 let liquidationAmount = i.payments[0].amount
260260 if ((checkUserHealth(userToLiquidate, 0, "", 0, "") == false))
261261 then {
262262 let borrowAsset = match i.payments[0].assetId {
263263 case t: ByteVector =>
264264 toBase58String(t)
265265 case _ =>
266266 throw("AssetId is not a String")
267267 }
268268 if (if (checkUserBorrow(userToLiquidate, liquidationPool, borrowAsset))
269269 then checkUserCollateral(userToLiquidate, collateralPool)
270270 else false)
271271 then {
272272 let result = invoke(addressFromStringValue(liquidationPool), "getBorrowUSD", [userToLiquidate], nil)
273273 if ((result == result))
274274 then {
275275 let userBorrow = match result {
276276 case t: (Int, Int, Int) =>
277277 t
278278 case _ =>
279279 throw("unexpected return value type")
280280 }
281281 let collateralResult = invoke(addressFromStringValue(collateralPool), "getCollateralUSD", [userToLiquidate], nil)
282282 if ((collateralResult == collateralResult))
283283 then {
284284 let userCollateral = match collateralResult {
285285 case a: (Int, Int, Int) =>
286286 a
287287 case _ =>
288288 throw("unexpected return value type")
289289 }
290290 if ((fraction(userBorrow._1, closeFactor, 1000) >= liquidationAmount))
291291 then {
292292 let collateralAmount = calcEqualCollateral(liquidationAmount, userBorrow._2, userBorrow._3, userCollateral._2, userCollateral._3, penalty)
293293 let repay = invoke(addressFromStringValue(liquidationPool), "repay", [userToLiquidate], i.payments)
294294 if ((repay == repay))
295295 then {
296296 let amount = invoke(addressFromStringValue(collateralPool), "payoutPenalty", [userToLiquidate, collateralAmount], nil)
297297 if ((amount == amount))
298298 then {
299299 let assetId = getStringValue(addressFromStringValue(collateralPool), "assetId")
300300 match amount {
301301 case t: Int =>
302302 if ((assetId == "WAVES"))
303303 then [ScriptTransfer(i.caller, t, unit)]
304304 else [ScriptTransfer(i.caller, t, fromBase58String(assetId))]
305305 case t: String =>
306306 nil
307307 case _ =>
308308 throw("Incorrect invoke result!")
309309 }
310310 }
311311 else throw("Strict value is not equal to itself.")
312312 }
313313 else throw("Strict value is not equal to itself.")
314314 }
315315 else throw("Liquidation amount exceeds closefactor!")
316316 }
317317 else throw("Strict value is not equal to itself.")
318318 }
319319 else throw("Strict value is not equal to itself.")
320320 }
321321 else throw("User does not have the required assets!")
322322 }
323323 else throw("Only unhealthy accounts can be liquidated!")
324324 }
325325
326326
327327
328328 @Callable(i)
329329 func borrowFrom (poolAddress,assetId,amount) = if (checkPool(poolAddress))
330330 then {
331331 let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId")
332332 if ((poolAsset == assetId))
333333 then if (checkPoolLiquidity(poolAddress, amount))
334334 then {
335335 let user = toBase58String(i.caller.bytes)
336336 if ((checkUserHealth(user, amount, assetId, 0, "") == true))
337337 then {
338338 let tokenAmount = invoke(addressFromStringValue(poolAddress), "borrow", [user, amount], nil)
339339 if ((tokenAmount == tokenAmount))
340340 then match tokenAmount {
341341 case t: Int =>
342342 if ((poolAsset == "WAVES"))
343343 then [ScriptTransfer(i.caller, t, unit)]
344344 else [ScriptTransfer(i.caller, t, fromBase58String(poolAsset))]
345345 case t: String =>
346346 nil
347347 case _ =>
348348 throw("Incorrect invoke result!")
349349 }
350350 else throw("Strict value is not equal to itself.")
351351 }
352352 else throw("Borrow exceeds user health!")
353353 }
354354 else throw("Pool liquidity is not sufficient!")
355355 else throw("AssetIds does not match")
356356 }
357357 else throw("Pool address not found!")
358358
359359
360360
361361 @Callable(i)
362362 func lockAsCollateralAt (poolAddress) = if (checkPool(poolAddress))
363363 then {
364364 let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
365365 if ((fromBase58String(dTokenId) == i.payments[0].assetId))
366366 then if ((size(i.payments) > 0))
367367 then {
368368 let user = toBase58String(i.caller.bytes)
369369 let msg = invoke(addressFromStringValue(poolAddress), "lockAsCollateral", [user], i.payments)
370370 if ((msg == msg))
371371 then match msg {
372372 case t: String =>
373373 nil
374374 case _ =>
375375 throw("Incorrect invoke result!")
376376 }
377377 else throw("Strict value is not equal to itself.")
378378 }
379379 else throw("No payment attached!")
380380 else throw("AssetIds does not match")
381381 }
382382 else throw("Pool address not found!")
383383
384384
385385
386386 @Callable(i)
387387 func redeemCollateralFrom (poolAddress,dtokeId,amount) = if (checkPool(poolAddress))
388388 then {
389389 let poolDTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
390390 if ((poolDTokenId == dtokeId))
391391 then {
392392 let user = toBase58String(i.caller.bytes)
393393 if ((checkUserHealth(user, 0, "", amount, dtokeId) == true))
394394 then {
395395 let tokenAmount = invoke(addressFromStringValue(poolAddress), "redeemCollateral", [user, amount], nil)
396396 if ((tokenAmount == tokenAmount))
397397 then {
398398 let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
399399 match tokenAmount {
400400 case t: Int =>
401401 [ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
402402 case t: String =>
403403 nil
404404 case _ =>
405405 throw("Incorrect invoke result!")
406406 }
407407 }
408408 else throw("Strict value is not equal to itself.")
409409 }
410410 else throw("Borrow exceeds user health!")
411411 }
412412 else throw("AssetIds does not match")
413413 }
414414 else throw("Pool address not found!")
415415
416416
417417
418418 @Callable(i)
419419 func deleteData (name) = [DeleteEntry(name)]
420420
421421

github/deemru/w8io/169f3d6 
46.19 ms