tx · 83rrYT3m2RtbbcvcoNRpRfxW23gZamgXrWz5iLxXbiNk 3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu: -0.01700000 Waves 2022.06.09 11:43 [2088606] smart account 3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu > SELF 0.00000000 Waves
{ "type": 13, "id": "83rrYT3m2RtbbcvcoNRpRfxW23gZamgXrWz5iLxXbiNk", "fee": 1700000, "feeAssetId": null, "timestamp": 1654764183672, "version": 1, "sender": "3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu", "senderPublicKey": "668WwQVaWxezbvLEK3FccCSTbjst4zYAJDPrfLFRj9b9", "proofs": [ "QfXoijFSZNrF6f1HmroyftWcupTsPsG5eK288w6U1UCYcYixXLYikeMLUwb2ffQ8GUayLQsXtVLDkCEobeuLLed" ], "script": "base64:AAIFAAAAAAAAACwIAhIDCgEIEgASABIFCgMICAgSCQoHCAgICAEIARIAEgQKAggIEgMKAQgSAAAAABcAAAAAA1NFUAIAAAACX18AAAAABUVNUFRZAgAAAAAAAAAACGNvbnRyYWN0AgAAAA9scF9zdGFraW5nX3YyOiABAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAACQAEuQAAAAIJAARMAAAAAgIAAAACJXMJAARMAAAAAgIAAAAQbWFuYWdlclB1YmxpY0tleQUAAAADbmlsBQAAAANTRVABAAAAGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAAAAAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAAF3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5BQAAAANuaWwFAAAAA1NFUAEAAAAGa2V5VFZMAAAAAQAAAAdhc3NldElkCQAEuQAAAAIJAARMAAAAAgIAAAAEJXMlcwkABEwAAAACAgAAAAN0dmwJAARMAAAAAgUAAAAHYXNzZXRJZAUAAAADbmlsBQAAAANTRVABAAAADWtleVRWTEhpc3RvcnkAAAACAAAAB2Fzc2V0SWQAAAAGaGVpZ2h0CQAEuQAAAAI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AAAJwawUAAAAHJG1hdGNoMAUAAAACcGsDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABFVuaXQIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA90YXJnZXRQdWJsaWNLZXluEqvv", "chainId": 84, "height": 2088606, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3UKHsdkxXxJbHrvg2UYRqUCd8wu4443LsRP1Fh1mUDjK Next: Er2dBrBRRNEbQv8FtrU9wtyXaeZjJtnJKbeRcHXZRFpJ Diff:
Old | New | Differences | |
---|---|---|---|
180 | 180 | then true | |
181 | 181 | else throwErr("no corresponding withdrawal request")] | |
182 | 182 | if ((checks == checks)) | |
183 | - | then { | |
184 | - | let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(assetId)), 0) | |
185 | - | [ScriptTransfer(addressFromStringValue(userAddress), withdrawalAmount, fromBase58String(assetId)), DeleteEntry(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId)), IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - withdrawalAmount))] | |
186 | - | } | |
183 | + | then [ScriptTransfer(addressFromStringValue(userAddress), withdrawalAmount, fromBase58String(assetId)), DeleteEntry(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId))] | |
187 | 184 | else throw("Strict value is not equal to itself.") | |
188 | 185 | } | |
189 | 186 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let EMPTY = "" | |
7 | 7 | ||
8 | 8 | let contract = "lp_staking_v2: " | |
9 | 9 | ||
10 | 10 | func keyManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP) | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func keyTVL (assetId) = makeString(["%s%s", "tvl", assetId], SEP) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func keyTVLHistory (assetId,height) = makeString(["%s%s%d", "tvlHistory", assetId, toString(height)], SEP) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func keyTopUpHistory (assetId,height) = makeString(["%s%s%d", "topUpHistory", assetId, toString(height)], SEP) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func keyPendingWithdrawals (assetId) = makeString(["%s%s", "pendingWithdrawals", assetId], SEP) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func keyDelayInBlocks (assetId) = makeString(["%s%s", "delayInBlocks", assetId], SEP) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func keyCreated (assetId) = makeString(["%s%s", "created", assetId], SEP) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func keyAssetIdToLPId (assetId) = makeString(["%s%s", "assetIdToLPId", assetId], SEP) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func keyLPIdToAssetId (lpId) = makeString(["%s%s", "lpIdToAssetId", lpId], SEP) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func keyProxyAddress (assetId) = makeString(["%s%s", "proxyAddress", assetId], SEP) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func keyMappingsUserToWithdrawal (assetId,userAddress,txId) = makeString(["%s%s%s%s", "userWithdrawalAmount", assetId, userAddress, txId], SEP) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func keyOtherChainAssetDecimals (assetId) = makeString(["%s%s", "otherChainAssetDecimals", assetId], SEP) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
53 | 53 | case s: String => | |
54 | 54 | fromBase58String(s) | |
55 | 55 | case _: Unit => | |
56 | 56 | unit | |
57 | 57 | case _ => | |
58 | 58 | throw("Match error") | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
63 | 63 | case s: String => | |
64 | 64 | fromBase58String(s) | |
65 | 65 | case _: Unit => | |
66 | 66 | unit | |
67 | 67 | case _ => | |
68 | 68 | throw("Match error") | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func throwErr (msg) = throw((contract + msg)) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func mustManager (i) = { | |
76 | 76 | let pd = throwErr("permission denied") | |
77 | 77 | match managerPublicKeyOrUnit() { | |
78 | 78 | case pk: ByteVector => | |
79 | 79 | if ((i.callerPublicKey == pk)) | |
80 | 80 | then true | |
81 | 81 | else pd | |
82 | 82 | case _: Unit => | |
83 | 83 | if ((i.caller == this)) | |
84 | 84 | then true | |
85 | 85 | else pd | |
86 | 86 | case _ => | |
87 | 87 | throw("Match error") | |
88 | 88 | } | |
89 | 89 | } | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func assetsStoreContract () = addressFromStringValue(value(getString(keyAssetsStoreContract()))) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func mustProxyAddress (i,assetId) = { | |
96 | 96 | let isProxy = (toString(i.caller) == valueOrElse(getString(keyProxyAddress(assetId)), EMPTY)) | |
97 | 97 | if (isProxy) | |
98 | 98 | then true | |
99 | 99 | else { | |
100 | 100 | let checkCaller = mustManager(i) | |
101 | 101 | if ((checkCaller == checkCaller)) | |
102 | 102 | then true | |
103 | 103 | else throw("Strict value is not equal to itself.") | |
104 | 104 | } | |
105 | 105 | } | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | @Callable(i) | |
109 | 109 | func constructor (assetsStoreContract) = { | |
110 | 110 | let checkCaller = mustManager(i) | |
111 | 111 | if ((checkCaller == checkCaller)) | |
112 | 112 | then [StringEntry(keyAssetsStoreContract(), assetsStoreContract)] | |
113 | 113 | else throw("Strict value is not equal to itself.") | |
114 | 114 | } | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | ||
118 | 118 | @Callable(i) | |
119 | 119 | func put () = { | |
120 | 120 | let pmt = value(i.payments[0]) | |
121 | 121 | let asset = value(pmt.assetId) | |
122 | 122 | let assetId = toBase58String(asset) | |
123 | 123 | let checks = [if ((size(i.payments) == 1)) | |
124 | 124 | then true | |
125 | 125 | else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
126 | 126 | then true | |
127 | 127 | else throwErr("attached payment asset must be registered in the contract"), if ((pmt.amount > 0)) | |
128 | 128 | then true | |
129 | 129 | else throwErr("positive amount required")] | |
130 | 130 | if ((checks == checks)) | |
131 | 131 | then { | |
132 | 132 | let tvl = valueOrElse(getInteger(keyTVL(assetId)), 0) | |
133 | 133 | let lpId = value(getString(keyAssetIdToLPId(assetId))) | |
134 | 134 | let lpInfo = value(assetInfo(fromBase58String(assetId))) | |
135 | 135 | let sharesAmount = if ((tvl > 0)) | |
136 | 136 | then ((pmt.amount * lpInfo.quantity) / tvl) | |
137 | 137 | else pmt.amount | |
138 | 138 | [Reissue(lpInfo.id, sharesAmount, true), ScriptTransfer(i.caller, sharesAmount, lpInfo.id)] | |
139 | 139 | } | |
140 | 140 | else throw("Strict value is not equal to itself.") | |
141 | 141 | } | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | ||
145 | 145 | @Callable(i) | |
146 | 146 | func submitGetRequest () = { | |
147 | 147 | let pmt = value(i.payments[0]) | |
148 | 148 | let lp = value(pmt.assetId) | |
149 | 149 | let lpId = toBase58String(lp) | |
150 | 150 | let userAddress = toString(i.caller) | |
151 | 151 | let baseAssetId = value(getString(keyLPIdToAssetId(lpId))) | |
152 | 152 | let shares = pmt.amount | |
153 | 153 | let checks = [if ((size(i.payments) == 1)) | |
154 | 154 | then true | |
155 | 155 | else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(baseAssetId)), false)) | |
156 | 156 | then true | |
157 | 157 | else throwErr("attached payment asset must be registered in the contract"), if ((shares > 0)) | |
158 | 158 | then true | |
159 | 159 | else throwErr("positive amount to withdrawal required")] | |
160 | 160 | if ((checks == checks)) | |
161 | 161 | then { | |
162 | 162 | let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(baseAssetId)), 0) | |
163 | 163 | let tvl = valueOrElse(getInteger(keyTVL(baseAssetId)), 0) | |
164 | 164 | let lpInfo = value(assetInfo(lp)) | |
165 | 165 | let decimals = lpInfo.decimals | |
166 | 166 | let withdrawalAmount = ((shares * tvl) / lpInfo.quantity) | |
167 | 167 | [Burn(lp, shares), IntegerEntry(keyPendingWithdrawals(baseAssetId), (pendingWithdrawals + withdrawalAmount)), IntegerEntry(keyMappingsUserToWithdrawal(baseAssetId, userAddress, toBase58String(i.transactionId)), withdrawalAmount)] | |
168 | 168 | } | |
169 | 169 | else throw("Strict value is not equal to itself.") | |
170 | 170 | } | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | ||
174 | 174 | @Callable(i) | |
175 | 175 | func executeGetRequest (assetId,userAddress,submitTxId) = { | |
176 | 176 | let withdrawalAmount = valueOrElse(getInteger(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId)), 0) | |
177 | 177 | let checks = [if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
178 | 178 | then true | |
179 | 179 | else throwErr("asset must be registered in the contract"), if ((withdrawalAmount > 0)) | |
180 | 180 | then true | |
181 | 181 | else throwErr("no corresponding withdrawal request")] | |
182 | 182 | if ((checks == checks)) | |
183 | - | then { | |
184 | - | let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(assetId)), 0) | |
185 | - | [ScriptTransfer(addressFromStringValue(userAddress), withdrawalAmount, fromBase58String(assetId)), DeleteEntry(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId)), IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - withdrawalAmount))] | |
186 | - | } | |
183 | + | then [ScriptTransfer(addressFromStringValue(userAddress), withdrawalAmount, fromBase58String(assetId)), DeleteEntry(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId))] | |
187 | 184 | else throw("Strict value is not equal to itself.") | |
188 | 185 | } | |
189 | 186 | ||
190 | 187 | ||
191 | 188 | ||
192 | 189 | @Callable(i) | |
193 | 190 | func registerAsset (assetId,lpName,lpDescription,lpLogo,delayInBlocks,proxyAddress,otherChainAssetDecimals) = { | |
194 | 191 | let checks = [mustManager(i), if ((delayInBlocks >= 0)) | |
195 | 192 | then true | |
196 | 193 | else throwErr("invalid delayInBlocks"), if ((addressFromString(proxyAddress) != unit)) | |
197 | 194 | then true | |
198 | 195 | else throwErr("invalid proxyAddress"), if ((valueOrElse(getBoolean(keyCreated(assetId)), false) == false)) | |
199 | 196 | then true | |
200 | 197 | else throwErr("asset already registered")] | |
201 | 198 | if ((checks == checks)) | |
202 | 199 | then { | |
203 | 200 | let decimals = value(assetInfo(fromBase58String(assetId))).decimals | |
204 | 201 | let lpIssue = Issue(lpName, lpDescription, 1, decimals, true) | |
205 | 202 | let lp = calculateAssetId(lpIssue) | |
206 | 203 | let lpId = toBase58String(lp) | |
207 | 204 | let createOrUpdate = invoke(assetsStoreContract(), "createOrUpdate", [lpId, lpLogo, false], nil) | |
208 | 205 | if ((createOrUpdate == createOrUpdate)) | |
209 | 206 | then { | |
210 | 207 | let addLabel = invoke(assetsStoreContract(), "addLabel", [lpId, "DEFI"], nil) | |
211 | 208 | if ((addLabel == addLabel)) | |
212 | 209 | then [BooleanEntry(keyCreated(assetId), true), IntegerEntry(keyTVL(assetId), 0), IntegerEntry(keyTVLHistory(assetId, height), 0), IntegerEntry(keyDelayInBlocks(assetId), delayInBlocks), StringEntry(keyLPIdToAssetId(lpId), assetId), StringEntry(keyAssetIdToLPId(assetId), lpId), StringEntry(keyProxyAddress(assetId), proxyAddress), IntegerEntry(keyOtherChainAssetDecimals(assetId), otherChainAssetDecimals), lpIssue, Burn(lp, 1)] | |
213 | 210 | else throw("Strict value is not equal to itself.") | |
214 | 211 | } | |
215 | 212 | else throw("Strict value is not equal to itself.") | |
216 | 213 | } | |
217 | 214 | else throw("Strict value is not equal to itself.") | |
218 | 215 | } | |
219 | 216 | ||
220 | 217 | ||
221 | 218 | ||
222 | 219 | @Callable(i) | |
223 | 220 | func topUpBalance () = { | |
224 | 221 | let pmt = valueOrErrorMessage(i.payments[0], (contract + "payment must be attached")) | |
225 | 222 | let assetId = toBase58String(value(pmt.assetId)) | |
226 | 223 | let amount = pmt.amount | |
227 | 224 | let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(assetId)), 0) | |
228 | 225 | let checks = [mustProxyAddress(i, assetId), if ((size(i.payments) == 1)) | |
229 | 226 | then true | |
230 | 227 | else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
231 | 228 | then true | |
232 | 229 | else throwErr("attached payment asset must be registered in the contract"), if ((pendingWithdrawals != 0)) | |
233 | 230 | then true | |
234 | 231 | else throwErr("zero pendingWithdrawals, nothing to top up"), if ((pendingWithdrawals >= amount)) | |
235 | 232 | then true | |
236 | 233 | else throwErr("amount to top up must be less or equal than pendingWithdrawals"), if ((getInteger(keyTopUpHistory(assetId, height)) == unit)) | |
237 | 234 | then true | |
238 | 235 | else throwErr("already have topUp in current block, wait for next block")] | |
239 | 236 | if ((checks == checks)) | |
240 | 237 | then [IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - amount)), IntegerEntry(keyTopUpHistory(assetId, height), amount)] | |
241 | 238 | else throw("Strict value is not equal to itself.") | |
242 | 239 | } | |
243 | 240 | ||
244 | 241 | ||
245 | 242 | ||
246 | 243 | @Callable(i) | |
247 | 244 | func setTVL (assetId,newStrTVL) = { | |
248 | 245 | let checks = [mustProxyAddress(i, assetId), if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
249 | 246 | then true | |
250 | 247 | else throwErr("asset must be registered in the contract"), if ((getInteger(keyTVLHistory(assetId, height)) == unit)) | |
251 | 248 | then true | |
252 | 249 | else throwErr("already have setTVL in current block, wait for next block")] | |
253 | 250 | if ((checks == checks)) | |
254 | 251 | then { | |
255 | 252 | let newBigIntTVL = parseBigIntValue(newStrTVL) | |
256 | 253 | let ten = parseBigIntValue("10") | |
257 | 254 | let assetDecimals = value(assetInfo(fromBase58String(assetId))).decimals | |
258 | 255 | let otherChainAssetDecimals = value(getInteger(keyOtherChainAssetDecimals(assetId))) | |
259 | 256 | let newTVLWavesDecimals = if ((otherChainAssetDecimals > assetDecimals)) | |
260 | 257 | then { | |
261 | 258 | let diff = parseBigIntValue(toString((otherChainAssetDecimals - assetDecimals))) | |
262 | 259 | (newBigIntTVL / pow(ten, 0, diff, 0, 0, DOWN)) | |
263 | 260 | } | |
264 | 261 | else if ((assetDecimals > otherChainAssetDecimals)) | |
265 | 262 | then { | |
266 | 263 | let diff = parseBigIntValue(toString((assetDecimals - otherChainAssetDecimals))) | |
267 | 264 | (newBigIntTVL * pow(ten, 0, diff, 0, 0, DOWN)) | |
268 | 265 | } | |
269 | 266 | else newBigIntTVL | |
270 | 267 | let newTVL = toInt(newTVLWavesDecimals) | |
271 | 268 | [IntegerEntry(keyTVL(assetId), newTVL), IntegerEntry(keyTVLHistory(assetId, height), newTVL)] | |
272 | 269 | } | |
273 | 270 | else throw("Strict value is not equal to itself.") | |
274 | 271 | } | |
275 | 272 | ||
276 | 273 | ||
277 | 274 | ||
278 | 275 | @Callable(i) | |
279 | 276 | func setManager (pendingManagerPublicKey) = { | |
280 | 277 | let checkCaller = mustManager(i) | |
281 | 278 | if ((checkCaller == checkCaller)) | |
282 | 279 | then { | |
283 | 280 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
284 | 281 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
285 | 282 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
286 | 283 | else throw("Strict value is not equal to itself.") | |
287 | 284 | } | |
288 | 285 | else throw("Strict value is not equal to itself.") | |
289 | 286 | } | |
290 | 287 | ||
291 | 288 | ||
292 | 289 | ||
293 | 290 | @Callable(i) | |
294 | 291 | func confirmManager () = { | |
295 | 292 | let pm = pendingManagerPublicKeyOrUnit() | |
296 | 293 | let hasPM = if (isDefined(pm)) | |
297 | 294 | then true | |
298 | 295 | else throwErr("no pending manager") | |
299 | 296 | if ((hasPM == hasPM)) | |
300 | 297 | then { | |
301 | 298 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
302 | 299 | then true | |
303 | 300 | else throwErr("you are not pending manager") | |
304 | 301 | if ((checkPM == checkPM)) | |
305 | 302 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
306 | 303 | else throw("Strict value is not equal to itself.") | |
307 | 304 | } | |
308 | 305 | else throw("Strict value is not equal to itself.") | |
309 | 306 | } | |
310 | 307 | ||
311 | 308 | ||
312 | 309 | @Verifier(tx) | |
313 | 310 | func verify () = { | |
314 | 311 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
315 | 312 | case pk: ByteVector => | |
316 | 313 | pk | |
317 | 314 | case _: Unit => | |
318 | 315 | tx.senderPublicKey | |
319 | 316 | case _ => | |
320 | 317 | throw("Match error") | |
321 | 318 | } | |
322 | 319 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
323 | 320 | } | |
324 | 321 |
github/deemru/w8io/026f985 43.31 ms ◑