tx · AX4B67bdQ3UM5vVnMypaDqZ1jJfUCXn4FUVnT655wxiu 3MyfKzBNordUSxbv54zj1hxm98ojcDvaiXU: -0.04000000 Waves 2021.09.05 03:27 [1689019] smart account 3MyfKzBNordUSxbv54zj1hxm98ojcDvaiXU > SELF 0.00000000 Waves
{ "type": 13, "id": "AX4B67bdQ3UM5vVnMypaDqZ1jJfUCXn4FUVnT655wxiu", "fee": 4000000, "feeAssetId": null, "timestamp": 1630801777322, "version": 2, "chainId": 84, "sender": "3MyfKzBNordUSxbv54zj1hxm98ojcDvaiXU", "senderPublicKey": "EhGswdVQkp8SXCWyKvRCUKYDidTrRjnzTPa8CZk6GYgN", "proofs": [ "4r6QgruA5CA5Tc7ihYxxb1cUuq4DUw6S7JZzAesSrc4GDiFPRxT9dxSuydiUY91yuQyn443JtcX8hKrebfDR4WVh" ], "script": "base64:AAIFAAAAAAAAADAIAhIHCgUIAQgBCBIECgIIBBIDCgEIEgMKAQgSBAoCCAESBwoFCAgBCAgSBAoCCAgAAAAuAAAAAApiYXNlRmFjdG9yAAAAAAAAAAPoAAAAAAliYXNlSW5kZXgAACOG8m/BAAAAAAAADWJsb2Nrc1BlclllYXIAAAAAAAAIBSAAAAAABmNvbmZpZwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAAA1jb25maWdBZGRyZXNzAgAAAAAAAAAABWFkbWluCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAEFAAAABmNvbmZpZwIAAAAFYWRtaW4CAAAAAAAAAAALd2F2ZXRyb2xsZXIJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAAGY29uZmlnAgAAAAt3YXZldHJvbGxlcgIAAAAAAAAAAAZvcmFjbGUJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgkBA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AAAADEludGVnZXJFbnRyeQAAAAICAAAADGRUb2tlblN1cHBseQAAAAAAAAAAAAUAAAADbmlsCQAAAgAAAAECAAAAE1Bvb2wgYWxyZWFkeSBzZXR1cCEAAAABaQEAAAAKd3JpdGVFbnRyeQAAAAIAAAAEbmFtZQAAAARkYXRhCQAETAAAAAIJAQAAAAt3cml0ZVN0cmluZwAAAAIFAAAABG5hbWUFAAAABGRhdGEFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V55b00Fg==", "height": 1689019, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2UPoT28HMXNHKpfW3GuTG1C2f3YbHshuqtVsLSxWHvpb Next: 6jgdaRXX7TWN8jT3rcqEEfecQRz1TEp2vdCLPfZMNoP8 Diff:
Old | New | Differences | |
---|---|---|---|
155 | 155 | let bCSummand = fraction(collateralValue, t, mantissa) | |
156 | 156 | let borrowInUSD = fraction(currentUserBorrow, t, mantissa) | |
157 | 157 | let bCUSummand = fraction(borrowInUSD, baseFactor, liquidationThreshold) | |
158 | - | $Tuple2(nil, $Tuple2(2, | |
158 | + | $Tuple2(nil, $Tuple2(2, bCUSummand)) | |
159 | 159 | case _ => | |
160 | 160 | throw("Incorrect pricing") | |
161 | 161 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let baseFactor = 1000 | |
5 | 5 | ||
6 | 6 | let baseIndex = 10000000000000000 | |
7 | 7 | ||
8 | 8 | let blocksPerYear = 525600 | |
9 | 9 | ||
10 | 10 | let config = valueOrElse(getString(this, "configAddress"), "") | |
11 | 11 | ||
12 | 12 | let admin = valueOrElse(getString(addressFromStringValue(config), "admin"), "") | |
13 | 13 | ||
14 | 14 | let wavetroller = valueOrElse(getString(addressFromStringValue(config), "wavetroller"), "") | |
15 | 15 | ||
16 | 16 | let oracle = valueOrElse(getString(addressFromStringValue(config), "oracle"), "") | |
17 | 17 | ||
18 | 18 | let assetIdSub = valueOrErrorMessage(getString(this, "assetId"), "No assetId could be found in data storage!") | |
19 | 19 | ||
20 | 20 | let assetDecimals = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_Decimals")), (("No key " + (assetIdSub + "_Decimals")) + " was found")) | |
21 | 21 | ||
22 | 22 | let multiplier = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_Multiplier")), (("No key " + (assetIdSub + "_Multiplier")) + " was found")) | |
23 | 23 | ||
24 | 24 | let kink = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_Kink")), (("No key " + (assetIdSub + "_Kink")) + " was found")) | |
25 | 25 | ||
26 | 26 | let jumpMultiplier = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_JumpMultiplier")), (("No key " + (assetIdSub + "_JumpMultiplier")) + " was found")) | |
27 | 27 | ||
28 | 28 | let baseRate = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_BaseRate")), (("No key " + (assetIdSub + "_BaseRate")) + " was found")) | |
29 | 29 | ||
30 | 30 | let baseExchangeRate = valueOrErrorMessage(getInteger(this, "baseExchangeRate"), "No key baseExchangeRate was found") | |
31 | 31 | ||
32 | 32 | let collateralFactor = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_CollateralFactor")), (("No key " + (assetIdSub + "_CollateralFactor")) + " was found")) | |
33 | 33 | ||
34 | 34 | let liquidationThreshold = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_Threshold")), (("No key " + (assetIdSub + "_Threshold")) + " was found")) | |
35 | 35 | ||
36 | 36 | let reserveFactor = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_ReserveFactor")), (("No key " + (assetIdSub + "_ReserveFactor")) + " was found")) | |
37 | 37 | ||
38 | 38 | let totalBorrow = valueOrElse(getInteger(this, "totalBorrow"), 0) | |
39 | 39 | ||
40 | 40 | let totalSupply = valueOrElse(getInteger(this, "totalSupply"), 0) | |
41 | 41 | ||
42 | 42 | let totalReserve = valueOrElse(getInteger(this, "totalReserve"), 0) | |
43 | 43 | ||
44 | 44 | let dTokenSupply = valueOrErrorMessage(getInteger(this, "dTokenSupply"), "No key dTokenSupply was found") | |
45 | 45 | ||
46 | 46 | let dTokenDecimals = valueOrErrorMessage(getInteger(this, "dTokenDecimals"), "No key dTokenDecimals was found") | |
47 | 47 | ||
48 | 48 | let dTokenId = valueOrErrorMessage(getString(this, "dTokenId"), "No key dTokenId was found") | |
49 | 49 | ||
50 | 50 | let dTokenName = valueOrErrorMessage(getString(this, "dTokenName"), "No key dTokenName was found") | |
51 | 51 | ||
52 | 52 | let storedHeight = valueOrElse(getInteger(this, "storedHeight"), height) | |
53 | 53 | ||
54 | 54 | let storedIndex = valueOrElse(getInteger(this, "storedIndex"), 10000000000000000) | |
55 | 55 | ||
56 | 56 | func isAdminAddress (address) = if ((addressFromStringValue(admin) == address)) | |
57 | 57 | then true | |
58 | 58 | else false | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func isWavetroller (address) = if ((addressFromStringValue(wavetroller) == address)) | |
62 | 62 | then true | |
63 | 63 | else false | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func isAcceptableAssetId (assetId) = if ((assetId == assetIdSub)) | |
67 | 67 | then true | |
68 | 68 | else false | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func writeString (key,stringValue) = StringEntry(key, stringValue) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func writeInteger (key,integerValue) = IntegerEntry(key, integerValue) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func userlockedBalance (userAddress) = valueOrElse(getInteger(this, (userAddress + "_locked")), 0) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | let utilization = if ((totalSupply > 0)) | |
81 | 81 | then fraction(totalBorrow, baseFactor, totalSupply) | |
82 | 82 | else 0 | |
83 | 83 | ||
84 | 84 | let apr = { | |
85 | 85 | let minValue = [utilization, kink] | |
86 | 86 | let minValueItem = min(minValue) | |
87 | 87 | let maxValue = [0, (utilization - kink)] | |
88 | 88 | let maxValueItem = max(maxValue) | |
89 | 89 | ((fraction(multiplier, minValueItem, baseFactor) + fraction(jumpMultiplier, maxValueItem, baseFactor)) + baseRate) | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | let apy = fraction(fraction(apr, utilization, baseFactor), (baseFactor - reserveFactor), baseFactor) | |
93 | 93 | ||
94 | 94 | let borrowRatePerBlock = fraction(apr, baseIndex, (blocksPerYear * baseFactor)) | |
95 | 95 | ||
96 | 96 | let deltaBlocks = (height - storedHeight) | |
97 | 97 | ||
98 | 98 | let currentIndex = fraction(storedIndex, (baseIndex + (borrowRatePerBlock * deltaBlocks)), baseIndex, CEILING) | |
99 | 99 | ||
100 | 100 | let currentTotalBorrow = fraction(totalBorrow, currentIndex, storedIndex) | |
101 | 101 | ||
102 | 102 | let collectedInterest = fraction(totalBorrow, (borrowRatePerBlock * deltaBlocks), baseIndex) | |
103 | 103 | ||
104 | 104 | let currentTotalSupply = (totalSupply + fraction((baseFactor - reserveFactor), collectedInterest, baseFactor)) | |
105 | 105 | ||
106 | 106 | let currentReserve = (totalReserve + fraction(reserveFactor, collectedInterest, baseFactor)) | |
107 | 107 | ||
108 | 108 | let exchangeRate = if ((dTokenSupply > 0)) | |
109 | 109 | then { | |
110 | 110 | let exponent = ((18 - dTokenDecimals) + assetDecimals) | |
111 | 111 | let mantissa = pow(10, 0, exponent, 0, 0, CEILING) | |
112 | 112 | fraction(currentTotalSupply, mantissa, dTokenSupply) | |
113 | 113 | } | |
114 | 114 | else baseExchangeRate | |
115 | 115 | ||
116 | 116 | func calcDTokenAmount (assetAmount) = { | |
117 | 117 | let exponent = ((18 - dTokenDecimals) + assetDecimals) | |
118 | 118 | let mantissa = pow(10, 0, exponent, 0, 0, CEILING) | |
119 | 119 | fraction(assetAmount, mantissa, exchangeRate) | |
120 | 120 | } | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func calcAssetAmount (dTokenAmount) = { | |
124 | 124 | let exponent = ((18 - dTokenDecimals) + assetDecimals) | |
125 | 125 | let mantissa = pow(10, 0, exponent, 0, 0, CEILING) | |
126 | 126 | fraction(dTokenAmount, exchangeRate, mantissa) | |
127 | 127 | } | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func getCurrentUserBorrow (user) = { | |
131 | 131 | let storedBorrow = valueOrElse(getIntegerValue(this, (user + "_borrow")), 0) | |
132 | 132 | let storedBorrowIndex = valueOrElse(getIntegerValue(this, (user + "_index")), 0) | |
133 | 133 | if ((storedBorrowIndex > 0)) | |
134 | 134 | then fraction(storedBorrow, currentIndex, storedBorrowIndex) | |
135 | 135 | else 0 | |
136 | 136 | } | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | @Callable(i) | |
140 | 140 | func getUserHealthParameter (user,collateralAmount,collateralId,newDebtAmount,newDebtId) = if (isWavetroller(i.caller)) | |
141 | 141 | then { | |
142 | 142 | let userLocked = valueOrElse(getIntegerValue(this, (user + "_locked")), 0) | |
143 | 143 | let userDTokenCollateral = if ((dTokenId == collateralId)) | |
144 | 144 | then (userLocked - collateralAmount) | |
145 | 145 | else userLocked | |
146 | 146 | let currentUserBorrow = if ((newDebtId == assetIdSub)) | |
147 | 147 | then (getCurrentUserBorrow(user) + newDebtAmount) | |
148 | 148 | else getCurrentUserBorrow(user) | |
149 | 149 | let userCollateral = calcAssetAmount(userDTokenCollateral) | |
150 | 150 | let assetPrice = invoke(addressFromStringValue(oracle), "getPrice", [assetIdSub], nil) | |
151 | 151 | match assetPrice { | |
152 | 152 | case t: Int => | |
153 | 153 | let collateralValue = fraction(collateralFactor, userCollateral, baseFactor) | |
154 | 154 | let mantissa = pow(10, 0, assetDecimals, 0, 0, CEILING) | |
155 | 155 | let bCSummand = fraction(collateralValue, t, mantissa) | |
156 | 156 | let borrowInUSD = fraction(currentUserBorrow, t, mantissa) | |
157 | 157 | let bCUSummand = fraction(borrowInUSD, baseFactor, liquidationThreshold) | |
158 | - | $Tuple2(nil, $Tuple2(2, | |
158 | + | $Tuple2(nil, $Tuple2(2, bCUSummand)) | |
159 | 159 | case _ => | |
160 | 160 | throw("Incorrect pricing") | |
161 | 161 | } | |
162 | 162 | } | |
163 | 163 | else throw("Address does not match with wavetroller address!") | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | ||
167 | 167 | @Callable(i) | |
168 | 168 | func deposit (user,isCollateral) = if (isWavetroller(i.caller)) | |
169 | 169 | then { | |
170 | 170 | let userTokenAmount = calcDTokenAmount(i.payments[0].amount) | |
171 | 171 | let currentDTokenSupply = (dTokenSupply + userTokenAmount) | |
172 | 172 | if (isCollateral) | |
173 | 173 | then { | |
174 | 174 | let lockedUserBalance = (userlockedBalance(user) + userTokenAmount) | |
175 | 175 | $Tuple2([writeInteger((user + "_locked"), lockedUserBalance), writeInteger("dTokenSupply", currentDTokenSupply), writeInteger("totalBorrow", currentTotalBorrow), writeInteger("totalSupply", (currentTotalSupply + i.payments[0].amount)), writeInteger("totalReserve", currentReserve), writeInteger("storedIndex", currentIndex), writeInteger("storedHeight", height), Reissue(fromBase58String(dTokenId), userTokenAmount, true)], ((toString(i.payments[0].amount) + dTokenName) + "were successfully locked")) | |
176 | 176 | } | |
177 | 177 | else $Tuple2([writeInteger("dTokenSupply", currentDTokenSupply), writeInteger("totalBorrow", currentTotalBorrow), writeInteger("totalSupply", (currentTotalSupply + i.payments[0].amount)), writeInteger("totalReserve", currentReserve), writeInteger("storedIndex", currentIndex), writeInteger("storedHeight", height), Reissue(fromBase58String(dTokenId), userTokenAmount, true), ScriptTransfer(i.caller, userTokenAmount, fromBase58String(dTokenId))], userTokenAmount) | |
178 | 178 | } | |
179 | 179 | else throw("Address does not match with wavetroller address!") | |
180 | 180 | ||
181 | 181 | ||
182 | 182 | ||
183 | 183 | @Callable(i) | |
184 | 184 | func withdraw (user) = if (isWavetroller(i.caller)) | |
185 | 185 | then { | |
186 | 186 | let availableLiquidity = (currentTotalSupply - currentTotalBorrow) | |
187 | 187 | let requestedAssetAmount = calcAssetAmount(i.payments[0].amount) | |
188 | 188 | if ((availableLiquidity >= requestedAssetAmount)) | |
189 | 189 | then $Tuple2([writeInteger("dTokenSupply", (dTokenSupply - i.payments[0].amount)), writeInteger("totalBorrow", currentTotalBorrow), writeInteger("totalSupply", (currentTotalSupply - requestedAssetAmount)), writeInteger("totalReserve", currentReserve), writeInteger("storedIndex", currentIndex), writeInteger("storedHeight", height), Burn(fromBase58String(dTokenId), i.payments[0].amount), if ((assetIdSub == "WAVES")) | |
190 | 190 | then ScriptTransfer(i.caller, requestedAssetAmount, unit) | |
191 | 191 | else ScriptTransfer(i.caller, requestedAssetAmount, fromBase58String(assetIdSub))], requestedAssetAmount) | |
192 | 192 | else throw("Pool liquidity is not sufficient!") | |
193 | 193 | } | |
194 | 194 | else throw("Address does not match with wavetroller address!") | |
195 | 195 | ||
196 | 196 | ||
197 | 197 | ||
198 | 198 | @Callable(i) | |
199 | 199 | func lockAsCollateral (user) = if (isWavetroller(i.caller)) | |
200 | 200 | then { | |
201 | 201 | let newLockedBalance = (userlockedBalance(user) + i.payments[0].amount) | |
202 | 202 | $Tuple2([writeInteger((user + "_locked"), newLockedBalance), writeInteger("totalBorrow", currentTotalBorrow), writeInteger("totalSupply", currentTotalSupply), writeInteger("totalReserve", currentReserve), writeInteger("storedIndex", currentIndex), writeInteger("storedHeight", height)], ((toString(i.payments[0].amount) + dTokenName) + "were successfully locked")) | |
203 | 203 | } | |
204 | 204 | else throw("Address does not match with wavetroller address!") | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | ||
208 | 208 | @Callable(i) | |
209 | 209 | func borrow (user,amount) = if (isWavetroller(i.caller)) | |
210 | 210 | then { | |
211 | 211 | let currentUserBorrow = getCurrentUserBorrow(user) | |
212 | 212 | $Tuple2([writeInteger((user + "_borrow"), (currentUserBorrow + amount)), writeInteger((user + "_index"), currentIndex), writeInteger("totalBorrow", (currentTotalBorrow + amount)), writeInteger("totalSupply", currentTotalSupply), writeInteger("totalReserve", currentReserve), writeInteger("storedIndex", currentIndex), writeInteger("storedHeight", height), if ((assetIdSub == "WAVES")) | |
213 | 213 | then ScriptTransfer(i.caller, amount, unit) | |
214 | 214 | else ScriptTransfer(i.caller, amount, fromBase58String(assetIdSub))], amount) | |
215 | 215 | } | |
216 | 216 | else throw("Address does not match with wavetroller address!") | |
217 | 217 | ||
218 | 218 | ||
219 | 219 | ||
220 | 220 | @Callable(i) | |
221 | 221 | func setup (aId,configAdd,baseExchangeRate,tokenName,tokenDescription) = if (!(isDefined(getString(this, "configAddress")))) | |
222 | 222 | then { | |
223 | 223 | let asset = Issue(tokenName, tokenDescription, 0, 8, true) | |
224 | 224 | let tokenId = calculateAssetId(asset) | |
225 | 225 | [asset, writeString("assetId", aId), writeString("configAddress", configAdd), IntegerEntry("totalBorrow", 0), IntegerEntry("totalSupply", 0), IntegerEntry("totalReserve", 0), IntegerEntry("storedIndex", baseIndex), IntegerEntry("storedHeight", height), IntegerEntry("baseExchangeRate", baseExchangeRate), writeString("dTokenName", tokenName), writeString("dTokenId", toBase58String(tokenId)), IntegerEntry("dTokenDecimals", 8), IntegerEntry("dTokenSupply", 0)] | |
226 | 226 | } | |
227 | 227 | else throw("Pool already setup!") | |
228 | 228 | ||
229 | 229 | ||
230 | 230 | ||
231 | 231 | @Callable(i) | |
232 | 232 | func writeEntry (name,data) = [writeString(name, data)] | |
233 | 233 | ||
234 | 234 | ||
235 | 235 | @Verifier(tx) | |
236 | 236 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
237 | 237 |
github/deemru/w8io/026f985 50.38 ms ◑