tx · Dt3Ui4XhBrHkvnPhWqQJWvUepjtDCgN179WcAw9JPeba 3NBG2Nuz2cjtG8wWcKLBGZ1bBpveU56gp77: -0.04000000 Waves 2021.09.05 20:13 [1690041] smart account 3NBG2Nuz2cjtG8wWcKLBGZ1bBpveU56gp77 > SELF 0.00000000 Waves
{ "type": 13, "id": "Dt3Ui4XhBrHkvnPhWqQJWvUepjtDCgN179WcAw9JPeba", "fee": 4000000, "feeAssetId": null, "timestamp": 1630861982078, "version": 2, "chainId": 84, "sender": "3NBG2Nuz2cjtG8wWcKLBGZ1bBpveU56gp77", "senderPublicKey": "B565vUqaobfDQJcgjUnNdsSqnqWfRsAQDBb1JeciPWtP", "proofs": [ "5jaqydRe6dzf57GWuk7oTquoE9zcdoCs1s92UoXrjVbmmLLTW96siqUqn1tnis88KRSxhZkCEaxwgXc1ff5TNmwy" ], "script": "base64:AAIFAAAAAAAAAC8IAhIHCgUIAQgBCBIECgIIBBIDCgEIEgMKAQgSBAoCCAESAwoBCBIHCgUICAEICAAAAC4AAAAACmJhc2VGYWN0b3IAAAAAAAAAA+gAAAAACWJhc2VJbmRleAAAI4byb8EAAAAAAAANYmxvY2tzUGVyWWVhcgAAAAAAAAgFIAAAAAAGY29uZmlnCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMCAAAADWNvbmZpZ0FkZHJlc3MCAAAAAAAAAAAFYWRtaW4JAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAAGY29uZmlnAgAAAAVhZG1pbgIAAAAAAAAAAAt3YXZldHJvbGxlcgkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAZjb25maWcCAAAAC3dhdmV0cm9sbGVyAgAAAAAAAAAABm9yYWNsZQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACCQEA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AAAd0b2tlbklkCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAA5kVG9rZW5EZWNpbWFscwAAAAAAAAAACAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAMZFRva2VuU3VwcGx5AAAAAAAAAAAABQAAAANuaWwJAAACAAAAAQIAAAATUG9vbCBhbHJlYWR5IHNldHVwIQAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5EEJAQw==", "height": 1690041, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2Hfim6fZbzLFsjLvdiazPcYABBfma4PmfkJeBEaefyFw Next: F1HARLxTV9X1hUQi7mkjtyKrQWpqHbGT3gdKfNDoCPwb Diff:
Old | New | Differences | |
---|---|---|---|
218 | 218 | ||
219 | 219 | ||
220 | 220 | @Callable(i) | |
221 | + | func repay (user) = if (isWavetroller(i.caller)) | |
222 | + | then { | |
223 | + | let currentUserBorrow = getCurrentUserBorrow(user) | |
224 | + | $Tuple2([writeInteger((user + "_borrow"), (currentUserBorrow - i.payments[0].amount)), writeInteger((user + "_index"), currentIndex), writeInteger("totalBorrow", (currentTotalBorrow - i.payments[0].amount)), writeInteger("totalSupply", currentTotalSupply), writeInteger("totalReserve", currentReserve), writeInteger("storedIndex", currentIndex), writeInteger("storedHeight", height)], ((toString(i.payments[0].amount) + " successfully repaid. User credit at") + toString((currentUserBorrow - i.payments[0].amount)))) | |
225 | + | } | |
226 | + | else throw("Address does not match with wavetroller address!") | |
227 | + | ||
228 | + | ||
229 | + | ||
230 | + | @Callable(i) | |
221 | 231 | func setup (aId,configAdd,baseExchangeRate,tokenName,tokenDescription) = if (!(isDefined(getString(this, "configAddress")))) | |
222 | 232 | then { | |
223 | 233 | let asset = Issue(tokenName, tokenDescription, 0, 8, true) |
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 | + | func repay (user) = if (isWavetroller(i.caller)) | |
222 | + | then { | |
223 | + | let currentUserBorrow = getCurrentUserBorrow(user) | |
224 | + | $Tuple2([writeInteger((user + "_borrow"), (currentUserBorrow - i.payments[0].amount)), writeInteger((user + "_index"), currentIndex), writeInteger("totalBorrow", (currentTotalBorrow - i.payments[0].amount)), writeInteger("totalSupply", currentTotalSupply), writeInteger("totalReserve", currentReserve), writeInteger("storedIndex", currentIndex), writeInteger("storedHeight", height)], ((toString(i.payments[0].amount) + " successfully repaid. User credit at") + toString((currentUserBorrow - i.payments[0].amount)))) | |
225 | + | } | |
226 | + | else throw("Address does not match with wavetroller address!") | |
227 | + | ||
228 | + | ||
229 | + | ||
230 | + | @Callable(i) | |
221 | 231 | func setup (aId,configAdd,baseExchangeRate,tokenName,tokenDescription) = if (!(isDefined(getString(this, "configAddress")))) | |
222 | 232 | then { | |
223 | 233 | let asset = Issue(tokenName, tokenDescription, 0, 8, true) | |
224 | 234 | let tokenId = calculateAssetId(asset) | |
225 | 235 | [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 | 236 | } | |
227 | 237 | else throw("Pool already setup!") | |
228 | 238 | ||
229 | 239 | ||
230 | 240 | @Verifier(tx) | |
231 | 241 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
232 | 242 |
github/deemru/w8io/026f985 50.92 ms ◑