tx · DtnPPqZXor71n3iJtMQAB13ee419iGiCDx5qvcKjrPbD 3NC9wWawxuFG6a3sZdfckGwoMeVhLFjZFwH: -0.01400000 Waves 2021.03.26 13:36 [1454597] smart account 3NC9wWawxuFG6a3sZdfckGwoMeVhLFjZFwH > SELF 0.00000000 Waves
{ "type": 13, "id": "DtnPPqZXor71n3iJtMQAB13ee419iGiCDx5qvcKjrPbD", "fee": 1400000, "feeAssetId": null, "timestamp": 1616755021238, "version": 1, "sender": "3NC9wWawxuFG6a3sZdfckGwoMeVhLFjZFwH", "senderPublicKey": "HoEvP2nFKMAsffQ9PUyAm6auWisyHgusY9HxDeMASrzZ", "proofs": [ "2kHxkTQKemB8XTgkXTNhvgdZiJRMXDLMaZEUC4emqo3PXNKa2BAgs533yWZNu3dMnyS6Ftw13JftXQeDzs9Jp4Yu" ], "script": "base64:AAIEAAAAAAAAADoIAhIPCg0ICAgBCAEBAQgBAQEBEgMKAQESABIAEgUKAwgICBIFCgMICAgSAwoBCBIECgIIARIDCgEIAAAASgAAAAADU0VQAgAAAAJfXwEAAAAPZ2V0U3RyaW5nT3JGYWlsAAAAAQAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkJAAEsAAAAAgIAAAAVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQAAAANrZXkBAAAAEGdldEJvb2xlYW5PckZhaWwAAAABAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEGwAAAAIFAAAABHRoaXMFAAAAA2tleQkAASwAAAACAgAAABVObyBkYXRhIGZvciB0aGlzLmtleT0FAAAAA2tleQEAAAAMZ2V0SW50T3JGYWlsAAAAAQAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkJAAEsAAAAAgIAAAAVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQ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ARMAAAAAgIAAAAZc3RhcnRDdXJyZW50U3lzUGFyYW1zUkVTVAkABEwAAAACCQABpAAAAAEFAAAABXByaWNlCQAETAAAAAIJAAGkAAAAAQUAAAARZGVjaW1hbHNNdWx0UHJpY2UJAARMAAAAAgkAAaQAAAABBQAAABBiYXNlQXNzZXRCYWxhbmNlCQAETAAAAAIJAAGkAAAAAQUAAAAVdG90YWxMb2NrZWRCYXNlQW1vdW50CQAETAAAAAIJAAGkAAAAAQUAAAATYmFzZUFzc2V0QmFsYW5jZVdDTwkABEwAAAACCQABpAAAAAEFAAAADXNoYXJlRW1pc3Npb24JAARMAAAAAgIAAAAXZW5kQ3VycmVudFN5c1BhcmFtc1JFU1QFAAAAA25pbAUAAAADU0VQCQAAAgAAAAEFAAAACHJlc3REYXRhAAAAADi3EUU=", "chainId": 84, "height": 1454597, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: F6XVGrwNfKoawn776NeSWJoTD3C1VpuxQxipH3TbBp3F Next: 24w2yoHRoB44ajZVdmtj6acdRUA8Vhf5Xr9niZFGveAw Diff:
Old | New | Differences | |
---|---|---|---|
16 | 16 | ||
17 | 17 | ||
18 | 18 | func failSubmitLimitsExceeds (remainingBase,remainingShare,newRemainingBase,newRemainingShare) = throw((((((((("submit operation limits have been reached: " + " remainingBase=") + toString(remainingBase)) + " remainingShare=") + toString(remainingShare)) + " newRemainingBase=") + toString(newRemainingBase)) + " newRemainingShare=") + toString(newRemainingShare))) | |
19 | + | ||
20 | + | ||
21 | + | func failTopupManagerOnly (topupManagerAddress) = throw((("opertion denied: only topUpManager=" + topupManagerAddress) + " can send such transactions")) | |
19 | 22 | ||
20 | 23 | ||
21 | 24 | func convertShare2Base (shareAmount,price,priceMult) = fraction(shareAmount, price, priceMult) | |
70 | 73 | ||
71 | 74 | ||
72 | 75 | func keyTopUpLastHeight (internalBasetAssetStr,sender) = makeString(["%s%s%s%d%s__topup__last__height", internalBasetAssetStr, sender], SEP) | |
76 | + | ||
77 | + | ||
78 | + | func keyTopupMutext (internalBasetAssetStr) = ("%s%s%d__topup__mutex__" + internalBasetAssetStr) | |
79 | + | ||
80 | + | ||
81 | + | func keyTopupHistory (internalBasetAssetStr,topupIdx) = makeString(["%s%s%d%d__topup__history", internalBasetAssetStr, toString(topupIdx)], SEP) | |
73 | 82 | ||
74 | 83 | ||
75 | 84 | func keyLimitsRemaining (internalBasetAssetStr) = ("%s%s%d__limits__remaining__" + internalBasetAssetStr) | |
193 | 202 | ||
194 | 203 | let IdxOperEndTimestamp = 8 | |
195 | 204 | ||
196 | - | let | |
205 | + | let IdxOperTopupUnlockIdx = 9 | |
197 | 206 | ||
198 | 207 | func privateDataOperationAllStrings (status,inAssetAmount,price,outAssetAmount,startHeight,startTimestamp,endHeight,endTimestamp,lock) = makeString(["%s%d%d%d%d%d%d%d%d", status, inAssetAmount, price, outAssetAmount, startHeight, startTimestamp, endHeight, endTimestamp, lock], SEP) | |
199 | 208 | ||
200 | 209 | ||
201 | - | func dataOperation (status,inAssetAmount,price,outAssetAmount,startHeight,startTimestamp,endHeight,endTimestamp, | |
210 | + | func dataOperation (status,inAssetAmount,price,outAssetAmount,startHeight,startTimestamp,endHeight,endTimestamp,topupUnlockIdx) = privateDataOperationAllStrings(status, toString(inAssetAmount), toString(price), toString(outAssetAmount), toString(startHeight), toString(startTimestamp), toString(endHeight), toString(endTimestamp), toString(topupUnlockIdx)) | |
202 | 211 | ||
203 | 212 | ||
204 | - | func dataOperationExecutionUpdate (currOperArray,newStatus,newPrice,newOutAmount) = privateDataOperationAllStrings(newStatus, currOperArray[IdxOperInAmount], toString(newPrice), toString(newOutAmount), currOperArray[IdxOperStartHeight], currOperArray[IdxOperStartTimestamp], toString(height), toString(lastBlock.timestamp), currOperArray[ | |
213 | + | func dataOperationExecutionUpdate (currOperArray,newStatus,newPrice,newOutAmount) = privateDataOperationAllStrings(newStatus, currOperArray[IdxOperInAmount], toString(newPrice), toString(newOutAmount), currOperArray[IdxOperStartHeight], currOperArray[IdxOperStartTimestamp], toString(height), toString(lastBlock.timestamp), currOperArray[IdxOperTopupUnlockIdx]) | |
205 | 214 | ||
206 | 215 | ||
207 | 216 | func readAssetCfgOrFail (baseAssetStr) = { | |
217 | 226 | func RemainingLimitsStringEntry (key,baseRemainingLimit,shareRemainingLimit) = StringEntry(key, makeString(["%d%d", toString(baseRemainingLimit), toString(shareRemainingLimit)], SEP)) | |
218 | 227 | ||
219 | 228 | ||
229 | + | func TopupMutexIntEntry (internalBaseAssetStr,acquiredHeight) = IntegerEntry(keyTopupMutext(internalBaseAssetStr), acquiredHeight) | |
230 | + | ||
231 | + | ||
232 | + | func TopupHistoryEntry (internalBaseAssetStr,topupIdx) = "" | |
233 | + | ||
234 | + | ||
220 | 235 | func genericCalcPrice (internalBaseAssetStr,baseAssetId,topUpBaseAmount,shareAssetId,decimalsMultPrice) = { | |
221 | 236 | let totalLockedArray = readTotalLocked(keyTotalLocked(internalBaseAssetStr)) | |
222 | 237 | let totalLockedOutBaseAmount = totalLockedArray[IdxTotalLockedOutBase] | |
223 | 238 | let totalLockedInBaseAmount = totalLockedArray[IdxTotalLockedInBase] | |
224 | 239 | let baseAssetBalance = assetBalance(this, baseAssetId) | |
225 | - | let | |
240 | + | let baseAssetBalanceWCO = (((baseAssetBalance + topUpBaseAmount) - totalLockedInBaseAmount) - totalLockedOutBaseAmount) | |
226 | 241 | let totalLockedOutShareAmount = totalLockedArray[IdxTotalLockedOutShare] | |
227 | 242 | let totalLockedInShareAmount = totalLockedArray[IdxTotalLockedInShare] | |
228 | 243 | let shareEmission = value(assetInfo(shareAssetId)).quantity | |
229 | - | let shareEmissionCALC = (shareEmission + totalLockedOutShareAmount) | |
230 | - | if ((0 > baseAssetBalanceCALC)) | |
231 | - | then throw(((("baseAssetBalanceCALC < 0: baseAssetBalance=" + toString(baseAssetBalance)) + " baseAssetBalanceCALC=") + toString(baseAssetBalanceCALC))) | |
244 | + | if ((0 > baseAssetBalanceWCO)) | |
245 | + | then throw(((("baseAssetBalanceWCO < 0: baseAssetBalance=" + toString(baseAssetBalance)) + " baseAssetBalanceWCO=") + toString(baseAssetBalanceWCO))) | |
232 | 246 | else { | |
233 | 247 | let lastPrice = getIntOrFail(keyPriceLast(internalBaseAssetStr)) | |
234 | 248 | let price = if ((shareEmission == 0)) | |
235 | 249 | then lastPrice | |
236 | - | else fraction( | |
237 | - | $Tuple5(price, baseAssetBalance, | |
250 | + | else fraction(baseAssetBalanceWCO, decimalsMultPrice, shareEmission) | |
251 | + | $Tuple5(price, baseAssetBalance, -1, baseAssetBalanceWCO, shareEmission) | |
238 | 252 | } | |
239 | 253 | } | |
240 | 254 | ||
259 | 273 | if (isPutBlocked) | |
260 | 274 | then throw("put operation is blocked") | |
261 | 275 | else { | |
262 | - | let diffTuple = calcTotalLockedDiff("submit", operationType, internalBaseAssetStr, 0, 0, inAmount, baseAssetId, shareAssetId) | |
263 | - | let limitsRemainingBaseNew = (limitsRemainingBase - diffTuple._2[IdxTotalLockedInBase]) | |
264 | - | let limitsRemainingShareNew = (limitsRemainingShare - diffTuple._2[IdxTotalLockedInShare]) | |
265 | - | if (if ((0 > limitsRemainingBaseNew)) | |
266 | - | then true | |
267 | - | else (0 > limitsRemainingShareNew)) | |
268 | - | then failSubmitLimitsExceeds(limitsRemainingBase, limitsRemainingShare, limitsRemainingBaseNew, limitsRemainingShareNew) | |
276 | + | let operationsMutex = valueOrElse(getInteger(this, keyTopupMutext(internalBaseAssetStr)), 0) | |
277 | + | if (((operationsMutex + 60) > height)) | |
278 | + | then throw("submit operations are blocked by topup manager") | |
269 | 279 | else { | |
270 | - | let topUpCurrentIdx = getIntOrFail(keyTopUpCurrentIdx(internalBaseAssetStr)) | |
271 | - | ((([StringEntry(keyOperation(operationType, internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId)), dataOperation("PENDING", inAmount, 0, 0, height, lastBlock.timestamp, 0, 0, (topUpCurrentIdx + 1)))] :+ TotalLockedStringEntry("INCREMENT", keyTotalLocked(internalBaseAssetStr), diffTuple._1)) :+ TotalLockedStringEntry("INCREMENT", keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), diffTuple._2)) :+ RemainingLimitsStringEntry(limitsKEY, limitsRemainingBaseNew, limitsRemainingShareNew)) | |
280 | + | let diffTuple = calcTotalLockedDiff("submit", operationType, internalBaseAssetStr, 0, 0, inAmount, baseAssetId, shareAssetId) | |
281 | + | let limitsRemainingBaseNew = (limitsRemainingBase - diffTuple._2[IdxTotalLockedInBase]) | |
282 | + | let limitsRemainingShareNew = (limitsRemainingShare - diffTuple._2[IdxTotalLockedInShare]) | |
283 | + | if (if ((0 > limitsRemainingBaseNew)) | |
284 | + | then true | |
285 | + | else (0 > limitsRemainingShareNew)) | |
286 | + | then failSubmitLimitsExceeds(limitsRemainingBase, limitsRemainingShare, limitsRemainingBaseNew, limitsRemainingShareNew) | |
287 | + | else { | |
288 | + | let topUpCurrentIdx = getIntOrFail(keyTopUpCurrentIdx(internalBaseAssetStr)) | |
289 | + | ((([StringEntry(keyOperation(operationType, internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId)), dataOperation("PENDING", inAmount, 0, 0, height, lastBlock.timestamp, 0, 0, (topUpCurrentIdx + 1)))] :+ TotalLockedStringEntry("INCREMENT", keyTotalLocked(internalBaseAssetStr), diffTuple._1)) :+ TotalLockedStringEntry("INCREMENT", keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), diffTuple._2)) :+ RemainingLimitsStringEntry(limitsKEY, limitsRemainingBaseNew, limitsRemainingShareNew)) | |
290 | + | } | |
272 | 291 | } | |
273 | 292 | } | |
274 | 293 | } | |
285 | 304 | let operationArray = split(getStringOrFail(operationKey), SEP) | |
286 | 305 | let status = operationArray[IdxOperStatus] | |
287 | 306 | let inAmount = parseIntValue(operationArray[IdxOperInAmount]) | |
288 | - | let | |
307 | + | let topupUnlockIdx = parseIntValue(operationArray[IdxOperTopupUnlockIdx]) | |
289 | 308 | let currTopUpIdx = getIntOrFail(keyTopUpCurrentIdx(internalBaseAssetStr)) | |
290 | 309 | let priceByTopUpId = getIntOrFail(keyPriceByTopUpIdx(internalBaseAssetStr, currTopUpIdx)) | |
291 | 310 | if ((status != "PENDING")) | |
292 | 311 | then failExecuteGet("Status is not PENDING", baseAssetStr, userAddressStr, submitTxIdStr, operationType) | |
293 | - | else if (( | |
294 | - | then failExecuteGet(((("OperLock[" + toString( | |
312 | + | else if ((topupUnlockIdx > currTopUpIdx)) | |
313 | + | then failExecuteGet(((("OperLock[" + toString(topupUnlockIdx)) + "] > ") + toString(currTopUpIdx)), baseAssetStr, userAddressStr, submitTxIdStr, operationType) | |
295 | 314 | else { | |
296 | 315 | let diffTuple = calcTotalLockedDiff("execute", operationType, internalBaseAssetStr, priceByTopUpId, decimalsMultPrice, inAmount, baseAssetId, shareAssetId) | |
297 | 316 | let outAmount = diffTuple._3 | |
298 | 317 | let outTransferData = if ((diffTuple._4 == baseAssetId)) | |
299 | 318 | then [ScriptTransfer(userAddress, outAmount, baseAssetId)] | |
300 | - | else [ | |
319 | + | else [ScriptTransfer(userAddress, outAmount, shareAssetId)] | |
301 | 320 | (((outTransferData :+ StringEntry(operationKey, dataOperationExecutionUpdate(operationArray, "FINISHED", priceByTopUpId, outAmount))) :+ TotalLockedStringEntry("DECREMENT", keyTotalLocked(internalBaseAssetStr), diffTuple._1)) :+ TotalLockedStringEntry("DECREMENT", keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), diffTuple._2)) | |
302 | 321 | } | |
303 | 322 | } | |
312 | 331 | let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice]) | |
313 | 332 | let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset] | |
314 | 333 | let sysState = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultPrice) | |
315 | - | $Tuple6(IntegerEntry("price", sysState._1), IntegerEntry("decimalsMultPrice", decimalsMultPrice), IntegerEntry("baseAssetBalance", sysState._2), IntegerEntry(" | |
334 | + | $Tuple6(IntegerEntry("price", sysState._1), IntegerEntry("decimalsMultPrice", decimalsMultPrice), IntegerEntry("baseAssetBalance", sysState._2), IntegerEntry("-1", sysState._3), IntegerEntry("baseAssetBalanceWCO", sysState._4), IntegerEntry("shareEmission", sysState._5)) | |
316 | 335 | } | |
317 | 336 | ||
318 | 337 | ||
401 | 420 | ||
402 | 421 | ||
403 | 422 | @Callable(i) | |
423 | + | func operationsMutex (baseAssetStr) = { | |
424 | + | let assetCfgArray = readAssetCfgOrFail(baseAssetStr) | |
425 | + | let topUpManagerAddressStr = assetCfgArray[IdxCfgTopupManagerAddress] | |
426 | + | let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset] | |
427 | + | if ((toString(i.caller) != topUpManagerAddressStr)) | |
428 | + | then failTopupManagerOnly(topUpManagerAddressStr) | |
429 | + | else [TopupMutexIntEntry(internalBaseAssetStr, height)] | |
430 | + | } | |
431 | + | ||
432 | + | ||
433 | + | ||
434 | + | @Callable(i) | |
404 | 435 | func topUpBalance (baseAssetStr,amount) = { | |
405 | 436 | let baseAssetId = fromBase58String(baseAssetStr) | |
406 | 437 | let assetCfgArray = readAssetCfgOrFail(baseAssetStr) | |
431 | 462 | let baseBalance = assetBalance(this, baseAssetId) | |
432 | 463 | let allowedAmount = fraction(topupMaxNegativePart, baseBalance, bothAssetMult) | |
433 | 464 | if ((-(amount) > allowedAmount)) | |
434 | - | then throw((" | |
465 | + | then throw(("topup negative amount couldn't be greater than " + toString(allowedAmount))) | |
435 | 466 | else true | |
436 | 467 | } | |
437 | 468 | else throw("zero amount is not allowed") | |
438 | 469 | let topUpLastHeightKEY = keyTopUpLastHeight(internalBaseAssetStr, toString(i.caller)) | |
439 | 470 | let topUpLastHeight = valueOrElse(getInteger(this, topUpLastHeightKEY), 0) | |
440 | 471 | if ((toString(i.caller) != topUpManagerAddressStr)) | |
441 | - | then | |
472 | + | then failTopupManagerOnly(topUpManagerAddressStr) | |
442 | 473 | else if (!(valid)) | |
443 | 474 | then throw("validation failed") | |
444 | 475 | else if ((topupIntervalInBlocks > (height - topUpLastHeight))) | |
449 | 480 | let topupTotalDiff = diffTuple._1 | |
450 | 481 | let priceAthKEY = keyPriceATH(internalBaseAssetStr) | |
451 | 482 | let prevPriceATH = valueOrElse(getInteger(this, priceAthKEY), 0) | |
452 | - | ((([IntegerEntry(keyPriceLast(internalBaseAssetStr), price), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), price), IntegerEntry(keyPriceByTopUpIdx(internalBaseAssetStr, currentTopUpIdx), price), IntegerEntry(topUpCurrentIdxKEY, currentTopUpIdx), IntegerEntry(priceAthKEY, if ((price > prevPriceATH)) | |
483 | + | ((((([IntegerEntry(keyPriceLast(internalBaseAssetStr), price), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), price), IntegerEntry(keyPriceByTopUpIdx(internalBaseAssetStr, currentTopUpIdx), price), IntegerEntry(topUpCurrentIdxKEY, currentTopUpIdx), IntegerEntry(priceAthKEY, if ((price > prevPriceATH)) | |
453 | 484 | then price | |
454 | - | else prevPriceATH), IntegerEntry(topUpLastHeightKEY, height)] :+ TotalLockedStringEntry("DECREMENT", keyTotalLocked(internalBaseAssetStr), topupTotalDiff)) :+ Burn(shareAssetId, topupTotalDiff[IdxTotalLockedInShare])) ++ (if ((0 > amount)) | |
485 | + | else prevPriceATH), IntegerEntry(topUpLastHeightKEY, height)] :+ TotalLockedStringEntry("DECREMENT", keyTotalLocked(internalBaseAssetStr), topupTotalDiff)) :+ TopupMutexIntEntry(internalBaseAssetStr, 0)) :+ Burn(shareAssetId, topupTotalDiff[IdxTotalLockedInShare])) :+ Reissue(shareAssetId, -(topupTotalDiff[IdxTotalLockedOutShare]), true)) ++ (if ((0 > amount)) | |
455 | 486 | then [ScriptTransfer(i.caller, -(amount), baseAssetId)] | |
456 | 487 | else nil)) | |
457 | 488 | } | |
466 | 497 | let decimalsMultPrice = sysStateTuple._2.value | |
467 | 498 | let baseAssetBalance = sysStateTuple._3.value | |
468 | 499 | let totalLockedBaseAmount = sysStateTuple._4.value | |
469 | - | let | |
500 | + | let baseAssetBalanceWCO = sysStateTuple._5.value | |
470 | 501 | let shareEmission = sysStateTuple._6.value | |
471 | - | let restData = makeString(["startCurrentSysParamsREST", toString(price), toString(decimalsMultPrice), toString(baseAssetBalance), toString(totalLockedBaseAmount), toString( | |
502 | + | let restData = makeString(["startCurrentSysParamsREST", toString(price), toString(decimalsMultPrice), toString(baseAssetBalance), toString(totalLockedBaseAmount), toString(baseAssetBalanceWCO), toString(shareEmission), "endCurrentSysParamsREST"], SEP) | |
472 | 503 | throw(restData) | |
473 | 504 | } | |
474 | 505 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key)) | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func getBooleanOrFail (key) = valueOrErrorMessage(getBoolean(this, key), ("No data for this.key=" + key)) | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), ("No data for this.key=" + key)) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func failExecuteGet (msg,baseAssetStr,userAddressStr,submitTxIdStr,operationType) = throw(((((((((msg + ": baseAssetStr=") + baseAssetStr) + " userAddressStr=") + userAddressStr) + " submitTxIdStr=") + submitTxIdStr) + " operationType=") + operationType)) | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func failSubmitLimitsExceeds (remainingBase,remainingShare,newRemainingBase,newRemainingShare) = throw((((((((("submit operation limits have been reached: " + " remainingBase=") + toString(remainingBase)) + " remainingShare=") + toString(remainingShare)) + " newRemainingBase=") + toString(newRemainingBase)) + " newRemainingShare=") + toString(newRemainingShare))) | |
19 | + | ||
20 | + | ||
21 | + | func failTopupManagerOnly (topupManagerAddress) = throw((("opertion denied: only topUpManager=" + topupManagerAddress) + " can send such transactions")) | |
19 | 22 | ||
20 | 23 | ||
21 | 24 | func convertShare2Base (shareAmount,price,priceMult) = fraction(shareAmount, price, priceMult) | |
22 | 25 | ||
23 | 26 | ||
24 | 27 | func convertBase2Share (baseAmount,price,priceMult) = fraction(baseAmount, priceMult, price) | |
25 | 28 | ||
26 | 29 | ||
27 | 30 | func keyAssetCfg (baseAssetStr) = ("%s%s%s__config__asset__" + baseAssetStr) | |
28 | 31 | ||
29 | 32 | ||
30 | 33 | func keyNextInternalAssetId () = "%s__nextInternalAssetId" | |
31 | 34 | ||
32 | 35 | ||
33 | 36 | func keyPriceLast (internalBasetAssetStr) = ("%s%s%d__price__last__" + internalBasetAssetStr) | |
34 | 37 | ||
35 | 38 | ||
36 | 39 | func keyPriceATH (internalBasetAssetStr) = ("%s%s%d__price__ath__" + internalBasetAssetStr) | |
37 | 40 | ||
38 | 41 | ||
39 | 42 | func keyPriceByTopUpIdx (internalBaseAssetStr,topUpIdx) = makeString(["%s%s%d%d__price__byTopUpIdx", internalBaseAssetStr, toString(topUpIdx)], SEP) | |
40 | 43 | ||
41 | 44 | ||
42 | 45 | func keyPriceHistory (internalBasetAssetStr,h,timestamp) = makeString(["%s%s%d%d%d__price__history", internalBasetAssetStr, toString(h), toString(timestamp)], SEP) | |
43 | 46 | ||
44 | 47 | ||
45 | 48 | func keyTotalLocked (internalBasetAssetStr) = ("%s%s%d__total__locked__" + internalBasetAssetStr) | |
46 | 49 | ||
47 | 50 | ||
48 | 51 | func keyTotalLockedByUser (internalBaseAssetStr,userAddressStr) = makeString(["%s%s%d%s__total__locked", internalBaseAssetStr, userAddressStr], SEP) | |
49 | 52 | ||
50 | 53 | ||
51 | 54 | func keyMappingsInternal2baseAssetId (internalBaseAsset) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(internalBaseAsset)) | |
52 | 55 | ||
53 | 56 | ||
54 | 57 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
55 | 58 | ||
56 | 59 | ||
57 | 60 | func keyMappingsShare2baseAssetId (shareAssetStr) = ("%s%s%s__mappings__share2baseAssetId__" + shareAssetStr) | |
58 | 61 | ||
59 | 62 | ||
60 | 63 | func keyMappingsBaseAsset2shareId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2shareId__" + baseAssetStr) | |
61 | 64 | ||
62 | 65 | ||
63 | 66 | func keyShutdownPutOperation (internalBaseAssetStr) = ("%s%s%d__shutdown__put__" + internalBaseAssetStr) | |
64 | 67 | ||
65 | 68 | ||
66 | 69 | func keyShutdownManager (internalBaseAssetStr) = ("%s%s%d__shutdown__manager__" + internalBaseAssetStr) | |
67 | 70 | ||
68 | 71 | ||
69 | 72 | func keyTopUpCurrentIdx (internalBaseAssetStr) = ("%s%s%d__topup__currentIdx__" + internalBaseAssetStr) | |
70 | 73 | ||
71 | 74 | ||
72 | 75 | func keyTopUpLastHeight (internalBasetAssetStr,sender) = makeString(["%s%s%s%d%s__topup__last__height", internalBasetAssetStr, sender], SEP) | |
76 | + | ||
77 | + | ||
78 | + | func keyTopupMutext (internalBasetAssetStr) = ("%s%s%d__topup__mutex__" + internalBasetAssetStr) | |
79 | + | ||
80 | + | ||
81 | + | func keyTopupHistory (internalBasetAssetStr,topupIdx) = makeString(["%s%s%d%d__topup__history", internalBasetAssetStr, toString(topupIdx)], SEP) | |
73 | 82 | ||
74 | 83 | ||
75 | 84 | func keyLimitsRemaining (internalBasetAssetStr) = ("%s%s%d__limits__remaining__" + internalBasetAssetStr) | |
76 | 85 | ||
77 | 86 | ||
78 | 87 | let IdxCfgShareAssetId = 1 | |
79 | 88 | ||
80 | 89 | let IdxCfgInternalBaseAsset = 2 | |
81 | 90 | ||
82 | 91 | let IdxCfgDecimalsMultBothAssets = 3 | |
83 | 92 | ||
84 | 93 | let IdxCfgDecimalsMultPrice = 4 | |
85 | 94 | ||
86 | 95 | let IdxCfgGetDelayBlocks = 5 | |
87 | 96 | ||
88 | 97 | let IdxCfgTopupIntervalInBlocks = 6 | |
89 | 98 | ||
90 | 99 | let IdxCfgTopupMaxNegativePart = 7 | |
91 | 100 | ||
92 | 101 | let IdxCfgTopupManagerAddress = 8 | |
93 | 102 | ||
94 | 103 | let IdxCfgSubmitLimitsBaseMax = 9 | |
95 | 104 | ||
96 | 105 | let IdxCfgSubmitLimitsBaseReset = 10 | |
97 | 106 | ||
98 | 107 | let IdxCfgSubmitLimitsShareMax = 11 | |
99 | 108 | ||
100 | 109 | let IdxCfgSubmitLimitsShareReset = 12 | |
101 | 110 | ||
102 | 111 | func dataAssetCfg (shareAssetStr,internalBaseAssetStr,decimalsMultBothAssets,decimalsMultPrice,getDelayInBlocks,topupIntervalInBlocks,topupMaxNegativePart,topupManagerAddress,submitLimitsBaseMax,submitLimitsBaseReset,submitLimitsShareMax,submitLimitsShareReset) = makeString(["%s%d%d%d%d%d%d%s%d%d%d%d", shareAssetStr, internalBaseAssetStr, toString(decimalsMultBothAssets), toString(decimalsMultPrice), toString(getDelayInBlocks), toString(topupIntervalInBlocks), toString(topupMaxNegativePart), topupManagerAddress, toString(submitLimitsBaseMax), toString(submitLimitsBaseReset), toString(submitLimitsShareMax), toString(submitLimitsShareReset)], SEP) | |
103 | 112 | ||
104 | 113 | ||
105 | 114 | let IdxTotalLockedInShare = 1 | |
106 | 115 | ||
107 | 116 | let IdxTotalLockedOutBase = 2 | |
108 | 117 | ||
109 | 118 | let IdxTotalLockedInBase = 3 | |
110 | 119 | ||
111 | 120 | let IdxTotalLockedOutShare = 4 | |
112 | 121 | ||
113 | 122 | func dataTotalLocked (inShareAmount,outBaseAmount,inBaseAmount,outShareAmount) = makeString(["%d%d%d%d", toString(inShareAmount), toString(outBaseAmount), toString(inBaseAmount), toString(outShareAmount)], SEP) | |
114 | 123 | ||
115 | 124 | ||
116 | 125 | func dataTotalLockedInt (inShareAmount,outBaseAmount,inBaseAmount,outShareAmount) = [-1, inShareAmount, outBaseAmount, inBaseAmount, outShareAmount] | |
117 | 126 | ||
118 | 127 | ||
119 | 128 | func readTotalLocked (key) = { | |
120 | 129 | let totalLockedArray = split(valueOrElse(getString(this, key), dataTotalLocked(0, 0, 0, 0)), SEP) | |
121 | 130 | dataTotalLockedInt(parseIntValue(totalLockedArray[IdxTotalLockedInShare]), parseIntValue(totalLockedArray[IdxTotalLockedOutBase]), parseIntValue(totalLockedArray[IdxTotalLockedInBase]), parseIntValue(totalLockedArray[IdxTotalLockedOutShare])) | |
122 | 131 | } | |
123 | 132 | ||
124 | 133 | ||
125 | 134 | func calcTotalLockedDiff (direction,operationType,internalBaseAssetStr,price,priceMult,inAmount,baseAssetId,shareAssetId) = { | |
126 | 135 | let t = (direction + operationType) | |
127 | 136 | if ((t == "submitP")) | |
128 | 137 | then { | |
129 | 138 | let totalDiff = dataTotalLockedInt(0, 0, inAmount, 0) | |
130 | 139 | let userDiff = totalDiff | |
131 | 140 | $Tuple4(totalDiff, userDiff, 0, fromBase58String("")) | |
132 | 141 | } | |
133 | 142 | else if ((t == "submitG")) | |
134 | 143 | then { | |
135 | 144 | let totalDiff = dataTotalLockedInt(inAmount, 0, 0, 0) | |
136 | 145 | let userDiff = totalDiff | |
137 | 146 | $Tuple4(totalDiff, userDiff, 0, fromBase58String("")) | |
138 | 147 | } | |
139 | 148 | else if ((t == "executeP")) | |
140 | 149 | then { | |
141 | 150 | let outAmount = convertBase2Share(inAmount, price, priceMult) | |
142 | 151 | let totalDiff = dataTotalLockedInt(0, 0, 0, outAmount) | |
143 | 152 | let userDiff = dataTotalLockedInt(0, 0, inAmount, 0) | |
144 | 153 | $Tuple4(totalDiff, userDiff, outAmount, shareAssetId) | |
145 | 154 | } | |
146 | 155 | else if ((t == "executeG")) | |
147 | 156 | then { | |
148 | 157 | let outAmount = convertShare2Base(inAmount, price, priceMult) | |
149 | 158 | let totalDiff = dataTotalLockedInt(0, outAmount, 0, 0) | |
150 | 159 | let userDiff = dataTotalLockedInt(inAmount, 0, 0, 0) | |
151 | 160 | $Tuple4(totalDiff, userDiff, outAmount, baseAssetId) | |
152 | 161 | } | |
153 | 162 | else if ((t == "topup")) | |
154 | 163 | then { | |
155 | 164 | let totalLockedArray = readTotalLocked(keyTotalLocked(internalBaseAssetStr)) | |
156 | 165 | let totalLockedInBaseAmount = totalLockedArray[IdxTotalLockedInBase] | |
157 | 166 | let totalLockedInShareAmount = totalLockedArray[IdxTotalLockedInShare] | |
158 | 167 | let totalDiff = dataTotalLockedInt(totalLockedInShareAmount, (-1 * convertShare2Base(totalLockedInShareAmount, price, priceMult)), totalLockedInBaseAmount, (-1 * convertBase2Share(totalLockedInBaseAmount, price, priceMult))) | |
159 | 168 | $Tuple4(totalDiff, nil, 0, fromBase58String("")) | |
160 | 169 | } | |
161 | 170 | else throw(("Unsupported Type " + t)) | |
162 | 171 | } | |
163 | 172 | ||
164 | 173 | ||
165 | 174 | func TotalLockedStringEntry (action,key,diff) = { | |
166 | 175 | func UPDATE (a,b) = if ((action == "INCREMENT")) | |
167 | 176 | then (a + b) | |
168 | 177 | else if ((action == "DECREMENT")) | |
169 | 178 | then (a - b) | |
170 | 179 | else throw(("Unsupported action " + action)) | |
171 | 180 | ||
172 | 181 | let dataArray = readTotalLocked(key) | |
173 | 182 | StringEntry(key, dataTotalLocked(UPDATE(dataArray[IdxTotalLockedInShare], diff[IdxTotalLockedInShare]), UPDATE(dataArray[IdxTotalLockedOutBase], diff[IdxTotalLockedOutBase]), UPDATE(dataArray[IdxTotalLockedInBase], diff[IdxTotalLockedInBase]), UPDATE(dataArray[IdxTotalLockedOutShare], diff[IdxTotalLockedOutShare]))) | |
174 | 183 | } | |
175 | 184 | ||
176 | 185 | ||
177 | 186 | func keyOperation (operationType,internalBaseAssetStr,userAddress,txId) = makeString(["%s%d%s%s", operationType, internalBaseAssetStr, userAddress, txId], SEP) | |
178 | 187 | ||
179 | 188 | ||
180 | 189 | let IdxOperStatus = 1 | |
181 | 190 | ||
182 | 191 | let IdxOperInAmount = 2 | |
183 | 192 | ||
184 | 193 | let IdxOperPrice = 3 | |
185 | 194 | ||
186 | 195 | let IdxOperOutAmount = 4 | |
187 | 196 | ||
188 | 197 | let IdxOperStartHeight = 5 | |
189 | 198 | ||
190 | 199 | let IdxOperStartTimestamp = 6 | |
191 | 200 | ||
192 | 201 | let IdxOperEndHeight = 7 | |
193 | 202 | ||
194 | 203 | let IdxOperEndTimestamp = 8 | |
195 | 204 | ||
196 | - | let | |
205 | + | let IdxOperTopupUnlockIdx = 9 | |
197 | 206 | ||
198 | 207 | func privateDataOperationAllStrings (status,inAssetAmount,price,outAssetAmount,startHeight,startTimestamp,endHeight,endTimestamp,lock) = makeString(["%s%d%d%d%d%d%d%d%d", status, inAssetAmount, price, outAssetAmount, startHeight, startTimestamp, endHeight, endTimestamp, lock], SEP) | |
199 | 208 | ||
200 | 209 | ||
201 | - | func dataOperation (status,inAssetAmount,price,outAssetAmount,startHeight,startTimestamp,endHeight,endTimestamp, | |
210 | + | func dataOperation (status,inAssetAmount,price,outAssetAmount,startHeight,startTimestamp,endHeight,endTimestamp,topupUnlockIdx) = privateDataOperationAllStrings(status, toString(inAssetAmount), toString(price), toString(outAssetAmount), toString(startHeight), toString(startTimestamp), toString(endHeight), toString(endTimestamp), toString(topupUnlockIdx)) | |
202 | 211 | ||
203 | 212 | ||
204 | - | func dataOperationExecutionUpdate (currOperArray,newStatus,newPrice,newOutAmount) = privateDataOperationAllStrings(newStatus, currOperArray[IdxOperInAmount], toString(newPrice), toString(newOutAmount), currOperArray[IdxOperStartHeight], currOperArray[IdxOperStartTimestamp], toString(height), toString(lastBlock.timestamp), currOperArray[ | |
213 | + | func dataOperationExecutionUpdate (currOperArray,newStatus,newPrice,newOutAmount) = privateDataOperationAllStrings(newStatus, currOperArray[IdxOperInAmount], toString(newPrice), toString(newOutAmount), currOperArray[IdxOperStartHeight], currOperArray[IdxOperStartTimestamp], toString(height), toString(lastBlock.timestamp), currOperArray[IdxOperTopupUnlockIdx]) | |
205 | 214 | ||
206 | 215 | ||
207 | 216 | func readAssetCfgOrFail (baseAssetStr) = { | |
208 | 217 | let key = keyAssetCfg(baseAssetStr) | |
209 | 218 | split(getStringOrFail(key), SEP) | |
210 | 219 | } | |
211 | 220 | ||
212 | 221 | ||
213 | 222 | let IdxLimitsRemainingBase = 1 | |
214 | 223 | ||
215 | 224 | let IdxLimitsRemainingShare = 2 | |
216 | 225 | ||
217 | 226 | func RemainingLimitsStringEntry (key,baseRemainingLimit,shareRemainingLimit) = StringEntry(key, makeString(["%d%d", toString(baseRemainingLimit), toString(shareRemainingLimit)], SEP)) | |
218 | 227 | ||
219 | 228 | ||
229 | + | func TopupMutexIntEntry (internalBaseAssetStr,acquiredHeight) = IntegerEntry(keyTopupMutext(internalBaseAssetStr), acquiredHeight) | |
230 | + | ||
231 | + | ||
232 | + | func TopupHistoryEntry (internalBaseAssetStr,topupIdx) = "" | |
233 | + | ||
234 | + | ||
220 | 235 | func genericCalcPrice (internalBaseAssetStr,baseAssetId,topUpBaseAmount,shareAssetId,decimalsMultPrice) = { | |
221 | 236 | let totalLockedArray = readTotalLocked(keyTotalLocked(internalBaseAssetStr)) | |
222 | 237 | let totalLockedOutBaseAmount = totalLockedArray[IdxTotalLockedOutBase] | |
223 | 238 | let totalLockedInBaseAmount = totalLockedArray[IdxTotalLockedInBase] | |
224 | 239 | let baseAssetBalance = assetBalance(this, baseAssetId) | |
225 | - | let | |
240 | + | let baseAssetBalanceWCO = (((baseAssetBalance + topUpBaseAmount) - totalLockedInBaseAmount) - totalLockedOutBaseAmount) | |
226 | 241 | let totalLockedOutShareAmount = totalLockedArray[IdxTotalLockedOutShare] | |
227 | 242 | let totalLockedInShareAmount = totalLockedArray[IdxTotalLockedInShare] | |
228 | 243 | let shareEmission = value(assetInfo(shareAssetId)).quantity | |
229 | - | let shareEmissionCALC = (shareEmission + totalLockedOutShareAmount) | |
230 | - | if ((0 > baseAssetBalanceCALC)) | |
231 | - | then throw(((("baseAssetBalanceCALC < 0: baseAssetBalance=" + toString(baseAssetBalance)) + " baseAssetBalanceCALC=") + toString(baseAssetBalanceCALC))) | |
244 | + | if ((0 > baseAssetBalanceWCO)) | |
245 | + | then throw(((("baseAssetBalanceWCO < 0: baseAssetBalance=" + toString(baseAssetBalance)) + " baseAssetBalanceWCO=") + toString(baseAssetBalanceWCO))) | |
232 | 246 | else { | |
233 | 247 | let lastPrice = getIntOrFail(keyPriceLast(internalBaseAssetStr)) | |
234 | 248 | let price = if ((shareEmission == 0)) | |
235 | 249 | then lastPrice | |
236 | - | else fraction( | |
237 | - | $Tuple5(price, baseAssetBalance, | |
250 | + | else fraction(baseAssetBalanceWCO, decimalsMultPrice, shareEmission) | |
251 | + | $Tuple5(price, baseAssetBalance, -1, baseAssetBalanceWCO, shareEmission) | |
238 | 252 | } | |
239 | 253 | } | |
240 | 254 | ||
241 | 255 | ||
242 | 256 | func calcPrice (internalBaseAssetStr,baseAssetId,shareAssetId,decimalsMultPrice) = genericCalcPrice(internalBaseAssetStr, baseAssetId, 0, shareAssetId, decimalsMultPrice) | |
243 | 257 | ||
244 | 258 | ||
245 | 259 | func submit (operationType,i,inAmount,inAssetId,baseAssetStr) = { | |
246 | 260 | let inAssetStr = toBase58String(inAssetId) | |
247 | 261 | let userAddressStr = toString(i.caller) | |
248 | 262 | let baseAssetId = fromBase58String(baseAssetStr) | |
249 | 263 | let cfgArray = readAssetCfgOrFail(baseAssetStr) | |
250 | 264 | let shareAssetStr = cfgArray[IdxCfgShareAssetId] | |
251 | 265 | let shareAssetId = fromBase58String(shareAssetStr) | |
252 | 266 | let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets]) | |
253 | 267 | let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset] | |
254 | 268 | let limitsKEY = keyLimitsRemaining(internalBaseAssetStr) | |
255 | 269 | let limitsCfgArray = split(getStringOrFail(limitsKEY), SEP) | |
256 | 270 | let limitsRemainingBase = parseIntValue(limitsCfgArray[IdxLimitsRemainingBase]) | |
257 | 271 | let limitsRemainingShare = parseIntValue(limitsCfgArray[IdxLimitsRemainingShare]) | |
258 | 272 | let isPutBlocked = getBooleanOrFail(keyShutdownPutOperation(internalBaseAssetStr)) | |
259 | 273 | if (isPutBlocked) | |
260 | 274 | then throw("put operation is blocked") | |
261 | 275 | else { | |
262 | - | let diffTuple = calcTotalLockedDiff("submit", operationType, internalBaseAssetStr, 0, 0, inAmount, baseAssetId, shareAssetId) | |
263 | - | let limitsRemainingBaseNew = (limitsRemainingBase - diffTuple._2[IdxTotalLockedInBase]) | |
264 | - | let limitsRemainingShareNew = (limitsRemainingShare - diffTuple._2[IdxTotalLockedInShare]) | |
265 | - | if (if ((0 > limitsRemainingBaseNew)) | |
266 | - | then true | |
267 | - | else (0 > limitsRemainingShareNew)) | |
268 | - | then failSubmitLimitsExceeds(limitsRemainingBase, limitsRemainingShare, limitsRemainingBaseNew, limitsRemainingShareNew) | |
276 | + | let operationsMutex = valueOrElse(getInteger(this, keyTopupMutext(internalBaseAssetStr)), 0) | |
277 | + | if (((operationsMutex + 60) > height)) | |
278 | + | then throw("submit operations are blocked by topup manager") | |
269 | 279 | else { | |
270 | - | let topUpCurrentIdx = getIntOrFail(keyTopUpCurrentIdx(internalBaseAssetStr)) | |
271 | - | ((([StringEntry(keyOperation(operationType, internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId)), dataOperation("PENDING", inAmount, 0, 0, height, lastBlock.timestamp, 0, 0, (topUpCurrentIdx + 1)))] :+ TotalLockedStringEntry("INCREMENT", keyTotalLocked(internalBaseAssetStr), diffTuple._1)) :+ TotalLockedStringEntry("INCREMENT", keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), diffTuple._2)) :+ RemainingLimitsStringEntry(limitsKEY, limitsRemainingBaseNew, limitsRemainingShareNew)) | |
280 | + | let diffTuple = calcTotalLockedDiff("submit", operationType, internalBaseAssetStr, 0, 0, inAmount, baseAssetId, shareAssetId) | |
281 | + | let limitsRemainingBaseNew = (limitsRemainingBase - diffTuple._2[IdxTotalLockedInBase]) | |
282 | + | let limitsRemainingShareNew = (limitsRemainingShare - diffTuple._2[IdxTotalLockedInShare]) | |
283 | + | if (if ((0 > limitsRemainingBaseNew)) | |
284 | + | then true | |
285 | + | else (0 > limitsRemainingShareNew)) | |
286 | + | then failSubmitLimitsExceeds(limitsRemainingBase, limitsRemainingShare, limitsRemainingBaseNew, limitsRemainingShareNew) | |
287 | + | else { | |
288 | + | let topUpCurrentIdx = getIntOrFail(keyTopUpCurrentIdx(internalBaseAssetStr)) | |
289 | + | ((([StringEntry(keyOperation(operationType, internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId)), dataOperation("PENDING", inAmount, 0, 0, height, lastBlock.timestamp, 0, 0, (topUpCurrentIdx + 1)))] :+ TotalLockedStringEntry("INCREMENT", keyTotalLocked(internalBaseAssetStr), diffTuple._1)) :+ TotalLockedStringEntry("INCREMENT", keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), diffTuple._2)) :+ RemainingLimitsStringEntry(limitsKEY, limitsRemainingBaseNew, limitsRemainingShareNew)) | |
290 | + | } | |
272 | 291 | } | |
273 | 292 | } | |
274 | 293 | } | |
275 | 294 | ||
276 | 295 | ||
277 | 296 | func execute (operationType,baseAssetStr,userAddressStr,submitTxIdStr) = { | |
278 | 297 | let userAddress = addressFromStringValue(userAddressStr) | |
279 | 298 | let assetCfgArray = readAssetCfgOrFail(baseAssetStr) | |
280 | 299 | let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId]) | |
281 | 300 | let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset] | |
282 | 301 | let decimalsMultPrice = parseIntValue(assetCfgArray[IdxCfgDecimalsMultPrice]) | |
283 | 302 | let baseAssetId = fromBase58String(baseAssetStr) | |
284 | 303 | let operationKey = keyOperation(operationType, internalBaseAssetStr, userAddressStr, submitTxIdStr) | |
285 | 304 | let operationArray = split(getStringOrFail(operationKey), SEP) | |
286 | 305 | let status = operationArray[IdxOperStatus] | |
287 | 306 | let inAmount = parseIntValue(operationArray[IdxOperInAmount]) | |
288 | - | let | |
307 | + | let topupUnlockIdx = parseIntValue(operationArray[IdxOperTopupUnlockIdx]) | |
289 | 308 | let currTopUpIdx = getIntOrFail(keyTopUpCurrentIdx(internalBaseAssetStr)) | |
290 | 309 | let priceByTopUpId = getIntOrFail(keyPriceByTopUpIdx(internalBaseAssetStr, currTopUpIdx)) | |
291 | 310 | if ((status != "PENDING")) | |
292 | 311 | then failExecuteGet("Status is not PENDING", baseAssetStr, userAddressStr, submitTxIdStr, operationType) | |
293 | - | else if (( | |
294 | - | then failExecuteGet(((("OperLock[" + toString( | |
312 | + | else if ((topupUnlockIdx > currTopUpIdx)) | |
313 | + | then failExecuteGet(((("OperLock[" + toString(topupUnlockIdx)) + "] > ") + toString(currTopUpIdx)), baseAssetStr, userAddressStr, submitTxIdStr, operationType) | |
295 | 314 | else { | |
296 | 315 | let diffTuple = calcTotalLockedDiff("execute", operationType, internalBaseAssetStr, priceByTopUpId, decimalsMultPrice, inAmount, baseAssetId, shareAssetId) | |
297 | 316 | let outAmount = diffTuple._3 | |
298 | 317 | let outTransferData = if ((diffTuple._4 == baseAssetId)) | |
299 | 318 | then [ScriptTransfer(userAddress, outAmount, baseAssetId)] | |
300 | - | else [ | |
319 | + | else [ScriptTransfer(userAddress, outAmount, shareAssetId)] | |
301 | 320 | (((outTransferData :+ StringEntry(operationKey, dataOperationExecutionUpdate(operationArray, "FINISHED", priceByTopUpId, outAmount))) :+ TotalLockedStringEntry("DECREMENT", keyTotalLocked(internalBaseAssetStr), diffTuple._1)) :+ TotalLockedStringEntry("DECREMENT", keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), diffTuple._2)) | |
302 | 321 | } | |
303 | 322 | } | |
304 | 323 | ||
305 | 324 | ||
306 | 325 | func privateCurrentSysParamsREST (baseAssetStr) = { | |
307 | 326 | let baseAssetId = fromBase58String(baseAssetStr) | |
308 | 327 | let cfgArray = readAssetCfgOrFail(baseAssetStr) | |
309 | 328 | let shareAssetStr = cfgArray[IdxCfgShareAssetId] | |
310 | 329 | let shareAssetId = fromBase58String(shareAssetStr) | |
311 | 330 | let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets]) | |
312 | 331 | let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice]) | |
313 | 332 | let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset] | |
314 | 333 | let sysState = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultPrice) | |
315 | - | $Tuple6(IntegerEntry("price", sysState._1), IntegerEntry("decimalsMultPrice", decimalsMultPrice), IntegerEntry("baseAssetBalance", sysState._2), IntegerEntry(" | |
334 | + | $Tuple6(IntegerEntry("price", sysState._1), IntegerEntry("decimalsMultPrice", decimalsMultPrice), IntegerEntry("baseAssetBalance", sysState._2), IntegerEntry("-1", sysState._3), IntegerEntry("baseAssetBalanceWCO", sysState._4), IntegerEntry("shareEmission", sysState._5)) | |
316 | 335 | } | |
317 | 336 | ||
318 | 337 | ||
319 | 338 | @Callable(i) | |
320 | 339 | func adminRegisterAsset (baseAssetStr,shareAssetName,shareAssetDescr,getDelayinBlocks,shutdownManagerAddress,startPrice,topupIntervalInBlocks,topupMaxNegativePart,topupManagerAddress,submitLimitsBaseMax,submitLimitsBaseReset,submitLimitsShareMax,submitLimitsShareReset) = { | |
321 | 340 | let baseAssetId = fromBase58String(baseAssetStr) | |
322 | 341 | let decimals = value(assetInfo(baseAssetId)).decimals | |
323 | 342 | let decimalsMultBothAssets = pow(10, 0, decimals, 0, 0, DOWN) | |
324 | 343 | let decimalsMultPrice = ((100 * 1000) * 1000) | |
325 | 344 | let topupMaxNegativePercents = fraction(topupMaxNegativePart, 100, decimalsMultBothAssets) | |
326 | 345 | let baseAssetBalance = assetBalance(this, baseAssetId) | |
327 | 346 | if ((i.caller != this)) | |
328 | 347 | then throw("permissions denied") | |
329 | 348 | else if ((baseAssetBalance == 0)) | |
330 | 349 | then throw(((toString(this) + " must have any initial balance of ") + baseAssetStr)) | |
331 | 350 | else if (isDefined(getString(this, keyAssetCfg(baseAssetStr)))) | |
332 | 351 | then throw((baseAssetStr + " has been already registered")) | |
333 | 352 | else if ((toString(addressFromStringValue(shutdownManagerAddress)) != shutdownManagerAddress)) | |
334 | 353 | then throw("invalid shutdownManagerAddress") | |
335 | 354 | else if ((toString(addressFromStringValue(topupManagerAddress)) != topupManagerAddress)) | |
336 | 355 | then throw("invalid topupManagerAddress") | |
337 | 356 | else if ((0 > getDelayinBlocks)) | |
338 | 357 | then throw(("invalid getDelayinBlocks=" + toString(getDelayinBlocks))) | |
339 | 358 | else if (if ((0 >= topupMaxNegativePercents)) | |
340 | 359 | then true | |
341 | 360 | else (topupMaxNegativePercents >= 99)) | |
342 | 361 | then throw("invalid topupMaxNegativePart parameter") | |
343 | 362 | else { | |
344 | 363 | let shareInitAmount = convertBase2Share(baseAssetBalance, startPrice, decimalsMultPrice) | |
345 | 364 | let shareAssetIssueAction = Issue(shareAssetName, shareAssetDescr, shareInitAmount, decimals, true) | |
346 | 365 | let shareAssetId = calculateAssetId(shareAssetIssueAction) | |
347 | 366 | let shareAssetStr = toBase58String(shareAssetId) | |
348 | 367 | let internalBaseAssetId = valueOrElse(getInteger(this, keyNextInternalAssetId()), 0) | |
349 | 368 | let internalBaseAssetStr = toString(internalBaseAssetId) | |
350 | 369 | [StringEntry(keyAssetCfg(baseAssetStr), dataAssetCfg(shareAssetStr, internalBaseAssetStr, decimalsMultBothAssets, decimalsMultPrice, getDelayinBlocks, topupIntervalInBlocks, topupMaxNegativePart, topupManagerAddress, submitLimitsBaseMax, submitLimitsBaseReset, submitLimitsShareMax, submitLimitsShareReset)), StringEntry(keyMappingsInternal2baseAssetId(internalBaseAssetId), baseAssetStr), StringEntry(keyMappingsBaseAsset2internalId(baseAssetStr), internalBaseAssetStr), StringEntry(keyMappingsShare2baseAssetId(shareAssetStr), baseAssetStr), StringEntry(keyMappingsBaseAsset2shareId(baseAssetStr), shareAssetStr), BooleanEntry(keyShutdownPutOperation(internalBaseAssetStr), false), StringEntry(keyShutdownManager(internalBaseAssetStr), shutdownManagerAddress), IntegerEntry(keyNextInternalAssetId(), (internalBaseAssetId + 1)), IntegerEntry(keyPriceLast(internalBaseAssetStr), startPrice), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), startPrice), IntegerEntry(keyTopUpCurrentIdx(internalBaseAssetStr), 0), RemainingLimitsStringEntry(keyLimitsRemaining(internalBaseAssetStr), submitLimitsBaseMax, submitLimitsShareMax), shareAssetIssueAction] | |
351 | 370 | } | |
352 | 371 | } | |
353 | 372 | ||
354 | 373 | ||
355 | 374 | ||
356 | 375 | @Callable(i) | |
357 | 376 | func shutdownPut (internalBaseAssetId) = { | |
358 | 377 | let internalBaseAssetIdStr = toString(internalBaseAssetId) | |
359 | 378 | let baseAssetIdStr = getStringOrFail(keyMappingsInternal2baseAssetId(internalBaseAssetId)) | |
360 | 379 | let shutdownManagerAddress = getStringOrFail(keyShutdownManager(internalBaseAssetIdStr)) | |
361 | 380 | if ((1 > size(baseAssetIdStr))) | |
362 | 381 | then throw("invalid internalBaseAssetId") | |
363 | 382 | else if ((toString(i.caller) != shutdownManagerAddress)) | |
364 | 383 | then throw("access denied") | |
365 | 384 | else [BooleanEntry(keyShutdownPutOperation(toString(internalBaseAssetId)), true)] | |
366 | 385 | } | |
367 | 386 | ||
368 | 387 | ||
369 | 388 | ||
370 | 389 | @Callable(i) | |
371 | 390 | func submitPut () = { | |
372 | 391 | let pmt = value(i.payments[0]) | |
373 | 392 | let inAmount = pmt.amount | |
374 | 393 | let inAssetId = value(pmt.assetId) | |
375 | 394 | let baseAssetStr = toBase58String(inAssetId) | |
376 | 395 | submit("P", i, inAmount, inAssetId, baseAssetStr) | |
377 | 396 | } | |
378 | 397 | ||
379 | 398 | ||
380 | 399 | ||
381 | 400 | @Callable(i) | |
382 | 401 | func submitGet () = { | |
383 | 402 | let pmt = value(i.payments[0]) | |
384 | 403 | let inAmount = pmt.amount | |
385 | 404 | let inAssetId = value(pmt.assetId) | |
386 | 405 | let shareAssetStr = toBase58String(inAssetId) | |
387 | 406 | let baseAssetStr = getStringOrFail(keyMappingsShare2baseAssetId(shareAssetStr)) | |
388 | 407 | submit("G", i, inAmount, inAssetId, baseAssetStr) | |
389 | 408 | } | |
390 | 409 | ||
391 | 410 | ||
392 | 411 | ||
393 | 412 | @Callable(i) | |
394 | 413 | func executePut (baseAssetStr,userAddressStr,submitTxIdStr) = execute("P", baseAssetStr, userAddressStr, submitTxIdStr) | |
395 | 414 | ||
396 | 415 | ||
397 | 416 | ||
398 | 417 | @Callable(i) | |
399 | 418 | func executeGet (baseAssetStr,userAddressStr,submitTxIdStr) = execute("G", baseAssetStr, userAddressStr, submitTxIdStr) | |
400 | 419 | ||
401 | 420 | ||
402 | 421 | ||
403 | 422 | @Callable(i) | |
423 | + | func operationsMutex (baseAssetStr) = { | |
424 | + | let assetCfgArray = readAssetCfgOrFail(baseAssetStr) | |
425 | + | let topUpManagerAddressStr = assetCfgArray[IdxCfgTopupManagerAddress] | |
426 | + | let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset] | |
427 | + | if ((toString(i.caller) != topUpManagerAddressStr)) | |
428 | + | then failTopupManagerOnly(topUpManagerAddressStr) | |
429 | + | else [TopupMutexIntEntry(internalBaseAssetStr, height)] | |
430 | + | } | |
431 | + | ||
432 | + | ||
433 | + | ||
434 | + | @Callable(i) | |
404 | 435 | func topUpBalance (baseAssetStr,amount) = { | |
405 | 436 | let baseAssetId = fromBase58String(baseAssetStr) | |
406 | 437 | let assetCfgArray = readAssetCfgOrFail(baseAssetStr) | |
407 | 438 | let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId]) | |
408 | 439 | let priceMult = parseIntValue(assetCfgArray[IdxCfgDecimalsMultPrice]) | |
409 | 440 | let bothAssetMult = parseIntValue(assetCfgArray[IdxCfgDecimalsMultBothAssets]) | |
410 | 441 | let topupIntervalInBlocks = parseIntValue(assetCfgArray[IdxCfgTopupIntervalInBlocks]) | |
411 | 442 | let topupMaxNegativePart = parseIntValue(assetCfgArray[IdxCfgTopupMaxNegativePart]) | |
412 | 443 | let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset] | |
413 | 444 | let topUpManagerAddressStr = assetCfgArray[IdxCfgTopupManagerAddress] | |
414 | 445 | let topUpCurrentIdxKEY = keyTopUpCurrentIdx(internalBaseAssetStr) | |
415 | 446 | let prevTopUpIdx = getIntOrFail(topUpCurrentIdxKEY) | |
416 | 447 | let currentTopUpIdx = (prevTopUpIdx + 1) | |
417 | 448 | let valid = if ((amount > 0)) | |
418 | 449 | then { | |
419 | 450 | let pmt = value(i.payments[0]) | |
420 | 451 | let pmtAssetId = value(pmt.assetId) | |
421 | 452 | if ((baseAssetId != pmtAssetId)) | |
422 | 453 | then throw("attached payment's asset id is NOT matched passed baseAssetStr") | |
423 | 454 | else if ((size(i.payments) > 1)) | |
424 | 455 | then throw("only one payment can be attached") | |
425 | 456 | else if ((pmt.amount != amount)) | |
426 | 457 | then throw("attached payment.amount is NOT matched passed amount argument") | |
427 | 458 | else true | |
428 | 459 | } | |
429 | 460 | else if ((0 > amount)) | |
430 | 461 | then { | |
431 | 462 | let baseBalance = assetBalance(this, baseAssetId) | |
432 | 463 | let allowedAmount = fraction(topupMaxNegativePart, baseBalance, bothAssetMult) | |
433 | 464 | if ((-(amount) > allowedAmount)) | |
434 | - | then throw((" | |
465 | + | then throw(("topup negative amount couldn't be greater than " + toString(allowedAmount))) | |
435 | 466 | else true | |
436 | 467 | } | |
437 | 468 | else throw("zero amount is not allowed") | |
438 | 469 | let topUpLastHeightKEY = keyTopUpLastHeight(internalBaseAssetStr, toString(i.caller)) | |
439 | 470 | let topUpLastHeight = valueOrElse(getInteger(this, topUpLastHeightKEY), 0) | |
440 | 471 | if ((toString(i.caller) != topUpManagerAddressStr)) | |
441 | - | then | |
472 | + | then failTopupManagerOnly(topUpManagerAddressStr) | |
442 | 473 | else if (!(valid)) | |
443 | 474 | then throw("validation failed") | |
444 | 475 | else if ((topupIntervalInBlocks > (height - topUpLastHeight))) | |
445 | 476 | then throw((("1 topup per " + toString(topupIntervalInBlocks)) + " blocks from the same address is allowed")) | |
446 | 477 | else { | |
447 | 478 | let price = genericCalcPrice(internalBaseAssetStr, baseAssetId, amount, shareAssetId, priceMult)._1 | |
448 | 479 | let diffTuple = calcTotalLockedDiff("topup", "", internalBaseAssetStr, price, priceMult, 0, baseAssetId, shareAssetId) | |
449 | 480 | let topupTotalDiff = diffTuple._1 | |
450 | 481 | let priceAthKEY = keyPriceATH(internalBaseAssetStr) | |
451 | 482 | let prevPriceATH = valueOrElse(getInteger(this, priceAthKEY), 0) | |
452 | - | ((([IntegerEntry(keyPriceLast(internalBaseAssetStr), price), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), price), IntegerEntry(keyPriceByTopUpIdx(internalBaseAssetStr, currentTopUpIdx), price), IntegerEntry(topUpCurrentIdxKEY, currentTopUpIdx), IntegerEntry(priceAthKEY, if ((price > prevPriceATH)) | |
483 | + | ((((([IntegerEntry(keyPriceLast(internalBaseAssetStr), price), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), price), IntegerEntry(keyPriceByTopUpIdx(internalBaseAssetStr, currentTopUpIdx), price), IntegerEntry(topUpCurrentIdxKEY, currentTopUpIdx), IntegerEntry(priceAthKEY, if ((price > prevPriceATH)) | |
453 | 484 | then price | |
454 | - | else prevPriceATH), IntegerEntry(topUpLastHeightKEY, height)] :+ TotalLockedStringEntry("DECREMENT", keyTotalLocked(internalBaseAssetStr), topupTotalDiff)) :+ Burn(shareAssetId, topupTotalDiff[IdxTotalLockedInShare])) ++ (if ((0 > amount)) | |
485 | + | else prevPriceATH), IntegerEntry(topUpLastHeightKEY, height)] :+ TotalLockedStringEntry("DECREMENT", keyTotalLocked(internalBaseAssetStr), topupTotalDiff)) :+ TopupMutexIntEntry(internalBaseAssetStr, 0)) :+ Burn(shareAssetId, topupTotalDiff[IdxTotalLockedInShare])) :+ Reissue(shareAssetId, -(topupTotalDiff[IdxTotalLockedOutShare]), true)) ++ (if ((0 > amount)) | |
455 | 486 | then [ScriptTransfer(i.caller, -(amount), baseAssetId)] | |
456 | 487 | else nil)) | |
457 | 488 | } | |
458 | 489 | } | |
459 | 490 | ||
460 | 491 | ||
461 | 492 | ||
462 | 493 | @Callable(i) | |
463 | 494 | func currentSysParamsREST (baseAssetStr) = { | |
464 | 495 | let sysStateTuple = privateCurrentSysParamsREST(baseAssetStr) | |
465 | 496 | let price = sysStateTuple._1.value | |
466 | 497 | let decimalsMultPrice = sysStateTuple._2.value | |
467 | 498 | let baseAssetBalance = sysStateTuple._3.value | |
468 | 499 | let totalLockedBaseAmount = sysStateTuple._4.value | |
469 | - | let | |
500 | + | let baseAssetBalanceWCO = sysStateTuple._5.value | |
470 | 501 | let shareEmission = sysStateTuple._6.value | |
471 | - | let restData = makeString(["startCurrentSysParamsREST", toString(price), toString(decimalsMultPrice), toString(baseAssetBalance), toString(totalLockedBaseAmount), toString( | |
502 | + | let restData = makeString(["startCurrentSysParamsREST", toString(price), toString(decimalsMultPrice), toString(baseAssetBalance), toString(totalLockedBaseAmount), toString(baseAssetBalanceWCO), toString(shareEmission), "endCurrentSysParamsREST"], SEP) | |
472 | 503 | throw(restData) | |
473 | 504 | } | |
474 | 505 | ||
475 | 506 |
github/deemru/w8io/169f3d6 117.62 ms ◑