tx · AcaeU1pMmAfEafsK6qqnBxNYCMnds6iNKJ32hJ5SuMEp 3MyfKzBNordUSxbv54zj1hxm98ojcDvaiXU: -0.04000000 Waves 2021.09.05 17:17 [1689855] smart account 3MyfKzBNordUSxbv54zj1hxm98ojcDvaiXU > SELF 0.00000000 Waves
{ "type": 13, "id": "AcaeU1pMmAfEafsK6qqnBxNYCMnds6iNKJ32hJ5SuMEp", "fee": 4000000, "feeAssetId": null, "timestamp": 1630851466900, "version": 2, "chainId": 84, "sender": "3MyfKzBNordUSxbv54zj1hxm98ojcDvaiXU", "senderPublicKey": "EhGswdVQkp8SXCWyKvRCUKYDidTrRjnzTPa8CZk6GYgN", "proofs": [ "3dDXhrFndMpyUw3MjLC1FZjveuHA3TDcUiy8hSPgh88tTCS7rJGZFek2grAETvwrGNg6qck1K2n7uLPwrgKee7K2" ], "script": "base64:AAIFAAAAAAAAACoIAhIHCgUIAQgBCBIECgIIBBIDCgEIEgMKAQgSBAoCCAESBwoFCAgBCAgAAAAuAAAAAApiYXNlRmFjdG9yAAAAAAAAAAPoAAAAAAliYXNlSW5kZXgAACOG8m/BAAAAAAAADWJsb2Nrc1BlclllYXIAAAAAAAAIBSAAAAAABmNvbmZpZwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAAA1jb25maWdBZGRyZXNzAgAAAAAAAAAABWFkbWluCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAEFAAAABmNvbmZpZwIAAAAFYWRtaW4CAAAAAAAAAAALd2F2ZXRyb2xsZXIJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAAGY29uZmlnAgAAAAt3YXZldHJvbGxlcgIAAAAAAAAAAAZvcmFjbGUJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgkBAAAAEUBleH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R5IHNldHVwIQAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5xMTmog==", "height": 1689855, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3mCqa8TGB2EVp1dWqQBUFJJpuEtWHg91RziS1hcmdy11 Next: Gne3BvGa6Z7sXopHJQTEUGbEV8K3Pe2c4WtJ8HuDrHSt Diff:
Old | New | Differences | |
---|---|---|---|
227 | 227 | else throw("Pool already setup!") | |
228 | 228 | ||
229 | 229 | ||
230 | - | ||
231 | - | @Callable(i) | |
232 | - | func deleteData (name) = [DeleteEntry(name)] | |
233 | - | ||
234 | - | ||
235 | 230 | @Verifier(tx) | |
236 | 231 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
237 | 232 |
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(getInteger(this, (user + "_borrow")), 0) | |
132 | 132 | let storedBorrowIndex = valueOrElse(getInteger(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(getInteger(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 | 158 | $Tuple2(nil, $Tuple2(bCSummand, 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 | - | ||
231 | - | @Callable(i) | |
232 | - | func deleteData (name) = [DeleteEntry(name)] | |
233 | - | ||
234 | - | ||
235 | 230 | @Verifier(tx) | |
236 | 231 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
237 | 232 |
github/deemru/w8io/026f985 43.40 ms ◑