tx · DCKGNAwRjGUSt2oyuhKPQrkAcemx85YkmidsrKxPvwPs

3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo:  -0.04000000 Waves

2021.09.05 01:32 [1688902] smart account 3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo > SELF 0.00000000 Waves

{ "type": 13, "id": "DCKGNAwRjGUSt2oyuhKPQrkAcemx85YkmidsrKxPvwPs", "fee": 4000000, "feeAssetId": null, "timestamp": 1630794761531, "version": 2, "chainId": 84, "sender": "3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo", "senderPublicKey": "CD4N2SBeZVBUwmtsqwfmQ3ZKnBP3AxpZCvJ5QkHytUed", "proofs": [ "4DM56RMd2nkpk5giNx11ozqRsSyctWBP494zD6kZXfqw9tsC3A4FT6zeKAaxKAHZRZAjCG8mUGhn9V1XkvLpsL7d" ], "script": "base64:AAIFAAAAAAAAACkIAhIECgIIGBIDCgEIEgMKAQgSBAoCCAQSAwoBCBIDCgEIEgUKAwgIAQAAAAwAAAAABmNvbmZpZwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAAGY29uZmlnAgAAAAAAAAAABWFkbWluCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAZjb25maWcCAAAABWFkbWluAgAAAAAAAAAABXBvb2xzCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAAVwb29scwIAAAAAAQAAAAdpc0FkbWluAAAAAQAAAA1jYWxsZXJBZGRyZXNzAwkAAAAAAAACBQAAAA1jYWxsZXJBZGRyZXNzCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAVhZG1pbgYHAQAAAAljaGVja1Bvb2wAAAABAAAAB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ZSgxMDYyKQAAAAEFAAAAC3Bvb2xBZGRyZXNzAgAAAAdhc3NldElkAwkAAAAAAAACBQAAAAlwb29sQXNzZXQFAAAAB2Fzc2V0SWQDCQEAAAASY2hlY2tQb29sTGlxdWlkaXR5AAAAAgUAAAALcG9vbEFkZHJlc3MFAAAABmFtb3VudAQAAAAEdXNlcgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAwkBAAAAD2NoZWNrVXNlckhlYWx0aAAAAAUFAAAABHVzZXIFAAAABmFtb3VudAUAAAAHYXNzZXRJZAAAAAAAAAAAAAIAAAAABQAAAANuaWwJAAACAAAAAQIAAAAbQm9ycm93IGV4Y2VlZHMgdXNlciBoZWFsdGghCQAAAgAAAAECAAAAIVBvb2wgbGlxdWlkaXR5IGlzIG5vdCBzdWZmaWNpZW50IQkAAAIAAAABAgAAABdBc3NldElkcyBkb2VzIG5vdCBtYXRjaAkAAAIAAAABAgAAABdQb29sIGFkZHJlc3Mgbm90IGZvdW5kIQAAAADA5YYI", "height": 1688902, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HTJ3HgBmFsnQYV2RYceizJivKZewYYtousKdAFE9DABR Next: 5TmJ2Pvb3wS4uU1iG5s531vznwJMfu8CYGRbpKKxP34E Diff:
OldNewDifferences
3434
3535
3636 func getHealthParameter (user,poolAddress,newDebtAmount,newDebtId,collateralAmount,collateralId) = {
37- let result = $Tuple2(1, 1)
37+ let result = invoke(addressFromStringValue(poolAddress), "getUserHealthParameter", [user, collateralAmount, collateralId, newDebtAmount, newDebtId], nil)
3838 match result {
3939 case t: (Int, Int) =>
4040 t
6060 }
6161 }
6262
63- let $list23102344 = poolList
64- let $size23102344 = size($list23102344)
65- let $acc023102344 = $Tuple2(0, 0)
66- if (($size23102344 == 0))
67- then $acc023102344
63+ let $list22902324 = poolList
64+ let $size22902324 = size($list22902324)
65+ let $acc022902324 = $Tuple2(0, 0)
66+ if (($size22902324 == 0))
67+ then $acc022902324
6868 else {
69- let $acc123102344 = foldPools($acc023102344, $list23102344[0])
70- if (($size23102344 == 1))
71- then $acc123102344
69+ let $acc122902324 = foldPools($acc022902324, $list22902324[0])
70+ if (($size22902324 == 1))
71+ then $acc122902324
7272 else {
73- let $acc223102344 = foldPools($acc123102344, $list23102344[1])
74- if (($size23102344 == 2))
75- then $acc223102344
73+ let $acc222902324 = foldPools($acc122902324, $list22902324[1])
74+ if (($size22902324 == 2))
75+ then $acc222902324
7676 else {
77- let $acc323102344 = foldPools($acc223102344, $list23102344[2])
77+ let $acc322902324 = foldPools($acc222902324, $list22902324[2])
7878 throw("List size exceed 2")
7979 }
8080 }
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) = {
37- let result = $Tuple2(1, 1)
37+ 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("Wrong Datatyp!")
4343 }
4444 }
4545
4646
4747 func calcHealthFactor (borrowCapacity,borrowCapacityUsed) = fraction((borrowCapacity - borrowCapacityUsed), 1000, borrowCapacity)
4848
4949
5050 func calcBorrowCBorrowCU (user,newDebtAmount,newDebtId,collateralAmount,collateralId) = {
5151 let poolList = split(pools, ";")
5252 let listSize = size(poolList)
5353 func foldPools (accum,next) = {
5454 let healthParams = getHealthParameter(user, next, newDebtAmount, newDebtId, collateralAmount, collateralId)
5555 match healthParams {
5656 case t: (Int, Int) =>
5757 $Tuple2((accum._1 + healthParams._1), (accum._2 + healthParams._1))
5858 case e =>
5959 throw("Test")
6060 }
6161 }
6262
63- let $list23102344 = poolList
64- let $size23102344 = size($list23102344)
65- let $acc023102344 = $Tuple2(0, 0)
66- if (($size23102344 == 0))
67- then $acc023102344
63+ let $list22902324 = poolList
64+ let $size22902324 = size($list22902324)
65+ let $acc022902324 = $Tuple2(0, 0)
66+ if (($size22902324 == 0))
67+ then $acc022902324
6868 else {
69- let $acc123102344 = foldPools($acc023102344, $list23102344[0])
70- if (($size23102344 == 1))
71- then $acc123102344
69+ let $acc122902324 = foldPools($acc022902324, $list22902324[0])
70+ if (($size22902324 == 1))
71+ then $acc122902324
7272 else {
73- let $acc223102344 = foldPools($acc123102344, $list23102344[1])
74- if (($size23102344 == 2))
75- then $acc223102344
73+ let $acc222902324 = foldPools($acc122902324, $list22902324[1])
74+ if (($size22902324 == 2))
75+ then $acc222902324
7676 else {
77- let $acc323102344 = foldPools($acc223102344, $list23102344[2])
77+ let $acc322902324 = foldPools($acc222902324, $list22902324[2])
7878 throw("List size exceed 2")
7979 }
8080 }
8181 }
8282 }
8383
8484
8585 func checkUserHealth (user,newDebtAmount,newDebtId,collateralAmount,collateralId) = {
8686 let bcBcu = calcBorrowCBorrowCU(user, newDebtAmount, newDebtId, collateralAmount, collateralId)
8787 let userHealth = calcHealthFactor(bcBcu._1, bcBcu._2)
8888 if ((userHealth >= 0))
8989 then true
9090 else false
9191 }
9292
9393
9494 @Callable(i)
9595 func setup (configAddress,pools) = if (if (!(isDefined(getString(this, "config"))))
9696 then !(isDefined(getString(this, "pools")))
9797 else false)
9898 then [writeString("config", configAddress), writeString("pools", makeString(pools, ";"))]
9999 else throw("Admin and config address already definied!")
100100
101101
102102
103103 @Callable(i)
104104 func addPool (poolAddress) = if (isAdmin(i.caller))
105105 then {
106106 let poolList = split(pools, ";")
107107 if ((containsElement(poolList, poolAddress) == false))
108108 then {
109109 let newPools = (poolList :+ poolAddress)
110110 [writeString("pools", makeString(newPools, ";"))]
111111 }
112112 else throw("Pool already exists!")
113113 }
114114 else throw("Address does not match with admin address!")
115115
116116
117117
118118 @Callable(i)
119119 func updateConfig (configAddress) = if (isAdmin(i.caller))
120120 then [writeString("config", configAddress)]
121121 else throw("Address does not match with admin address!")
122122
123123
124124
125125 @Callable(i)
126126 func depositAt (poolAddress,isCollateral) = if (checkPool(poolAddress))
127127 then if ((size(i.payments) > 0))
128128 then {
129129 let user = toBase58String(i.caller.bytes)
130130 let tokenAmount = invoke(addressFromStringValue(poolAddress), "deposit", [user, isCollateral], i.payments)
131131 if ((tokenAmount == tokenAmount))
132132 then {
133133 let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
134134 match tokenAmount {
135135 case t: Int =>
136136 [ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
137137 case t: String =>
138138 nil
139139 case _ =>
140140 throw("Incorrect invoke result!")
141141 }
142142 }
143143 else throw("Strict value is not equal to itself.")
144144 }
145145 else throw("No payment attached!")
146146 else throw("Pool address not found!")
147147
148148
149149
150150 @Callable(i)
151151 func withdrawFrom (poolAddress) = if (checkPool(poolAddress))
152152 then {
153153 let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
154154 if ((fromBase58String(dTokenId) == i.payments[0].assetId))
155155 then if ((size(i.payments) > 0))
156156 then {
157157 let user = toBase58String(i.caller.bytes)
158158 let tokenAmount = invoke(addressFromStringValue(poolAddress), "withdraw", [user], i.payments)
159159 if ((tokenAmount == tokenAmount))
160160 then {
161161 let tokenId = getStringValue(addressFromStringValue(poolAddress), "assetId")
162162 match tokenAmount {
163163 case t: Int =>
164164 if ((tokenId == "WAVES"))
165165 then [ScriptTransfer(i.caller, t, unit)]
166166 else [ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
167167 case t: String =>
168168 nil
169169 case _ =>
170170 throw("Incorrect invoke result!")
171171 }
172172 }
173173 else throw("Strict value is not equal to itself.")
174174 }
175175 else throw("No payment attached!")
176176 else throw("AssetIds does not match")
177177 }
178178 else throw("Pool address not found!")
179179
180180
181181
182182 @Callable(i)
183183 func lockAsCollateralAt (poolAddress) = if (checkPool(poolAddress))
184184 then {
185185 let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
186186 if ((fromBase58String(dTokenId) == i.payments[0].assetId))
187187 then if ((size(i.payments) > 0))
188188 then {
189189 let user = toBase58String(i.caller.bytes)
190190 let msg = invoke(addressFromStringValue(poolAddress), "lockAsCollateral", [user], i.payments)
191191 if ((msg == msg))
192192 then match msg {
193193 case t: String =>
194194 nil
195195 case _ =>
196196 throw("Incorrect invoke result!")
197197 }
198198 else throw("Strict value is not equal to itself.")
199199 }
200200 else throw("No payment attached!")
201201 else throw("AssetIds does not match")
202202 }
203203 else throw("Pool address not found!")
204204
205205
206206
207207 @Callable(i)
208208 func borrowFrom (poolAddress,assetId,amount) = if (checkPool(poolAddress))
209209 then {
210210 let poolAsset = getStringValue(addressFromStringValue(poolAddress), "assetId")
211211 if ((poolAsset == assetId))
212212 then if (checkPoolLiquidity(poolAddress, amount))
213213 then {
214214 let user = toBase58String(i.caller.bytes)
215215 if (checkUserHealth(user, amount, assetId, 0, ""))
216216 then nil
217217 else throw("Borrow exceeds user health!")
218218 }
219219 else throw("Pool liquidity is not sufficient!")
220220 else throw("AssetIds does not match")
221221 }
222222 else throw("Pool address not found!")
223223
224224

github/deemru/w8io/026f985 
41.94 ms