tx · 4eoxz9iBHJD55uHwwMF8nD9vy8JtDrcigMLnBiGLNQN9

3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo:  -0.05000000 Waves

2021.10.14 17:23 [1746045] smart account 3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo > SELF 0.00000000 Waves

{ "type": 13, "id": "4eoxz9iBHJD55uHwwMF8nD9vy8JtDrcigMLnBiGLNQN9", "fee": 5000000, "feeAssetId": null, "timestamp": 1634221404070, "version": 2, "chainId": 84, "sender": "3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo", "senderPublicKey": "CD4N2SBeZVBUwmtsqwfmQ3ZKnBP3AxpZCvJ5QkHytUed", "proofs": [ "2ktmVbuLXPwh4yPXsGvYtxQ9qAdnv95LpmpjzQexs6shhE4QWy65yddwSjVHJphDw8BK1qLDQSEXkKKG3pzudgWy" ], "script": "base64:AAIFAAAAAAAAAD0IAhIECgIIGBIDCgEIEgMKAQgSBAoCCAQSAwoBCBIDCgEIEgYKBAgICAgSBQoDCAgBEgMKAQgSBQoDCAgBAAAADwAAAAAGY29uZmlnCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAAZjb25maWcCAAAAAAAAAAAFYWRtaW4JAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAEFAAAABmNvbmZpZwIAAAAFYWRtaW4CAAAAAAAAAAAFcG9vbHMJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAABXBvb2xzAgAAAAABAAAAB2lzQWRtaW4AAAABAAAADWNhbGxlckFkZHJlc3MDCQAAAAAAAAIFAAAADWNhbGxlckFkZHJlc3MJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAA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OU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAAXQJAAJZAAAAAQUAAAAHdG9rZW5JZAUAAAADbmlsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAXQFAAAAByRtYXRjaDAFAAAAA25pbAkAAAIAAAABAgAAABhJbmNvcnJlY3QgaW52b2tlIHJlc3VsdCEJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQAAAgAAAAECAAAAG0JvcnJvdyBleGNlZWRzIHVzZXIgaGVhbHRoIQkAAAIAAAABAgAAABdBc3NldElkcyBkb2VzIG5vdCBtYXRjaAkAAAIAAAABAgAAABdQb29sIGFkZHJlc3Mgbm90IGZvdW5kIQAAAABWBuST", "height": 1746045, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 58S5VFz1Fvx81Ufu1dckojkxjLNBcHvcMx2Gx9ZTVwvk Next: none Diff:
OldNewDifferences
3535
3636 func getHealthParameter (user,poolAddress,newDebtAmount,newDebtId,collateralAmount,collateralId) = {
3737 let result = invoke(addressFromStringValue(poolAddress), "getUserHealthParameter", [user, collateralAmount, collateralId, newDebtAmount, newDebtId], nil)
38- match result {
39- case t: (Int, Int) =>
40- t
41- case _ =>
42- throw("Return value has the wrong data type")
43- }
38+ if ((result == result))
39+ then match result {
40+ case t: (Int, Int) =>
41+ t
42+ case _ =>
43+ throw("Return value has the wrong data type")
44+ }
45+ else throw("Strict value is not equal to itself.")
4446 }
4547
4648
6264 }
6365 }
6466
65- let $list23512385 = poolList
66- let $size23512385 = size($list23512385)
67- let $acc023512385 = $Tuple2(0, 0)
68- if (($size23512385 == 0))
69- then $acc023512385
70- else {
71- let $acc123512385 = foldPools($acc023512385, $list23512385[0])
72- if (($size23512385 == 1))
73- then $acc123512385
74- else {
75- let $acc223512385 = foldPools($acc123512385, $list23512385[1])
76- if (($size23512385 == 2))
77- then $acc223512385
78- else {
79- let $acc323512385 = foldPools($acc223512385, $list23512385[2])
80- throw("List size exceed 2")
81- }
82- }
83- }
67+ let $l = poolList
68+ let $s = size($l)
69+ let $acc0 = $Tuple2(0, 0)
70+ func 1 ($a,$i) = if (($i >= $s))
71+ then $a
72+ else foldPools($a, $l[$i])
73+
74+ func 2 ($a,$i) = if (($i >= $s))
75+ then $a
76+ else throw("List size exceeds 2")
77+
78+ 2(1(1($acc0, 0), 1), 2)
8479 }
8580
8681
120115 let penaltyUSD = fraction(liquidationUSD, penalty, baseFactor)
121116 fraction((liquidationUSD + penaltyUSD), collateralMantissa, collateralPrice)
122117 }
123-
124-
125-@Callable(i)
126-func checkUserHealthTest () = {
127- let user = toBase58String(i.caller.bytes)
128- let bcBcu = calcBorrowCBorrowCU(user, 0, "", 0, "")
129- let userHealth = calcHealthFactor(bcBcu._1, bcBcu._2)
130-[writeInteger((user + "_BC"), bcBcu._1), writeInteger((user + "_BCU"), bcBcu._2), writeInteger((user + "_health"), userHealth)]
131- }
132-
133118
134119
135120 @Callable(i)
222207
223208 @Callable(i)
224209 func repayTo (poolAddress) = if (checkPool(poolAddress))
225- then {
226- let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId")
227- if ((fromBase58String(poolAsset) == i.payments[0].assetId))
228- then if ((size(i.payments) > 0))
210+ then if ((size(i.payments) > 0))
211+ then {
212+ let user = toBase58String(i.caller.bytes)
213+ let amount = invoke(addressFromStringValue(poolAddress), "repay", [user], i.payments)
214+ if ((amount == amount))
229215 then {
230- let user = toBase58String(i.caller.bytes)
231- let amount = invoke(addressFromStringValue(poolAddress), "repay", [user], i.payments)
232- if ((amount == amount))
233- then {
234- let assetId = getStringValue(addressFromStringValue(poolAddress), "assetId")
235- match amount {
236- case t: Int =>
237- if ((assetId == "WAVES"))
238- then [ScriptTransfer(i.caller, t, unit)]
239- else [ScriptTransfer(i.caller, t, fromBase58String(assetId))]
240- case t: String =>
241- nil
242- case _ =>
243- throw("Incorrect invoke result!")
244- }
245- }
246- else throw("Strict value is not equal to itself.")
216+ let assetId = getStringValue(addressFromStringValue(poolAddress), "assetId")
217+ match amount {
218+ case t: Int =>
219+ if ((assetId == "WAVES"))
220+ then [ScriptTransfer(i.caller, t, unit)]
221+ else [ScriptTransfer(i.caller, t, fromBase58String(assetId))]
222+ case t: String =>
223+ nil
224+ case _ =>
225+ throw("Incorrect invoke result!")
247226 }
248- else throw("No payment attached!")
249- else throw("AssetIds does not match")
250- }
227+ }
228+ else throw("Strict value is not equal to itself.")
229+ }
230+ else throw("No payment attached!")
251231 else throw("Pool address not found!")
252232
253233
414394 else throw("Pool address not found!")
415395
416396
417-
418-@Callable(i)
419-func deleteData (name) = [DeleteEntry(name)]
420-
421-
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)
38- match result {
39- case t: (Int, Int) =>
40- t
41- case _ =>
42- throw("Return value has the wrong data type")
43- }
38+ if ((result == result))
39+ then match result {
40+ case t: (Int, Int) =>
41+ t
42+ case _ =>
43+ throw("Return value has the wrong data type")
44+ }
45+ else throw("Strict value is not equal to itself.")
4446 }
4547
4648
4749 func calcHealthFactor (borrowCapacity,borrowCapacityUsed) = if ((borrowCapacity > 0))
4850 then fraction((borrowCapacity - borrowCapacityUsed), 1000, borrowCapacity)
4951 else 0
5052
5153
5254 func calcBorrowCBorrowCU (user,newDebtAmount,newDebtId,collateralAmount,collateralId) = {
5355 let poolList = split(pools, ";")
5456 let listSize = size(poolList)
5557 func foldPools (accum,next) = {
5658 let healthParams = getHealthParameter(user, next, newDebtAmount, newDebtId, collateralAmount, collateralId)
5759 match healthParams {
5860 case t: (Int, Int) =>
5961 $Tuple2((accum._1 + healthParams._1), (accum._2 + healthParams._2))
6062 case e =>
6163 throw("Test")
6264 }
6365 }
6466
65- let $list23512385 = poolList
66- let $size23512385 = size($list23512385)
67- let $acc023512385 = $Tuple2(0, 0)
68- if (($size23512385 == 0))
69- then $acc023512385
70- else {
71- let $acc123512385 = foldPools($acc023512385, $list23512385[0])
72- if (($size23512385 == 1))
73- then $acc123512385
74- else {
75- let $acc223512385 = foldPools($acc123512385, $list23512385[1])
76- if (($size23512385 == 2))
77- then $acc223512385
78- else {
79- let $acc323512385 = foldPools($acc223512385, $list23512385[2])
80- throw("List size exceed 2")
81- }
82- }
83- }
67+ let $l = poolList
68+ let $s = size($l)
69+ let $acc0 = $Tuple2(0, 0)
70+ func 1 ($a,$i) = if (($i >= $s))
71+ then $a
72+ else foldPools($a, $l[$i])
73+
74+ func 2 ($a,$i) = if (($i >= $s))
75+ then $a
76+ else throw("List size exceeds 2")
77+
78+ 2(1(1($acc0, 0), 1), 2)
8479 }
8580
8681
8782 func checkUserHealth (user,newDebtAmount,newDebtId,collateralAmount,collateralId) = {
8883 let bcBcu = calcBorrowCBorrowCU(user, newDebtAmount, newDebtId, collateralAmount, collateralId)
8984 let userHealth = calcHealthFactor(bcBcu._1, bcBcu._2)
9085 if ((userHealth >= 0))
9186 then true
9287 else false
9388 }
9489
9590
9691 func checkUserBorrow (user,poolAddress,borrowAsset) = {
9792 let poolAsset = getString(addressFromStringValue(poolAddress), "assetId")
9893 if ((poolAsset == borrowAsset))
9994 then {
10095 let userBorrow = valueOrElse(getInteger(addressFromStringValue(poolAddress), (user + "_borrow")), 0)
10196 if ((userBorrow > 0))
10297 then true
10398 else false
10499 }
105100 else throw("AssetIds do not match!")
106101 }
107102
108103
109104 func checkUserCollateral (user,poolAddress) = {
110105 let userCollateral = valueOrElse(getInteger(addressFromStringValue(poolAddress), (user + "_locked")), 0)
111106 if ((userCollateral > 0))
112107 then true
113108 else false
114109 }
115110
116111
117112 func calcEqualCollateral (liquidationAmount,liquidationPrice,liquidationMantissa,collateralPrice,collateralMantissa,penalty) = {
118113 let baseFactor = 1000
119114 let liquidationUSD = fraction(liquidationAmount, liquidationPrice, liquidationMantissa)
120115 let penaltyUSD = fraction(liquidationUSD, penalty, baseFactor)
121116 fraction((liquidationUSD + penaltyUSD), collateralMantissa, collateralPrice)
122117 }
123-
124-
125-@Callable(i)
126-func checkUserHealthTest () = {
127- let user = toBase58String(i.caller.bytes)
128- let bcBcu = calcBorrowCBorrowCU(user, 0, "", 0, "")
129- let userHealth = calcHealthFactor(bcBcu._1, bcBcu._2)
130-[writeInteger((user + "_BC"), bcBcu._1), writeInteger((user + "_BCU"), bcBcu._2), writeInteger((user + "_health"), userHealth)]
131- }
132-
133118
134119
135120 @Callable(i)
136121 func setup (configAddress,pools) = if (if (!(isDefined(getString(this, "config"))))
137122 then !(isDefined(getString(this, "pools")))
138123 else false)
139124 then [writeString("config", configAddress), writeString("pools", makeString(pools, ";"))]
140125 else throw("Admin and config address already definied!")
141126
142127
143128
144129 @Callable(i)
145130 func addPool (poolAddress) = if (isAdmin(i.caller))
146131 then {
147132 let poolList = split(pools, ";")
148133 if ((containsElement(poolList, poolAddress) == false))
149134 then {
150135 let newPools = (poolList :+ poolAddress)
151136 [writeString("pools", makeString(newPools, ";"))]
152137 }
153138 else throw("Pool already exists!")
154139 }
155140 else throw("Address does not match with admin address!")
156141
157142
158143
159144 @Callable(i)
160145 func updateConfig (configAddress) = if (isAdmin(i.caller))
161146 then [writeString("config", configAddress)]
162147 else throw("Address does not match with admin address!")
163148
164149
165150
166151 @Callable(i)
167152 func depositAt (poolAddress,isCollateral) = if (checkPool(poolAddress))
168153 then if ((size(i.payments) > 0))
169154 then {
170155 let user = toBase58String(i.caller.bytes)
171156 let tokenAmount = invoke(addressFromStringValue(poolAddress), "deposit", [user, isCollateral], i.payments)
172157 if ((tokenAmount == tokenAmount))
173158 then {
174159 let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
175160 match tokenAmount {
176161 case t: Int =>
177162 [ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
178163 case t: String =>
179164 nil
180165 case _ =>
181166 throw("Incorrect invoke result!")
182167 }
183168 }
184169 else throw("Strict value is not equal to itself.")
185170 }
186171 else throw("No payment attached!")
187172 else throw("Pool address not found!")
188173
189174
190175
191176 @Callable(i)
192177 func withdrawFrom (poolAddress) = if (checkPool(poolAddress))
193178 then {
194179 let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
195180 if ((fromBase58String(dTokenId) == i.payments[0].assetId))
196181 then if ((size(i.payments) > 0))
197182 then {
198183 let user = toBase58String(i.caller.bytes)
199184 let tokenAmount = invoke(addressFromStringValue(poolAddress), "withdraw", [user], i.payments)
200185 if ((tokenAmount == tokenAmount))
201186 then {
202187 let tokenId = getStringValue(addressFromStringValue(poolAddress), "assetId")
203188 match tokenAmount {
204189 case t: Int =>
205190 if ((tokenId == "WAVES"))
206191 then [ScriptTransfer(i.caller, t, unit)]
207192 else [ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
208193 case t: String =>
209194 nil
210195 case _ =>
211196 throw("Incorrect invoke result!")
212197 }
213198 }
214199 else throw("Strict value is not equal to itself.")
215200 }
216201 else throw("No payment attached!")
217202 else throw("AssetIds does not match")
218203 }
219204 else throw("Pool address not found!")
220205
221206
222207
223208 @Callable(i)
224209 func repayTo (poolAddress) = if (checkPool(poolAddress))
225- then {
226- let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId")
227- if ((fromBase58String(poolAsset) == i.payments[0].assetId))
228- then if ((size(i.payments) > 0))
210+ then if ((size(i.payments) > 0))
211+ then {
212+ let user = toBase58String(i.caller.bytes)
213+ let amount = invoke(addressFromStringValue(poolAddress), "repay", [user], i.payments)
214+ if ((amount == amount))
229215 then {
230- let user = toBase58String(i.caller.bytes)
231- let amount = invoke(addressFromStringValue(poolAddress), "repay", [user], i.payments)
232- if ((amount == amount))
233- then {
234- let assetId = getStringValue(addressFromStringValue(poolAddress), "assetId")
235- match amount {
236- case t: Int =>
237- if ((assetId == "WAVES"))
238- then [ScriptTransfer(i.caller, t, unit)]
239- else [ScriptTransfer(i.caller, t, fromBase58String(assetId))]
240- case t: String =>
241- nil
242- case _ =>
243- throw("Incorrect invoke result!")
244- }
245- }
246- else throw("Strict value is not equal to itself.")
216+ let assetId = getStringValue(addressFromStringValue(poolAddress), "assetId")
217+ match amount {
218+ case t: Int =>
219+ if ((assetId == "WAVES"))
220+ then [ScriptTransfer(i.caller, t, unit)]
221+ else [ScriptTransfer(i.caller, t, fromBase58String(assetId))]
222+ case t: String =>
223+ nil
224+ case _ =>
225+ throw("Incorrect invoke result!")
247226 }
248- else throw("No payment attached!")
249- else throw("AssetIds does not match")
250- }
227+ }
228+ else throw("Strict value is not equal to itself.")
229+ }
230+ else throw("No payment attached!")
251231 else throw("Pool address not found!")
252232
253233
254234
255235 @Callable(i)
256236 func liquidateAt (userToLiquidate,liquidationPool,collateralPool,collateralAsset) = {
257237 let closeFactor = getIntegerValue(addressFromStringValue(config), "closeFactor")
258238 let penalty = getIntegerValue(addressFromStringValue(config), (collateralAsset + "_Penalty"))
259239 let liquidationAmount = i.payments[0].amount
260240 if ((checkUserHealth(userToLiquidate, 0, "", 0, "") == false))
261241 then {
262242 let borrowAsset = match i.payments[0].assetId {
263243 case t: ByteVector =>
264244 toBase58String(t)
265245 case _ =>
266246 throw("AssetId is not a String")
267247 }
268248 if (if (checkUserBorrow(userToLiquidate, liquidationPool, borrowAsset))
269249 then checkUserCollateral(userToLiquidate, collateralPool)
270250 else false)
271251 then {
272252 let result = invoke(addressFromStringValue(liquidationPool), "getBorrowUSD", [userToLiquidate], nil)
273253 if ((result == result))
274254 then {
275255 let userBorrow = match result {
276256 case t: (Int, Int, Int) =>
277257 t
278258 case _ =>
279259 throw("unexpected return value type")
280260 }
281261 let collateralResult = invoke(addressFromStringValue(collateralPool), "getCollateralUSD", [userToLiquidate], nil)
282262 if ((collateralResult == collateralResult))
283263 then {
284264 let userCollateral = match collateralResult {
285265 case a: (Int, Int, Int) =>
286266 a
287267 case _ =>
288268 throw("unexpected return value type")
289269 }
290270 if ((fraction(userBorrow._1, closeFactor, 1000) >= liquidationAmount))
291271 then {
292272 let collateralAmount = calcEqualCollateral(liquidationAmount, userBorrow._2, userBorrow._3, userCollateral._2, userCollateral._3, penalty)
293273 let repay = invoke(addressFromStringValue(liquidationPool), "repay", [userToLiquidate], i.payments)
294274 if ((repay == repay))
295275 then {
296276 let amount = invoke(addressFromStringValue(collateralPool), "payoutPenalty", [userToLiquidate, collateralAmount], nil)
297277 if ((amount == amount))
298278 then {
299279 let assetId = getStringValue(addressFromStringValue(collateralPool), "assetId")
300280 match amount {
301281 case t: Int =>
302282 if ((assetId == "WAVES"))
303283 then [ScriptTransfer(i.caller, t, unit)]
304284 else [ScriptTransfer(i.caller, t, fromBase58String(assetId))]
305285 case t: String =>
306286 nil
307287 case _ =>
308288 throw("Incorrect invoke result!")
309289 }
310290 }
311291 else throw("Strict value is not equal to itself.")
312292 }
313293 else throw("Strict value is not equal to itself.")
314294 }
315295 else throw("Liquidation amount exceeds closefactor!")
316296 }
317297 else throw("Strict value is not equal to itself.")
318298 }
319299 else throw("Strict value is not equal to itself.")
320300 }
321301 else throw("User does not have the required assets!")
322302 }
323303 else throw("Only unhealthy accounts can be liquidated!")
324304 }
325305
326306
327307
328308 @Callable(i)
329309 func borrowFrom (poolAddress,assetId,amount) = if (checkPool(poolAddress))
330310 then {
331311 let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId")
332312 if ((poolAsset == assetId))
333313 then if (checkPoolLiquidity(poolAddress, amount))
334314 then {
335315 let user = toBase58String(i.caller.bytes)
336316 if ((checkUserHealth(user, amount, assetId, 0, "") == true))
337317 then {
338318 let tokenAmount = invoke(addressFromStringValue(poolAddress), "borrow", [user, amount], nil)
339319 if ((tokenAmount == tokenAmount))
340320 then match tokenAmount {
341321 case t: Int =>
342322 if ((poolAsset == "WAVES"))
343323 then [ScriptTransfer(i.caller, t, unit)]
344324 else [ScriptTransfer(i.caller, t, fromBase58String(poolAsset))]
345325 case t: String =>
346326 nil
347327 case _ =>
348328 throw("Incorrect invoke result!")
349329 }
350330 else throw("Strict value is not equal to itself.")
351331 }
352332 else throw("Borrow exceeds user health!")
353333 }
354334 else throw("Pool liquidity is not sufficient!")
355335 else throw("AssetIds does not match")
356336 }
357337 else throw("Pool address not found!")
358338
359339
360340
361341 @Callable(i)
362342 func lockAsCollateralAt (poolAddress) = if (checkPool(poolAddress))
363343 then {
364344 let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
365345 if ((fromBase58String(dTokenId) == i.payments[0].assetId))
366346 then if ((size(i.payments) > 0))
367347 then {
368348 let user = toBase58String(i.caller.bytes)
369349 let msg = invoke(addressFromStringValue(poolAddress), "lockAsCollateral", [user], i.payments)
370350 if ((msg == msg))
371351 then match msg {
372352 case t: String =>
373353 nil
374354 case _ =>
375355 throw("Incorrect invoke result!")
376356 }
377357 else throw("Strict value is not equal to itself.")
378358 }
379359 else throw("No payment attached!")
380360 else throw("AssetIds does not match")
381361 }
382362 else throw("Pool address not found!")
383363
384364
385365
386366 @Callable(i)
387367 func redeemCollateralFrom (poolAddress,dtokeId,amount) = if (checkPool(poolAddress))
388368 then {
389369 let poolDTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
390370 if ((poolDTokenId == dtokeId))
391371 then {
392372 let user = toBase58String(i.caller.bytes)
393373 if ((checkUserHealth(user, 0, "", amount, dtokeId) == true))
394374 then {
395375 let tokenAmount = invoke(addressFromStringValue(poolAddress), "redeemCollateral", [user, amount], nil)
396376 if ((tokenAmount == tokenAmount))
397377 then {
398378 let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
399379 match tokenAmount {
400380 case t: Int =>
401381 [ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
402382 case t: String =>
403383 nil
404384 case _ =>
405385 throw("Incorrect invoke result!")
406386 }
407387 }
408388 else throw("Strict value is not equal to itself.")
409389 }
410390 else throw("Borrow exceeds user health!")
411391 }
412392 else throw("AssetIds does not match")
413393 }
414394 else throw("Pool address not found!")
415395
416396
417-
418-@Callable(i)
419-func deleteData (name) = [DeleteEntry(name)]
420-
421-

github/deemru/w8io/169f3d6 
66.18 ms