tx · BJbFWETL5ucuhkmgaHvCsLNKxXXi1H2NzHbMgvMyt791

3N53siKhr59udoWv8myp2B3sEXcRmY5j7b2:  -0.01600000 Waves

2023.02.28 17:34 [2469681] smart account 3N53siKhr59udoWv8myp2B3sEXcRmY5j7b2 > SELF 0.00000000 Waves

{ "type": 13, "id": "BJbFWETL5ucuhkmgaHvCsLNKxXXi1H2NzHbMgvMyt791", "fee": 1600000, "feeAssetId": null, "timestamp": 1677594964524, "version": 2, "chainId": 84, "sender": "3N53siKhr59udoWv8myp2B3sEXcRmY5j7b2", "senderPublicKey": "39MQ3tMDeghcEji1wBaaBdguHU3bebLKhA7uzqrNf1Mq", "proofs": [ "5R2qwtvTmULkN4cvzUAPmcMNPjqjWsPAccLSHVYi3o4BXwkW7qr2G8bmjAv5z4xGH4p73tUNFXaVHBehZunFRt1N" ], "script": "base64:BgLgEggCEgcKBQgICAEIEgMKAQESABIAEgUKAwgICBIDCgEIEgQKAgIBEgQKAgIBEgMKAQgSAwoBCBIAIgNTRVAiB3dyYXBFcnIiA21zZyIIdGhyb3dFcnIiD2dldFN0cmluZ09yRmFpbCIDa2V5IhBnZXRCb29sZWFuT3JGYWlsIg5mYWlsRXhlY3V0ZUdldCIMYmFzZUFzc2V0U3RyIg51c2VyQWRkcmVzc1N0ciIKZ2V0VHhJZFN0ciILa2V5QXNzZXRDZmciFmtleU5leHRJbnRlcm5hbEFzc2V0SWQiDGtleVByaWNlTGFzdCIVaW50ZXJuYWxCYXNldEFzc2V0U3RyIhJrZXlUb3BVcExhc3RIZWlnaHQiBnNlbmRlciIPa2V5UHJpY2VIaXN0b3J5IgFoIgl0aW1lc3RhbXAiDmtleVRvdGFsTG9ja2VkIhRrZXlUb3RhbExvY2tlZEJ5VXNlciIUaW50ZXJuYWxCYXNlQXNzZXRTdHIiH2tleU1hcHBpbmdzSW50ZXJuYWwyYmFzZUFzc2V0SWQiEWludGVybmFsQmFzZUFzc2V0Ih9rZXlNYXBwaW5nc0Jhc2VBc3N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EAmJKAwkAAAIIBQFUD2NhbGxlclB1YmxpY0tleQkBBXZhbHVlAQUCYkgGCQEBZAECG3lvdSBhcmUgbm90IHBlbmRpbmcgbWFuYWdlcgMJAAACBQJiSgUCYkoJAMwIAgkBC1N0cmluZ0VudHJ5AgkBAUwACQDYBAEJAQV2YWx1ZQEFAmJICQDMCAIJAQtEZWxldGVFbnRyeQEJAQFNAAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJiSwECYkwABAJiTQQBTwkBAU4AAwkAAQIFAU8CCkJ5dGVWZWN0b3IEAVYFAU8FAVYDCQABAgUBTwIEVW5pdAgFAmJLD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJiSwlib2R5Qnl0ZXMJAJEDAggFAmJLBnByb29mcwAABQJiTR+MzJc=", "height": 2469681, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 6ostDXTFnpkMzQoCmP5XKJbRAygtyyWBbnYMx7QUZTnZ 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) = 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+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"))
119+
120+func dataAssetCfg (shareAssetStr,internalBaseAssetStr,decimalsMultBothAssets,decimalsMultPrice,getDelayInBlocks) = makeString(["%s%d%d%d%d", shareAssetStr, internalBaseAssetStr, toString(decimalsMultBothAssets), toString(decimalsMultPrice), toString(getDelayInBlocks)], SEP)
121+
122+
123+let IdxTotalLockedShare = 1
124+
125+let IdxTotalLockedBase = 2
126+
127+func dataTotalLocked (shareAssetAmount,baseAssetAmount) = makeString(["%d%d", toString(shareAssetAmount), toString(baseAssetAmount)], SEP)
128+
129+
130+func readTotalLocked (key) = {
131+ let totalLockedArray = split(valueOrElse(getString(this, key), dataTotalLocked(0, 0)), SEP)
132+[-1, parseIntValue(totalLockedArray[IdxTotalLockedShare]), parseIntValue(totalLockedArray[IdxTotalLockedBase])]
133+ }
134+
135+
136+func keyOperation (operationType,internalBaseAssetStr,userAddress,txId) = makeString(["%s%d%s%s", operationType, internalBaseAssetStr, userAddress, txId], SEP)
137+
138+
139+let IdxOperStatus = 1
140+
141+let IdxOperInAmount = 2
142+
143+let IdxOperPrice = 3
144+
145+let IdxOperOutAmount = 4
146+
147+let IdxOperStartHeight = 5
148+
149+let IdxOperStartTimestamp = 6
150+
151+let IdxOperEndHeight = 7
152+
153+let IdxOperEndTimestamp = 8
154+
155+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)
156+
157+
158+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))
159+
160+
161+func dataOperationExecutionUpdate (currOperArray,newStatus,newEndTimestamp) = privateDataOperationAllStrings(newStatus, currOperArray[IdxOperInAmount], currOperArray[IdxOperPrice], currOperArray[IdxOperOutAmount], currOperArray[IdxOperStartHeight], currOperArray[IdxOperStartTimestamp], currOperArray[IdxOperEndHeight], toString(newEndTimestamp))
162+
163+
164+func readAssetCfgOrFail (baseAssetStr) = {
165+ let key = keyAssetCfg(baseAssetStr)
166+ split(getStringOrFail(key), SEP)
167+ }
168+
169+
170+func incrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = {
171+ let dataArray = readTotalLocked(key)
172+ StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] + shareAssetAmount), (dataArray[IdxTotalLockedBase] + baseAssetAmount)))
173+ }
174+
175+
176+func decrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = {
177+ let dataArray = readTotalLocked(key)
178+ StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] - shareAssetAmount), (dataArray[IdxTotalLockedBase] - baseAssetAmount)))
179+ }
180+
181+
182+func genericCalcPrice (internalBaseAssetStr,baseAssetId,topUpBaseAmount,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = {
183+ let totalLockedArray = readTotalLocked(keyTotalLocked(internalBaseAssetStr))
184+ let totalLockedBaseAmount = totalLockedArray[IdxTotalLockedBase]
185+ let baseAssetBalance = assetBalance(this, baseAssetId)
186+ let baseAssetBalanceConsideringLock = ((baseAssetBalance - totalLockedBaseAmount) + topUpBaseAmount)
187+ if ((0 > baseAssetBalanceConsideringLock))
188+ then throw(((("baseAssetBalanceConsideringLock < 0: baseAssetBalance=" + toString(baseAssetBalance)) + " baseAssetBalanceConsideringLock=") + toString(baseAssetBalanceConsideringLock)))
189+ else {
190+ let shareEmission = value(assetInfo(shareAssetId)).quantity
191+ let price = if ((shareEmission == 0))
192+ then (1 * decimalsMultPrice)
193+ else fraction(baseAssetBalanceConsideringLock, decimalsMultPrice, shareEmission)
194+ $Tuple5(price, baseAssetBalance, totalLockedBaseAmount, baseAssetBalanceConsideringLock, shareEmission)
195+ }
196+ }
197+
198+
199+func calcPrice (internalBaseAssetStr,baseAssetId,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = genericCalcPrice(internalBaseAssetStr, baseAssetId, 0, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)
200+
201+
202+func privateCurrentSysParamsREST (baseAssetStr) = {
203+ let baseAssetId = fromBase58String(baseAssetStr)
204+ let cfgArray = readAssetCfgOrFail(baseAssetStr)
205+ let shareAssetStr = cfgArray[IdxCfgShareAssetId]
206+ let shareAssetId = fromBase58String(shareAssetStr)
207+ let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
208+ let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
209+ let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
210+ let sysState = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)
211+ $Tuple6(IntegerEntry("price", sysState._1), IntegerEntry("decimalsMultPrice", decimalsMultPrice), IntegerEntry("baseAssetBalance", sysState._2), IntegerEntry("totalLockedBaseAmount", sysState._3), IntegerEntry("baseAssetBalanceConsideringLock", sysState._4), IntegerEntry("shareEmission", sysState._5))
212+ }
213+
214+
215+@Callable(i)
216+func adminRegisterAsset (baseAssetStr,shareAssetName,shareAssetDescr,getDelayinBlocks,shutdownManagerAddress) = {
217+ let baseAssetId = fromBase58String(baseAssetStr)
218+ let decimals = value(assetInfo(baseAssetId)).decimals
219+ let checkCaller = mustManager(i)
220+ if ((checkCaller == checkCaller))
221+ then if ((toString(addressFromStringValue(shutdownManagerAddress)) != shutdownManagerAddress))
222+ then throw("invalid shutdownManagerAddress")
223+ else if ((0 > getDelayinBlocks))
224+ then throw(("invalid getDelayinBlocks=" + toString(getDelayinBlocks)))
225+ else {
226+ let shareAssetIssueAction = Issue(shareAssetName, shareAssetDescr, 1, decimals, true)
227+ let shareAssetId = calculateAssetId(shareAssetIssueAction)
228+ let shareAssetStr = toBase58String(shareAssetId)
229+ let decimalsMultPrice = ((100 * 1000) * 1000)
230+ let decimalsMultBothAssets = pow(10, 0, decimals, 0, 0, DOWN)
231+ let startPrice = (1 * decimalsMultPrice)
232+ let internalBaseAssettId = valueOrElse(getInteger(this, keyNextInternalAssetId()), 0)
233+ let internalBaseAssetStr = toString(internalBaseAssettId)
234+[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)]
235+ }
236+ else throw("Strict value is not equal to itself.")
237+ }
238+
239+
240+
241+@Callable(i)
242+func shutdownPut (internalBaseAssetId) = {
243+ let internalBaseAssetIdStr = toString(internalBaseAssetId)
244+ let baseAssetIdStr = getStringOrFail(keyMappingsInternal2baseAssetId(internalBaseAssetId))
245+ let shutdownManagerAddress = getStringOrFail(keyShutdownManager(internalBaseAssetIdStr))
246+ if ((1 > size(baseAssetIdStr)))
247+ then throw("invalid internalBaseAssetId")
248+ else if ((toString(i.caller) != shutdownManagerAddress))
249+ then throw("access denied")
250+ else [BooleanEntry(keyShutdownPutOperation(toString(internalBaseAssetId)), true)]
251+ }
252+
253+
254+
255+@Callable(i)
256+func put () = {
257+ let pmt = value(i.payments[0])
258+ let baseAssetId = value(pmt.assetId)
259+ let baseAssetStr = toBase58String(baseAssetId)
260+ let userAddressStr = toString(i.caller)
261+ let cfgArray = readAssetCfgOrFail(baseAssetStr)
262+ let shareAssetStr = cfgArray[IdxCfgShareAssetId]
263+ let shareAssetId = fromBase58String(shareAssetStr)
264+ let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
265+ let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
266+ let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
267+ let isPutBlocked = getBooleanOrFail(keyShutdownPutOperation(internalBaseAssetStr))
268+ let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
269+ if (if (isPutBlocked)
270+ then true
271+ else shutdown)
272+ then throw("put operation is blocked")
273+ else {
274+ let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
275+ let shareAssetAmount = fraction(pmt.amount, decimalsMultPrice, price)
276+[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))]
277+ }
278+ }
279+
280+
281+
282+@Callable(i)
283+func submitGetRequest () = {
284+ let pmt = value(i.payments[0])
285+ let shareAssetId = value(pmt.assetId)
286+ let shareAssetStr = toBase58String(shareAssetId)
287+ let callerPubStr = toBase58String(i.callerPublicKey)
288+ let userAddress = i.caller
289+ let userAddressStr = toString(userAddress)
290+ let shareAssetAmount = pmt.amount
291+ let baseAssetStr = getStringOrFail(keyMappingsShare2baseAssetId(shareAssetStr))
292+ let baseAssetId = fromBase58String(baseAssetStr)
293+ let cfgArray = readAssetCfgOrFail(baseAssetStr)
294+ let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
295+ let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
296+ let getDelayBlocks = parseIntValue(cfgArray[IdxCfgGetDelayBlocks])
297+ 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)
306+[Burn(shareAssetId, shareAssetAmount), StringEntry(operationKey, operationData), incrementTotalLocked(keyTotalLocked(internalBaseAssetStr), shareAssetAmount, baseAssetAmount), incrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), shareAssetAmount, baseAssetAmount)]
307+ }
308+ }
309+
310+
311+
312+@Callable(i)
313+func executeGetRequest (baseAssetStr,userAddressStr,getTxIdStr) = {
314+ let userAddress = addressFromStringValue(userAddressStr)
315+ let assetCfgArray = readAssetCfgOrFail(baseAssetStr)
316+ let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId])
317+ let baseAssetId = fromBase58String(baseAssetStr)
318+ 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+ }
335+ }
336+
337+
338+
339+@Callable(i)
340+func topUpBalance (baseAssetStr) = {
341+ let assetCfgArray = readAssetCfgOrFail(baseAssetStr)
342+ let pmt = value(i.payments[0])
343+ let pmtAssetId = value(pmt.assetId)
344+ let pmtAssetStr = toBase58String(pmtAssetId)
345+ let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId])
346+ let decimalsMultBothAssets = parseIntValue(assetCfgArray[IdxCfgDecimalsMultBothAssets])
347+ let decimalsMultPrice = parseIntValue(assetCfgArray[IdxCfgDecimalsMultPrice])
348+ let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset]
349+ let topUpLastHeightKEY = keyTopUpLastHeight(internalBaseAssetStr, toString(i.caller))
350+ 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
362+[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.")
399+ }
400+
401+
402+
403+@Callable(i)
404+func currentSysParamsREST (baseAssetStr) = {
405+ let sysStateTuple = privateCurrentSysParamsREST(baseAssetStr)
406+ let price = sysStateTuple._1.value
407+ let decimalsMultPrice = sysStateTuple._2.value
408+ let baseAssetBalance = sysStateTuple._3.value
409+ let totalLockedBaseAmount = sysStateTuple._4.value
410+ let baseAssetBalanceConsideringLock = sysStateTuple._5.value
411+ let shareEmission = sysStateTuple._6.value
412+ let restData = makeString(["startCurrentSysParamsREST", toString(price), toString(decimalsMultPrice), toString(baseAssetBalance), toString(totalLockedBaseAmount), toString(baseAssetBalanceConsideringLock), toString(shareEmission), "endCurrentSysParamsREST"], SEP)
413+ throw(restData)
414+ }
415+
416+
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+
452+@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+ }
464+

github/deemru/w8io/169f3d6 
35.43 ms