tx · J78Pt3YfBwHAVf6ptMvBLvzAyznFXL4h1rHqAdNS74Dh

3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu:  -0.01700000 Waves

2022.06.08 19:55 [2087661] smart account 3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu > SELF 0.00000000 Waves

{ "type": 13, "id": "J78Pt3YfBwHAVf6ptMvBLvzAyznFXL4h1rHqAdNS74Dh", "fee": 1700000, "feeAssetId": null, "timestamp": 1654707397541, "version": 1, "sender": "3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu", "senderPublicKey": "668WwQVaWxezbvLEK3FccCSTbjst4zYAJDPrfLFRj9b9", "proofs": [ "5qqRnmhSA2vocNqRBHMo1w8cb5tZe32UvQzt6mhjGcLGFxTwGjdSQ9uATYsbTHjvZPYdsX1jmWv47cXH4rFFWof7" ], "script": "base64:AAIFAAAAAAAAACwIAhIDCgEIEgASABIFCgMICAgSCQoHCAgICAEIARIAEgQKAggBEgMKAQgSAAAAABYAAAAAA1NFUAIAAAACX18AAAAABUVNUFRZAgAAAAAAAAAACGNvbnRyYWN0AgAAAA9scF9zdGFraW5nX3YyOiABAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAACQAEuQAAAAIJAARMAAAAAgIAAAACJXMJAARMAAAAAgIAAAAQbWFuYWdlclB1YmxpY0tleQUAAAADbmlsBQAAAANTRVABAAAAGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAAAAAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAAF3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5BQAAAANuaWwFAAAAA1NFUAEAAAAGa2V5VFZMAAAAAQAAAAdhc3NldElkCQAEuQAAAAIJAARMAAAAAgIAAAAEJXMlcwkABEwAAAACAgAAAAN0dmwJAARMAAAAAgUAAAAHYXNzZXRJZAUAAAADbmlsBQAAAANTRVABAAAADWtleVRWTEhpc3RvcnkAAAACAAAAB2Fzc2V0SWQAAAAGaGVpZ2h0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kBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAAAAAUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAA90YXJnZXRQdWJsaWNLZXkEAAAAByRtYXRjaDAJAQAAABZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAAAAAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAACcGsFAAAAByRtYXRjaDAFAAAAAnBrAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0CAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAPdGFyZ2V0UHVibGljS2V5KHPJRw==", "chainId": 84, "height": 2087661, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9LA7qr8ZwkVPtVgErL9XCej1ZuCqeWCi6btZbdQZHBVY Next: 6sPeaTDqUhQpwXGNvnYT6n6xbuAnYxreRmSWLoseSPUw Diff:
OldNewDifferences
3838
3939
4040 func keyMappingsUserToWithdrawal (assetId,userAddress,txId) = makeString(["%s%s%s%s", "userWithdrawalAmount", assetId, userAddress, txId], SEP)
41+
42+
43+func keyOtherChainAssetDecimals (assetId) = makeString(["%s%s", "otherChainAssetDecimals", assetId], SEP)
4144
4245
4346 func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP)
184187
185188
186189 @Callable(i)
187-func registerAsset (assetId,lpName,lpDescription,lpLogo,delayInBlocks,proxyAddress) = {
190+func registerAsset (assetId,lpName,lpDescription,lpLogo,delayInBlocks,proxyAddress,otherChainAssetDecimals) = {
188191 let checks = [mustManager(i), if ((delayInBlocks >= 0))
189192 then true
190193 else throwErr("invalid delayInBlocks"), if ((addressFromString(proxyAddress) != unit))
203206 then {
204207 let addLabel = invoke(assetsStoreContract(), "addLabel", [lpId, "DEFI"], nil)
205208 if ((addLabel == addLabel))
206- 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), lpIssue, Burn(lp, 1)]
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)]
207210 else throw("Strict value is not equal to itself.")
208211 }
209212 else throw("Strict value is not equal to itself.")
236239
237240
238241 @Callable(i)
239-func setTVL (assetId,newTVL) = {
240- let checkCaller = mustProxyAddress(i, assetId)
241- if ((checkCaller == checkCaller))
242- then [IntegerEntry(keyTVL(assetId), newTVL), IntegerEntry(keyTVLHistory(assetId, height), newTVL)]
242+func setTVL (assetId,newRawTVL) = {
243+ let checks = [mustProxyAddress(i, assetId), if (valueOrElse(getBoolean(keyCreated(assetId)), false))
244+ then true
245+ else throwErr("asset must be registered in the contract")]
246+ if ((checks == checks))
247+ then {
248+ let assetDecimals = value(assetInfo(fromBase58String(assetId))).decimals
249+ let otherChainAssetDecimals = value(getInteger(keyOtherChainAssetDecimals(assetId)))
250+ let newTVL = if ((otherChainAssetDecimals > assetDecimals))
251+ then {
252+ let diff = (otherChainAssetDecimals - assetDecimals)
253+ (newRawTVL / pow(10, 0, diff, 0, 0, DOWN))
254+ }
255+ else if ((assetDecimals > otherChainAssetDecimals))
256+ then {
257+ let diff = (assetDecimals - otherChainAssetDecimals)
258+ (newRawTVL * pow(10, 0, diff, 0, 0, DOWN))
259+ }
260+ else newRawTVL
261+[IntegerEntry(keyTVL(assetId), newTVL), IntegerEntry(keyTVLHistory(assetId, height), newTVL)]
262+ }
243263 else throw("Strict value is not equal to itself.")
244264 }
245265
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)
2020
2121
2222 func keyPendingWithdrawals (assetId) = makeString(["%s%s", "pendingWithdrawals", assetId], SEP)
2323
2424
2525 func keyDelayInBlocks (assetId) = makeString(["%s%s", "delayInBlocks", assetId], SEP)
2626
2727
2828 func keyCreated (assetId) = makeString(["%s%s", "created", assetId], SEP)
2929
3030
3131 func keyAssetIdToLPId (assetId) = makeString(["%s%s", "assetIdToLPId", assetId], SEP)
3232
3333
3434 func keyLPIdToAssetId (lpId) = makeString(["%s%s", "lpIdToAssetId", lpId], SEP)
3535
3636
3737 func keyProxyAddress (assetId) = makeString(["%s%s", "proxyAddress", assetId], SEP)
3838
3939
4040 func keyMappingsUserToWithdrawal (assetId,userAddress,txId) = makeString(["%s%s%s%s", "userWithdrawalAmount", assetId, userAddress, txId], SEP)
41+
42+
43+func keyOtherChainAssetDecimals (assetId) = makeString(["%s%s", "otherChainAssetDecimals", assetId], SEP)
4144
4245
4346 func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP)
4447
4548
4649 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
4750 case s: String =>
4851 fromBase58String(s)
4952 case _: Unit =>
5053 unit
5154 case _ =>
5255 throw("Match error")
5356 }
5457
5558
5659 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
5760 case s: String =>
5861 fromBase58String(s)
5962 case _: Unit =>
6063 unit
6164 case _ =>
6265 throw("Match error")
6366 }
6467
6568
6669 func throwErr (msg) = throw((contract + msg))
6770
6871
6972 func mustManager (i) = {
7073 let pd = throwErr("permission denied")
7174 match managerPublicKeyOrUnit() {
7275 case pk: ByteVector =>
7376 if ((i.callerPublicKey == pk))
7477 then true
7578 else pd
7679 case _: Unit =>
7780 if ((i.caller == this))
7881 then true
7982 else pd
8083 case _ =>
8184 throw("Match error")
8285 }
8386 }
8487
8588
8689 func assetsStoreContract () = addressFromStringValue(value(getString(keyAssetsStoreContract())))
8790
8891
8992 func mustProxyAddress (i,assetId) = {
9093 let isProxy = (toString(i.caller) == valueOrElse(getString(keyProxyAddress(assetId)), EMPTY))
9194 if (isProxy)
9295 then true
9396 else {
9497 let checkCaller = mustManager(i)
9598 if ((checkCaller == checkCaller))
9699 then true
97100 else throw("Strict value is not equal to itself.")
98101 }
99102 }
100103
101104
102105 @Callable(i)
103106 func constructor (assetsStoreContract) = {
104107 let checkCaller = mustManager(i)
105108 if ((checkCaller == checkCaller))
106109 then [StringEntry(keyAssetsStoreContract(), assetsStoreContract)]
107110 else throw("Strict value is not equal to itself.")
108111 }
109112
110113
111114
112115 @Callable(i)
113116 func put () = {
114117 let pmt = value(i.payments[0])
115118 let asset = value(pmt.assetId)
116119 let assetId = toBase58String(asset)
117120 let checks = [if ((size(i.payments) == 1))
118121 then true
119122 else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(assetId)), false))
120123 then true
121124 else throwErr("attached payment asset must be registered in the contract"), if ((pmt.amount > 0))
122125 then true
123126 else throwErr("positive amount required")]
124127 if ((checks == checks))
125128 then {
126129 let tvl = valueOrElse(getInteger(keyTVL(assetId)), 0)
127130 let lpId = value(getString(keyAssetIdToLPId(assetId)))
128131 let lpInfo = value(assetInfo(fromBase58String(assetId)))
129132 let sharesAmount = if ((tvl > 0))
130133 then ((pmt.amount * lpInfo.quantity) / tvl)
131134 else pmt.amount
132135 [Reissue(lpInfo.id, sharesAmount, true), ScriptTransfer(i.caller, sharesAmount, lpInfo.id)]
133136 }
134137 else throw("Strict value is not equal to itself.")
135138 }
136139
137140
138141
139142 @Callable(i)
140143 func submitGetRequest () = {
141144 let pmt = value(i.payments[0])
142145 let lp = value(pmt.assetId)
143146 let lpId = toBase58String(lp)
144147 let userAddress = toString(i.caller)
145148 let baseAssetId = value(getString(keyLPIdToAssetId(lpId)))
146149 let shares = pmt.amount
147150 let checks = [if ((size(i.payments) == 1))
148151 then true
149152 else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(baseAssetId)), false))
150153 then true
151154 else throwErr("attached payment asset must be registered in the contract"), if ((shares > 0))
152155 then true
153156 else throwErr("positive amount to withdrawal required")]
154157 if ((checks == checks))
155158 then {
156159 let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(baseAssetId)), 0)
157160 let tvl = valueOrElse(getInteger(keyTVL(baseAssetId)), 0)
158161 let lpInfo = value(assetInfo(lp))
159162 let decimals = lpInfo.decimals
160163 let withdrawalAmount = ((shares * tvl) / lpInfo.quantity)
161164 [Burn(lp, shares), IntegerEntry(keyPendingWithdrawals(baseAssetId), (pendingWithdrawals + withdrawalAmount)), IntegerEntry(keyMappingsUserToWithdrawal(baseAssetId, userAddress, toBase58String(i.transactionId)), withdrawalAmount)]
162165 }
163166 else throw("Strict value is not equal to itself.")
164167 }
165168
166169
167170
168171 @Callable(i)
169172 func executeGetRequest (assetId,userAddress,submitTxId) = {
170173 let withdrawalAmount = valueOrElse(getInteger(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId)), 0)
171174 let checks = [if (valueOrElse(getBoolean(keyCreated(assetId)), false))
172175 then true
173176 else throwErr("asset must be registered in the contract"), if ((withdrawalAmount > 0))
174177 then true
175178 else throwErr("no corresponding withdrawal request")]
176179 if ((checks == checks))
177180 then {
178181 let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(assetId)), 0)
179182 [ScriptTransfer(addressFromStringValue(userAddress), withdrawalAmount, fromBase58String(assetId)), DeleteEntry(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId)), IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - withdrawalAmount))]
180183 }
181184 else throw("Strict value is not equal to itself.")
182185 }
183186
184187
185188
186189 @Callable(i)
187-func registerAsset (assetId,lpName,lpDescription,lpLogo,delayInBlocks,proxyAddress) = {
190+func registerAsset (assetId,lpName,lpDescription,lpLogo,delayInBlocks,proxyAddress,otherChainAssetDecimals) = {
188191 let checks = [mustManager(i), if ((delayInBlocks >= 0))
189192 then true
190193 else throwErr("invalid delayInBlocks"), if ((addressFromString(proxyAddress) != unit))
191194 then true
192195 else throwErr("invalid proxyAddress"), if ((valueOrElse(getBoolean(keyCreated(assetId)), false) == false))
193196 then true
194197 else throwErr("asset already registered")]
195198 if ((checks == checks))
196199 then {
197200 let decimals = value(assetInfo(fromBase58String(assetId))).decimals
198201 let lpIssue = Issue(lpName, lpDescription, 1, decimals, true)
199202 let lp = calculateAssetId(lpIssue)
200203 let lpId = toBase58String(lp)
201204 let createOrUpdate = invoke(assetsStoreContract(), "createOrUpdate", [lpId, lpLogo, false], nil)
202205 if ((createOrUpdate == createOrUpdate))
203206 then {
204207 let addLabel = invoke(assetsStoreContract(), "addLabel", [lpId, "DEFI"], nil)
205208 if ((addLabel == addLabel))
206- 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), lpIssue, Burn(lp, 1)]
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)]
207210 else throw("Strict value is not equal to itself.")
208211 }
209212 else throw("Strict value is not equal to itself.")
210213 }
211214 else throw("Strict value is not equal to itself.")
212215 }
213216
214217
215218
216219 @Callable(i)
217220 func topUpBalance () = {
218221 let pmt = valueOrErrorMessage(i.payments[0], (contract + "payment must be attached"))
219222 let assetId = toBase58String(value(pmt.assetId))
220223 let amount = pmt.amount
221224 let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(assetId)), 0)
222225 let checks = [mustProxyAddress(i, assetId), if ((size(i.payments) == 1))
223226 then true
224227 else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(assetId)), false))
225228 then true
226229 else throwErr("attached payment asset must be registered in the contract"), if ((pendingWithdrawals != 0))
227230 then true
228231 else throwErr("zero pendingWithdrawals, nothing to top up"), if ((pendingWithdrawals >= amount))
229232 then true
230233 else "amount to top up must be less or equal than pendingWithdrawals"]
231234 if ((checks == checks))
232235 then [IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - amount))]
233236 else throw("Strict value is not equal to itself.")
234237 }
235238
236239
237240
238241 @Callable(i)
239-func setTVL (assetId,newTVL) = {
240- let checkCaller = mustProxyAddress(i, assetId)
241- if ((checkCaller == checkCaller))
242- then [IntegerEntry(keyTVL(assetId), newTVL), IntegerEntry(keyTVLHistory(assetId, height), newTVL)]
242+func setTVL (assetId,newRawTVL) = {
243+ let checks = [mustProxyAddress(i, assetId), if (valueOrElse(getBoolean(keyCreated(assetId)), false))
244+ then true
245+ else throwErr("asset must be registered in the contract")]
246+ if ((checks == checks))
247+ then {
248+ let assetDecimals = value(assetInfo(fromBase58String(assetId))).decimals
249+ let otherChainAssetDecimals = value(getInteger(keyOtherChainAssetDecimals(assetId)))
250+ let newTVL = if ((otherChainAssetDecimals > assetDecimals))
251+ then {
252+ let diff = (otherChainAssetDecimals - assetDecimals)
253+ (newRawTVL / pow(10, 0, diff, 0, 0, DOWN))
254+ }
255+ else if ((assetDecimals > otherChainAssetDecimals))
256+ then {
257+ let diff = (assetDecimals - otherChainAssetDecimals)
258+ (newRawTVL * pow(10, 0, diff, 0, 0, DOWN))
259+ }
260+ else newRawTVL
261+[IntegerEntry(keyTVL(assetId), newTVL), IntegerEntry(keyTVLHistory(assetId, height), newTVL)]
262+ }
243263 else throw("Strict value is not equal to itself.")
244264 }
245265
246266
247267
248268 @Callable(i)
249269 func setManager (pendingManagerPublicKey) = {
250270 let checkCaller = mustManager(i)
251271 if ((checkCaller == checkCaller))
252272 then {
253273 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
254274 if ((checkManagerPublicKey == checkManagerPublicKey))
255275 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
256276 else throw("Strict value is not equal to itself.")
257277 }
258278 else throw("Strict value is not equal to itself.")
259279 }
260280
261281
262282
263283 @Callable(i)
264284 func confirmManager () = {
265285 let pm = pendingManagerPublicKeyOrUnit()
266286 let hasPM = if (isDefined(pm))
267287 then true
268288 else throwErr("no pending manager")
269289 if ((hasPM == hasPM))
270290 then {
271291 let checkPM = if ((i.callerPublicKey == value(pm)))
272292 then true
273293 else throwErr("you are not pending manager")
274294 if ((checkPM == checkPM))
275295 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
276296 else throw("Strict value is not equal to itself.")
277297 }
278298 else throw("Strict value is not equal to itself.")
279299 }
280300
281301
282302 @Verifier(tx)
283303 func verify () = {
284304 let targetPublicKey = match managerPublicKeyOrUnit() {
285305 case pk: ByteVector =>
286306 pk
287307 case _: Unit =>
288308 tx.senderPublicKey
289309 case _ =>
290310 throw("Match error")
291311 }
292312 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
293313 }
294314

github/deemru/w8io/026f985 
45.76 ms