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:AAIFAAAAAAAAAEQIAhIAEgQKAggYEgMKAQgSAwoBCBIECgIIBBIDCgEIEgMKAQgSBgoECAgICBIFCgMICAESAwoBCBIFCgMICAESAwoBCAAAAA8AAAAABmNvbmZpZwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAAGY29uZmlnAgAAAAAAAAAABWFkbWluCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAZjb25maWcCAAAABWFkbWluAgAAAAAAAAAABXBvb2xzCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAAVwb29scwIAAAAAAQAAAAdpc0FkbWluAAAAAQAAAA1jYWxsZXJBZGRyZXNzAwkAAAAAAAACBQAAAA1jYWxsZXJBZGRyZXNzCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAA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AAckbWF0Y2gwAgAAAANJbnQEAAAAAXQFAAAAByRtYXRjaDAJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAF0CQACWQAAAAEFAAAAB3Rva2VuSWQFAAAAA25pbAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAF0BQAAAAckbWF0Y2gwBQAAAANuaWwJAAACAAAAAQIAAAAYSW5jb3JyZWN0IGludm9rZSByZXN1bHQhCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAABtCb3Jyb3cgZXhjZWVkcyB1c2VyIGhlYWx0aCEJAAACAAAAAQIAAAAXQXNzZXRJZHMgZG9lcyBub3QgbWF0Y2gJAAACAAAAAQIAAAAXUG9vbCBhZGRyZXNzIG5vdCBmb3VuZCEAAAABaQEAAAAKZGVsZXRlRGF0YQAAAAEAAAAEbmFtZQkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAARuYW1lBQAAAANuaWwAAAAA/pklUg==", "height": 1692685, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 59iroGMSmdiPPrq3WA3euMj4yabWeyG5ij8cPhQVfgTd Next: 4eoxz9iBHJD55uHwwMF8nD9vy8JtDrcigMLnBiGLNQN9 Diff:
Old | New | Differences | |
---|---|---|---|
127 | 127 | let user = toBase58String(i.caller.bytes) | |
128 | 128 | let bcBcu = calcBorrowCBorrowCU(user, 0, "", 0, "") | |
129 | 129 | 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)] | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let config = valueOrElse(getStringValue(this, "config"), "") | |
5 | 5 | ||
6 | 6 | let admin = valueOrElse(getStringValue(addressFromStringValue(config), "admin"), "") | |
7 | 7 | ||
8 | 8 | let pools = valueOrElse(getStringValue(this, "pools"), "") | |
9 | 9 | ||
10 | 10 | func isAdmin (callerAddress) = if ((callerAddress == addressFromStringValue(admin))) | |
11 | 11 | then true | |
12 | 12 | else false | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func checkPool (poolAdd) = if (contains(pools, poolAdd)) | |
16 | 16 | then true | |
17 | 17 | else false | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func writeString (key,stringValue) = StringEntry(key, stringValue) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func writeInteger (key,integerValue) = IntegerEntry(key, integerValue) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func checkPoolLiquidity (poolAddress,amount) = { | |
27 | 27 | let totalSupply = getIntegerValue(addressFromStringValue(poolAddress), "totalSupply") | |
28 | 28 | let totalBorrow = getIntegerValue(addressFromStringValue(poolAddress), "totalBorrow") | |
29 | 29 | let availableLiquidity = (totalSupply - totalBorrow) | |
30 | 30 | if ((availableLiquidity >= amount)) | |
31 | 31 | then true | |
32 | 32 | else false | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getHealthParameter (user,poolAddress,newDebtAmount,newDebtId,collateralAmount,collateralId) = { | |
37 | 37 | let result = invoke(addressFromStringValue(poolAddress), "getUserHealthParameter", [user, collateralAmount, collateralId, newDebtAmount, newDebtId], nil) | |
38 | 38 | match result { | |
39 | 39 | case t: (Int, Int) => | |
40 | 40 | t | |
41 | 41 | case _ => | |
42 | 42 | throw("Return value has the wrong data type") | |
43 | 43 | } | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func calcHealthFactor (borrowCapacity,borrowCapacityUsed) = if ((borrowCapacity > 0)) | |
48 | 48 | then fraction((borrowCapacity - borrowCapacityUsed), 1000, borrowCapacity) | |
49 | 49 | else 0 | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func calcBorrowCBorrowCU (user,newDebtAmount,newDebtId,collateralAmount,collateralId) = { | |
53 | 53 | let poolList = split(pools, ";") | |
54 | 54 | let listSize = size(poolList) | |
55 | 55 | func foldPools (accum,next) = { | |
56 | 56 | let healthParams = getHealthParameter(user, next, newDebtAmount, newDebtId, collateralAmount, collateralId) | |
57 | 57 | match healthParams { | |
58 | 58 | case t: (Int, Int) => | |
59 | 59 | $Tuple2((accum._1 + healthParams._1), (accum._2 + healthParams._2)) | |
60 | 60 | case e => | |
61 | 61 | throw("Test") | |
62 | 62 | } | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 | let $list23512385 = poolList | |
66 | 66 | let $size23512385 = size($list23512385) | |
67 | 67 | let $acc023512385 = $Tuple2(0, 0) | |
68 | 68 | if (($size23512385 == 0)) | |
69 | 69 | then $acc023512385 | |
70 | 70 | else { | |
71 | 71 | let $acc123512385 = foldPools($acc023512385, $list23512385[0]) | |
72 | 72 | if (($size23512385 == 1)) | |
73 | 73 | then $acc123512385 | |
74 | 74 | else { | |
75 | 75 | let $acc223512385 = foldPools($acc123512385, $list23512385[1]) | |
76 | 76 | if (($size23512385 == 2)) | |
77 | 77 | then $acc223512385 | |
78 | 78 | else { | |
79 | 79 | let $acc323512385 = foldPools($acc223512385, $list23512385[2]) | |
80 | 80 | throw("List size exceed 2") | |
81 | 81 | } | |
82 | 82 | } | |
83 | 83 | } | |
84 | 84 | } | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func checkUserHealth (user,newDebtAmount,newDebtId,collateralAmount,collateralId) = { | |
88 | 88 | let bcBcu = calcBorrowCBorrowCU(user, newDebtAmount, newDebtId, collateralAmount, collateralId) | |
89 | 89 | let userHealth = calcHealthFactor(bcBcu._1, bcBcu._2) | |
90 | 90 | if ((userHealth >= 0)) | |
91 | 91 | then true | |
92 | 92 | else false | |
93 | 93 | } | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func checkUserBorrow (user,poolAddress,borrowAsset) = { | |
97 | 97 | let poolAsset = getString(addressFromStringValue(poolAddress), "assetId") | |
98 | 98 | if ((poolAsset == borrowAsset)) | |
99 | 99 | then { | |
100 | 100 | let userBorrow = valueOrElse(getInteger(addressFromStringValue(poolAddress), (user + "_borrow")), 0) | |
101 | 101 | if ((userBorrow > 0)) | |
102 | 102 | then true | |
103 | 103 | else false | |
104 | 104 | } | |
105 | 105 | else throw("AssetIds do not match!") | |
106 | 106 | } | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func checkUserCollateral (user,poolAddress) = { | |
110 | 110 | let userCollateral = valueOrElse(getInteger(addressFromStringValue(poolAddress), (user + "_locked")), 0) | |
111 | 111 | if ((userCollateral > 0)) | |
112 | 112 | then true | |
113 | 113 | else false | |
114 | 114 | } | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func calcEqualCollateral (liquidationAmount,liquidationPrice,liquidationMantissa,collateralPrice,collateralMantissa,penalty) = { | |
118 | 118 | let baseFactor = 1000 | |
119 | 119 | let liquidationUSD = fraction(liquidationAmount, liquidationPrice, liquidationMantissa) | |
120 | 120 | let penaltyUSD = fraction(liquidationUSD, penalty, baseFactor) | |
121 | 121 | fraction((liquidationUSD + penaltyUSD), collateralMantissa, collateralPrice) | |
122 | 122 | } | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | @Callable(i) | |
126 | 126 | func checkUserHealthTest () = { | |
127 | 127 | let user = toBase58String(i.caller.bytes) | |
128 | 128 | let bcBcu = calcBorrowCBorrowCU(user, 0, "", 0, "") | |
129 | 129 | 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)] | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | ||
135 | 135 | @Callable(i) | |
136 | 136 | func setup (configAddress,pools) = if (if (!(isDefined(getString(this, "config")))) | |
137 | 137 | then !(isDefined(getString(this, "pools"))) | |
138 | 138 | else false) | |
139 | 139 | then [writeString("config", configAddress), writeString("pools", makeString(pools, ";"))] | |
140 | 140 | else throw("Admin and config address already definied!") | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | ||
144 | 144 | @Callable(i) | |
145 | 145 | func addPool (poolAddress) = if (isAdmin(i.caller)) | |
146 | 146 | then { | |
147 | 147 | let poolList = split(pools, ";") | |
148 | 148 | if ((containsElement(poolList, poolAddress) == false)) | |
149 | 149 | then { | |
150 | 150 | let newPools = (poolList :+ poolAddress) | |
151 | 151 | [writeString("pools", makeString(newPools, ";"))] | |
152 | 152 | } | |
153 | 153 | else throw("Pool already exists!") | |
154 | 154 | } | |
155 | 155 | else throw("Address does not match with admin address!") | |
156 | 156 | ||
157 | 157 | ||
158 | 158 | ||
159 | 159 | @Callable(i) | |
160 | 160 | func updateConfig (configAddress) = if (isAdmin(i.caller)) | |
161 | 161 | then [writeString("config", configAddress)] | |
162 | 162 | else throw("Address does not match with admin address!") | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | ||
166 | 166 | @Callable(i) | |
167 | 167 | func depositAt (poolAddress,isCollateral) = if (checkPool(poolAddress)) | |
168 | 168 | then if ((size(i.payments) > 0)) | |
169 | 169 | then { | |
170 | 170 | let user = toBase58String(i.caller.bytes) | |
171 | 171 | let tokenAmount = invoke(addressFromStringValue(poolAddress), "deposit", [user, isCollateral], i.payments) | |
172 | 172 | if ((tokenAmount == tokenAmount)) | |
173 | 173 | then { | |
174 | 174 | let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId") | |
175 | 175 | match tokenAmount { | |
176 | 176 | case t: Int => | |
177 | 177 | [ScriptTransfer(i.caller, t, fromBase58String(tokenId))] | |
178 | 178 | case t: String => | |
179 | 179 | nil | |
180 | 180 | case _ => | |
181 | 181 | throw("Incorrect invoke result!") | |
182 | 182 | } | |
183 | 183 | } | |
184 | 184 | else throw("Strict value is not equal to itself.") | |
185 | 185 | } | |
186 | 186 | else throw("No payment attached!") | |
187 | 187 | else throw("Pool address not found!") | |
188 | 188 | ||
189 | 189 | ||
190 | 190 | ||
191 | 191 | @Callable(i) | |
192 | 192 | func withdrawFrom (poolAddress) = if (checkPool(poolAddress)) | |
193 | 193 | then { | |
194 | 194 | let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId") | |
195 | 195 | if ((fromBase58String(dTokenId) == i.payments[0].assetId)) | |
196 | 196 | then if ((size(i.payments) > 0)) | |
197 | 197 | then { | |
198 | 198 | let user = toBase58String(i.caller.bytes) | |
199 | 199 | let tokenAmount = invoke(addressFromStringValue(poolAddress), "withdraw", [user], i.payments) | |
200 | 200 | if ((tokenAmount == tokenAmount)) | |
201 | 201 | then { | |
202 | 202 | let tokenId = getStringValue(addressFromStringValue(poolAddress), "assetId") | |
203 | 203 | match tokenAmount { | |
204 | 204 | case t: Int => | |
205 | 205 | if ((tokenId == "WAVES")) | |
206 | 206 | then [ScriptTransfer(i.caller, t, unit)] | |
207 | 207 | else [ScriptTransfer(i.caller, t, fromBase58String(tokenId))] | |
208 | 208 | case t: String => | |
209 | 209 | nil | |
210 | 210 | case _ => | |
211 | 211 | throw("Incorrect invoke result!") | |
212 | 212 | } | |
213 | 213 | } | |
214 | 214 | else throw("Strict value is not equal to itself.") | |
215 | 215 | } | |
216 | 216 | else throw("No payment attached!") | |
217 | 217 | else throw("AssetIds does not match") | |
218 | 218 | } | |
219 | 219 | else throw("Pool address not found!") | |
220 | 220 | ||
221 | 221 | ||
222 | 222 | ||
223 | 223 | @Callable(i) | |
224 | 224 | func repayTo (poolAddress) = if (checkPool(poolAddress)) | |
225 | 225 | then { | |
226 | 226 | let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId") | |
227 | 227 | if ((fromBase58String(poolAsset) == i.payments[0].assetId)) | |
228 | 228 | then if ((size(i.payments) > 0)) | |
229 | 229 | then { | |
230 | 230 | let user = toBase58String(i.caller.bytes) | |
231 | 231 | let amount = invoke(addressFromStringValue(poolAddress), "repay", [user], i.payments) | |
232 | 232 | if ((amount == amount)) | |
233 | 233 | then { | |
234 | 234 | let assetId = getStringValue(addressFromStringValue(poolAddress), "assetId") | |
235 | 235 | match amount { | |
236 | 236 | case t: Int => | |
237 | 237 | if ((assetId == "WAVES")) | |
238 | 238 | then [ScriptTransfer(i.caller, t, unit)] | |
239 | 239 | else [ScriptTransfer(i.caller, t, fromBase58String(assetId))] | |
240 | 240 | case t: String => | |
241 | 241 | nil | |
242 | 242 | case _ => | |
243 | 243 | throw("Incorrect invoke result!") | |
244 | 244 | } | |
245 | 245 | } | |
246 | 246 | else throw("Strict value is not equal to itself.") | |
247 | 247 | } | |
248 | 248 | else throw("No payment attached!") | |
249 | 249 | else throw("AssetIds does not match") | |
250 | 250 | } | |
251 | 251 | else throw("Pool address not found!") | |
252 | 252 | ||
253 | 253 | ||
254 | 254 | ||
255 | 255 | @Callable(i) | |
256 | 256 | func liquidateAt (userToLiquidate,liquidationPool,collateralPool,collateralAsset) = { | |
257 | 257 | let closeFactor = getIntegerValue(addressFromStringValue(config), "closeFactor") | |
258 | 258 | let penalty = getIntegerValue(addressFromStringValue(config), (collateralAsset + "_Penalty")) | |
259 | 259 | let liquidationAmount = i.payments[0].amount | |
260 | 260 | if ((checkUserHealth(userToLiquidate, 0, "", 0, "") == false)) | |
261 | 261 | then { | |
262 | 262 | let borrowAsset = match i.payments[0].assetId { | |
263 | 263 | case t: ByteVector => | |
264 | 264 | toBase58String(t) | |
265 | 265 | case _ => | |
266 | 266 | throw("AssetId is not a String") | |
267 | 267 | } | |
268 | 268 | if (if (checkUserBorrow(userToLiquidate, liquidationPool, borrowAsset)) | |
269 | 269 | then checkUserCollateral(userToLiquidate, collateralPool) | |
270 | 270 | else false) | |
271 | 271 | then { | |
272 | 272 | let result = invoke(addressFromStringValue(liquidationPool), "getBorrowUSD", [userToLiquidate], nil) | |
273 | 273 | if ((result == result)) | |
274 | 274 | then { | |
275 | 275 | let userBorrow = match result { | |
276 | 276 | case t: (Int, Int, Int) => | |
277 | 277 | t | |
278 | 278 | case _ => | |
279 | 279 | throw("unexpected return value type") | |
280 | 280 | } | |
281 | 281 | let collateralResult = invoke(addressFromStringValue(collateralPool), "getCollateralUSD", [userToLiquidate], nil) | |
282 | 282 | if ((collateralResult == collateralResult)) | |
283 | 283 | then { | |
284 | 284 | let userCollateral = match collateralResult { | |
285 | 285 | case a: (Int, Int, Int) => | |
286 | 286 | a | |
287 | 287 | case _ => | |
288 | 288 | throw("unexpected return value type") | |
289 | 289 | } | |
290 | 290 | if ((fraction(userBorrow._1, closeFactor, 1000) >= liquidationAmount)) | |
291 | 291 | then { | |
292 | 292 | let collateralAmount = calcEqualCollateral(liquidationAmount, userBorrow._2, userBorrow._3, userCollateral._2, userCollateral._3, penalty) | |
293 | 293 | let repay = invoke(addressFromStringValue(liquidationPool), "repay", [userToLiquidate], i.payments) | |
294 | 294 | if ((repay == repay)) | |
295 | 295 | then { | |
296 | 296 | let amount = invoke(addressFromStringValue(collateralPool), "payoutPenalty", [userToLiquidate, collateralAmount], nil) | |
297 | 297 | if ((amount == amount)) | |
298 | 298 | then { | |
299 | 299 | let assetId = getStringValue(addressFromStringValue(collateralPool), "assetId") | |
300 | 300 | match amount { | |
301 | 301 | case t: Int => | |
302 | 302 | if ((assetId == "WAVES")) | |
303 | 303 | then [ScriptTransfer(i.caller, t, unit)] | |
304 | 304 | else [ScriptTransfer(i.caller, t, fromBase58String(assetId))] | |
305 | 305 | case t: String => | |
306 | 306 | nil | |
307 | 307 | case _ => | |
308 | 308 | throw("Incorrect invoke result!") | |
309 | 309 | } | |
310 | 310 | } | |
311 | 311 | else throw("Strict value is not equal to itself.") | |
312 | 312 | } | |
313 | 313 | else throw("Strict value is not equal to itself.") | |
314 | 314 | } | |
315 | 315 | else throw("Liquidation amount exceeds closefactor!") | |
316 | 316 | } | |
317 | 317 | else throw("Strict value is not equal to itself.") | |
318 | 318 | } | |
319 | 319 | else throw("Strict value is not equal to itself.") | |
320 | 320 | } | |
321 | 321 | else throw("User does not have the required assets!") | |
322 | 322 | } | |
323 | 323 | else throw("Only unhealthy accounts can be liquidated!") | |
324 | 324 | } | |
325 | 325 | ||
326 | 326 | ||
327 | 327 | ||
328 | 328 | @Callable(i) | |
329 | 329 | func borrowFrom (poolAddress,assetId,amount) = if (checkPool(poolAddress)) | |
330 | 330 | then { | |
331 | 331 | let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId") | |
332 | 332 | if ((poolAsset == assetId)) | |
333 | 333 | then if (checkPoolLiquidity(poolAddress, amount)) | |
334 | 334 | then { | |
335 | 335 | let user = toBase58String(i.caller.bytes) | |
336 | 336 | if ((checkUserHealth(user, amount, assetId, 0, "") == true)) | |
337 | 337 | then { | |
338 | 338 | let tokenAmount = invoke(addressFromStringValue(poolAddress), "borrow", [user, amount], nil) | |
339 | 339 | if ((tokenAmount == tokenAmount)) | |
340 | 340 | then match tokenAmount { | |
341 | 341 | case t: Int => | |
342 | 342 | if ((poolAsset == "WAVES")) | |
343 | 343 | then [ScriptTransfer(i.caller, t, unit)] | |
344 | 344 | else [ScriptTransfer(i.caller, t, fromBase58String(poolAsset))] | |
345 | 345 | case t: String => | |
346 | 346 | nil | |
347 | 347 | case _ => | |
348 | 348 | throw("Incorrect invoke result!") | |
349 | 349 | } | |
350 | 350 | else throw("Strict value is not equal to itself.") | |
351 | 351 | } | |
352 | 352 | else throw("Borrow exceeds user health!") | |
353 | 353 | } | |
354 | 354 | else throw("Pool liquidity is not sufficient!") | |
355 | 355 | else throw("AssetIds does not match") | |
356 | 356 | } | |
357 | 357 | else throw("Pool address not found!") | |
358 | 358 | ||
359 | 359 | ||
360 | 360 | ||
361 | 361 | @Callable(i) | |
362 | 362 | func lockAsCollateralAt (poolAddress) = if (checkPool(poolAddress)) | |
363 | 363 | then { | |
364 | 364 | let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId") | |
365 | 365 | if ((fromBase58String(dTokenId) == i.payments[0].assetId)) | |
366 | 366 | then if ((size(i.payments) > 0)) | |
367 | 367 | then { | |
368 | 368 | let user = toBase58String(i.caller.bytes) | |
369 | 369 | let msg = invoke(addressFromStringValue(poolAddress), "lockAsCollateral", [user], i.payments) | |
370 | 370 | if ((msg == msg)) | |
371 | 371 | then match msg { | |
372 | 372 | case t: String => | |
373 | 373 | nil | |
374 | 374 | case _ => | |
375 | 375 | throw("Incorrect invoke result!") | |
376 | 376 | } | |
377 | 377 | else throw("Strict value is not equal to itself.") | |
378 | 378 | } | |
379 | 379 | else throw("No payment attached!") | |
380 | 380 | else throw("AssetIds does not match") | |
381 | 381 | } | |
382 | 382 | else throw("Pool address not found!") | |
383 | 383 | ||
384 | 384 | ||
385 | 385 | ||
386 | 386 | @Callable(i) | |
387 | 387 | func redeemCollateralFrom (poolAddress,dtokeId,amount) = if (checkPool(poolAddress)) | |
388 | 388 | then { | |
389 | 389 | let poolDTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId") | |
390 | 390 | if ((poolDTokenId == dtokeId)) | |
391 | 391 | then { | |
392 | 392 | let user = toBase58String(i.caller.bytes) | |
393 | 393 | if ((checkUserHealth(user, 0, "", amount, dtokeId) == true)) | |
394 | 394 | then { | |
395 | 395 | let tokenAmount = invoke(addressFromStringValue(poolAddress), "redeemCollateral", [user, amount], nil) | |
396 | 396 | if ((tokenAmount == tokenAmount)) | |
397 | 397 | then { | |
398 | 398 | let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId") | |
399 | 399 | match tokenAmount { | |
400 | 400 | case t: Int => | |
401 | 401 | [ScriptTransfer(i.caller, t, fromBase58String(tokenId))] | |
402 | 402 | case t: String => | |
403 | 403 | nil | |
404 | 404 | case _ => | |
405 | 405 | throw("Incorrect invoke result!") | |
406 | 406 | } | |
407 | 407 | } | |
408 | 408 | else throw("Strict value is not equal to itself.") | |
409 | 409 | } | |
410 | 410 | else throw("Borrow exceeds user health!") | |
411 | 411 | } | |
412 | 412 | else throw("AssetIds does not match") | |
413 | 413 | } | |
414 | 414 | else throw("Pool address not found!") | |
415 | 415 | ||
416 | 416 | ||
417 | 417 | ||
418 | 418 | @Callable(i) | |
419 | 419 | func deleteData (name) = [DeleteEntry(name)] | |
420 | 420 | ||
421 | 421 |
github/deemru/w8io/169f3d6 46.19 ms ◑