tx · 3UKHsdkxXxJbHrvg2UYRqUCd8wu4443LsRP1Fh1mUDjK

3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu:  -0.01800000 Waves

2022.06.09 11:19 [2088582] smart account 3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu > SELF 0.00000000 Waves

{ "type": 13, "id": "3UKHsdkxXxJbHrvg2UYRqUCd8wu4443LsRP1Fh1mUDjK", "fee": 1800000, "feeAssetId": null, "timestamp": 1654762877817, "version": 1, "sender": "3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu", "senderPublicKey": "668WwQVaWxezbvLEK3FccCSTbjst4zYAJDPrfLFRj9b9", "proofs": [ "4EPB6sRT4u5QLLseuEaoEU8zzitU87LCqMq1nn5jkczSBnYRGEQrBocr1NkmQuD37LQpkGHbErGHCfNTGHzU7QEM" ], "script": "base64:AAIFAAAAAAAAACwIAhIDCgEIEgASABIFCgMICAgSCQoHCAgICAEIARIAEgQKAggIEgMKAQgSAAAAABcAAAAAA1NFUAIAAAACX18AAAAABUVNUFRZAgAAAAAAAAAACGNvbnRyYWN0AgAAAA9scF9zdGFraW5nX3YyOiABAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAACQAEuQAAAAIJAARMAAAAAgIAAAACJXMJAARMAAAAAgIAAAAQbWFuYWdlclB1YmxpY0tleQUAAAADbmlsBQAAAANTRVABAAAAGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAAAAAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAAF3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5BQAAAANuaWwFAAAAA1NFUAEAAAAGa2V5VFZMAAAAAQAAAAdhc3NldElkCQAEuQAAAAIJAARMAAAAAgIAAAAEJXMlcwkABEwAAAACAgAAAAN0dmwJAARMAAAAAgUAAAAHYXNzZXRJZAUAAAADbmlsBQAAAANTRVABAAAADWtleVRWTEhpc3RvcnkAAAACAAAAB2Fzc2V0SWQAAAAGaGVpZ2h0CQ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2VyUHVibGljS2V5AAAAAAUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAA90YXJnZXRQdWJsaWNLZXkEAAAAByRtYXRjaDAJAQAAABZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAAAAAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAACcGsFAAAAByRtYXRjaDAFAAAAAnBrAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0CAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAPdGFyZ2V0UHVibGljS2V5ZxtqPg==", "chainId": 84, "height": 2088582, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6sPeaTDqUhQpwXGNvnYT6n6xbuAnYxreRmSWLoseSPUw Next: 83rrYT3m2RtbbcvcoNRpRfxW23gZamgXrWz5iLxXbiNk Diff:
OldNewDifferences
1717
1818
1919 func keyTVLHistory (assetId,height) = makeString(["%s%s%d", "tvlHistory", assetId, toString(height)], SEP)
20+
21+
22+func keyTopUpHistory (assetId,height) = makeString(["%s%s%d", "topUpHistory", assetId, toString(height)], SEP)
2023
2124
2225 func keyPendingWithdrawals (assetId) = makeString(["%s%s", "pendingWithdrawals", assetId], SEP)
230233 then true
231234 else throwErr("zero pendingWithdrawals, nothing to top up"), if ((pendingWithdrawals >= amount))
232235 then true
233- else "amount to top up must be less or equal than pendingWithdrawals"]
236+ else throwErr("amount to top up must be less or equal than pendingWithdrawals"), if ((getInteger(keyTopUpHistory(assetId, height)) == unit))
237+ then true
238+ else throwErr("already have topUp in current block, wait for next block")]
234239 if ((checks == checks))
235- then [IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - amount))]
240+ then [IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - amount)), IntegerEntry(keyTopUpHistory(assetId, height), amount)]
236241 else throw("Strict value is not equal to itself.")
237242 }
238243
242247 func setTVL (assetId,newStrTVL) = {
243248 let checks = [mustProxyAddress(i, assetId), if (valueOrElse(getBoolean(keyCreated(assetId)), false))
244249 then true
245- else throwErr("asset must be registered in the contract")]
250+ else throwErr("asset must be registered in the contract"), if ((getInteger(keyTVLHistory(assetId, height)) == unit))
251+ then true
252+ else throwErr("already have setTVL in current block, wait for next block")]
246253 if ((checks == checks))
247254 then {
248255 let newBigIntTVL = parseBigIntValue(newStrTVL)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let EMPTY = ""
77
88 let contract = "lp_staking_v2: "
99
1010 func keyManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP)
1111
1212
1313 func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP)
1414
1515
1616 func keyTVL (assetId) = makeString(["%s%s", "tvl", assetId], SEP)
1717
1818
1919 func keyTVLHistory (assetId,height) = makeString(["%s%s%d", "tvlHistory", assetId, toString(height)], SEP)
20+
21+
22+func keyTopUpHistory (assetId,height) = makeString(["%s%s%d", "topUpHistory", assetId, toString(height)], SEP)
2023
2124
2225 func keyPendingWithdrawals (assetId) = makeString(["%s%s", "pendingWithdrawals", assetId], SEP)
2326
2427
2528 func keyDelayInBlocks (assetId) = makeString(["%s%s", "delayInBlocks", assetId], SEP)
2629
2730
2831 func keyCreated (assetId) = makeString(["%s%s", "created", assetId], SEP)
2932
3033
3134 func keyAssetIdToLPId (assetId) = makeString(["%s%s", "assetIdToLPId", assetId], SEP)
3235
3336
3437 func keyLPIdToAssetId (lpId) = makeString(["%s%s", "lpIdToAssetId", lpId], SEP)
3538
3639
3740 func keyProxyAddress (assetId) = makeString(["%s%s", "proxyAddress", assetId], SEP)
3841
3942
4043 func keyMappingsUserToWithdrawal (assetId,userAddress,txId) = makeString(["%s%s%s%s", "userWithdrawalAmount", assetId, userAddress, txId], SEP)
4144
4245
4346 func keyOtherChainAssetDecimals (assetId) = makeString(["%s%s", "otherChainAssetDecimals", assetId], SEP)
4447
4548
4649 func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP)
4750
4851
4952 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
5053 case s: String =>
5154 fromBase58String(s)
5255 case _: Unit =>
5356 unit
5457 case _ =>
5558 throw("Match error")
5659 }
5760
5861
5962 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
6063 case s: String =>
6164 fromBase58String(s)
6265 case _: Unit =>
6366 unit
6467 case _ =>
6568 throw("Match error")
6669 }
6770
6871
6972 func throwErr (msg) = throw((contract + msg))
7073
7174
7275 func mustManager (i) = {
7376 let pd = throwErr("permission denied")
7477 match managerPublicKeyOrUnit() {
7578 case pk: ByteVector =>
7679 if ((i.callerPublicKey == pk))
7780 then true
7881 else pd
7982 case _: Unit =>
8083 if ((i.caller == this))
8184 then true
8285 else pd
8386 case _ =>
8487 throw("Match error")
8588 }
8689 }
8790
8891
8992 func assetsStoreContract () = addressFromStringValue(value(getString(keyAssetsStoreContract())))
9093
9194
9295 func mustProxyAddress (i,assetId) = {
9396 let isProxy = (toString(i.caller) == valueOrElse(getString(keyProxyAddress(assetId)), EMPTY))
9497 if (isProxy)
9598 then true
9699 else {
97100 let checkCaller = mustManager(i)
98101 if ((checkCaller == checkCaller))
99102 then true
100103 else throw("Strict value is not equal to itself.")
101104 }
102105 }
103106
104107
105108 @Callable(i)
106109 func constructor (assetsStoreContract) = {
107110 let checkCaller = mustManager(i)
108111 if ((checkCaller == checkCaller))
109112 then [StringEntry(keyAssetsStoreContract(), assetsStoreContract)]
110113 else throw("Strict value is not equal to itself.")
111114 }
112115
113116
114117
115118 @Callable(i)
116119 func put () = {
117120 let pmt = value(i.payments[0])
118121 let asset = value(pmt.assetId)
119122 let assetId = toBase58String(asset)
120123 let checks = [if ((size(i.payments) == 1))
121124 then true
122125 else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(assetId)), false))
123126 then true
124127 else throwErr("attached payment asset must be registered in the contract"), if ((pmt.amount > 0))
125128 then true
126129 else throwErr("positive amount required")]
127130 if ((checks == checks))
128131 then {
129132 let tvl = valueOrElse(getInteger(keyTVL(assetId)), 0)
130133 let lpId = value(getString(keyAssetIdToLPId(assetId)))
131134 let lpInfo = value(assetInfo(fromBase58String(assetId)))
132135 let sharesAmount = if ((tvl > 0))
133136 then ((pmt.amount * lpInfo.quantity) / tvl)
134137 else pmt.amount
135138 [Reissue(lpInfo.id, sharesAmount, true), ScriptTransfer(i.caller, sharesAmount, lpInfo.id)]
136139 }
137140 else throw("Strict value is not equal to itself.")
138141 }
139142
140143
141144
142145 @Callable(i)
143146 func submitGetRequest () = {
144147 let pmt = value(i.payments[0])
145148 let lp = value(pmt.assetId)
146149 let lpId = toBase58String(lp)
147150 let userAddress = toString(i.caller)
148151 let baseAssetId = value(getString(keyLPIdToAssetId(lpId)))
149152 let shares = pmt.amount
150153 let checks = [if ((size(i.payments) == 1))
151154 then true
152155 else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(baseAssetId)), false))
153156 then true
154157 else throwErr("attached payment asset must be registered in the contract"), if ((shares > 0))
155158 then true
156159 else throwErr("positive amount to withdrawal required")]
157160 if ((checks == checks))
158161 then {
159162 let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(baseAssetId)), 0)
160163 let tvl = valueOrElse(getInteger(keyTVL(baseAssetId)), 0)
161164 let lpInfo = value(assetInfo(lp))
162165 let decimals = lpInfo.decimals
163166 let withdrawalAmount = ((shares * tvl) / lpInfo.quantity)
164167 [Burn(lp, shares), IntegerEntry(keyPendingWithdrawals(baseAssetId), (pendingWithdrawals + withdrawalAmount)), IntegerEntry(keyMappingsUserToWithdrawal(baseAssetId, userAddress, toBase58String(i.transactionId)), withdrawalAmount)]
165168 }
166169 else throw("Strict value is not equal to itself.")
167170 }
168171
169172
170173
171174 @Callable(i)
172175 func executeGetRequest (assetId,userAddress,submitTxId) = {
173176 let withdrawalAmount = valueOrElse(getInteger(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId)), 0)
174177 let checks = [if (valueOrElse(getBoolean(keyCreated(assetId)), false))
175178 then true
176179 else throwErr("asset must be registered in the contract"), if ((withdrawalAmount > 0))
177180 then true
178181 else throwErr("no corresponding withdrawal request")]
179182 if ((checks == checks))
180183 then {
181184 let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(assetId)), 0)
182185 [ScriptTransfer(addressFromStringValue(userAddress), withdrawalAmount, fromBase58String(assetId)), DeleteEntry(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId)), IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - withdrawalAmount))]
183186 }
184187 else throw("Strict value is not equal to itself.")
185188 }
186189
187190
188191
189192 @Callable(i)
190193 func registerAsset (assetId,lpName,lpDescription,lpLogo,delayInBlocks,proxyAddress,otherChainAssetDecimals) = {
191194 let checks = [mustManager(i), if ((delayInBlocks >= 0))
192195 then true
193196 else throwErr("invalid delayInBlocks"), if ((addressFromString(proxyAddress) != unit))
194197 then true
195198 else throwErr("invalid proxyAddress"), if ((valueOrElse(getBoolean(keyCreated(assetId)), false) == false))
196199 then true
197200 else throwErr("asset already registered")]
198201 if ((checks == checks))
199202 then {
200203 let decimals = value(assetInfo(fromBase58String(assetId))).decimals
201204 let lpIssue = Issue(lpName, lpDescription, 1, decimals, true)
202205 let lp = calculateAssetId(lpIssue)
203206 let lpId = toBase58String(lp)
204207 let createOrUpdate = invoke(assetsStoreContract(), "createOrUpdate", [lpId, lpLogo, false], nil)
205208 if ((createOrUpdate == createOrUpdate))
206209 then {
207210 let addLabel = invoke(assetsStoreContract(), "addLabel", [lpId, "DEFI"], nil)
208211 if ((addLabel == addLabel))
209212 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)]
210213 else throw("Strict value is not equal to itself.")
211214 }
212215 else throw("Strict value is not equal to itself.")
213216 }
214217 else throw("Strict value is not equal to itself.")
215218 }
216219
217220
218221
219222 @Callable(i)
220223 func topUpBalance () = {
221224 let pmt = valueOrErrorMessage(i.payments[0], (contract + "payment must be attached"))
222225 let assetId = toBase58String(value(pmt.assetId))
223226 let amount = pmt.amount
224227 let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(assetId)), 0)
225228 let checks = [mustProxyAddress(i, assetId), if ((size(i.payments) == 1))
226229 then true
227230 else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(assetId)), false))
228231 then true
229232 else throwErr("attached payment asset must be registered in the contract"), if ((pendingWithdrawals != 0))
230233 then true
231234 else throwErr("zero pendingWithdrawals, nothing to top up"), if ((pendingWithdrawals >= amount))
232235 then true
233- else "amount to top up must be less or equal than pendingWithdrawals"]
236+ else throwErr("amount to top up must be less or equal than pendingWithdrawals"), if ((getInteger(keyTopUpHistory(assetId, height)) == unit))
237+ then true
238+ else throwErr("already have topUp in current block, wait for next block")]
234239 if ((checks == checks))
235- then [IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - amount))]
240+ then [IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - amount)), IntegerEntry(keyTopUpHistory(assetId, height), amount)]
236241 else throw("Strict value is not equal to itself.")
237242 }
238243
239244
240245
241246 @Callable(i)
242247 func setTVL (assetId,newStrTVL) = {
243248 let checks = [mustProxyAddress(i, assetId), if (valueOrElse(getBoolean(keyCreated(assetId)), false))
244249 then true
245- else throwErr("asset must be registered in the contract")]
250+ else throwErr("asset must be registered in the contract"), if ((getInteger(keyTVLHistory(assetId, height)) == unit))
251+ then true
252+ else throwErr("already have setTVL in current block, wait for next block")]
246253 if ((checks == checks))
247254 then {
248255 let newBigIntTVL = parseBigIntValue(newStrTVL)
249256 let ten = parseBigIntValue("10")
250257 let assetDecimals = value(assetInfo(fromBase58String(assetId))).decimals
251258 let otherChainAssetDecimals = value(getInteger(keyOtherChainAssetDecimals(assetId)))
252259 let newTVLWavesDecimals = if ((otherChainAssetDecimals > assetDecimals))
253260 then {
254261 let diff = parseBigIntValue(toString((otherChainAssetDecimals - assetDecimals)))
255262 (newBigIntTVL / pow(ten, 0, diff, 0, 0, DOWN))
256263 }
257264 else if ((assetDecimals > otherChainAssetDecimals))
258265 then {
259266 let diff = parseBigIntValue(toString((assetDecimals - otherChainAssetDecimals)))
260267 (newBigIntTVL * pow(ten, 0, diff, 0, 0, DOWN))
261268 }
262269 else newBigIntTVL
263270 let newTVL = toInt(newTVLWavesDecimals)
264271 [IntegerEntry(keyTVL(assetId), newTVL), IntegerEntry(keyTVLHistory(assetId, height), newTVL)]
265272 }
266273 else throw("Strict value is not equal to itself.")
267274 }
268275
269276
270277
271278 @Callable(i)
272279 func setManager (pendingManagerPublicKey) = {
273280 let checkCaller = mustManager(i)
274281 if ((checkCaller == checkCaller))
275282 then {
276283 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
277284 if ((checkManagerPublicKey == checkManagerPublicKey))
278285 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
279286 else throw("Strict value is not equal to itself.")
280287 }
281288 else throw("Strict value is not equal to itself.")
282289 }
283290
284291
285292
286293 @Callable(i)
287294 func confirmManager () = {
288295 let pm = pendingManagerPublicKeyOrUnit()
289296 let hasPM = if (isDefined(pm))
290297 then true
291298 else throwErr("no pending manager")
292299 if ((hasPM == hasPM))
293300 then {
294301 let checkPM = if ((i.callerPublicKey == value(pm)))
295302 then true
296303 else throwErr("you are not pending manager")
297304 if ((checkPM == checkPM))
298305 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
299306 else throw("Strict value is not equal to itself.")
300307 }
301308 else throw("Strict value is not equal to itself.")
302309 }
303310
304311
305312 @Verifier(tx)
306313 func verify () = {
307314 let targetPublicKey = match managerPublicKeyOrUnit() {
308315 case pk: ByteVector =>
309316 pk
310317 case _: Unit =>
311318 tx.senderPublicKey
312319 case _ =>
313320 throw("Match error")
314321 }
315322 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
316323 }
317324

github/deemru/w8io/026f985 
47.93 ms