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