tx · 8FurQAffAdR21eerYn7eGTv7kMunvoJhooZecsmtyTs4

3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk:  -0.01700000 Waves

2023.01.17 13:50 [2408829] smart account 3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk > SELF 0.00000000 Waves

{ "type": 13, "id": "8FurQAffAdR21eerYn7eGTv7kMunvoJhooZecsmtyTs4", "fee": 1700000, "feeAssetId": null, "timestamp": 1673952632650, "version": 1, "sender": "3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk", "senderPublicKey": "2rdeGwVMkuRfRdUgrYaekNmjnegHokhyDx1z6TJq525F", "proofs": [ "54YbYnwG1x1oVkJbBXoYAqZdfppxR6QCzPsfiusCiUw5cadj5PsD5crbJyK9Hi5NvPujEv1avJsuLbjtiVD1oMPC" ], "script": "base64:AAIEAAAAAAAAB9wIAhIHCgUICAgBCBIDCgEBEgASABIFCgMICAgSAwoBCBIDCgEIIgNTRVAiD2dldFN0cmluZ09yRmFpbCIDa2V5IhBnZXRCb29sZWFuT3JGYWlsIg5mYWlsRXhlY3V0ZUdldCIDbXNnIgxiYXNlQXNzZXRTdHIiDnVzZXJBZGRyZXNzU3RyIgpnZXRUeElkU3RyIgtrZXlBc3NldENmZyIWa2V5TmV4dEludGVybmFsQXNzZXRJZCIMa2V5UHJpY2VMYXN0IhVpbnRlcm5hbEJhc2V0QXNzZXRTdHIiEmtleVRvcFVwTGFzdEhlaWdodCIGc2VuZGVyIg9rZXlQcmljZUhpc3RvcnkiAWgiCXRpbWVzdGFtcCIOa2V5VG90YWxMb2NrZWQiFGtleVRvdGFsTG9ja2VkQnlVc2VyIhRpbnRlcm5hbEJhc2VBc3NldFN0ciIfa2V5TWFwcGluZ3NJbnRlcm5hbDJiYXNlQXNzZXRJZCIRaW50ZXJuYWxCYXNlQXNzZXQiH2tleU1hcHBpbmdzQmFzZUFzc2V0MmludGVybmFsSWQiHGtleU1hcHBpbmdzU2hhcmUyYmFzZ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cnJlbnRTeXNQYXJhbXNSRVNUBQAAAANuaWwFAAAAAWEJAAACAAAAAQUAAAACYmsAAAABAAAAAmJsAQAAAAJibQAAAAAJAAH0AAAAAwgFAAAAAmJsAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACYmwAAAAGcHJvb2ZzAAAAAAAAAAAACQACWQAAAAECAAAALDJDYmQ4b3pHN0ExUnlSTkMzbk5uWmdIdTdSdTRLM0pDZnB5UGtocXI5enhx7qRurw==", "chainId": 84, "height": 2408829, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 28DAJQDGWMLhKmHRTCR72v11NDteh36ZBGJh2syKuDFX Next: none Diff:
OldNewDifferences
1-{-# STDLIB_VERSION 6 #-}
1+{-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
5-
6-func wrapErr (msg) = makeString(["lp_staking.ride:", msg], " ")
7-
8-
9-func throwErr (msg) = throw(wrapErr(msg))
10-
115
126 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key))
137
5448 func keyShutdownPutOperation (internalBaseAssetStr) = ("%s%s%d__shutdown__put__" + internalBaseAssetStr)
5549
5650
57-func keyShutdown (internalBaseAssetStr) = ("%s%d__shutdown__" + internalBaseAssetStr)
58-
59-
6051 func keyShutdownManager (internalBaseAssetStr) = ("%s%s%d__shutdown__manager__" + internalBaseAssetStr)
6152
6253
6960 let IdxCfgDecimalsMultPrice = 4
7061
7162 let IdxCfgGetDelayBlocks = 5
72-
73-func keyManagerPublicKey () = "%s__managerPublicKey"
74-
75-
76-func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
77-
78-
79-func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
80- case s: String =>
81- fromBase58String(s)
82- case _: Unit =>
83- unit
84- case _ =>
85- throw("Match error")
86-}
87-
88-
89-func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
90- case s: String =>
91- fromBase58String(s)
92- case _: Unit =>
93- unit
94- case _ =>
95- throw("Match error")
96-}
97-
98-
99-let permissionDeniedError = throw("Permission denied")
100-
101-func mustThis (i) = if ((i.caller == this))
102- then true
103- else permissionDeniedError
104-
105-
106-func mustManager (i) = match managerPublicKeyOrUnit() {
107- case pk: ByteVector =>
108- if ((i.callerPublicKey == pk))
109- then true
110- else permissionDeniedError
111- case _: Unit =>
112- mustThis(i)
113- case _ =>
114- throw("Match error")
115-}
116-
117-
118-let lpStakingPoolsContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(makeString(["%s", "lpStakingPoolsContract"], SEP)), wrapErr("lp_staking_pools contract address is undefined"))), wrapErr("invalid lp_staking_pools contract address"))
11963
12064 func dataAssetCfg (shareAssetStr,internalBaseAssetStr,decimalsMultBothAssets,decimalsMultPrice,getDelayInBlocks) = makeString(["%s%d%d%d%d", shareAssetStr, internalBaseAssetStr, toString(decimalsMultBothAssets), toString(decimalsMultPrice), toString(getDelayInBlocks)], SEP)
12165
216160 func adminRegisterAsset (baseAssetStr,shareAssetName,shareAssetDescr,getDelayinBlocks,shutdownManagerAddress) = {
217161 let baseAssetId = fromBase58String(baseAssetStr)
218162 let decimals = value(assetInfo(baseAssetId)).decimals
219- let checkCaller = mustManager(i)
220- if ((checkCaller == checkCaller))
221- then if ((toString(addressFromStringValue(shutdownManagerAddress)) != shutdownManagerAddress))
163+ if ((i.caller != this))
164+ then throw("permissions denied")
165+ else if ((toString(addressFromStringValue(shutdownManagerAddress)) != shutdownManagerAddress))
222166 then throw("invalid shutdownManagerAddress")
223167 else if ((0 > getDelayinBlocks))
224168 then throw(("invalid getDelayinBlocks=" + toString(getDelayinBlocks)))
233177 let internalBaseAssetStr = toString(internalBaseAssettId)
234178 [StringEntry(keyAssetCfg(baseAssetStr), dataAssetCfg(shareAssetStr, internalBaseAssetStr, decimalsMultBothAssets, decimalsMultPrice, getDelayinBlocks)), StringEntry(keyMappingsInternal2baseAssetId(internalBaseAssettId), baseAssetStr), StringEntry(keyMappingsBaseAsset2internalId(baseAssetStr), internalBaseAssetStr), StringEntry(keyMappingsShare2baseAssetId(shareAssetStr), baseAssetStr), StringEntry(keyMappingsBaseAsset2shareId(baseAssetStr), shareAssetStr), BooleanEntry(keyShutdownPutOperation(internalBaseAssetStr), false), StringEntry(keyShutdownManager(internalBaseAssetStr), shutdownManagerAddress), IntegerEntry(keyNextInternalAssetId(), (internalBaseAssettId + 1)), IntegerEntry(keyPriceLast(internalBaseAssetStr), startPrice), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), startPrice), shareAssetIssueAction, Burn(shareAssetId, 1)]
235179 }
236- else throw("Strict value is not equal to itself.")
237180 }
238181
239182
265208 let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
266209 let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
267210 let isPutBlocked = getBooleanOrFail(keyShutdownPutOperation(internalBaseAssetStr))
268- let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
269- if (if (isPutBlocked)
270- then true
271- else shutdown)
211+ if (isPutBlocked)
272212 then throw("put operation is blocked")
273213 else {
274214 let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
295235 let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
296236 let getDelayBlocks = parseIntValue(cfgArray[IdxCfgGetDelayBlocks])
297237 let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
298- let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
299- if (shutdown)
300- then throw("operation is blocked")
301- else {
302- let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
303- let baseAssetAmount = fraction(shareAssetAmount, price, decimalsMultPrice)
304- let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId))
305- let operationData = dataOperation("PENDING", shareAssetAmount, price, baseAssetAmount, height, lastBlock.timestamp, (height + getDelayBlocks), 0)
238+ let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
239+ let baseAssetAmount = fraction(shareAssetAmount, price, decimalsMultPrice)
240+ let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId))
241+ let operationData = dataOperation("PENDING", shareAssetAmount, price, baseAssetAmount, height, lastBlock.timestamp, (height + getDelayBlocks), 0)
306242 [Burn(shareAssetId, shareAssetAmount), StringEntry(operationKey, operationData), incrementTotalLocked(keyTotalLocked(internalBaseAssetStr), shareAssetAmount, baseAssetAmount), incrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), shareAssetAmount, baseAssetAmount)]
307- }
308243 }
309244
310245
316251 let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId])
317252 let baseAssetId = fromBase58String(baseAssetStr)
318253 let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset]
319- let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
320- if (shutdown)
321- then throw("operation is blocked")
322- else {
323- let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, getTxIdStr)
324- let operationArray = split(getStringOrFail(operationKey), SEP)
325- let status = operationArray[IdxOperStatus]
326- let endHeight = parseIntValue(operationArray[IdxOperEndHeight])
327- let inShareAmount = parseIntValue(operationArray[IdxOperInAmount])
328- let outBaseAmount = parseIntValue(operationArray[IdxOperOutAmount])
329- if ((status != "PENDING"))
330- then failExecuteGet("Status is not PENDING", baseAssetStr, userAddressStr, getTxIdStr)
331- else if ((endHeight > height))
332- then failExecuteGet(((("EndHeight[" + toString(endHeight)) + "] > ") + toString(height)), baseAssetStr, userAddressStr, getTxIdStr)
333- else [ScriptTransfer(userAddress, outBaseAmount, baseAssetId), StringEntry(operationKey, dataOperationExecutionUpdate(operationArray, "FINISHED", lastBlock.timestamp)), decrementTotalLocked(keyTotalLocked(internalBaseAssetStr), inShareAmount, outBaseAmount), decrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), inShareAmount, outBaseAmount)]
334- }
254+ let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, getTxIdStr)
255+ let operationArray = split(getStringOrFail(operationKey), SEP)
256+ let status = operationArray[IdxOperStatus]
257+ let endHeight = parseIntValue(operationArray[IdxOperEndHeight])
258+ let inShareAmount = parseIntValue(operationArray[IdxOperInAmount])
259+ let outBaseAmount = parseIntValue(operationArray[IdxOperOutAmount])
260+ if ((status != "PENDING"))
261+ then failExecuteGet("Status is not PENDING", baseAssetStr, userAddressStr, getTxIdStr)
262+ else if ((endHeight > height))
263+ then failExecuteGet(((("EndHeight[" + toString(endHeight)) + "] > ") + toString(height)), baseAssetStr, userAddressStr, getTxIdStr)
264+ else [ScriptTransfer(userAddress, outBaseAmount, baseAssetId), StringEntry(operationKey, dataOperationExecutionUpdate(operationArray, "FINISHED", lastBlock.timestamp)), decrementTotalLocked(keyTotalLocked(internalBaseAssetStr), inShareAmount, outBaseAmount), decrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), inShareAmount, outBaseAmount)]
335265 }
336266
337267
348278 let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset]
349279 let topUpLastHeightKEY = keyTopUpLastHeight(internalBaseAssetStr, toString(i.caller))
350280 let topUpLastHeight = valueOrElse(getInteger(this, topUpLastHeightKEY), 0)
351- let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
352- if (shutdown)
353- then throw("operation is blocked")
354- else if ((baseAssetStr != pmtAssetStr))
355- then throw("attached payment's asset id is NOT matched passed baseAssetStr")
356- else if ((size(i.payments) > 1))
357- then throw("only one payment can be attached")
358- else if ((100 > (height - topUpLastHeight)))
359- then throw("1 topUp per 100 blocks from the same address is allowed")
360- else {
361- let price = genericCalcPrice(internalBaseAssetStr, pmtAssetId, pmt.amount, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
281+ if ((baseAssetStr != pmtAssetStr))
282+ then throw("attached payment's asset id is NOT matched passed baseAssetStr")
283+ else if ((size(i.payments) > 1))
284+ then throw("only one payment can be attached")
285+ else if ((100 > (height - topUpLastHeight)))
286+ then throw("1 topUp per 100 blocks from the same address is allowed")
287+ else {
288+ let price = genericCalcPrice(internalBaseAssetStr, pmtAssetId, pmt.amount, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
362289 [IntegerEntry(keyPriceLast(internalBaseAssetStr), price), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), price), IntegerEntry(topUpLastHeightKEY, height)]
363- }
364- }
365-
366-
367-
368-@Callable(i)
369-func emit (assetId,amount) = {
370- let checks = [if ((i.caller == lpStakingPoolsContract))
371- then true
372- else throwErr("permission denied"), if ((amount > 0))
373- then true
374- else throwErr("invalid amount to emit"), if ((getString(keyMappingsShare2baseAssetId(toBase58String(assetId))) != unit))
375- then true
376- else throwErr("invalid assetId")]
377- if ((checks == checks))
378- then {
379- let isReissuable = true
380- $Tuple2([Reissue(assetId, amount, isReissuable), ScriptTransfer(lpStakingPoolsContract, amount, assetId)], amount)
381- }
382- else throw("Strict value is not equal to itself.")
383- }
384-
385-
386-
387-@Callable(i)
388-func burn (assetId,amount) = {
389- let checks = [if ((i.caller == lpStakingPoolsContract))
390- then true
391- else throwErr("permission denied"), if ((amount > 0))
392- then true
393- else throwErr("invalid amount to burn"), if ((getString(keyMappingsShare2baseAssetId(toBase58String(assetId))) != unit))
394- then true
395- else throwErr("invalid assetId")]
396- if ((checks == checks))
397- then $Tuple2([Burn(assetId, amount)], amount)
398- else throw("Strict value is not equal to itself.")
290+ }
399291 }
400292
401293
414306 }
415307
416308
417-
418-@Callable(i)
419-func setManager (pendingManagerPublicKey) = {
420- let checkCaller = mustManager(i)
421- if ((checkCaller == checkCaller))
422- then {
423- let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
424- if ((checkManagerPublicKey == checkManagerPublicKey))
425- then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
426- else throw("Strict value is not equal to itself.")
427- }
428- else throw("Strict value is not equal to itself.")
429- }
430-
431-
432-
433-@Callable(i)
434-func confirmManager () = {
435- let pm = pendingManagerPublicKeyOrUnit()
436- let hasPM = if (isDefined(pm))
437- then true
438- else throwErr("no pending manager")
439- if ((hasPM == hasPM))
440- then {
441- let checkPM = if ((i.callerPublicKey == value(pm)))
442- then true
443- else throwErr("you are not pending manager")
444- if ((checkPM == checkPM))
445- then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
446- else throw("Strict value is not equal to itself.")
447- }
448- else throw("Strict value is not equal to itself.")
449- }
450-
451-
452309 @Verifier(tx)
453-func verify () = {
454- let targetPublicKey = match managerPublicKeyOrUnit() {
455- case pk: ByteVector =>
456- pk
457- case _: Unit =>
458- tx.senderPublicKey
459- case _ =>
460- throw("Match error")
461- }
462- sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
463- }
310+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String("2Cbd8ozG7A1RyRNC3nNnZgHu7Ru4K3JCfpyPkhqr9zxq"))
464311
Full:
OldNewDifferences
1-{-# STDLIB_VERSION 6 #-}
1+{-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
5-
6-func wrapErr (msg) = makeString(["lp_staking.ride:", msg], " ")
7-
8-
9-func throwErr (msg) = throw(wrapErr(msg))
10-
115
126 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key))
137
148
159 func getBooleanOrFail (key) = valueOrErrorMessage(getBoolean(this, key), ("No data for this.key=" + key))
1610
1711
1812 func failExecuteGet (msg,baseAssetStr,userAddressStr,getTxIdStr) = throw(((((((msg + ": baseAssetStr=") + baseAssetStr) + " userAddressStr=") + userAddressStr) + " getTxIdStr=") + getTxIdStr))
1913
2014
2115 func keyAssetCfg (baseAssetStr) = ("%s%s%s__config__asset__" + baseAssetStr)
2216
2317
2418 func keyNextInternalAssetId () = "%s__nextInternalAssetId"
2519
2620
2721 func keyPriceLast (internalBasetAssetStr) = ("%s%s%d__price__last__" + internalBasetAssetStr)
2822
2923
3024 func keyTopUpLastHeight (internalBasetAssetStr,sender) = makeString(["%s%s%s%d%s__topup__last__height", internalBasetAssetStr, sender], SEP)
3125
3226
3327 func keyPriceHistory (internalBasetAssetStr,h,timestamp) = makeString(["%s%s%d%d%d__price__history", internalBasetAssetStr, toString(h), toString(timestamp)], SEP)
3428
3529
3630 func keyTotalLocked (internalBasetAssetStr) = ("%s%s%d__total__locked__" + internalBasetAssetStr)
3731
3832
3933 func keyTotalLockedByUser (internalBaseAssetStr,userAddressStr) = makeString(["%s%s%d%s__total__locked", internalBaseAssetStr, userAddressStr], SEP)
4034
4135
4236 func keyMappingsInternal2baseAssetId (internalBaseAsset) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(internalBaseAsset))
4337
4438
4539 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
4640
4741
4842 func keyMappingsShare2baseAssetId (shareAssetStr) = ("%s%s%s__mappings__share2baseAssetId__" + shareAssetStr)
4943
5044
5145 func keyMappingsBaseAsset2shareId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2shareId__" + baseAssetStr)
5246
5347
5448 func keyShutdownPutOperation (internalBaseAssetStr) = ("%s%s%d__shutdown__put__" + internalBaseAssetStr)
5549
5650
57-func keyShutdown (internalBaseAssetStr) = ("%s%d__shutdown__" + internalBaseAssetStr)
58-
59-
6051 func keyShutdownManager (internalBaseAssetStr) = ("%s%s%d__shutdown__manager__" + internalBaseAssetStr)
6152
6253
6354 let IdxCfgShareAssetId = 1
6455
6556 let IdxCfgInternalBaseAsset = 2
6657
6758 let IdxCfgDecimalsMultBothAssets = 3
6859
6960 let IdxCfgDecimalsMultPrice = 4
7061
7162 let IdxCfgGetDelayBlocks = 5
72-
73-func keyManagerPublicKey () = "%s__managerPublicKey"
74-
75-
76-func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
77-
78-
79-func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
80- case s: String =>
81- fromBase58String(s)
82- case _: Unit =>
83- unit
84- case _ =>
85- throw("Match error")
86-}
87-
88-
89-func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
90- case s: String =>
91- fromBase58String(s)
92- case _: Unit =>
93- unit
94- case _ =>
95- throw("Match error")
96-}
97-
98-
99-let permissionDeniedError = throw("Permission denied")
100-
101-func mustThis (i) = if ((i.caller == this))
102- then true
103- else permissionDeniedError
104-
105-
106-func mustManager (i) = match managerPublicKeyOrUnit() {
107- case pk: ByteVector =>
108- if ((i.callerPublicKey == pk))
109- then true
110- else permissionDeniedError
111- case _: Unit =>
112- mustThis(i)
113- case _ =>
114- throw("Match error")
115-}
116-
117-
118-let lpStakingPoolsContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(makeString(["%s", "lpStakingPoolsContract"], SEP)), wrapErr("lp_staking_pools contract address is undefined"))), wrapErr("invalid lp_staking_pools contract address"))
11963
12064 func dataAssetCfg (shareAssetStr,internalBaseAssetStr,decimalsMultBothAssets,decimalsMultPrice,getDelayInBlocks) = makeString(["%s%d%d%d%d", shareAssetStr, internalBaseAssetStr, toString(decimalsMultBothAssets), toString(decimalsMultPrice), toString(getDelayInBlocks)], SEP)
12165
12266
12367 let IdxTotalLockedShare = 1
12468
12569 let IdxTotalLockedBase = 2
12670
12771 func dataTotalLocked (shareAssetAmount,baseAssetAmount) = makeString(["%d%d", toString(shareAssetAmount), toString(baseAssetAmount)], SEP)
12872
12973
13074 func readTotalLocked (key) = {
13175 let totalLockedArray = split(valueOrElse(getString(this, key), dataTotalLocked(0, 0)), SEP)
13276 [-1, parseIntValue(totalLockedArray[IdxTotalLockedShare]), parseIntValue(totalLockedArray[IdxTotalLockedBase])]
13377 }
13478
13579
13680 func keyOperation (operationType,internalBaseAssetStr,userAddress,txId) = makeString(["%s%d%s%s", operationType, internalBaseAssetStr, userAddress, txId], SEP)
13781
13882
13983 let IdxOperStatus = 1
14084
14185 let IdxOperInAmount = 2
14286
14387 let IdxOperPrice = 3
14488
14589 let IdxOperOutAmount = 4
14690
14791 let IdxOperStartHeight = 5
14892
14993 let IdxOperStartTimestamp = 6
15094
15195 let IdxOperEndHeight = 7
15296
15397 let IdxOperEndTimestamp = 8
15498
15599 func privateDataOperationAllStrings (status,inAssetAmount,price,outAssetAmount,startHeight,startTimestamp,endHeight,endTimestamp) = makeString(["%s%d%d%d%d%d%d%d", status, inAssetAmount, price, outAssetAmount, startHeight, startTimestamp, endHeight, endTimestamp], SEP)
156100
157101
158102 func dataOperation (status,inAssetAmount,price,outAssetAmount,startHeight,startTimestamp,endHeight,endTimestamp) = privateDataOperationAllStrings(status, toString(inAssetAmount), toString(price), toString(outAssetAmount), toString(startHeight), toString(startTimestamp), toString(endHeight), toString(endTimestamp))
159103
160104
161105 func dataOperationExecutionUpdate (currOperArray,newStatus,newEndTimestamp) = privateDataOperationAllStrings(newStatus, currOperArray[IdxOperInAmount], currOperArray[IdxOperPrice], currOperArray[IdxOperOutAmount], currOperArray[IdxOperStartHeight], currOperArray[IdxOperStartTimestamp], currOperArray[IdxOperEndHeight], toString(newEndTimestamp))
162106
163107
164108 func readAssetCfgOrFail (baseAssetStr) = {
165109 let key = keyAssetCfg(baseAssetStr)
166110 split(getStringOrFail(key), SEP)
167111 }
168112
169113
170114 func incrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = {
171115 let dataArray = readTotalLocked(key)
172116 StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] + shareAssetAmount), (dataArray[IdxTotalLockedBase] + baseAssetAmount)))
173117 }
174118
175119
176120 func decrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = {
177121 let dataArray = readTotalLocked(key)
178122 StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] - shareAssetAmount), (dataArray[IdxTotalLockedBase] - baseAssetAmount)))
179123 }
180124
181125
182126 func genericCalcPrice (internalBaseAssetStr,baseAssetId,topUpBaseAmount,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = {
183127 let totalLockedArray = readTotalLocked(keyTotalLocked(internalBaseAssetStr))
184128 let totalLockedBaseAmount = totalLockedArray[IdxTotalLockedBase]
185129 let baseAssetBalance = assetBalance(this, baseAssetId)
186130 let baseAssetBalanceConsideringLock = ((baseAssetBalance - totalLockedBaseAmount) + topUpBaseAmount)
187131 if ((0 > baseAssetBalanceConsideringLock))
188132 then throw(((("baseAssetBalanceConsideringLock < 0: baseAssetBalance=" + toString(baseAssetBalance)) + " baseAssetBalanceConsideringLock=") + toString(baseAssetBalanceConsideringLock)))
189133 else {
190134 let shareEmission = value(assetInfo(shareAssetId)).quantity
191135 let price = if ((shareEmission == 0))
192136 then (1 * decimalsMultPrice)
193137 else fraction(baseAssetBalanceConsideringLock, decimalsMultPrice, shareEmission)
194138 $Tuple5(price, baseAssetBalance, totalLockedBaseAmount, baseAssetBalanceConsideringLock, shareEmission)
195139 }
196140 }
197141
198142
199143 func calcPrice (internalBaseAssetStr,baseAssetId,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = genericCalcPrice(internalBaseAssetStr, baseAssetId, 0, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)
200144
201145
202146 func privateCurrentSysParamsREST (baseAssetStr) = {
203147 let baseAssetId = fromBase58String(baseAssetStr)
204148 let cfgArray = readAssetCfgOrFail(baseAssetStr)
205149 let shareAssetStr = cfgArray[IdxCfgShareAssetId]
206150 let shareAssetId = fromBase58String(shareAssetStr)
207151 let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
208152 let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
209153 let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
210154 let sysState = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)
211155 $Tuple6(IntegerEntry("price", sysState._1), IntegerEntry("decimalsMultPrice", decimalsMultPrice), IntegerEntry("baseAssetBalance", sysState._2), IntegerEntry("totalLockedBaseAmount", sysState._3), IntegerEntry("baseAssetBalanceConsideringLock", sysState._4), IntegerEntry("shareEmission", sysState._5))
212156 }
213157
214158
215159 @Callable(i)
216160 func adminRegisterAsset (baseAssetStr,shareAssetName,shareAssetDescr,getDelayinBlocks,shutdownManagerAddress) = {
217161 let baseAssetId = fromBase58String(baseAssetStr)
218162 let decimals = value(assetInfo(baseAssetId)).decimals
219- let checkCaller = mustManager(i)
220- if ((checkCaller == checkCaller))
221- then if ((toString(addressFromStringValue(shutdownManagerAddress)) != shutdownManagerAddress))
163+ if ((i.caller != this))
164+ then throw("permissions denied")
165+ else if ((toString(addressFromStringValue(shutdownManagerAddress)) != shutdownManagerAddress))
222166 then throw("invalid shutdownManagerAddress")
223167 else if ((0 > getDelayinBlocks))
224168 then throw(("invalid getDelayinBlocks=" + toString(getDelayinBlocks)))
225169 else {
226170 let shareAssetIssueAction = Issue(shareAssetName, shareAssetDescr, 1, decimals, true)
227171 let shareAssetId = calculateAssetId(shareAssetIssueAction)
228172 let shareAssetStr = toBase58String(shareAssetId)
229173 let decimalsMultPrice = ((100 * 1000) * 1000)
230174 let decimalsMultBothAssets = pow(10, 0, decimals, 0, 0, DOWN)
231175 let startPrice = (1 * decimalsMultPrice)
232176 let internalBaseAssettId = valueOrElse(getInteger(this, keyNextInternalAssetId()), 0)
233177 let internalBaseAssetStr = toString(internalBaseAssettId)
234178 [StringEntry(keyAssetCfg(baseAssetStr), dataAssetCfg(shareAssetStr, internalBaseAssetStr, decimalsMultBothAssets, decimalsMultPrice, getDelayinBlocks)), StringEntry(keyMappingsInternal2baseAssetId(internalBaseAssettId), baseAssetStr), StringEntry(keyMappingsBaseAsset2internalId(baseAssetStr), internalBaseAssetStr), StringEntry(keyMappingsShare2baseAssetId(shareAssetStr), baseAssetStr), StringEntry(keyMappingsBaseAsset2shareId(baseAssetStr), shareAssetStr), BooleanEntry(keyShutdownPutOperation(internalBaseAssetStr), false), StringEntry(keyShutdownManager(internalBaseAssetStr), shutdownManagerAddress), IntegerEntry(keyNextInternalAssetId(), (internalBaseAssettId + 1)), IntegerEntry(keyPriceLast(internalBaseAssetStr), startPrice), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), startPrice), shareAssetIssueAction, Burn(shareAssetId, 1)]
235179 }
236- else throw("Strict value is not equal to itself.")
237180 }
238181
239182
240183
241184 @Callable(i)
242185 func shutdownPut (internalBaseAssetId) = {
243186 let internalBaseAssetIdStr = toString(internalBaseAssetId)
244187 let baseAssetIdStr = getStringOrFail(keyMappingsInternal2baseAssetId(internalBaseAssetId))
245188 let shutdownManagerAddress = getStringOrFail(keyShutdownManager(internalBaseAssetIdStr))
246189 if ((1 > size(baseAssetIdStr)))
247190 then throw("invalid internalBaseAssetId")
248191 else if ((toString(i.caller) != shutdownManagerAddress))
249192 then throw("access denied")
250193 else [BooleanEntry(keyShutdownPutOperation(toString(internalBaseAssetId)), true)]
251194 }
252195
253196
254197
255198 @Callable(i)
256199 func put () = {
257200 let pmt = value(i.payments[0])
258201 let baseAssetId = value(pmt.assetId)
259202 let baseAssetStr = toBase58String(baseAssetId)
260203 let userAddressStr = toString(i.caller)
261204 let cfgArray = readAssetCfgOrFail(baseAssetStr)
262205 let shareAssetStr = cfgArray[IdxCfgShareAssetId]
263206 let shareAssetId = fromBase58String(shareAssetStr)
264207 let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
265208 let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
266209 let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
267210 let isPutBlocked = getBooleanOrFail(keyShutdownPutOperation(internalBaseAssetStr))
268- let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
269- if (if (isPutBlocked)
270- then true
271- else shutdown)
211+ if (isPutBlocked)
272212 then throw("put operation is blocked")
273213 else {
274214 let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
275215 let shareAssetAmount = fraction(pmt.amount, decimalsMultPrice, price)
276216 [Reissue(shareAssetId, shareAssetAmount, true), ScriptTransfer(i.caller, shareAssetAmount, shareAssetId), StringEntry(keyOperation("P", internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId)), dataOperation("FINISHED", pmt.amount, price, shareAssetAmount, height, lastBlock.timestamp, height, lastBlock.timestamp))]
277217 }
278218 }
279219
280220
281221
282222 @Callable(i)
283223 func submitGetRequest () = {
284224 let pmt = value(i.payments[0])
285225 let shareAssetId = value(pmt.assetId)
286226 let shareAssetStr = toBase58String(shareAssetId)
287227 let callerPubStr = toBase58String(i.callerPublicKey)
288228 let userAddress = i.caller
289229 let userAddressStr = toString(userAddress)
290230 let shareAssetAmount = pmt.amount
291231 let baseAssetStr = getStringOrFail(keyMappingsShare2baseAssetId(shareAssetStr))
292232 let baseAssetId = fromBase58String(baseAssetStr)
293233 let cfgArray = readAssetCfgOrFail(baseAssetStr)
294234 let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
295235 let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
296236 let getDelayBlocks = parseIntValue(cfgArray[IdxCfgGetDelayBlocks])
297237 let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
298- let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
299- if (shutdown)
300- then throw("operation is blocked")
301- else {
302- let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
303- let baseAssetAmount = fraction(shareAssetAmount, price, decimalsMultPrice)
304- let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId))
305- let operationData = dataOperation("PENDING", shareAssetAmount, price, baseAssetAmount, height, lastBlock.timestamp, (height + getDelayBlocks), 0)
238+ let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
239+ let baseAssetAmount = fraction(shareAssetAmount, price, decimalsMultPrice)
240+ let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId))
241+ let operationData = dataOperation("PENDING", shareAssetAmount, price, baseAssetAmount, height, lastBlock.timestamp, (height + getDelayBlocks), 0)
306242 [Burn(shareAssetId, shareAssetAmount), StringEntry(operationKey, operationData), incrementTotalLocked(keyTotalLocked(internalBaseAssetStr), shareAssetAmount, baseAssetAmount), incrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), shareAssetAmount, baseAssetAmount)]
307- }
308243 }
309244
310245
311246
312247 @Callable(i)
313248 func executeGetRequest (baseAssetStr,userAddressStr,getTxIdStr) = {
314249 let userAddress = addressFromStringValue(userAddressStr)
315250 let assetCfgArray = readAssetCfgOrFail(baseAssetStr)
316251 let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId])
317252 let baseAssetId = fromBase58String(baseAssetStr)
318253 let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset]
319- let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
320- if (shutdown)
321- then throw("operation is blocked")
322- else {
323- let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, getTxIdStr)
324- let operationArray = split(getStringOrFail(operationKey), SEP)
325- let status = operationArray[IdxOperStatus]
326- let endHeight = parseIntValue(operationArray[IdxOperEndHeight])
327- let inShareAmount = parseIntValue(operationArray[IdxOperInAmount])
328- let outBaseAmount = parseIntValue(operationArray[IdxOperOutAmount])
329- if ((status != "PENDING"))
330- then failExecuteGet("Status is not PENDING", baseAssetStr, userAddressStr, getTxIdStr)
331- else if ((endHeight > height))
332- then failExecuteGet(((("EndHeight[" + toString(endHeight)) + "] > ") + toString(height)), baseAssetStr, userAddressStr, getTxIdStr)
333- else [ScriptTransfer(userAddress, outBaseAmount, baseAssetId), StringEntry(operationKey, dataOperationExecutionUpdate(operationArray, "FINISHED", lastBlock.timestamp)), decrementTotalLocked(keyTotalLocked(internalBaseAssetStr), inShareAmount, outBaseAmount), decrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), inShareAmount, outBaseAmount)]
334- }
254+ let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, getTxIdStr)
255+ let operationArray = split(getStringOrFail(operationKey), SEP)
256+ let status = operationArray[IdxOperStatus]
257+ let endHeight = parseIntValue(operationArray[IdxOperEndHeight])
258+ let inShareAmount = parseIntValue(operationArray[IdxOperInAmount])
259+ let outBaseAmount = parseIntValue(operationArray[IdxOperOutAmount])
260+ if ((status != "PENDING"))
261+ then failExecuteGet("Status is not PENDING", baseAssetStr, userAddressStr, getTxIdStr)
262+ else if ((endHeight > height))
263+ then failExecuteGet(((("EndHeight[" + toString(endHeight)) + "] > ") + toString(height)), baseAssetStr, userAddressStr, getTxIdStr)
264+ else [ScriptTransfer(userAddress, outBaseAmount, baseAssetId), StringEntry(operationKey, dataOperationExecutionUpdate(operationArray, "FINISHED", lastBlock.timestamp)), decrementTotalLocked(keyTotalLocked(internalBaseAssetStr), inShareAmount, outBaseAmount), decrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), inShareAmount, outBaseAmount)]
335265 }
336266
337267
338268
339269 @Callable(i)
340270 func topUpBalance (baseAssetStr) = {
341271 let assetCfgArray = readAssetCfgOrFail(baseAssetStr)
342272 let pmt = value(i.payments[0])
343273 let pmtAssetId = value(pmt.assetId)
344274 let pmtAssetStr = toBase58String(pmtAssetId)
345275 let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId])
346276 let decimalsMultBothAssets = parseIntValue(assetCfgArray[IdxCfgDecimalsMultBothAssets])
347277 let decimalsMultPrice = parseIntValue(assetCfgArray[IdxCfgDecimalsMultPrice])
348278 let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset]
349279 let topUpLastHeightKEY = keyTopUpLastHeight(internalBaseAssetStr, toString(i.caller))
350280 let topUpLastHeight = valueOrElse(getInteger(this, topUpLastHeightKEY), 0)
351- let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
352- if (shutdown)
353- then throw("operation is blocked")
354- else if ((baseAssetStr != pmtAssetStr))
355- then throw("attached payment's asset id is NOT matched passed baseAssetStr")
356- else if ((size(i.payments) > 1))
357- then throw("only one payment can be attached")
358- else if ((100 > (height - topUpLastHeight)))
359- then throw("1 topUp per 100 blocks from the same address is allowed")
360- else {
361- let price = genericCalcPrice(internalBaseAssetStr, pmtAssetId, pmt.amount, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
281+ if ((baseAssetStr != pmtAssetStr))
282+ then throw("attached payment's asset id is NOT matched passed baseAssetStr")
283+ else if ((size(i.payments) > 1))
284+ then throw("only one payment can be attached")
285+ else if ((100 > (height - topUpLastHeight)))
286+ then throw("1 topUp per 100 blocks from the same address is allowed")
287+ else {
288+ let price = genericCalcPrice(internalBaseAssetStr, pmtAssetId, pmt.amount, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
362289 [IntegerEntry(keyPriceLast(internalBaseAssetStr), price), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), price), IntegerEntry(topUpLastHeightKEY, height)]
363- }
364- }
365-
366-
367-
368-@Callable(i)
369-func emit (assetId,amount) = {
370- let checks = [if ((i.caller == lpStakingPoolsContract))
371- then true
372- else throwErr("permission denied"), if ((amount > 0))
373- then true
374- else throwErr("invalid amount to emit"), if ((getString(keyMappingsShare2baseAssetId(toBase58String(assetId))) != unit))
375- then true
376- else throwErr("invalid assetId")]
377- if ((checks == checks))
378- then {
379- let isReissuable = true
380- $Tuple2([Reissue(assetId, amount, isReissuable), ScriptTransfer(lpStakingPoolsContract, amount, assetId)], amount)
381- }
382- else throw("Strict value is not equal to itself.")
383- }
384-
385-
386-
387-@Callable(i)
388-func burn (assetId,amount) = {
389- let checks = [if ((i.caller == lpStakingPoolsContract))
390- then true
391- else throwErr("permission denied"), if ((amount > 0))
392- then true
393- else throwErr("invalid amount to burn"), if ((getString(keyMappingsShare2baseAssetId(toBase58String(assetId))) != unit))
394- then true
395- else throwErr("invalid assetId")]
396- if ((checks == checks))
397- then $Tuple2([Burn(assetId, amount)], amount)
398- else throw("Strict value is not equal to itself.")
290+ }
399291 }
400292
401293
402294
403295 @Callable(i)
404296 func currentSysParamsREST (baseAssetStr) = {
405297 let sysStateTuple = privateCurrentSysParamsREST(baseAssetStr)
406298 let price = sysStateTuple._1.value
407299 let decimalsMultPrice = sysStateTuple._2.value
408300 let baseAssetBalance = sysStateTuple._3.value
409301 let totalLockedBaseAmount = sysStateTuple._4.value
410302 let baseAssetBalanceConsideringLock = sysStateTuple._5.value
411303 let shareEmission = sysStateTuple._6.value
412304 let restData = makeString(["startCurrentSysParamsREST", toString(price), toString(decimalsMultPrice), toString(baseAssetBalance), toString(totalLockedBaseAmount), toString(baseAssetBalanceConsideringLock), toString(shareEmission), "endCurrentSysParamsREST"], SEP)
413305 throw(restData)
414306 }
415307
416308
417-
418-@Callable(i)
419-func setManager (pendingManagerPublicKey) = {
420- let checkCaller = mustManager(i)
421- if ((checkCaller == checkCaller))
422- then {
423- let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
424- if ((checkManagerPublicKey == checkManagerPublicKey))
425- then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
426- else throw("Strict value is not equal to itself.")
427- }
428- else throw("Strict value is not equal to itself.")
429- }
430-
431-
432-
433-@Callable(i)
434-func confirmManager () = {
435- let pm = pendingManagerPublicKeyOrUnit()
436- let hasPM = if (isDefined(pm))
437- then true
438- else throwErr("no pending manager")
439- if ((hasPM == hasPM))
440- then {
441- let checkPM = if ((i.callerPublicKey == value(pm)))
442- then true
443- else throwErr("you are not pending manager")
444- if ((checkPM == checkPM))
445- then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
446- else throw("Strict value is not equal to itself.")
447- }
448- else throw("Strict value is not equal to itself.")
449- }
450-
451-
452309 @Verifier(tx)
453-func verify () = {
454- let targetPublicKey = match managerPublicKeyOrUnit() {
455- case pk: ByteVector =>
456- pk
457- case _: Unit =>
458- tx.senderPublicKey
459- case _ =>
460- throw("Match error")
461- }
462- sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
463- }
310+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String("2Cbd8ozG7A1RyRNC3nNnZgHu7Ru4K3JCfpyPkhqr9zxq"))
464311

github/deemru/w8io/026f985 
52.05 ms