tx · 3nbDoQet1dyK3yZkip8c1UbB6DdDiBjTbz66nwyHkhc8

3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk:  -0.01500000 Waves

2023.01.11 13:38 [2400176] smart account 3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk > SELF 0.00000000 Waves

{ "type": 13, "id": "3nbDoQet1dyK3yZkip8c1UbB6DdDiBjTbz66nwyHkhc8", "fee": 1500000, "feeAssetId": null, "timestamp": 1673433550541, "version": 1, "sender": "3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk", "senderPublicKey": "2rdeGwVMkuRfRdUgrYaekNmjnegHokhyDx1z6TJq525F", "proofs": [ "3S6BSRiXQSd7cizKK9ev2iqXKyK8u3KaggY8tyLQ9X3TDvatyffEUjhZTPaRwUZf5nqsE7QonPjJJc1sJdz3uzrE" ], "script": "base64:BgLaEggCEgcKBQgICAEIEgMKAQESABIAEgUKAwgICBIDCgEIEgQKAgIBEgMKAQgSAwoBCBIAIgNTRVAiB3dyYXBFcnIiA21zZyIIdGhyb3dFcnIiD2dldFN0cmluZ09yRmFpbCIDa2V5IhBnZXRCb29sZWFuT3JGYWlsIg5mYWlsRXhlY3V0ZUdldCIMYmFzZUFzc2V0U3RyIg51c2VyQWRkcmVzc1N0ciIKZ2V0VHhJZFN0ciILa2V5QXNzZXRDZmciFmtleU5leHRJbnRlcm5hbEFzc2V0SWQiDGtleVByaWNlTGFzdCIVaW50ZXJuYWxCYXNldEFzc2V0U3RyIhJrZXlUb3BVcExhc3RIZWlnaHQiBnNlbmRlciIPa2V5UHJpY2VIaXN0b3J5IgFoIgl0aW1lc3RhbXAiDmtleVRvdGFsTG9ja2VkIhRrZXlUb3RhbExvY2tlZEJ5VXNlciIUaW50ZXJuYWxCYXNlQXNzZXRTdHIiH2tleU1hcHBpbmdzSW50ZXJuYWwyYmFzZUFzc2V0SWQiEWludGVybmFsQmFzZUFzc2V0Ih9rZXlNYXBwaW5nc0Jhc2VBc3NldD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l0ZVZlY3RvcgQBVgUBTwUBVgMJAAECBQFPAgRVbml0CAUCYksPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmJLCWJvZHlCeXRlcwkAkQMCCAUCYksGcHJvb2ZzAAAFAmJNhoYWfQ==", "chainId": 84, "height": 2400176, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: A6eWjiiWhq69KmqRSS3e1gcHu7Wr7sy33st6iEyA4rXZ Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 6 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let SEP = "__"
5+
6+func wrapErr (msg) = throw(makeString(["lp_staking.ride:", msg], " "))
7+
8+
9+func throwErr (msg) = throw(wrapErr(msg))
10+
11+
12+func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key))
13+
14+
15+func getBooleanOrFail (key) = valueOrErrorMessage(getBoolean(this, key), ("No data for this.key=" + key))
16+
17+
18+func failExecuteGet (msg,baseAssetStr,userAddressStr,getTxIdStr) = throw(((((((msg + ": baseAssetStr=") + baseAssetStr) + " userAddressStr=") + userAddressStr) + " getTxIdStr=") + getTxIdStr))
19+
20+
21+func keyAssetCfg (baseAssetStr) = ("%s%s%s__config__asset__" + baseAssetStr)
22+
23+
24+func keyNextInternalAssetId () = "%s__nextInternalAssetId"
25+
26+
27+func keyPriceLast (internalBasetAssetStr) = ("%s%s%d__price__last__" + internalBasetAssetStr)
28+
29+
30+func keyTopUpLastHeight (internalBasetAssetStr,sender) = makeString(["%s%s%s%d%s__topup__last__height", internalBasetAssetStr, sender], SEP)
31+
32+
33+func keyPriceHistory (internalBasetAssetStr,h,timestamp) = makeString(["%s%s%d%d%d__price__history", internalBasetAssetStr, toString(h), toString(timestamp)], SEP)
34+
35+
36+func keyTotalLocked (internalBasetAssetStr) = ("%s%s%d__total__locked__" + internalBasetAssetStr)
37+
38+
39+func keyTotalLockedByUser (internalBaseAssetStr,userAddressStr) = makeString(["%s%s%d%s__total__locked", internalBaseAssetStr, userAddressStr], SEP)
40+
41+
42+func keyMappingsInternal2baseAssetId (internalBaseAsset) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(internalBaseAsset))
43+
44+
45+func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
46+
47+
48+func keyMappingsShare2baseAssetId (shareAssetStr) = ("%s%s%s__mappings__share2baseAssetId__" + shareAssetStr)
49+
50+
51+func keyMappingsBaseAsset2shareId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2shareId__" + baseAssetStr)
52+
53+
54+func keyShutdownPutOperation (internalBaseAssetStr) = ("%s%s%d__shutdown__put__" + internalBaseAssetStr)
55+
56+
57+func keyShutdown (internalBaseAssetStr) = ("%s%d__shutdown__" + internalBaseAssetStr)
58+
59+
60+func keyShutdownManager (internalBaseAssetStr) = ("%s%s%d__shutdown__manager__" + internalBaseAssetStr)
61+
62+
63+let IdxCfgShareAssetId = 1
64+
65+let IdxCfgInternalBaseAsset = 2
66+
67+let IdxCfgDecimalsMultBothAssets = 3
68+
69+let IdxCfgDecimalsMultPrice = 4
70+
71+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+func dataAssetCfg (shareAssetStr,internalBaseAssetStr,decimalsMultBothAssets,decimalsMultPrice,getDelayInBlocks) = makeString(["%s%d%d%d%d", shareAssetStr, internalBaseAssetStr, toString(decimalsMultBothAssets), toString(decimalsMultPrice), toString(getDelayInBlocks)], SEP)
119+
120+
121+let IdxTotalLockedShare = 1
122+
123+let IdxTotalLockedBase = 2
124+
125+func dataTotalLocked (shareAssetAmount,baseAssetAmount) = makeString(["%d%d", toString(shareAssetAmount), toString(baseAssetAmount)], SEP)
126+
127+
128+func readTotalLocked (key) = {
129+ let totalLockedArray = split(valueOrElse(getString(this, key), dataTotalLocked(0, 0)), SEP)
130+[-1, parseIntValue(totalLockedArray[IdxTotalLockedShare]), parseIntValue(totalLockedArray[IdxTotalLockedBase])]
131+ }
132+
133+
134+func keyOperation (operationType,internalBaseAssetStr,userAddress,txId) = makeString(["%s%d%s%s", operationType, internalBaseAssetStr, userAddress, txId], SEP)
135+
136+
137+let IdxOperStatus = 1
138+
139+let IdxOperInAmount = 2
140+
141+let IdxOperPrice = 3
142+
143+let IdxOperOutAmount = 4
144+
145+let IdxOperStartHeight = 5
146+
147+let IdxOperStartTimestamp = 6
148+
149+let IdxOperEndHeight = 7
150+
151+let IdxOperEndTimestamp = 8
152+
153+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)
154+
155+
156+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))
157+
158+
159+func dataOperationExecutionUpdate (currOperArray,newStatus,newEndTimestamp) = privateDataOperationAllStrings(newStatus, currOperArray[IdxOperInAmount], currOperArray[IdxOperPrice], currOperArray[IdxOperOutAmount], currOperArray[IdxOperStartHeight], currOperArray[IdxOperStartTimestamp], currOperArray[IdxOperEndHeight], toString(newEndTimestamp))
160+
161+
162+func readAssetCfgOrFail (baseAssetStr) = {
163+ let key = keyAssetCfg(baseAssetStr)
164+ split(getStringOrFail(key), SEP)
165+ }
166+
167+
168+func incrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = {
169+ let dataArray = readTotalLocked(key)
170+ StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] + shareAssetAmount), (dataArray[IdxTotalLockedBase] + baseAssetAmount)))
171+ }
172+
173+
174+func decrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = {
175+ let dataArray = readTotalLocked(key)
176+ StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] - shareAssetAmount), (dataArray[IdxTotalLockedBase] - baseAssetAmount)))
177+ }
178+
179+
180+func genericCalcPrice (internalBaseAssetStr,baseAssetId,topUpBaseAmount,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = {
181+ let totalLockedArray = readTotalLocked(keyTotalLocked(internalBaseAssetStr))
182+ let totalLockedBaseAmount = totalLockedArray[IdxTotalLockedBase]
183+ let baseAssetBalance = assetBalance(this, baseAssetId)
184+ let baseAssetBalanceConsideringLock = ((baseAssetBalance - totalLockedBaseAmount) + topUpBaseAmount)
185+ if ((0 > baseAssetBalanceConsideringLock))
186+ then throw(((("baseAssetBalanceConsideringLock < 0: baseAssetBalance=" + toString(baseAssetBalance)) + " baseAssetBalanceConsideringLock=") + toString(baseAssetBalanceConsideringLock)))
187+ else {
188+ let shareEmission = value(assetInfo(shareAssetId)).quantity
189+ let price = if ((shareEmission == 0))
190+ then (1 * decimalsMultPrice)
191+ else fraction(baseAssetBalanceConsideringLock, decimalsMultPrice, shareEmission)
192+ $Tuple5(price, baseAssetBalance, totalLockedBaseAmount, baseAssetBalanceConsideringLock, shareEmission)
193+ }
194+ }
195+
196+
197+func calcPrice (internalBaseAssetStr,baseAssetId,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = genericCalcPrice(internalBaseAssetStr, baseAssetId, 0, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)
198+
199+
200+func privateCurrentSysParamsREST (baseAssetStr) = {
201+ let baseAssetId = fromBase58String(baseAssetStr)
202+ let cfgArray = readAssetCfgOrFail(baseAssetStr)
203+ let shareAssetStr = cfgArray[IdxCfgShareAssetId]
204+ let shareAssetId = fromBase58String(shareAssetStr)
205+ let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
206+ let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
207+ let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
208+ let sysState = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)
209+ $Tuple6(IntegerEntry("price", sysState._1), IntegerEntry("decimalsMultPrice", decimalsMultPrice), IntegerEntry("baseAssetBalance", sysState._2), IntegerEntry("totalLockedBaseAmount", sysState._3), IntegerEntry("baseAssetBalanceConsideringLock", sysState._4), IntegerEntry("shareEmission", sysState._5))
210+ }
211+
212+
213+@Callable(i)
214+func adminRegisterAsset (baseAssetStr,shareAssetName,shareAssetDescr,getDelayinBlocks,shutdownManagerAddress) = {
215+ let baseAssetId = fromBase58String(baseAssetStr)
216+ let decimals = value(assetInfo(baseAssetId)).decimals
217+ if ((i.caller != this))
218+ then throw("permissions denied")
219+ else if ((toString(addressFromStringValue(shutdownManagerAddress)) != shutdownManagerAddress))
220+ then throw("invalid shutdownManagerAddress")
221+ else if ((0 > getDelayinBlocks))
222+ then throw(("invalid getDelayinBlocks=" + toString(getDelayinBlocks)))
223+ else {
224+ let shareAssetIssueAction = Issue(shareAssetName, shareAssetDescr, 1, decimals, true)
225+ let shareAssetId = calculateAssetId(shareAssetIssueAction)
226+ let shareAssetStr = toBase58String(shareAssetId)
227+ let decimalsMultPrice = ((100 * 1000) * 1000)
228+ let decimalsMultBothAssets = pow(10, 0, decimals, 0, 0, DOWN)
229+ let startPrice = (1 * decimalsMultPrice)
230+ let internalBaseAssettId = valueOrElse(getInteger(this, keyNextInternalAssetId()), 0)
231+ let internalBaseAssetStr = toString(internalBaseAssettId)
232+[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)]
233+ }
234+ }
235+
236+
237+
238+@Callable(i)
239+func shutdownPut (internalBaseAssetId) = {
240+ let internalBaseAssetIdStr = toString(internalBaseAssetId)
241+ let baseAssetIdStr = getStringOrFail(keyMappingsInternal2baseAssetId(internalBaseAssetId))
242+ let shutdownManagerAddress = getStringOrFail(keyShutdownManager(internalBaseAssetIdStr))
243+ if ((1 > size(baseAssetIdStr)))
244+ then throw("invalid internalBaseAssetId")
245+ else if ((toString(i.caller) != shutdownManagerAddress))
246+ then throw("access denied")
247+ else [BooleanEntry(keyShutdownPutOperation(toString(internalBaseAssetId)), true)]
248+ }
249+
250+
251+
252+@Callable(i)
253+func put () = {
254+ let pmt = value(i.payments[0])
255+ let baseAssetId = value(pmt.assetId)
256+ let baseAssetStr = toBase58String(baseAssetId)
257+ let userAddressStr = toString(i.caller)
258+ let cfgArray = readAssetCfgOrFail(baseAssetStr)
259+ let shareAssetStr = cfgArray[IdxCfgShareAssetId]
260+ let shareAssetId = fromBase58String(shareAssetStr)
261+ let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
262+ let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
263+ let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
264+ let isPutBlocked = getBooleanOrFail(keyShutdownPutOperation(internalBaseAssetStr))
265+ let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
266+ if (if (isPutBlocked)
267+ then true
268+ else shutdown)
269+ then throw("put operation is blocked")
270+ else {
271+ let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
272+ let shareAssetAmount = fraction(pmt.amount, decimalsMultPrice, price)
273+[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))]
274+ }
275+ }
276+
277+
278+
279+@Callable(i)
280+func submitGetRequest () = {
281+ let pmt = value(i.payments[0])
282+ let shareAssetId = value(pmt.assetId)
283+ let shareAssetStr = toBase58String(shareAssetId)
284+ let callerPubStr = toBase58String(i.callerPublicKey)
285+ let userAddress = i.caller
286+ let userAddressStr = toString(userAddress)
287+ let shareAssetAmount = pmt.amount
288+ let baseAssetStr = getStringOrFail(keyMappingsShare2baseAssetId(shareAssetStr))
289+ let baseAssetId = fromBase58String(baseAssetStr)
290+ let cfgArray = readAssetCfgOrFail(baseAssetStr)
291+ let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
292+ let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
293+ let getDelayBlocks = parseIntValue(cfgArray[IdxCfgGetDelayBlocks])
294+ let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
295+ let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
296+ if (shutdown)
297+ then throw("operation is blocked")
298+ else {
299+ let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
300+ let baseAssetAmount = fraction(shareAssetAmount, price, decimalsMultPrice)
301+ let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId))
302+ let operationData = dataOperation("PENDING", shareAssetAmount, price, baseAssetAmount, height, lastBlock.timestamp, (height + getDelayBlocks), 0)
303+[Burn(shareAssetId, shareAssetAmount), StringEntry(operationKey, operationData), incrementTotalLocked(keyTotalLocked(internalBaseAssetStr), shareAssetAmount, baseAssetAmount), incrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), shareAssetAmount, baseAssetAmount)]
304+ }
305+ }
306+
307+
308+
309+@Callable(i)
310+func executeGetRequest (baseAssetStr,userAddressStr,getTxIdStr) = {
311+ let userAddress = addressFromStringValue(userAddressStr)
312+ let assetCfgArray = readAssetCfgOrFail(baseAssetStr)
313+ let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId])
314+ let baseAssetId = fromBase58String(baseAssetStr)
315+ let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset]
316+ let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
317+ if (shutdown)
318+ then throw("operation is blocked")
319+ else {
320+ let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, getTxIdStr)
321+ let operationArray = split(getStringOrFail(operationKey), SEP)
322+ let status = operationArray[IdxOperStatus]
323+ let endHeight = parseIntValue(operationArray[IdxOperEndHeight])
324+ let inShareAmount = parseIntValue(operationArray[IdxOperInAmount])
325+ let outBaseAmount = parseIntValue(operationArray[IdxOperOutAmount])
326+ if ((status != "PENDING"))
327+ then failExecuteGet("Status is not PENDING", baseAssetStr, userAddressStr, getTxIdStr)
328+ else if ((endHeight > height))
329+ then failExecuteGet(((("EndHeight[" + toString(endHeight)) + "] > ") + toString(height)), baseAssetStr, userAddressStr, getTxIdStr)
330+ else [ScriptTransfer(userAddress, outBaseAmount, baseAssetId), StringEntry(operationKey, dataOperationExecutionUpdate(operationArray, "FINISHED", lastBlock.timestamp)), decrementTotalLocked(keyTotalLocked(internalBaseAssetStr), inShareAmount, outBaseAmount), decrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), inShareAmount, outBaseAmount)]
331+ }
332+ }
333+
334+
335+
336+@Callable(i)
337+func topUpBalance (baseAssetStr) = {
338+ let assetCfgArray = readAssetCfgOrFail(baseAssetStr)
339+ let pmt = value(i.payments[0])
340+ let pmtAssetId = value(pmt.assetId)
341+ let pmtAssetStr = toBase58String(pmtAssetId)
342+ let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId])
343+ let decimalsMultBothAssets = parseIntValue(assetCfgArray[IdxCfgDecimalsMultBothAssets])
344+ let decimalsMultPrice = parseIntValue(assetCfgArray[IdxCfgDecimalsMultPrice])
345+ let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset]
346+ let topUpLastHeightKEY = keyTopUpLastHeight(internalBaseAssetStr, toString(i.caller))
347+ let topUpLastHeight = valueOrElse(getInteger(this, topUpLastHeightKEY), 0)
348+ let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
349+ if (shutdown)
350+ then throw("operation is blocked")
351+ else if ((baseAssetStr != pmtAssetStr))
352+ then throw("attached payment's asset id is NOT matched passed baseAssetStr")
353+ else if ((size(i.payments) > 1))
354+ then throw("only one payment can be attached")
355+ else if ((100 > (height - topUpLastHeight)))
356+ then throw("1 topUp per 100 blocks from the same address is allowed")
357+ else {
358+ let price = genericCalcPrice(internalBaseAssetStr, pmtAssetId, pmt.amount, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
359+[IntegerEntry(keyPriceLast(internalBaseAssetStr), price), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), price), IntegerEntry(topUpLastHeightKEY, height)]
360+ }
361+ }
362+
363+
364+
365+@Callable(i)
366+func emit (assetId,amount) = {
367+ 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"))
368+ let checks = [if ((i.caller == lpStakingPoolsContract))
369+ then true
370+ else throwErr("permission denied"), if ((amount > 0))
371+ then true
372+ else throwErr("invalid amount to emit"), if ((getString(keyMappingsShare2baseAssetId(toBase58String(assetId))) != unit))
373+ then true
374+ else throwErr("invalid assetId")]
375+ if ((checks == checks))
376+ then {
377+ let isReissuable = true
378+ $Tuple2([Reissue(assetId, amount, isReissuable), ScriptTransfer(lpStakingPoolsContract, amount, assetId)], amount)
379+ }
380+ else throw("Strict value is not equal to itself.")
381+ }
382+
383+
384+
385+@Callable(i)
386+func currentSysParamsREST (baseAssetStr) = {
387+ let sysStateTuple = privateCurrentSysParamsREST(baseAssetStr)
388+ let price = sysStateTuple._1.value
389+ let decimalsMultPrice = sysStateTuple._2.value
390+ let baseAssetBalance = sysStateTuple._3.value
391+ let totalLockedBaseAmount = sysStateTuple._4.value
392+ let baseAssetBalanceConsideringLock = sysStateTuple._5.value
393+ let shareEmission = sysStateTuple._6.value
394+ let restData = makeString(["startCurrentSysParamsREST", toString(price), toString(decimalsMultPrice), toString(baseAssetBalance), toString(totalLockedBaseAmount), toString(baseAssetBalanceConsideringLock), toString(shareEmission), "endCurrentSysParamsREST"], SEP)
395+ throw(restData)
396+ }
397+
398+
399+
400+@Callable(i)
401+func setManager (pendingManagerPublicKey) = {
402+ let checkCaller = mustManager(i)
403+ if ((checkCaller == checkCaller))
404+ then {
405+ let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
406+ if ((checkManagerPublicKey == checkManagerPublicKey))
407+ then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
408+ else throw("Strict value is not equal to itself.")
409+ }
410+ else throw("Strict value is not equal to itself.")
411+ }
412+
413+
414+
415+@Callable(i)
416+func confirmManager () = {
417+ let pm = pendingManagerPublicKeyOrUnit()
418+ let hasPM = if (isDefined(pm))
419+ then true
420+ else throwErr("no pending manager")
421+ if ((hasPM == hasPM))
422+ then {
423+ let checkPM = if ((i.callerPublicKey == value(pm)))
424+ then true
425+ else throwErr("you are not pending manager")
426+ if ((checkPM == checkPM))
427+ then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
428+ else throw("Strict value is not equal to itself.")
429+ }
430+ else throw("Strict value is not equal to itself.")
431+ }
432+
433+
434+@Verifier(tx)
435+func verify () = {
436+ let targetPublicKey = match managerPublicKeyOrUnit() {
437+ case pk: ByteVector =>
438+ pk
439+ case _: Unit =>
440+ tx.senderPublicKey
441+ case _ =>
442+ throw("Match error")
443+ }
444+ sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
445+ }
446+

github/deemru/w8io/026f985 
26.48 ms