tx · 8hVgMLDwMoxTGjTG4wRjrDELv4xzEsAVVXHwqWmPct8E 3MyfKzBNordUSxbv54zj1hxm98ojcDvaiXU: -0.04000000 Waves 2021.09.02 16:15 [1685459] smart account 3MyfKzBNordUSxbv54zj1hxm98ojcDvaiXU > SELF 0.00000000 Waves
{ "type": 13, "id": "8hVgMLDwMoxTGjTG4wRjrDELv4xzEsAVVXHwqWmPct8E", "fee": 4000000, "feeAssetId": null, "timestamp": 1630588550630, "version": 2, "chainId": 84, "sender": "3MyfKzBNordUSxbv54zj1hxm98ojcDvaiXU", "senderPublicKey": "EhGswdVQkp8SXCWyKvRCUKYDidTrRjnzTPa8CZk6GYgN", "proofs": [ "Un9Mc8swh4QrYZBuK5F7PfDbaNz8kQrmfCRPvJUM37sdjvUVV1NxmnndFfyTSPnnNGeFEZxSBc4c9GVU5yRV7QS" ], "script": "base64:AAIFAAAAAAAAAB8IAhIECgIIBBIDCgEIEgMKAQgSBgoECAgICBIDCgEIAAAAKQAAAAAKYmFzZUZhY3RvcgAAAAAAAAAD6AAAAAAJYmFzZUluZGV4AAAjhvJvwQAAAAAAAA1ibG9ja3NQZXJZZWFyAAAAAAAACAUgAAAAAAZjb25maWcJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwIAAAANY29uZmlnQWRkcmVzcwIAAAAAAAAAAAVhZG1pbgkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAZjb25maWcCAAAABWFkbWluAgAAAAAAAAAAC3dhdmV0cm9sbGVyCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAEFAAAABmNvbmZpZwIAAAALd2F2ZXRyb2xsZXICAAAAAAAAAAAKYXNzZXRJZFN1YgkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAABHRo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BhbiBhZG1pbiEAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tledEmmd0=", "height": 1685459, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9VFxopaCPNrovAcoN8WL8HDfNEb72qt7sAiUFSXRLDxW Next: BHFQadct4QZHnyrg1akvf6H4oEhcqHfn43S7VTtjgEEn Diff:
Old | New | Differences | |
---|---|---|---|
38 | 38 | let dTokenDecimals = valueOrErrorMessage(getInteger(this, "dTokenDecimals"), "No key dTokenDecimals was found") | |
39 | 39 | ||
40 | 40 | let dTokenId = valueOrErrorMessage(getString(this, "dTokenId"), "No key dTokenId was found") | |
41 | + | ||
42 | + | let dTokenName = valueOrErrorMessage(getString(this, "dTokenName"), "No key dTokenName was found") | |
41 | 43 | ||
42 | 44 | let storedHeight = valueOrElse(getInteger(this, "storedHeight"), height) | |
43 | 45 | ||
125 | 127 | if (isCollateral) | |
126 | 128 | then { | |
127 | 129 | let lockedUserBalance = (userlockedBalance(user) + userTokenAmount) | |
128 | - | $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) + "were successfully locked")) | |
130 | + | $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")) | |
129 | 131 | } | |
130 | 132 | 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) | |
131 | 133 | } | |
139 | 141 | let availableLiquidity = (currentTotalSupply - currentTotalBorrow) | |
140 | 142 | let requestedAssetAmount = calcAssetAmount(i.payments[0].amount) | |
141 | 143 | if ((availableLiquidity >= requestedAssetAmount)) | |
142 | - | then $Tuple2([writeInteger("dTokenSupply", (dTokenSupply - i.payments[0].amount)), writeInteger("totalBorrow", currentTotalBorrow), writeInteger("totalSupply", | |
144 | + | then $Tuple2([writeInteger("dTokenSupply", (dTokenSupply - i.payments[0].amount)), writeInteger("totalBorrow", currentTotalBorrow), writeInteger("totalSupply", currentTotalSupply), writeInteger("totalReserve", currentReserve), writeInteger("storedIndex", currentIndex), writeInteger("storedHeight", height), Burn(fromBase58String(dTokenId), i.payments[0].amount), if ((assetIdSub == "WAVES")) | |
143 | 145 | then ScriptTransfer(i.caller, requestedAssetAmount, unit) | |
144 | 146 | else ScriptTransfer(i.caller, requestedAssetAmount, fromBase58String(assetIdSub))], requestedAssetAmount) | |
145 | 147 | else throw("Pool liquidity is not sufficient!") | |
148 | + | } | |
149 | + | else throw("Address does not match with wavetroller address!") | |
150 | + | ||
151 | + | ||
152 | + | ||
153 | + | @Callable(i) | |
154 | + | func lockAsCollateral (user) = if (isWavetroller(i.caller)) | |
155 | + | then { | |
156 | + | let newLockedBalance = (userlockedBalance(user) + i.payments[0].amount) | |
157 | + | $Tuple2([writeInteger((user + "_locked"), newLockedBalance), writeInteger("totalBorrow", currentTotalBorrow), writeInteger("totalSupply", (currentTotalSupply + i.payments[0].amount)), writeInteger("totalReserve", currentReserve), writeInteger("storedIndex", currentIndex), writeInteger("storedHeight", height)], ((toString(i.payments[0].amount) + dTokenName) + "were successfully locked")) | |
146 | 158 | } | |
147 | 159 | else throw("Address does not match with wavetroller address!") | |
148 | 160 |
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 assetIdSub = valueOrErrorMessage(getString(this, "assetId"), "No assetId could be found in data storage!") | |
17 | 17 | ||
18 | 18 | let assetDecimals = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_Decimals")), (("No key " + (assetIdSub + "_Decimals")) + " was found")) | |
19 | 19 | ||
20 | 20 | let multiplier = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_Multiplier")), (("No key " + (assetIdSub + "_Multiplier")) + " was found")) | |
21 | 21 | ||
22 | 22 | let kink = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_Kink")), (("No key " + (assetIdSub + "_Kink")) + " was found")) | |
23 | 23 | ||
24 | 24 | let jumpMultiplier = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_JumpMultiplier")), (("No key " + (assetIdSub + "_JumpMultiplier")) + " was found")) | |
25 | 25 | ||
26 | 26 | let baseRate = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_BaseRate")), (("No key " + (assetIdSub + "_BaseRate")) + " was found")) | |
27 | 27 | ||
28 | 28 | let reserveFactor = valueOrErrorMessage(getInteger(addressFromStringValue(config), (assetIdSub + "_ReserveFactor")), (("No key " + (assetIdSub + "_ReserveFactor")) + " was found")) | |
29 | 29 | ||
30 | 30 | let totalBorrow = valueOrElse(getInteger(this, "totalBorrow"), 0) | |
31 | 31 | ||
32 | 32 | let totalSupply = valueOrElse(getInteger(this, "totalSupply"), 0) | |
33 | 33 | ||
34 | 34 | let totalReserve = valueOrElse(getInteger(this, "totalReserve"), 0) | |
35 | 35 | ||
36 | 36 | let dTokenSupply = valueOrErrorMessage(getInteger(this, "dTokenSupply"), "No key dTokenSupply was found") | |
37 | 37 | ||
38 | 38 | let dTokenDecimals = valueOrErrorMessage(getInteger(this, "dTokenDecimals"), "No key dTokenDecimals was found") | |
39 | 39 | ||
40 | 40 | let dTokenId = valueOrErrorMessage(getString(this, "dTokenId"), "No key dTokenId was found") | |
41 | + | ||
42 | + | let dTokenName = valueOrErrorMessage(getString(this, "dTokenName"), "No key dTokenName was found") | |
41 | 43 | ||
42 | 44 | let storedHeight = valueOrElse(getInteger(this, "storedHeight"), height) | |
43 | 45 | ||
44 | 46 | let storedIndex = valueOrElse(getInteger(this, "storedIndex"), 10000000000000000) | |
45 | 47 | ||
46 | 48 | func isAdminAddress (address) = if ((addressFromStringValue(admin) == address)) | |
47 | 49 | then true | |
48 | 50 | else false | |
49 | 51 | ||
50 | 52 | ||
51 | 53 | func isWavetroller (address) = if ((addressFromStringValue(wavetroller) == address)) | |
52 | 54 | then true | |
53 | 55 | else false | |
54 | 56 | ||
55 | 57 | ||
56 | 58 | func isAcceptableAssetId (assetId) = if ((assetId == assetIdSub)) | |
57 | 59 | then true | |
58 | 60 | else false | |
59 | 61 | ||
60 | 62 | ||
61 | 63 | func writeString (key,stringValue) = StringEntry(key, stringValue) | |
62 | 64 | ||
63 | 65 | ||
64 | 66 | func writeInteger (key,integerValue) = IntegerEntry(key, integerValue) | |
65 | 67 | ||
66 | 68 | ||
67 | 69 | func userlockedBalance (userAddress) = valueOrElse(getInteger(this, (userAddress + "_locked")), 0) | |
68 | 70 | ||
69 | 71 | ||
70 | 72 | let utilization = if ((totalSupply > 0)) | |
71 | 73 | then fraction(totalBorrow, baseFactor, totalSupply) | |
72 | 74 | else 0 | |
73 | 75 | ||
74 | 76 | let apr = { | |
75 | 77 | let minValue = [utilization, kink] | |
76 | 78 | let minValueItem = min(minValue) | |
77 | 79 | let maxValue = [0, (utilization - kink)] | |
78 | 80 | let maxValueItem = max(maxValue) | |
79 | 81 | ((fraction(multiplier, minValueItem, baseFactor) + fraction(jumpMultiplier, maxValueItem, baseFactor)) + baseRate) | |
80 | 82 | } | |
81 | 83 | ||
82 | 84 | let apy = fraction(fraction(apr, utilization, baseFactor), (baseFactor - reserveFactor), baseFactor) | |
83 | 85 | ||
84 | 86 | let borrowRatePerBlock = fraction(apr, baseIndex, (blocksPerYear * baseFactor)) | |
85 | 87 | ||
86 | 88 | let deltaBlocks = (height - storedHeight) | |
87 | 89 | ||
88 | 90 | let currentIndex = fraction(storedIndex, (baseIndex + (borrowRatePerBlock * deltaBlocks)), baseIndex, CEILING) | |
89 | 91 | ||
90 | 92 | let currentTotalBorrow = fraction(totalBorrow, currentIndex, storedIndex) | |
91 | 93 | ||
92 | 94 | let collectedInterest = fraction(totalBorrow, (borrowRatePerBlock * deltaBlocks), baseIndex) | |
93 | 95 | ||
94 | 96 | let currentTotalSupply = (totalSupply + fraction((baseFactor - reserveFactor), collectedInterest, baseFactor)) | |
95 | 97 | ||
96 | 98 | let currentReserve = (totalReserve + fraction(reserveFactor, collectedInterest, baseFactor)) | |
97 | 99 | ||
98 | 100 | let exchangeRate = if ((dTokenSupply > 0)) | |
99 | 101 | then { | |
100 | 102 | let exponent = ((18 - dTokenDecimals) + assetDecimals) | |
101 | 103 | let mantissa = pow(10, 0, exponent, 0, 0, CEILING) | |
102 | 104 | fraction(currentTotalSupply, mantissa, dTokenSupply) | |
103 | 105 | } | |
104 | 106 | else 20000000000000000 | |
105 | 107 | ||
106 | 108 | func calcDTokenAmount (assetAmount) = { | |
107 | 109 | let exponent = ((18 - dTokenDecimals) + assetDecimals) | |
108 | 110 | let mantissa = pow(10, 0, exponent, 0, 0, CEILING) | |
109 | 111 | fraction(assetAmount, mantissa, exchangeRate) | |
110 | 112 | } | |
111 | 113 | ||
112 | 114 | ||
113 | 115 | func calcAssetAmount (dTokenAmount) = { | |
114 | 116 | let exponent = ((18 - dTokenDecimals) + assetDecimals) | |
115 | 117 | let mantissa = pow(10, 0, exponent, 0, 0, CEILING) | |
116 | 118 | fraction(dTokenAmount, exchangeRate, mantissa) | |
117 | 119 | } | |
118 | 120 | ||
119 | 121 | ||
120 | 122 | @Callable(i) | |
121 | 123 | func deposit (user,isCollateral) = if (isWavetroller(i.caller)) | |
122 | 124 | then { | |
123 | 125 | let userTokenAmount = calcDTokenAmount(i.payments[0].amount) | |
124 | 126 | let currentDTokenSupply = (dTokenSupply + userTokenAmount) | |
125 | 127 | if (isCollateral) | |
126 | 128 | then { | |
127 | 129 | let lockedUserBalance = (userlockedBalance(user) + userTokenAmount) | |
128 | - | $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) + "were successfully locked")) | |
130 | + | $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")) | |
129 | 131 | } | |
130 | 132 | 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) | |
131 | 133 | } | |
132 | 134 | else throw("Address does not match with wavetroller address!") | |
133 | 135 | ||
134 | 136 | ||
135 | 137 | ||
136 | 138 | @Callable(i) | |
137 | 139 | func withdraw (user) = if (isWavetroller(i.caller)) | |
138 | 140 | then { | |
139 | 141 | let availableLiquidity = (currentTotalSupply - currentTotalBorrow) | |
140 | 142 | let requestedAssetAmount = calcAssetAmount(i.payments[0].amount) | |
141 | 143 | if ((availableLiquidity >= requestedAssetAmount)) | |
142 | - | then $Tuple2([writeInteger("dTokenSupply", (dTokenSupply - i.payments[0].amount)), writeInteger("totalBorrow", currentTotalBorrow), writeInteger("totalSupply", | |
144 | + | then $Tuple2([writeInteger("dTokenSupply", (dTokenSupply - i.payments[0].amount)), writeInteger("totalBorrow", currentTotalBorrow), writeInteger("totalSupply", currentTotalSupply), writeInteger("totalReserve", currentReserve), writeInteger("storedIndex", currentIndex), writeInteger("storedHeight", height), Burn(fromBase58String(dTokenId), i.payments[0].amount), if ((assetIdSub == "WAVES")) | |
143 | 145 | then ScriptTransfer(i.caller, requestedAssetAmount, unit) | |
144 | 146 | else ScriptTransfer(i.caller, requestedAssetAmount, fromBase58String(assetIdSub))], requestedAssetAmount) | |
145 | 147 | else throw("Pool liquidity is not sufficient!") | |
148 | + | } | |
149 | + | else throw("Address does not match with wavetroller address!") | |
150 | + | ||
151 | + | ||
152 | + | ||
153 | + | @Callable(i) | |
154 | + | func lockAsCollateral (user) = if (isWavetroller(i.caller)) | |
155 | + | then { | |
156 | + | let newLockedBalance = (userlockedBalance(user) + i.payments[0].amount) | |
157 | + | $Tuple2([writeInteger((user + "_locked"), newLockedBalance), writeInteger("totalBorrow", currentTotalBorrow), writeInteger("totalSupply", (currentTotalSupply + i.payments[0].amount)), writeInteger("totalReserve", currentReserve), writeInteger("storedIndex", currentIndex), writeInteger("storedHeight", height)], ((toString(i.payments[0].amount) + dTokenName) + "were successfully locked")) | |
146 | 158 | } | |
147 | 159 | else throw("Address does not match with wavetroller address!") | |
148 | 160 | ||
149 | 161 | ||
150 | 162 | ||
151 | 163 | @Callable(i) | |
152 | 164 | func setup (aId,configAdd,tokenName,tokenDescription) = if (!(isDefined(getString(this, "configAddress")))) | |
153 | 165 | then { | |
154 | 166 | let asset = Issue(tokenName, tokenDescription, 0, 8, true) | |
155 | 167 | let tokenId = calculateAssetId(asset) | |
156 | 168 | [asset, writeString("assetId", aId), writeString("configAddress", configAdd), IntegerEntry("totalBorrow", 0), IntegerEntry("totalSupply", 0), IntegerEntry("totalReserve", 0), IntegerEntry("storedIndex", baseIndex), IntegerEntry("storedHeight", height), writeString("dTokenName", tokenName), writeString("dTokenId", toBase58String(tokenId)), IntegerEntry("dTokenDecimals", 8), IntegerEntry("dTokenSupply", 0)] | |
157 | 169 | } | |
158 | 170 | else throw("Pool already setup!") | |
159 | 171 | ||
160 | 172 | ||
161 | 173 | ||
162 | 174 | @Callable(i) | |
163 | 175 | func deletEntry (key) = if (isAdminAddress(i.caller)) | |
164 | 176 | then [DeleteEntry(key)] | |
165 | 177 | else throw("Caller is not an admin!") | |
166 | 178 | ||
167 | 179 | ||
168 | 180 | @Verifier(tx) | |
169 | 181 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
170 | 182 |
github/deemru/w8io/026f985 41.76 ms ◑