tx · 28DAJQDGWMLhKmHRTCR72v11NDteh36ZBGJh2syKuDFX

3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk:  -0.01600000 Waves

2023.01.13 12:52 [2403024] smart account 3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk > SELF 0.00000000 Waves

{ "type": 13, "id": "28DAJQDGWMLhKmHRTCR72v11NDteh36ZBGJh2syKuDFX", "fee": 1600000, "feeAssetId": null, "timestamp": 1673603572199, "version": 1, "sender": "3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk", "senderPublicKey": "2rdeGwVMkuRfRdUgrYaekNmjnegHokhyDx1z6TJq525F", "proofs": [ "2Q41vxf6QMZh22TeKQByR7j7qj1gWNmPzamSJyHYrku1FCgaA4k3p8uV9hRR1ctH9TFBAzw32NGoeDRNDWHcFmrV" ], "script": "base64:BgLgEggCEgcKBQgICAEIEgMKAQESABIAEgUKAwgICBIDCgEIEgQKAgIBEgQKAgIBEgMKAQgSAwoBCBIAIgNTRVAiB3dyYXBFcnIiA21zZyIIdGhyb3dFcnIiD2dldFN0cmluZ09yRmFpbCIDa2V5IhBnZXRCb29sZWFuT3JGYWlsIg5mYWlsRXhlY3V0ZUdldCIMYmFzZUFzc2V0U3RyIg51c2VyQWRkcmVzc1N0ciIKZ2V0VHhJZFN0ciILa2V5QXNzZXRDZmciFmtleU5leHRJbnRlcm5hbEFzc2V0SWQiDGtleVByaWNlTGFzdCIVaW50ZXJuYWxCYXNldEFzc2V0U3RyIhJrZXlUb3BVcExhc3RIZWlnaHQiBnNlbmRlciIPa2V5UHJpY2VIaXN0b3J5IgFoIgl0aW1lc3RhbXAiDmtleVRvdGFsTG9ja2VkIhRrZXlUb3RhbExvY2tlZEJ5VXNlciIUaW50ZXJuYWxCYXNlQXNzZXRTdHIiH2tleU1hcHBpbmdzSW50ZXJuYWwyYmFzZUFzc2V0SWQiEWludGVybmFsQmFzZUFzc2V0Ih9rZXlNYXBwaW5nc0Jhc2VBc3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kEAmJKAwkAAAIIBQFUD2NhbGxlclB1YmxpY0tleQkBBXZhbHVlAQUCYkgGCQEBZAECG3lvdSBhcmUgbm90IHBlbmRpbmcgbWFuYWdlcgMJAAACBQJiSgUCYkoJAMwIAgkBC1N0cmluZ0VudHJ5AgkBAUwACQDYBAEJAQV2YWx1ZQEFAmJICQDMCAIJAQtEZWxldGVFbnRyeQEJAQFNAAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJiSwECYkwABAJiTQQBTwkBAU4AAwkAAQIFAU8CCkJ5dGVWZWN0b3IEAVYFAU8FAVYDCQABAgUBTwIEVW5pdAgFAmJLD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJiSwlib2R5Qnl0ZXMJAJEDAggFAmJLBnByb29mcwAABQJiTR+MzJc=", "chainId": 84, "height": 2403024, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: F6qPjohVAwGiuyRayjuXD82KbqjuvVdmwMt87ZWHzvma Next: 8FurQAffAdR21eerYn7eGTv7kMunvoJhooZecsmtyTs4 Diff:
OldNewDifferences
114114 throw("Match error")
115115 }
116116
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"))
117119
118120 func dataAssetCfg (shareAssetStr,internalBaseAssetStr,decimalsMultBothAssets,decimalsMultPrice,getDelayInBlocks) = makeString(["%s%d%d%d%d", shareAssetStr, internalBaseAssetStr, toString(decimalsMultBothAssets), toString(decimalsMultPrice), toString(getDelayInBlocks)], SEP)
119121
365367
366368 @Callable(i)
367369 func emit (assetId,amount) = {
368- 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"))
369370 let checks = [if ((i.caller == lpStakingPoolsContract))
370371 then true
371372 else throwErr("permission denied"), if ((amount > 0))
378379 let isReissuable = true
379380 $Tuple2([Reissue(assetId, amount, isReissuable), ScriptTransfer(lpStakingPoolsContract, amount, assetId)], amount)
380381 }
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)
381398 else throw("Strict value is not equal to itself.")
382399 }
383400
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 func wrapErr (msg) = makeString(["lp_staking.ride:", msg], " ")
77
88
99 func throwErr (msg) = throw(wrapErr(msg))
1010
1111
1212 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key))
1313
1414
1515 func getBooleanOrFail (key) = valueOrErrorMessage(getBoolean(this, key), ("No data for this.key=" + key))
1616
1717
1818 func failExecuteGet (msg,baseAssetStr,userAddressStr,getTxIdStr) = throw(((((((msg + ": baseAssetStr=") + baseAssetStr) + " userAddressStr=") + userAddressStr) + " getTxIdStr=") + getTxIdStr))
1919
2020
2121 func keyAssetCfg (baseAssetStr) = ("%s%s%s__config__asset__" + baseAssetStr)
2222
2323
2424 func keyNextInternalAssetId () = "%s__nextInternalAssetId"
2525
2626
2727 func keyPriceLast (internalBasetAssetStr) = ("%s%s%d__price__last__" + internalBasetAssetStr)
2828
2929
3030 func keyTopUpLastHeight (internalBasetAssetStr,sender) = makeString(["%s%s%s%d%s__topup__last__height", internalBasetAssetStr, sender], SEP)
3131
3232
3333 func keyPriceHistory (internalBasetAssetStr,h,timestamp) = makeString(["%s%s%d%d%d__price__history", internalBasetAssetStr, toString(h), toString(timestamp)], SEP)
3434
3535
3636 func keyTotalLocked (internalBasetAssetStr) = ("%s%s%d__total__locked__" + internalBasetAssetStr)
3737
3838
3939 func keyTotalLockedByUser (internalBaseAssetStr,userAddressStr) = makeString(["%s%s%d%s__total__locked", internalBaseAssetStr, userAddressStr], SEP)
4040
4141
4242 func keyMappingsInternal2baseAssetId (internalBaseAsset) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(internalBaseAsset))
4343
4444
4545 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
4646
4747
4848 func keyMappingsShare2baseAssetId (shareAssetStr) = ("%s%s%s__mappings__share2baseAssetId__" + shareAssetStr)
4949
5050
5151 func keyMappingsBaseAsset2shareId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2shareId__" + baseAssetStr)
5252
5353
5454 func keyShutdownPutOperation (internalBaseAssetStr) = ("%s%s%d__shutdown__put__" + internalBaseAssetStr)
5555
5656
5757 func keyShutdown (internalBaseAssetStr) = ("%s%d__shutdown__" + internalBaseAssetStr)
5858
5959
6060 func keyShutdownManager (internalBaseAssetStr) = ("%s%s%d__shutdown__manager__" + internalBaseAssetStr)
6161
6262
6363 let IdxCfgShareAssetId = 1
6464
6565 let IdxCfgInternalBaseAsset = 2
6666
6767 let IdxCfgDecimalsMultBothAssets = 3
6868
6969 let IdxCfgDecimalsMultPrice = 4
7070
7171 let IdxCfgGetDelayBlocks = 5
7272
7373 func keyManagerPublicKey () = "%s__managerPublicKey"
7474
7575
7676 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
7777
7878
7979 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
8080 case s: String =>
8181 fromBase58String(s)
8282 case _: Unit =>
8383 unit
8484 case _ =>
8585 throw("Match error")
8686 }
8787
8888
8989 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
9090 case s: String =>
9191 fromBase58String(s)
9292 case _: Unit =>
9393 unit
9494 case _ =>
9595 throw("Match error")
9696 }
9797
9898
9999 let permissionDeniedError = throw("Permission denied")
100100
101101 func mustThis (i) = if ((i.caller == this))
102102 then true
103103 else permissionDeniedError
104104
105105
106106 func mustManager (i) = match managerPublicKeyOrUnit() {
107107 case pk: ByteVector =>
108108 if ((i.callerPublicKey == pk))
109109 then true
110110 else permissionDeniedError
111111 case _: Unit =>
112112 mustThis(i)
113113 case _ =>
114114 throw("Match error")
115115 }
116116
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"))
117119
118120 func dataAssetCfg (shareAssetStr,internalBaseAssetStr,decimalsMultBothAssets,decimalsMultPrice,getDelayInBlocks) = makeString(["%s%d%d%d%d", shareAssetStr, internalBaseAssetStr, toString(decimalsMultBothAssets), toString(decimalsMultPrice), toString(getDelayInBlocks)], SEP)
119121
120122
121123 let IdxTotalLockedShare = 1
122124
123125 let IdxTotalLockedBase = 2
124126
125127 func dataTotalLocked (shareAssetAmount,baseAssetAmount) = makeString(["%d%d", toString(shareAssetAmount), toString(baseAssetAmount)], SEP)
126128
127129
128130 func readTotalLocked (key) = {
129131 let totalLockedArray = split(valueOrElse(getString(this, key), dataTotalLocked(0, 0)), SEP)
130132 [-1, parseIntValue(totalLockedArray[IdxTotalLockedShare]), parseIntValue(totalLockedArray[IdxTotalLockedBase])]
131133 }
132134
133135
134136 func keyOperation (operationType,internalBaseAssetStr,userAddress,txId) = makeString(["%s%d%s%s", operationType, internalBaseAssetStr, userAddress, txId], SEP)
135137
136138
137139 let IdxOperStatus = 1
138140
139141 let IdxOperInAmount = 2
140142
141143 let IdxOperPrice = 3
142144
143145 let IdxOperOutAmount = 4
144146
145147 let IdxOperStartHeight = 5
146148
147149 let IdxOperStartTimestamp = 6
148150
149151 let IdxOperEndHeight = 7
150152
151153 let IdxOperEndTimestamp = 8
152154
153155 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)
154156
155157
156158 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))
157159
158160
159161 func dataOperationExecutionUpdate (currOperArray,newStatus,newEndTimestamp) = privateDataOperationAllStrings(newStatus, currOperArray[IdxOperInAmount], currOperArray[IdxOperPrice], currOperArray[IdxOperOutAmount], currOperArray[IdxOperStartHeight], currOperArray[IdxOperStartTimestamp], currOperArray[IdxOperEndHeight], toString(newEndTimestamp))
160162
161163
162164 func readAssetCfgOrFail (baseAssetStr) = {
163165 let key = keyAssetCfg(baseAssetStr)
164166 split(getStringOrFail(key), SEP)
165167 }
166168
167169
168170 func incrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = {
169171 let dataArray = readTotalLocked(key)
170172 StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] + shareAssetAmount), (dataArray[IdxTotalLockedBase] + baseAssetAmount)))
171173 }
172174
173175
174176 func decrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = {
175177 let dataArray = readTotalLocked(key)
176178 StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] - shareAssetAmount), (dataArray[IdxTotalLockedBase] - baseAssetAmount)))
177179 }
178180
179181
180182 func genericCalcPrice (internalBaseAssetStr,baseAssetId,topUpBaseAmount,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = {
181183 let totalLockedArray = readTotalLocked(keyTotalLocked(internalBaseAssetStr))
182184 let totalLockedBaseAmount = totalLockedArray[IdxTotalLockedBase]
183185 let baseAssetBalance = assetBalance(this, baseAssetId)
184186 let baseAssetBalanceConsideringLock = ((baseAssetBalance - totalLockedBaseAmount) + topUpBaseAmount)
185187 if ((0 > baseAssetBalanceConsideringLock))
186188 then throw(((("baseAssetBalanceConsideringLock < 0: baseAssetBalance=" + toString(baseAssetBalance)) + " baseAssetBalanceConsideringLock=") + toString(baseAssetBalanceConsideringLock)))
187189 else {
188190 let shareEmission = value(assetInfo(shareAssetId)).quantity
189191 let price = if ((shareEmission == 0))
190192 then (1 * decimalsMultPrice)
191193 else fraction(baseAssetBalanceConsideringLock, decimalsMultPrice, shareEmission)
192194 $Tuple5(price, baseAssetBalance, totalLockedBaseAmount, baseAssetBalanceConsideringLock, shareEmission)
193195 }
194196 }
195197
196198
197199 func calcPrice (internalBaseAssetStr,baseAssetId,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = genericCalcPrice(internalBaseAssetStr, baseAssetId, 0, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)
198200
199201
200202 func privateCurrentSysParamsREST (baseAssetStr) = {
201203 let baseAssetId = fromBase58String(baseAssetStr)
202204 let cfgArray = readAssetCfgOrFail(baseAssetStr)
203205 let shareAssetStr = cfgArray[IdxCfgShareAssetId]
204206 let shareAssetId = fromBase58String(shareAssetStr)
205207 let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
206208 let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
207209 let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
208210 let sysState = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)
209211 $Tuple6(IntegerEntry("price", sysState._1), IntegerEntry("decimalsMultPrice", decimalsMultPrice), IntegerEntry("baseAssetBalance", sysState._2), IntegerEntry("totalLockedBaseAmount", sysState._3), IntegerEntry("baseAssetBalanceConsideringLock", sysState._4), IntegerEntry("shareEmission", sysState._5))
210212 }
211213
212214
213215 @Callable(i)
214216 func adminRegisterAsset (baseAssetStr,shareAssetName,shareAssetDescr,getDelayinBlocks,shutdownManagerAddress) = {
215217 let baseAssetId = fromBase58String(baseAssetStr)
216218 let decimals = value(assetInfo(baseAssetId)).decimals
217219 let checkCaller = mustManager(i)
218220 if ((checkCaller == checkCaller))
219221 then if ((toString(addressFromStringValue(shutdownManagerAddress)) != shutdownManagerAddress))
220222 then throw("invalid shutdownManagerAddress")
221223 else if ((0 > getDelayinBlocks))
222224 then throw(("invalid getDelayinBlocks=" + toString(getDelayinBlocks)))
223225 else {
224226 let shareAssetIssueAction = Issue(shareAssetName, shareAssetDescr, 1, decimals, true)
225227 let shareAssetId = calculateAssetId(shareAssetIssueAction)
226228 let shareAssetStr = toBase58String(shareAssetId)
227229 let decimalsMultPrice = ((100 * 1000) * 1000)
228230 let decimalsMultBothAssets = pow(10, 0, decimals, 0, 0, DOWN)
229231 let startPrice = (1 * decimalsMultPrice)
230232 let internalBaseAssettId = valueOrElse(getInteger(this, keyNextInternalAssetId()), 0)
231233 let internalBaseAssetStr = toString(internalBaseAssettId)
232234 [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)]
233235 }
234236 else throw("Strict value is not equal to itself.")
235237 }
236238
237239
238240
239241 @Callable(i)
240242 func shutdownPut (internalBaseAssetId) = {
241243 let internalBaseAssetIdStr = toString(internalBaseAssetId)
242244 let baseAssetIdStr = getStringOrFail(keyMappingsInternal2baseAssetId(internalBaseAssetId))
243245 let shutdownManagerAddress = getStringOrFail(keyShutdownManager(internalBaseAssetIdStr))
244246 if ((1 > size(baseAssetIdStr)))
245247 then throw("invalid internalBaseAssetId")
246248 else if ((toString(i.caller) != shutdownManagerAddress))
247249 then throw("access denied")
248250 else [BooleanEntry(keyShutdownPutOperation(toString(internalBaseAssetId)), true)]
249251 }
250252
251253
252254
253255 @Callable(i)
254256 func put () = {
255257 let pmt = value(i.payments[0])
256258 let baseAssetId = value(pmt.assetId)
257259 let baseAssetStr = toBase58String(baseAssetId)
258260 let userAddressStr = toString(i.caller)
259261 let cfgArray = readAssetCfgOrFail(baseAssetStr)
260262 let shareAssetStr = cfgArray[IdxCfgShareAssetId]
261263 let shareAssetId = fromBase58String(shareAssetStr)
262264 let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
263265 let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
264266 let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
265267 let isPutBlocked = getBooleanOrFail(keyShutdownPutOperation(internalBaseAssetStr))
266268 let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
267269 if (if (isPutBlocked)
268270 then true
269271 else shutdown)
270272 then throw("put operation is blocked")
271273 else {
272274 let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
273275 let shareAssetAmount = fraction(pmt.amount, decimalsMultPrice, price)
274276 [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))]
275277 }
276278 }
277279
278280
279281
280282 @Callable(i)
281283 func submitGetRequest () = {
282284 let pmt = value(i.payments[0])
283285 let shareAssetId = value(pmt.assetId)
284286 let shareAssetStr = toBase58String(shareAssetId)
285287 let callerPubStr = toBase58String(i.callerPublicKey)
286288 let userAddress = i.caller
287289 let userAddressStr = toString(userAddress)
288290 let shareAssetAmount = pmt.amount
289291 let baseAssetStr = getStringOrFail(keyMappingsShare2baseAssetId(shareAssetStr))
290292 let baseAssetId = fromBase58String(baseAssetStr)
291293 let cfgArray = readAssetCfgOrFail(baseAssetStr)
292294 let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets])
293295 let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice])
294296 let getDelayBlocks = parseIntValue(cfgArray[IdxCfgGetDelayBlocks])
295297 let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset]
296298 let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
297299 if (shutdown)
298300 then throw("operation is blocked")
299301 else {
300302 let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
301303 let baseAssetAmount = fraction(shareAssetAmount, price, decimalsMultPrice)
302304 let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId))
303305 let operationData = dataOperation("PENDING", shareAssetAmount, price, baseAssetAmount, height, lastBlock.timestamp, (height + getDelayBlocks), 0)
304306 [Burn(shareAssetId, shareAssetAmount), StringEntry(operationKey, operationData), incrementTotalLocked(keyTotalLocked(internalBaseAssetStr), shareAssetAmount, baseAssetAmount), incrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), shareAssetAmount, baseAssetAmount)]
305307 }
306308 }
307309
308310
309311
310312 @Callable(i)
311313 func executeGetRequest (baseAssetStr,userAddressStr,getTxIdStr) = {
312314 let userAddress = addressFromStringValue(userAddressStr)
313315 let assetCfgArray = readAssetCfgOrFail(baseAssetStr)
314316 let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId])
315317 let baseAssetId = fromBase58String(baseAssetStr)
316318 let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset]
317319 let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
318320 if (shutdown)
319321 then throw("operation is blocked")
320322 else {
321323 let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, getTxIdStr)
322324 let operationArray = split(getStringOrFail(operationKey), SEP)
323325 let status = operationArray[IdxOperStatus]
324326 let endHeight = parseIntValue(operationArray[IdxOperEndHeight])
325327 let inShareAmount = parseIntValue(operationArray[IdxOperInAmount])
326328 let outBaseAmount = parseIntValue(operationArray[IdxOperOutAmount])
327329 if ((status != "PENDING"))
328330 then failExecuteGet("Status is not PENDING", baseAssetStr, userAddressStr, getTxIdStr)
329331 else if ((endHeight > height))
330332 then failExecuteGet(((("EndHeight[" + toString(endHeight)) + "] > ") + toString(height)), baseAssetStr, userAddressStr, getTxIdStr)
331333 else [ScriptTransfer(userAddress, outBaseAmount, baseAssetId), StringEntry(operationKey, dataOperationExecutionUpdate(operationArray, "FINISHED", lastBlock.timestamp)), decrementTotalLocked(keyTotalLocked(internalBaseAssetStr), inShareAmount, outBaseAmount), decrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), inShareAmount, outBaseAmount)]
332334 }
333335 }
334336
335337
336338
337339 @Callable(i)
338340 func topUpBalance (baseAssetStr) = {
339341 let assetCfgArray = readAssetCfgOrFail(baseAssetStr)
340342 let pmt = value(i.payments[0])
341343 let pmtAssetId = value(pmt.assetId)
342344 let pmtAssetStr = toBase58String(pmtAssetId)
343345 let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId])
344346 let decimalsMultBothAssets = parseIntValue(assetCfgArray[IdxCfgDecimalsMultBothAssets])
345347 let decimalsMultPrice = parseIntValue(assetCfgArray[IdxCfgDecimalsMultPrice])
346348 let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset]
347349 let topUpLastHeightKEY = keyTopUpLastHeight(internalBaseAssetStr, toString(i.caller))
348350 let topUpLastHeight = valueOrElse(getInteger(this, topUpLastHeightKEY), 0)
349351 let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false)
350352 if (shutdown)
351353 then throw("operation is blocked")
352354 else if ((baseAssetStr != pmtAssetStr))
353355 then throw("attached payment's asset id is NOT matched passed baseAssetStr")
354356 else if ((size(i.payments) > 1))
355357 then throw("only one payment can be attached")
356358 else if ((100 > (height - topUpLastHeight)))
357359 then throw("1 topUp per 100 blocks from the same address is allowed")
358360 else {
359361 let price = genericCalcPrice(internalBaseAssetStr, pmtAssetId, pmt.amount, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1
360362 [IntegerEntry(keyPriceLast(internalBaseAssetStr), price), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), price), IntegerEntry(topUpLastHeightKEY, height)]
361363 }
362364 }
363365
364366
365367
366368 @Callable(i)
367369 func emit (assetId,amount) = {
368- 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"))
369370 let checks = [if ((i.caller == lpStakingPoolsContract))
370371 then true
371372 else throwErr("permission denied"), if ((amount > 0))
372373 then true
373374 else throwErr("invalid amount to emit"), if ((getString(keyMappingsShare2baseAssetId(toBase58String(assetId))) != unit))
374375 then true
375376 else throwErr("invalid assetId")]
376377 if ((checks == checks))
377378 then {
378379 let isReissuable = true
379380 $Tuple2([Reissue(assetId, amount, isReissuable), ScriptTransfer(lpStakingPoolsContract, amount, assetId)], amount)
380381 }
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)
381398 else throw("Strict value is not equal to itself.")
382399 }
383400
384401
385402
386403 @Callable(i)
387404 func currentSysParamsREST (baseAssetStr) = {
388405 let sysStateTuple = privateCurrentSysParamsREST(baseAssetStr)
389406 let price = sysStateTuple._1.value
390407 let decimalsMultPrice = sysStateTuple._2.value
391408 let baseAssetBalance = sysStateTuple._3.value
392409 let totalLockedBaseAmount = sysStateTuple._4.value
393410 let baseAssetBalanceConsideringLock = sysStateTuple._5.value
394411 let shareEmission = sysStateTuple._6.value
395412 let restData = makeString(["startCurrentSysParamsREST", toString(price), toString(decimalsMultPrice), toString(baseAssetBalance), toString(totalLockedBaseAmount), toString(baseAssetBalanceConsideringLock), toString(shareEmission), "endCurrentSysParamsREST"], SEP)
396413 throw(restData)
397414 }
398415
399416
400417
401418 @Callable(i)
402419 func setManager (pendingManagerPublicKey) = {
403420 let checkCaller = mustManager(i)
404421 if ((checkCaller == checkCaller))
405422 then {
406423 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
407424 if ((checkManagerPublicKey == checkManagerPublicKey))
408425 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
409426 else throw("Strict value is not equal to itself.")
410427 }
411428 else throw("Strict value is not equal to itself.")
412429 }
413430
414431
415432
416433 @Callable(i)
417434 func confirmManager () = {
418435 let pm = pendingManagerPublicKeyOrUnit()
419436 let hasPM = if (isDefined(pm))
420437 then true
421438 else throwErr("no pending manager")
422439 if ((hasPM == hasPM))
423440 then {
424441 let checkPM = if ((i.callerPublicKey == value(pm)))
425442 then true
426443 else throwErr("you are not pending manager")
427444 if ((checkPM == checkPM))
428445 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
429446 else throw("Strict value is not equal to itself.")
430447 }
431448 else throw("Strict value is not equal to itself.")
432449 }
433450
434451
435452 @Verifier(tx)
436453 func verify () = {
437454 let targetPublicKey = match managerPublicKeyOrUnit() {
438455 case pk: ByteVector =>
439456 pk
440457 case _: Unit =>
441458 tx.senderPublicKey
442459 case _ =>
443460 throw("Match error")
444461 }
445462 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
446463 }
447464

github/deemru/w8io/026f985 
55.09 ms