tx · 5TmJ2Pvb3wS4uU1iG5s531vznwJMfu8CYGRbpKKxP34E 3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo: -0.04000000 Waves 2021.09.05 01:45 [1688918] smart account 3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo > SELF 0.00000000 Waves
{ "type": 13, "id": "5TmJ2Pvb3wS4uU1iG5s531vznwJMfu8CYGRbpKKxP34E", "fee": 4000000, "feeAssetId": null, "timestamp": 1630795547349, "version": 2, "chainId": 84, "sender": "3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo", "senderPublicKey": "CD4N2SBeZVBUwmtsqwfmQ3ZKnBP3AxpZCvJ5QkHytUed", "proofs": [ "3tAqGm4SKbxjsNENTH42mGG3w5QDA9BBDvNVzRJLSBCo4RAw1Y1VQGXZhedXChgekftzM2CKRGFd5R13hnV7hxwr" ], "script": "base64:AAIFAAAAAAAAACkIAhIFCgMICAESBAoCCBgSAwoBCBIDCgEIEgQKAggEEgMKAQgSAwoBCAAAAAwAAAAABmNvbmZpZwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAAGY29uZmlnAgAAAAAAAAAABWFkbWluCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAZjb25maWcCAAAABWFkbWluAgAAAAAAAAAABXBvb2xzCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAAVwb29scwIAAAAAAQAAAAdpc0FkbWluAAAAAQAAAA1jYWxsZXJBZGRyZXNzAwkAAAAAAAACBQAAAA1jYWxsZXJBZGRyZXNzCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAVhZG1pbgYHAQAAAAljaGVja1Bvb2wAAAABAAAAB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AQAAAAEdXNlcgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAANtc2cJAAP8AAAABAkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAALcG9vbEFkZHJlc3MCAAAAEGxvY2tBc0NvbGxhdGVyYWwJAARMAAAAAgUAAAAEdXNlcgUAAAADbmlsCAUAAAABaQAAAAhwYXltZW50cwMJAAAAAAAAAgUAAAADbXNnBQAAAANtc2cEAAAAByRtYXRjaDAFAAAAA21zZwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAF0BQAAAAckbWF0Y2gwBQAAAANuaWwJAAACAAAAAQIAAAAYSW5jb3JyZWN0IGludm9rZSByZXN1bHQhCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAABRObyBwYXltZW50IGF0dGFjaGVkIQkAAAIAAAABAgAAABdBc3NldElkcyBkb2VzIG5vdCBtYXRjaAkAAAIAAAABAgAAABdQb29sIGFkZHJlc3Mgbm90IGZvdW5kIQAAAAC2MEeN", "height": 1688918, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DCKGNAwRjGUSt2oyuhKPQrkAcemx85YkmidsrKxPvwPs Next: 7hfGBaXRL47icNMrYuQPK7pFHxRHHQKCHfviXGajDL9U Diff:
Old | New | Differences | |
---|---|---|---|
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getHealthParameter (user,poolAddress,newDebtAmount,newDebtId,collateralAmount,collateralId) = { | |
37 | - | let result = invoke(addressFromStringValue( | |
37 | + | let result = invoke(addressFromStringValue("3NBG2Nuz2cjtG8wWcKLBGZ1bBpveU56gp77"), "getUserHealthParameter", [user, collateralAmount, collateralId, newDebtAmount, newDebtId], nil) | |
38 | 38 | match result { | |
39 | 39 | case t: (Int, Int) => | |
40 | 40 | t | |
60 | 60 | } | |
61 | 61 | } | |
62 | 62 | ||
63 | - | let $ | |
64 | - | let $ | |
65 | - | let $ | |
66 | - | if (($ | |
67 | - | then $ | |
63 | + | let $list24662500 = poolList | |
64 | + | let $size24662500 = size($list24662500) | |
65 | + | let $acc024662500 = $Tuple2(0, 0) | |
66 | + | if (($size24662500 == 0)) | |
67 | + | then $acc024662500 | |
68 | 68 | else { | |
69 | - | let $ | |
70 | - | if (($ | |
71 | - | then $ | |
69 | + | let $acc124662500 = foldPools($acc024662500, $list24662500[0]) | |
70 | + | if (($size24662500 == 1)) | |
71 | + | then $acc124662500 | |
72 | 72 | else { | |
73 | - | let $ | |
74 | - | if (($ | |
75 | - | then $ | |
73 | + | let $acc224662500 = foldPools($acc124662500, $list24662500[1]) | |
74 | + | if (($size24662500 == 2)) | |
75 | + | then $acc224662500 | |
76 | 76 | else { | |
77 | - | let $ | |
77 | + | let $acc324662500 = foldPools($acc224662500, $list24662500[2]) | |
78 | 78 | throw("List size exceed 2") | |
79 | 79 | } | |
80 | 80 | } | |
89 | 89 | then true | |
90 | 90 | else false | |
91 | 91 | } | |
92 | + | ||
93 | + | ||
94 | + | @Callable(i) | |
95 | + | func borrowFrom (poolAddress,assetId,amount) = if (checkPool(poolAddress)) | |
96 | + | then { | |
97 | + | let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId") | |
98 | + | if ((poolAsset == assetId)) | |
99 | + | then if (checkPoolLiquidity(poolAddress, amount)) | |
100 | + | then { | |
101 | + | let user = toBase58String(i.caller.bytes) | |
102 | + | if (checkUserHealth(user, amount, assetId, 0, "")) | |
103 | + | then nil | |
104 | + | else throw("Borrow exceeds user health!") | |
105 | + | } | |
106 | + | else throw("Pool liquidity is not sufficient!") | |
107 | + | else throw("AssetIds does not match") | |
108 | + | } | |
109 | + | else throw("Pool address not found!") | |
110 | + | ||
92 | 111 | ||
93 | 112 | ||
94 | 113 | @Callable(i) | |
203 | 222 | else throw("Pool address not found!") | |
204 | 223 | ||
205 | 224 | ||
206 | - | ||
207 | - | @Callable(i) | |
208 | - | func borrowFrom (poolAddress,assetId,amount) = if (checkPool(poolAddress)) | |
209 | - | then { | |
210 | - | let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId") | |
211 | - | if ((poolAsset == assetId)) | |
212 | - | then if (checkPoolLiquidity(poolAddress, amount)) | |
213 | - | then { | |
214 | - | let user = toBase58String(i.caller.bytes) | |
215 | - | if (checkUserHealth(user, amount, assetId, 0, "")) | |
216 | - | then nil | |
217 | - | else throw("Borrow exceeds user health!") | |
218 | - | } | |
219 | - | else throw("Pool liquidity is not sufficient!") | |
220 | - | else throw("AssetIds does not match") | |
221 | - | } | |
222 | - | else throw("Pool address not found!") | |
223 | - | ||
224 | - |
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 | - | let result = invoke(addressFromStringValue( | |
37 | + | let result = invoke(addressFromStringValue("3NBG2Nuz2cjtG8wWcKLBGZ1bBpveU56gp77"), "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("Wrong Datatyp!") | |
43 | 43 | } | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func calcHealthFactor (borrowCapacity,borrowCapacityUsed) = fraction((borrowCapacity - borrowCapacityUsed), 1000, borrowCapacity) | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func calcBorrowCBorrowCU (user,newDebtAmount,newDebtId,collateralAmount,collateralId) = { | |
51 | 51 | let poolList = split(pools, ";") | |
52 | 52 | let listSize = size(poolList) | |
53 | 53 | func foldPools (accum,next) = { | |
54 | 54 | let healthParams = getHealthParameter(user, next, newDebtAmount, newDebtId, collateralAmount, collateralId) | |
55 | 55 | match healthParams { | |
56 | 56 | case t: (Int, Int) => | |
57 | 57 | $Tuple2((accum._1 + healthParams._1), (accum._2 + healthParams._1)) | |
58 | 58 | case e => | |
59 | 59 | throw("Test") | |
60 | 60 | } | |
61 | 61 | } | |
62 | 62 | ||
63 | - | let $ | |
64 | - | let $ | |
65 | - | let $ | |
66 | - | if (($ | |
67 | - | then $ | |
63 | + | let $list24662500 = poolList | |
64 | + | let $size24662500 = size($list24662500) | |
65 | + | let $acc024662500 = $Tuple2(0, 0) | |
66 | + | if (($size24662500 == 0)) | |
67 | + | then $acc024662500 | |
68 | 68 | else { | |
69 | - | let $ | |
70 | - | if (($ | |
71 | - | then $ | |
69 | + | let $acc124662500 = foldPools($acc024662500, $list24662500[0]) | |
70 | + | if (($size24662500 == 1)) | |
71 | + | then $acc124662500 | |
72 | 72 | else { | |
73 | - | let $ | |
74 | - | if (($ | |
75 | - | then $ | |
73 | + | let $acc224662500 = foldPools($acc124662500, $list24662500[1]) | |
74 | + | if (($size24662500 == 2)) | |
75 | + | then $acc224662500 | |
76 | 76 | else { | |
77 | - | let $ | |
77 | + | let $acc324662500 = foldPools($acc224662500, $list24662500[2]) | |
78 | 78 | throw("List size exceed 2") | |
79 | 79 | } | |
80 | 80 | } | |
81 | 81 | } | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func checkUserHealth (user,newDebtAmount,newDebtId,collateralAmount,collateralId) = { | |
86 | 86 | let bcBcu = calcBorrowCBorrowCU(user, newDebtAmount, newDebtId, collateralAmount, collateralId) | |
87 | 87 | let userHealth = calcHealthFactor(bcBcu._1, bcBcu._2) | |
88 | 88 | if ((userHealth >= 0)) | |
89 | 89 | then true | |
90 | 90 | else false | |
91 | 91 | } | |
92 | + | ||
93 | + | ||
94 | + | @Callable(i) | |
95 | + | func borrowFrom (poolAddress,assetId,amount) = if (checkPool(poolAddress)) | |
96 | + | then { | |
97 | + | let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId") | |
98 | + | if ((poolAsset == assetId)) | |
99 | + | then if (checkPoolLiquidity(poolAddress, amount)) | |
100 | + | then { | |
101 | + | let user = toBase58String(i.caller.bytes) | |
102 | + | if (checkUserHealth(user, amount, assetId, 0, "")) | |
103 | + | then nil | |
104 | + | else throw("Borrow exceeds user health!") | |
105 | + | } | |
106 | + | else throw("Pool liquidity is not sufficient!") | |
107 | + | else throw("AssetIds does not match") | |
108 | + | } | |
109 | + | else throw("Pool address not found!") | |
110 | + | ||
92 | 111 | ||
93 | 112 | ||
94 | 113 | @Callable(i) | |
95 | 114 | func setup (configAddress,pools) = if (if (!(isDefined(getString(this, "config")))) | |
96 | 115 | then !(isDefined(getString(this, "pools"))) | |
97 | 116 | else false) | |
98 | 117 | then [writeString("config", configAddress), writeString("pools", makeString(pools, ";"))] | |
99 | 118 | else throw("Admin and config address already definied!") | |
100 | 119 | ||
101 | 120 | ||
102 | 121 | ||
103 | 122 | @Callable(i) | |
104 | 123 | func addPool (poolAddress) = if (isAdmin(i.caller)) | |
105 | 124 | then { | |
106 | 125 | let poolList = split(pools, ";") | |
107 | 126 | if ((containsElement(poolList, poolAddress) == false)) | |
108 | 127 | then { | |
109 | 128 | let newPools = (poolList :+ poolAddress) | |
110 | 129 | [writeString("pools", makeString(newPools, ";"))] | |
111 | 130 | } | |
112 | 131 | else throw("Pool already exists!") | |
113 | 132 | } | |
114 | 133 | else throw("Address does not match with admin address!") | |
115 | 134 | ||
116 | 135 | ||
117 | 136 | ||
118 | 137 | @Callable(i) | |
119 | 138 | func updateConfig (configAddress) = if (isAdmin(i.caller)) | |
120 | 139 | then [writeString("config", configAddress)] | |
121 | 140 | else throw("Address does not match with admin address!") | |
122 | 141 | ||
123 | 142 | ||
124 | 143 | ||
125 | 144 | @Callable(i) | |
126 | 145 | func depositAt (poolAddress,isCollateral) = if (checkPool(poolAddress)) | |
127 | 146 | then if ((size(i.payments) > 0)) | |
128 | 147 | then { | |
129 | 148 | let user = toBase58String(i.caller.bytes) | |
130 | 149 | let tokenAmount = invoke(addressFromStringValue(poolAddress), "deposit", [user, isCollateral], i.payments) | |
131 | 150 | if ((tokenAmount == tokenAmount)) | |
132 | 151 | then { | |
133 | 152 | let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId") | |
134 | 153 | match tokenAmount { | |
135 | 154 | case t: Int => | |
136 | 155 | [ScriptTransfer(i.caller, t, fromBase58String(tokenId))] | |
137 | 156 | case t: String => | |
138 | 157 | nil | |
139 | 158 | case _ => | |
140 | 159 | throw("Incorrect invoke result!") | |
141 | 160 | } | |
142 | 161 | } | |
143 | 162 | else throw("Strict value is not equal to itself.") | |
144 | 163 | } | |
145 | 164 | else throw("No payment attached!") | |
146 | 165 | else throw("Pool address not found!") | |
147 | 166 | ||
148 | 167 | ||
149 | 168 | ||
150 | 169 | @Callable(i) | |
151 | 170 | func withdrawFrom (poolAddress) = if (checkPool(poolAddress)) | |
152 | 171 | then { | |
153 | 172 | let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId") | |
154 | 173 | if ((fromBase58String(dTokenId) == i.payments[0].assetId)) | |
155 | 174 | then if ((size(i.payments) > 0)) | |
156 | 175 | then { | |
157 | 176 | let user = toBase58String(i.caller.bytes) | |
158 | 177 | let tokenAmount = invoke(addressFromStringValue(poolAddress), "withdraw", [user], i.payments) | |
159 | 178 | if ((tokenAmount == tokenAmount)) | |
160 | 179 | then { | |
161 | 180 | let tokenId = getStringValue(addressFromStringValue(poolAddress), "assetId") | |
162 | 181 | match tokenAmount { | |
163 | 182 | case t: Int => | |
164 | 183 | if ((tokenId == "WAVES")) | |
165 | 184 | then [ScriptTransfer(i.caller, t, unit)] | |
166 | 185 | else [ScriptTransfer(i.caller, t, fromBase58String(tokenId))] | |
167 | 186 | case t: String => | |
168 | 187 | nil | |
169 | 188 | case _ => | |
170 | 189 | throw("Incorrect invoke result!") | |
171 | 190 | } | |
172 | 191 | } | |
173 | 192 | else throw("Strict value is not equal to itself.") | |
174 | 193 | } | |
175 | 194 | else throw("No payment attached!") | |
176 | 195 | else throw("AssetIds does not match") | |
177 | 196 | } | |
178 | 197 | else throw("Pool address not found!") | |
179 | 198 | ||
180 | 199 | ||
181 | 200 | ||
182 | 201 | @Callable(i) | |
183 | 202 | func lockAsCollateralAt (poolAddress) = if (checkPool(poolAddress)) | |
184 | 203 | then { | |
185 | 204 | let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId") | |
186 | 205 | if ((fromBase58String(dTokenId) == i.payments[0].assetId)) | |
187 | 206 | then if ((size(i.payments) > 0)) | |
188 | 207 | then { | |
189 | 208 | let user = toBase58String(i.caller.bytes) | |
190 | 209 | let msg = invoke(addressFromStringValue(poolAddress), "lockAsCollateral", [user], i.payments) | |
191 | 210 | if ((msg == msg)) | |
192 | 211 | then match msg { | |
193 | 212 | case t: String => | |
194 | 213 | nil | |
195 | 214 | case _ => | |
196 | 215 | throw("Incorrect invoke result!") | |
197 | 216 | } | |
198 | 217 | else throw("Strict value is not equal to itself.") | |
199 | 218 | } | |
200 | 219 | else throw("No payment attached!") | |
201 | 220 | else throw("AssetIds does not match") | |
202 | 221 | } | |
203 | 222 | else throw("Pool address not found!") | |
204 | 223 | ||
205 | 224 | ||
206 | - | ||
207 | - | @Callable(i) | |
208 | - | func borrowFrom (poolAddress,assetId,amount) = if (checkPool(poolAddress)) | |
209 | - | then { | |
210 | - | let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId") | |
211 | - | if ((poolAsset == assetId)) | |
212 | - | then if (checkPoolLiquidity(poolAddress, amount)) | |
213 | - | then { | |
214 | - | let user = toBase58String(i.caller.bytes) | |
215 | - | if (checkUserHealth(user, amount, assetId, 0, "")) | |
216 | - | then nil | |
217 | - | else throw("Borrow exceeds user health!") | |
218 | - | } | |
219 | - | else throw("Pool liquidity is not sufficient!") | |
220 | - | else throw("AssetIds does not match") | |
221 | - | } | |
222 | - | else throw("Pool address not found!") | |
223 | - | ||
224 | - |
github/deemru/w8io/026f985 35.47 ms ◑