tx · 4f29r3Rifad8HW7x6XTxQu9UJTY38KEgaB7s9HGyiYyY 3MptKi7f3jwXjzqhHpvLLzsSpEQdZiwAo5c: -0.02200000 Waves 2023.05.10 13:07 [2571648] smart account 3MptKi7f3jwXjzqhHpvLLzsSpEQdZiwAo5c > SELF 0.00000000 Waves
{ "type": 13, "id": "4f29r3Rifad8HW7x6XTxQu9UJTY38KEgaB7s9HGyiYyY", "fee": 2200000, "feeAssetId": null, "timestamp": 1683713308316, "version": 2, "chainId": 84, "sender": "3MptKi7f3jwXjzqhHpvLLzsSpEQdZiwAo5c", "senderPublicKey": "44kjsoExo76qSrM51NMhbG8FtdLkcPtyJxEDrwDyT8kz", "proofs": [ "e6uAt3fw7uYa1hmfhsqt3nXUtSWAKFrVU85SgDZYNajp56ywCw4jKhovhBM1UyHApf5aSrvLoVYLJcFirFH6U9d" ], "script": "base64:BgK6IggCEgkKBwEBAQEBCAESABIECgIICBIDCgEIEgQKAggIEgQKAggIIg9nZXRTdHJpbmdPckZhaWwiA2tleSIDU0VQIghCVUZTQ0FMRSIGc2NhbGU4Igh0aHJvd0VyciIDbXNnIghhc1N0cmluZyIDdmFsIgckbWF0Y2gwIgZ2YWxTdHIiHWNvbnZlcnRQcmljZUFzc2V0SW50b0lkb0Fzc2V0IhBwcmljZUFzc2V0QW1vdW50Ig5wcmljZUFzc2V0TVVMVCIFcHJpY2UiCXByaWNlTVVMVCIMaWRvQXNzZXRNVUxUIg9iUHJpY2VBc3NldE1VTFQiDWJJZG9Bc3NldE1VTFQiDmJQcmljZUFzc2V0QlVGIg9iQW1vdW50QXNzZXRCVUYiDklkeENmZ0lkb1N0YXJ0IhFJZHhDZmdJZG9EdXJhdGlvbiIQSWR4Q2ZnQ2xhaW1TdGFydCITSWR4Q2ZnQ2xhaW1EdXJhdGlvbiILSWR4Q2ZnUHJpY2UiD0lkeENmZ1ByaWNlTXVsdCIQSWR4Q2ZnSWRvQXNzZXRJZCISSWR4Q2ZnSWRvQXNzZXRNdWx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QFqAgpCeXRlVmVjdG9yBAJjcwUBagUCY3MDCQABAgUBagIEVW5pdAgFAmR3D3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJkdwlib2R5Qnl0ZXMJAJEDAggFAmR3BnByb29mcwAABQJkebRS9H8=", "height": 2571648, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 317zwLpeAhktTyej8CLJHf2vxw9PfSnmW7Wg3QAeACkk Next: 3u4aJct23eHfBtSMFRzP1USEqeyUsiRnDwFa6oQUs9Cv Diff:
Old | New | Differences | |
---|---|---|---|
158 | 158 | func readInvestorArrayOrFail (userAddress) = split(getStringOrFail(keyInvestor(userAddress)), SEP) | |
159 | 159 | ||
160 | 160 | ||
161 | - | func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress())) | |
161 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
162 | + | case s: String => | |
163 | + | addressFromStringValue(s) | |
164 | + | case _ => | |
165 | + | this | |
166 | + | } | |
162 | 167 | ||
163 | 168 | ||
164 | 169 | let IdxDiffTotalIncrement = 0 | |
253 | 258 | let periodLength = value(getInteger(keyPeriodLength())) | |
254 | 259 | let currentPeriod = valueOrElse(getInteger(keyCurrentPeriod()), 0) | |
255 | 260 | let zeroPeriodEndHeighIsDefined = isDefined(getInteger(keyPeriodEndHeight(0))) | |
256 | - | let $ | |
261 | + | let $t01313615006 = if ((currentPeriod > 0)) | |
257 | 262 | then { | |
258 | 263 | let lastPeriodStartHeight = value(getInteger(keyPeriodStartHeight(currentPeriod))) | |
259 | 264 | let lastPeriodEndHeight = value(getInteger(keyPeriodEndHeight(currentPeriod))) | |
260 | - | let $ | |
265 | + | let $t01339614101 = if ((height > lastPeriodEndHeight)) | |
261 | 266 | then { | |
262 | 267 | let updatedCurrentPeriod = (currentPeriod + 1) | |
263 | 268 | let periodStart = if ((height > (lastPeriodEndHeight + periodLength))) | |
272 | 277 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
273 | 278 | } | |
274 | 279 | else $Tuple3(currentPeriod, lastPeriodStartHeight, lastPeriodEndHeight) | |
275 | - | let updatedCurrentPeriod = $ | |
276 | - | let periodStart = $ | |
277 | - | let periodEnd = $ | |
280 | + | let updatedCurrentPeriod = $t01339614101._1 | |
281 | + | let periodStart = $t01339614101._2 | |
282 | + | let periodEnd = $t01339614101._3 | |
278 | 283 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
279 | 284 | } | |
280 | 285 | else if (zeroPeriodEndHeighIsDefined) | |
281 | 286 | then { | |
282 | 287 | let zeroPeriodStartHeight = value(getInteger(keyPeriodStartHeight(0))) | |
283 | 288 | let zeroPeriodEndHeight = value(getInteger(keyPeriodEndHeight(0))) | |
284 | - | let $ | |
289 | + | let $t01435614738 = if ((height > zeroPeriodEndHeight)) | |
285 | 290 | then { | |
286 | 291 | let updatedCurrentPeriod = (currentPeriod + 1) | |
287 | 292 | let periodStart = (zeroPeriodEndHeight + 1) | |
289 | 294 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
290 | 295 | } | |
291 | 296 | else $Tuple3(currentPeriod, zeroPeriodStartHeight, zeroPeriodEndHeight) | |
292 | - | let updatedCurrentPeriod = $ | |
293 | - | let periodStart = $ | |
294 | - | let periodEnd = $ | |
297 | + | let updatedCurrentPeriod = $t01435614738._1 | |
298 | + | let periodStart = $t01435614738._2 | |
299 | + | let periodEnd = $t01435614738._3 | |
295 | 300 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
296 | 301 | } | |
297 | 302 | else $Tuple3(currentPeriod, valueOrElse(getInteger(keyPeriodStartHeight(currentPeriod)), height), valueOrElse(getInteger(keyPeriodEndHeight(currentPeriod)), ((height + periodLength) - 1))) | |
298 | - | let updatedCurrentPeriod = $ | |
299 | - | let periodStart = $ | |
300 | - | let periodEnd = $ | |
303 | + | let updatedCurrentPeriod = $t01313615006._1 | |
304 | + | let periodStart = $t01313615006._2 | |
305 | + | let periodEnd = $t01313615006._3 | |
301 | 306 | let periodTotalAvailableToClaim = valueOrElse(getInteger(keyPeriodTotalAvailableToClaim(priceAssetId58, updatedCurrentPeriod)), totalPeriodPriceAssetAllowance) | |
302 | 307 | let periodUserAvailableToClaim = valueOrElse(getInteger(keyPeriodUserAvailableToClaim(priceAssetId58, updatedCurrentPeriod, userAddress58)), userPeriodPriceAssetAllowance) | |
303 | 308 | let priceAssetBalance = valueOrElse(getInteger(keyPriceAssetBalance(userAddress58)), 0) | |
304 | 309 | let periodMinAvailableToClaim = min([(outAmount + priceAssetBalance), periodTotalAvailableToClaim, periodUserAvailableToClaim]) | |
305 | 310 | let usdtPriceAssetAllowableRatio = value(getInteger(keyUsdtPriceAssetAllowableRatio())) | |
306 | 311 | let putOneTknV2PriceAssetAmount = scale8 | |
307 | - | let $ | |
312 | + | let $t01576116014 = { | |
308 | 313 | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "putOneTknV2WithoutTakeFeeREADONLY", [putOneTknV2PriceAssetAmount, priceAssetId58], nil) | |
309 | 314 | if ($isInstanceOf(@, "(Int, Int, Int)")) | |
310 | 315 | then @ | |
311 | 316 | else throw(($getType(@) + " couldn't be cast to (Int, Int, Int)")) | |
312 | 317 | } | |
313 | - | if (($ | |
318 | + | if (($t01576116014 == $t01576116014)) | |
314 | 319 | then { | |
315 | - | let bonus = $ | |
316 | - | let feeAmount = $ | |
317 | - | let lpAmount = $ | |
320 | + | let bonus = $t01576116014._3 | |
321 | + | let feeAmount = $t01576116014._2 | |
322 | + | let lpAmount = $t01576116014._1 | |
318 | 323 | let usdtAssetId = value(getString(keyUsdtAssetId())) | |
319 | - | let $ | |
324 | + | let $t01607616294 = { | |
320 | 325 | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "getOneTknV2READONLY", [usdtAssetId, lpAmount], nil) | |
321 | 326 | if ($isInstanceOf(@, "(Int, Int)")) | |
322 | 327 | then @ | |
323 | 328 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
324 | 329 | } | |
325 | - | if (($ | |
330 | + | if (($t01607616294 == $t01607616294)) | |
326 | 331 | then { | |
327 | - | let getOneTknV2FeeAmount = $ | |
328 | - | let usdtAmount = $ | |
332 | + | let getOneTknV2FeeAmount = $t01607616294._2 | |
333 | + | let usdtAmount = $t01607616294._1 | |
329 | 334 | let currentUsdtPriceAssetRatio = fraction(putOneTknV2PriceAssetAmount, scale8, usdtAmount) | |
330 | 335 | let endPeriodBlocksLeft = (periodEnd - height) | |
331 | 336 | $Tuple10(periodMinAvailableToClaim, periodTotalAvailableToClaim, periodUserAvailableToClaim, totalUserAvailableToClaim, usdtPriceAssetAllowableRatio, currentUsdtPriceAssetRatio, endPeriodBlocksLeft, updatedCurrentPeriod, periodStart, periodEnd) | |
337 | 342 | ||
338 | 343 | ||
339 | 344 | func managerPublicKeyOrUnit () = { | |
340 | - | let managerVaultAddress = | |
345 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
341 | 346 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
342 | 347 | case s: String => | |
343 | 348 | fromBase58String(s) | |
462 | 467 | let priceAssetDecimals = value(assetInfo(fromBase58String(priceAssetId58))).decimals | |
463 | 468 | let entries = if ((claimedAssetId58 == priceAssetId58)) | |
464 | 469 | then { | |
465 | - | let $ | |
466 | - | let periodMinAvailableToClaim = $ | |
467 | - | let periodTotalAvailableToClaim = $ | |
468 | - | let periodUserAvailableToClaim = $ | |
469 | - | let totalUserAvailableToClaim = $ | |
470 | - | let usdtPriceAssetAllowableRatio = $ | |
471 | - | let currentUsdtPriceAssetRatio = $ | |
472 | - | let endPeriodBlocksLeft = $ | |
473 | - | let updatedCurrentPeriod = $ | |
474 | - | let periodStart = $ | |
475 | - | let periodEnd = $ | |
470 | + | let $t02213822582 = internalClaimV2(priceAssetId58, userAddress58, outAmount, totalsDiff[IdxDiffClaimedPriceAmountIncrement]) | |
471 | + | let periodMinAvailableToClaim = $t02213822582._1 | |
472 | + | let periodTotalAvailableToClaim = $t02213822582._2 | |
473 | + | let periodUserAvailableToClaim = $t02213822582._3 | |
474 | + | let totalUserAvailableToClaim = $t02213822582._4 | |
475 | + | let usdtPriceAssetAllowableRatio = $t02213822582._5 | |
476 | + | let currentUsdtPriceAssetRatio = $t02213822582._6 | |
477 | + | let endPeriodBlocksLeft = $t02213822582._7 | |
478 | + | let updatedCurrentPeriod = $t02213822582._8 | |
479 | + | let periodStart = $t02213822582._9 | |
480 | + | let periodEnd = $t02213822582._10 | |
476 | 481 | let checks = [if ((periodUserAvailableToClaim > 0)) | |
477 | 482 | then true | |
478 | 483 | else throwErr("unavailable to claim because user period allowance reached"), if ((periodTotalAvailableToClaim > 0)) | |
607 | 612 | let priceAssetBalance = valueOrElse(getInteger(keyPriceAssetBalance(userAddress58)), 0) | |
608 | 613 | let priceAssetBalanceIdoDecimals = (priceAssetBalance * 100) | |
609 | 614 | let availableIdoAmountToClaimWithPriceAssetBalance = (availableIdoAmountToClaim + priceAssetBalanceIdoDecimals) | |
610 | - | let $ | |
611 | - | let periodMinAvailableToClaim = $ | |
612 | - | let periodTotalAvailableToClaim = $ | |
613 | - | let periodUserAvailableToClaim = $ | |
614 | - | let totalUserAvailableToClaim = $ | |
615 | - | let usdtPriceAssetAllowableRatio = $ | |
616 | - | let currentUsdtPriceAssetRatio = $ | |
617 | - | let endPeriodBlocksLeft = $ | |
618 | - | let updatedCurrentPeriod = $ | |
619 | - | let periodStart = $ | |
620 | - | let periodEnd = $ | |
615 | + | let $t03383334245 = internalClaimV2(priceAssetId58, userAddress58, outAmount, totalsDiff[IdxDiffClaimedPriceAmountIncrement]) | |
616 | + | let periodMinAvailableToClaim = $t03383334245._1 | |
617 | + | let periodTotalAvailableToClaim = $t03383334245._2 | |
618 | + | let periodUserAvailableToClaim = $t03383334245._3 | |
619 | + | let totalUserAvailableToClaim = $t03383334245._4 | |
620 | + | let usdtPriceAssetAllowableRatio = $t03383334245._5 | |
621 | + | let currentUsdtPriceAssetRatio = $t03383334245._6 | |
622 | + | let endPeriodBlocksLeft = $t03383334245._7 | |
623 | + | let updatedCurrentPeriod = $t03383334245._8 | |
624 | + | let periodStart = $t03383334245._9 | |
625 | + | let periodEnd = $t03383334245._10 | |
621 | 626 | let currentPeriodEndHeight = valueOrElse(getInteger(keyPeriodEndHeight(updatedCurrentPeriod)), 0) | |
622 | 627 | let userTotalPriceAssetClaimed = (parseIntValue(readInvestorArrayOrFail(userAddress58)[IdxInvClaimedPriceAssetAmount]) - priceAssetBalance) | |
623 | 628 | let resultString = if ((height > currentPeriodEndHeight)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | let SEP = "__" | |
8 | 8 | ||
9 | 9 | let BUFSCALE = toBigInt(1000000000000000000) | |
10 | 10 | ||
11 | 11 | let scale8 = 100000000 | |
12 | 12 | ||
13 | 13 | func throwErr (msg) = throw(makeString(["ido.ride:", msg], " ")) | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func asString (val) = match val { | |
17 | 17 | case valStr: String => | |
18 | 18 | valStr | |
19 | 19 | case _ => | |
20 | 20 | throw("fail to cast into String") | |
21 | 21 | } | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func convertPriceAssetIntoIdoAsset (priceAssetAmount,priceAssetMULT,price,priceMULT,idoAssetMULT) = { | |
25 | 25 | let bPriceAssetMULT = toBigInt(priceAssetMULT) | |
26 | 26 | let bIdoAssetMULT = toBigInt(idoAssetMULT) | |
27 | 27 | let bPriceAssetBUF = fraction(toBigInt(priceAssetAmount), BUFSCALE, bPriceAssetMULT) | |
28 | 28 | let bAmountAssetBUF = fraction(bPriceAssetBUF, toBigInt(priceMULT), toBigInt(price)) | |
29 | 29 | toInt(fraction(bAmountAssetBUF, toBigInt(idoAssetMULT), BUFSCALE)) | |
30 | 30 | } | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | let IdxCfgIdoStart = 1 | |
34 | 34 | ||
35 | 35 | let IdxCfgIdoDuration = 2 | |
36 | 36 | ||
37 | 37 | let IdxCfgClaimStart = 3 | |
38 | 38 | ||
39 | 39 | let IdxCfgClaimDuration = 4 | |
40 | 40 | ||
41 | 41 | let IdxCfgPrice = 5 | |
42 | 42 | ||
43 | 43 | let IdxCfgPriceMult = 6 | |
44 | 44 | ||
45 | 45 | let IdxCfgIdoAssetId = 7 | |
46 | 46 | ||
47 | 47 | let IdxCfgIdoAssetMult = 8 | |
48 | 48 | ||
49 | 49 | let IdxCfgPriceAssetId = 9 | |
50 | 50 | ||
51 | 51 | let IdxCfgPriceAssetMult = 10 | |
52 | 52 | ||
53 | 53 | let IdxCfgMinInvestAmount = 11 | |
54 | 54 | ||
55 | 55 | func fromatConfigS (idoStart,idoDuration,claimStart,claimDuration,price,priceMult,idoAssetId58,idoAssetMult,priceAssetId58,priceAssetMult,minInvestAmount,totalIdoAssetToSell) = makeString(["%d%d%d%d%d%d%s%d%s%d%d%d", idoStart, idoDuration, claimStart, claimDuration, price, priceMult, idoAssetId58, idoAssetMult, priceAssetId58, priceAssetMult, minInvestAmount, totalIdoAssetToSell], SEP) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func fromatConfig (idoStart,idoDuration,claimStart,claimDuration,price,priceMult,idoAssetId58,idoAssetMult,priceAssetId58,priceAssetMult,minInvestAmount,totalIdoAssetToSell) = fromatConfigS(toString(idoStart), toString(idoDuration), toString(claimStart), toString(claimDuration), toString(price), toString(priceMult), idoAssetId58, toString(idoAssetMult), priceAssetId58, toString(priceAssetMult), toString(minInvestAmount), toString(totalIdoAssetToSell)) | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | let IdxInvTotalAmount = 1 | |
62 | 62 | ||
63 | 63 | let IdxInvRemainingAmount = 2 | |
64 | 64 | ||
65 | 65 | let IdxInvClaimedPriceAssetAmount = 3 | |
66 | 66 | ||
67 | 67 | let IdxInvClaimedIdoAssetAmount = 4 | |
68 | 68 | ||
69 | 69 | let IdxInvLastClaimedHeight = 5 | |
70 | 70 | ||
71 | 71 | func formatInvestorS (totalAmount,remainingAmount,claimedPriceAssetAmount,claimedIdoAssetAmount,lastClaimedHeight) = makeString(["%d%d%d%d%d", totalAmount, remainingAmount, claimedPriceAssetAmount, claimedIdoAssetAmount, lastClaimedHeight], SEP) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func formatInvestor (totalAmount,remainingAmount,claimedPriceAssetAmount,claimedIdoAssetAmount,lastClaimedHeight) = formatInvestorS(toString(totalAmount), toString(remainingAmount), toString(claimedPriceAssetAmount), toString(claimedIdoAssetAmount), toString(lastClaimedHeight)) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func formatHistoryRecord (priceAssetAmount,idoAssetAmount) = makeString(["%d%d%d%d", toString(height), toString(lastBlock.timestamp), toString(priceAssetAmount), toString(idoAssetAmount)], SEP) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func keyConfig () = "%s__config" | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func keyInvestor (userAddress) = ("%s__" + userAddress) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func keyTotals () = "%s__totals" | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func keyUSDNClaimDisabled () = "%s__usdnClaimDisabled" | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func keyUSDNClaimEndHeight () = "%s__usdnClaimEndHeight" | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func keyPeriodLength () = makeString(["%s", "periodLength"], SEP) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func keyCurrentPeriod () = makeString(["%s", "currentPeriod"], SEP) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func keyPeriodStartHeight (periodNum) = makeString(["%s%s", "periodStartHeight", toString(periodNum)], SEP) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func keyPeriodEndHeight (periodNum) = makeString(["%s%s", "periodEndHeight", toString(periodNum)], SEP) | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func keyUsdtPriceAssetAllowableRatio () = makeString(["%s", "usdtPriceAssetAllowableRatio"], SEP) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func keyTotalPeriodAllowance (assetId) = makeString(["%s%s", "totalPeriodAllowance", assetId], SEP) | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func keyUserPeriodAllowance (assetId) = makeString(["%s%s", "userPeriodAllowance", assetId], SEP) | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func keyPeriodTotalAvailableToClaim (assetId,periodNum) = makeString(["%s%s%s", "periodTotalAvailableToClaim", assetId, toString(periodNum)], SEP) | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | func keyPeriodUserAvailableToClaim (assetId,periodNum,userAddress) = makeString(["%s%s%s%s", "periodUserAvailableToClaim", assetId, toString(periodNum), userAddress], SEP) | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | func keyUsdtPriceAssetStablePool () = makeString(["%s", "usdtPriceAssetStablePool"], SEP) | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | func keyUsdtAssetId () = makeString(["%s", "usdtAssetId"], SEP) | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func keyPriceAssetBalance (address) = makeString(["%s%s", "priceAssetBalance", address], SEP) | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func keyInvestorRemainingAmount (address) = makeString(["%s%s", "investorRemainingAmount", address], SEP) | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func keyTotalRemainingAmount () = makeString(["%s", "totalRemainingAmount"], SEP) | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func readConfigArray () = split(getStringOrFail(keyConfig()), SEP) | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | func readTotalsArrayOrDefaultByCustomKey (customKey) = split(valueOrElse(getString(customKey), formatInvestorS("0", "0", "0", "0", "0")), SEP) | |
150 | 150 | ||
151 | 151 | ||
152 | 152 | func readTotalsArrayOrDefault () = readTotalsArrayOrDefaultByCustomKey(keyTotals()) | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | func readInvestorArrayOrDefault (userAddress) = readTotalsArrayOrDefaultByCustomKey(keyInvestor(userAddress)) | |
156 | 156 | ||
157 | 157 | ||
158 | 158 | func readInvestorArrayOrFail (userAddress) = split(getStringOrFail(keyInvestor(userAddress)), SEP) | |
159 | 159 | ||
160 | 160 | ||
161 | - | func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress())) | |
161 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
162 | + | case s: String => | |
163 | + | addressFromStringValue(s) | |
164 | + | case _ => | |
165 | + | this | |
166 | + | } | |
162 | 167 | ||
163 | 168 | ||
164 | 169 | let IdxDiffTotalIncrement = 0 | |
165 | 170 | ||
166 | 171 | let IdxDiffRemainingPriceAmountIncrement = 1 | |
167 | 172 | ||
168 | 173 | let IdxDiffClaimedPriceAmountIncrement = 2 | |
169 | 174 | ||
170 | 175 | let IdxDiffClaimedIdoAssetAmountIncrement = 3 | |
171 | 176 | ||
172 | 177 | func TotalsEntry (key,origArray,incrementDiff,newLastClaimedHeight,priceAssetBalance) = { | |
173 | 178 | let totalAmount = parseIntValue(origArray[IdxInvTotalAmount]) | |
174 | 179 | let remainingAmount = parseIntValue(origArray[IdxInvRemainingAmount]) | |
175 | 180 | let claimedPriceAssetAmount = parseIntValue(origArray[IdxInvClaimedPriceAssetAmount]) | |
176 | 181 | let claimedIdoAssetAmount = parseIntValue(origArray[IdxInvClaimedIdoAssetAmount]) | |
177 | 182 | let lastClaimedHeight = parseIntValue(origArray[IdxInvLastClaimedHeight]) | |
178 | 183 | let newTotalAmount = (totalAmount + incrementDiff[IdxDiffTotalIncrement]) | |
179 | 184 | let newRemainingAmount = (remainingAmount + incrementDiff[IdxDiffRemainingPriceAmountIncrement]) | |
180 | 185 | let cfgArray = readConfigArray() | |
181 | 186 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
182 | 187 | let priceAssetDecimals = value(assetInfo(fromBase58String(priceAssetId58))).decimals | |
183 | 188 | let priceAssetBalancePriceAssetDecimals = fraction(priceAssetBalance, scale8, pow(10, 0, priceAssetDecimals, 0, 0, DOWN)) | |
184 | 189 | let newClaimedPriceAssetAmount = ((claimedPriceAssetAmount + incrementDiff[IdxDiffClaimedPriceAmountIncrement]) - priceAssetBalance) | |
185 | 190 | let newClaimedIdoAssetAmount = ((claimedIdoAssetAmount + incrementDiff[IdxDiffClaimedIdoAssetAmountIncrement]) + priceAssetBalancePriceAssetDecimals) | |
186 | 191 | let entries = if ((0 > newRemainingAmount)) | |
187 | 192 | then { | |
188 | 193 | let diff = ((newTotalAmount - newClaimedPriceAssetAmount) - newClaimedIdoAssetAmount) | |
189 | 194 | let newLogicRemainingAmount = if ((0 > diff)) | |
190 | 195 | then 0 | |
191 | 196 | else diff | |
192 | 197 | StringEntry(key, formatInvestor(newTotalAmount, newLogicRemainingAmount, newClaimedPriceAssetAmount, newClaimedIdoAssetAmount, newLastClaimedHeight)) | |
193 | 198 | } | |
194 | 199 | else StringEntry(key, formatInvestor(newTotalAmount, newRemainingAmount, newClaimedPriceAssetAmount, newClaimedIdoAssetAmount, newLastClaimedHeight)) | |
195 | 200 | entries | |
196 | 201 | } | |
197 | 202 | ||
198 | 203 | ||
199 | 204 | func InvestOperationHistoryEntry (userAddress,priceAssetAmount,idoAssetAmount,txId) = StringEntry(keyOperationHistoryRecord("invest", userAddress, toBase58String(txId)), formatHistoryRecord(priceAssetAmount, idoAssetAmount)) | |
200 | 205 | ||
201 | 206 | ||
202 | 207 | func ClaimOperationHistoryEntry (userAddress,priceAssetAmount,idoAssetAmount,txId) = StringEntry(keyOperationHistoryRecord("claim", userAddress, toBase58String(txId)), formatHistoryRecord(priceAssetAmount, idoAssetAmount)) | |
203 | 208 | ||
204 | 209 | ||
205 | 210 | func internalClaim (claimedAssetId58,userAddress,txId) = { | |
206 | 211 | let cfgArray = readConfigArray() | |
207 | 212 | let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart]) | |
208 | 213 | let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration]) | |
209 | 214 | let claimEnd = (claimStart + claimDuration) | |
210 | 215 | let price = parseIntValue(cfgArray[IdxCfgPrice]) | |
211 | 216 | let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult]) | |
212 | 217 | let idoAssetId58 = cfgArray[IdxCfgIdoAssetId] | |
213 | 218 | let idoAssetId = fromBase58String(idoAssetId58) | |
214 | 219 | let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult]) | |
215 | 220 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
216 | 221 | let priceAssetId = fromBase58String(priceAssetId58) | |
217 | 222 | let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult]) | |
218 | 223 | let userAddress58 = toString(userAddress) | |
219 | 224 | let origInvestArray = readInvestorArrayOrFail(userAddress58) | |
220 | 225 | let investTotalAmount = parseIntValue(origInvestArray[IdxInvTotalAmount]) | |
221 | 226 | let investLastClaimedHeightTMP = parseIntValue(origInvestArray[IdxInvLastClaimedHeight]) | |
222 | 227 | let investLastClaimedHeight = if ((claimStart >= investLastClaimedHeightTMP)) | |
223 | 228 | then claimStart | |
224 | 229 | else investLastClaimedHeightTMP | |
225 | 230 | let newClaimPeriodHeight = if ((height > claimEnd)) | |
226 | 231 | then claimEnd | |
227 | 232 | else if ((claimStart > height)) | |
228 | 233 | then claimStart | |
229 | 234 | else height | |
230 | 235 | let claimingBlocks = (newClaimPeriodHeight - investLastClaimedHeight) | |
231 | 236 | let claimingPriceAssetAmount = fraction(investTotalAmount, claimingBlocks, claimDuration) | |
232 | 237 | let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset(claimingPriceAssetAmount, priceAssetMult, price, priceMult, idoAssetMult) | |
233 | 238 | let isUSDN = (claimedAssetId58 == priceAssetId58) | |
234 | 239 | let isUSDNClaimDisabled = valueOrElse(getBoolean(keyUSDNClaimDisabled()), false) | |
235 | 240 | let checks = [if (!(if (isUSDN) | |
236 | 241 | then isUSDNClaimDisabled | |
237 | 242 | else false)) | |
238 | 243 | then true | |
239 | 244 | else throw("USDN claim is disabled")] | |
240 | 245 | if ((checks == checks)) | |
241 | 246 | then if ((claimedAssetId58 == priceAssetId58)) | |
242 | 247 | then $Tuple6([0, -(claimingPriceAssetAmount), claimingPriceAssetAmount, 0], claimingPriceAssetAmount, priceAssetId, origInvestArray, newClaimPeriodHeight, [claimingPriceAssetAmount, claimingIdoAssetAmount]) | |
243 | 248 | else if ((claimedAssetId58 == idoAssetId58)) | |
244 | 249 | then $Tuple6([0, -(claimingPriceAssetAmount), 0, claimingIdoAssetAmount], claimingIdoAssetAmount, idoAssetId, origInvestArray, newClaimPeriodHeight, [claimingPriceAssetAmount, claimingIdoAssetAmount]) | |
245 | 250 | else throw(("unsupported assetId: " + claimedAssetId58)) | |
246 | 251 | else throw("Strict value is not equal to itself.") | |
247 | 252 | } | |
248 | 253 | ||
249 | 254 | ||
250 | 255 | func internalClaimV2 (priceAssetId58,userAddress58,outAmount,totalUserAvailableToClaim) = { | |
251 | 256 | let totalPeriodPriceAssetAllowance = value(getInteger(keyTotalPeriodAllowance(priceAssetId58))) | |
252 | 257 | let userPeriodPriceAssetAllowance = value(getInteger(keyUserPeriodAllowance(priceAssetId58))) | |
253 | 258 | let periodLength = value(getInteger(keyPeriodLength())) | |
254 | 259 | let currentPeriod = valueOrElse(getInteger(keyCurrentPeriod()), 0) | |
255 | 260 | let zeroPeriodEndHeighIsDefined = isDefined(getInteger(keyPeriodEndHeight(0))) | |
256 | - | let $ | |
261 | + | let $t01313615006 = if ((currentPeriod > 0)) | |
257 | 262 | then { | |
258 | 263 | let lastPeriodStartHeight = value(getInteger(keyPeriodStartHeight(currentPeriod))) | |
259 | 264 | let lastPeriodEndHeight = value(getInteger(keyPeriodEndHeight(currentPeriod))) | |
260 | - | let $ | |
265 | + | let $t01339614101 = if ((height > lastPeriodEndHeight)) | |
261 | 266 | then { | |
262 | 267 | let updatedCurrentPeriod = (currentPeriod + 1) | |
263 | 268 | let periodStart = if ((height > (lastPeriodEndHeight + periodLength))) | |
264 | 269 | then { | |
265 | 270 | let blocksToLastPeriodStart = ((height - lastPeriodEndHeight) % periodLength) | |
266 | 271 | if ((blocksToLastPeriodStart == 0)) | |
267 | 272 | then ((height - periodLength) + 1) | |
268 | 273 | else (height - blocksToLastPeriodStart) | |
269 | 274 | } | |
270 | 275 | else (lastPeriodEndHeight + 1) | |
271 | 276 | let periodEnd = ((periodStart + periodLength) - 1) | |
272 | 277 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
273 | 278 | } | |
274 | 279 | else $Tuple3(currentPeriod, lastPeriodStartHeight, lastPeriodEndHeight) | |
275 | - | let updatedCurrentPeriod = $ | |
276 | - | let periodStart = $ | |
277 | - | let periodEnd = $ | |
280 | + | let updatedCurrentPeriod = $t01339614101._1 | |
281 | + | let periodStart = $t01339614101._2 | |
282 | + | let periodEnd = $t01339614101._3 | |
278 | 283 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
279 | 284 | } | |
280 | 285 | else if (zeroPeriodEndHeighIsDefined) | |
281 | 286 | then { | |
282 | 287 | let zeroPeriodStartHeight = value(getInteger(keyPeriodStartHeight(0))) | |
283 | 288 | let zeroPeriodEndHeight = value(getInteger(keyPeriodEndHeight(0))) | |
284 | - | let $ | |
289 | + | let $t01435614738 = if ((height > zeroPeriodEndHeight)) | |
285 | 290 | then { | |
286 | 291 | let updatedCurrentPeriod = (currentPeriod + 1) | |
287 | 292 | let periodStart = (zeroPeriodEndHeight + 1) | |
288 | 293 | let periodEnd = ((periodStart + periodLength) - 1) | |
289 | 294 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
290 | 295 | } | |
291 | 296 | else $Tuple3(currentPeriod, zeroPeriodStartHeight, zeroPeriodEndHeight) | |
292 | - | let updatedCurrentPeriod = $ | |
293 | - | let periodStart = $ | |
294 | - | let periodEnd = $ | |
297 | + | let updatedCurrentPeriod = $t01435614738._1 | |
298 | + | let periodStart = $t01435614738._2 | |
299 | + | let periodEnd = $t01435614738._3 | |
295 | 300 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
296 | 301 | } | |
297 | 302 | else $Tuple3(currentPeriod, valueOrElse(getInteger(keyPeriodStartHeight(currentPeriod)), height), valueOrElse(getInteger(keyPeriodEndHeight(currentPeriod)), ((height + periodLength) - 1))) | |
298 | - | let updatedCurrentPeriod = $ | |
299 | - | let periodStart = $ | |
300 | - | let periodEnd = $ | |
303 | + | let updatedCurrentPeriod = $t01313615006._1 | |
304 | + | let periodStart = $t01313615006._2 | |
305 | + | let periodEnd = $t01313615006._3 | |
301 | 306 | let periodTotalAvailableToClaim = valueOrElse(getInteger(keyPeriodTotalAvailableToClaim(priceAssetId58, updatedCurrentPeriod)), totalPeriodPriceAssetAllowance) | |
302 | 307 | let periodUserAvailableToClaim = valueOrElse(getInteger(keyPeriodUserAvailableToClaim(priceAssetId58, updatedCurrentPeriod, userAddress58)), userPeriodPriceAssetAllowance) | |
303 | 308 | let priceAssetBalance = valueOrElse(getInteger(keyPriceAssetBalance(userAddress58)), 0) | |
304 | 309 | let periodMinAvailableToClaim = min([(outAmount + priceAssetBalance), periodTotalAvailableToClaim, periodUserAvailableToClaim]) | |
305 | 310 | let usdtPriceAssetAllowableRatio = value(getInteger(keyUsdtPriceAssetAllowableRatio())) | |
306 | 311 | let putOneTknV2PriceAssetAmount = scale8 | |
307 | - | let $ | |
312 | + | let $t01576116014 = { | |
308 | 313 | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "putOneTknV2WithoutTakeFeeREADONLY", [putOneTknV2PriceAssetAmount, priceAssetId58], nil) | |
309 | 314 | if ($isInstanceOf(@, "(Int, Int, Int)")) | |
310 | 315 | then @ | |
311 | 316 | else throw(($getType(@) + " couldn't be cast to (Int, Int, Int)")) | |
312 | 317 | } | |
313 | - | if (($ | |
318 | + | if (($t01576116014 == $t01576116014)) | |
314 | 319 | then { | |
315 | - | let bonus = $ | |
316 | - | let feeAmount = $ | |
317 | - | let lpAmount = $ | |
320 | + | let bonus = $t01576116014._3 | |
321 | + | let feeAmount = $t01576116014._2 | |
322 | + | let lpAmount = $t01576116014._1 | |
318 | 323 | let usdtAssetId = value(getString(keyUsdtAssetId())) | |
319 | - | let $ | |
324 | + | let $t01607616294 = { | |
320 | 325 | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "getOneTknV2READONLY", [usdtAssetId, lpAmount], nil) | |
321 | 326 | if ($isInstanceOf(@, "(Int, Int)")) | |
322 | 327 | then @ | |
323 | 328 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
324 | 329 | } | |
325 | - | if (($ | |
330 | + | if (($t01607616294 == $t01607616294)) | |
326 | 331 | then { | |
327 | - | let getOneTknV2FeeAmount = $ | |
328 | - | let usdtAmount = $ | |
332 | + | let getOneTknV2FeeAmount = $t01607616294._2 | |
333 | + | let usdtAmount = $t01607616294._1 | |
329 | 334 | let currentUsdtPriceAssetRatio = fraction(putOneTknV2PriceAssetAmount, scale8, usdtAmount) | |
330 | 335 | let endPeriodBlocksLeft = (periodEnd - height) | |
331 | 336 | $Tuple10(periodMinAvailableToClaim, periodTotalAvailableToClaim, periodUserAvailableToClaim, totalUserAvailableToClaim, usdtPriceAssetAllowableRatio, currentUsdtPriceAssetRatio, endPeriodBlocksLeft, updatedCurrentPeriod, periodStart, periodEnd) | |
332 | 337 | } | |
333 | 338 | else throw("Strict value is not equal to itself.") | |
334 | 339 | } | |
335 | 340 | else throw("Strict value is not equal to itself.") | |
336 | 341 | } | |
337 | 342 | ||
338 | 343 | ||
339 | 344 | func managerPublicKeyOrUnit () = { | |
340 | - | let managerVaultAddress = | |
345 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
341 | 346 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
342 | 347 | case s: String => | |
343 | 348 | fromBase58String(s) | |
344 | 349 | case _: Unit => | |
345 | 350 | unit | |
346 | 351 | case _ => | |
347 | 352 | throw("Match error") | |
348 | 353 | } | |
349 | 354 | } | |
350 | 355 | ||
351 | 356 | ||
352 | 357 | func mustManager (i) = { | |
353 | 358 | let pd = throw("Permission denied") | |
354 | 359 | match managerPublicKeyOrUnit() { | |
355 | 360 | case pk: ByteVector => | |
356 | 361 | if ((i.callerPublicKey == pk)) | |
357 | 362 | then true | |
358 | 363 | else pd | |
359 | 364 | case _: Unit => | |
360 | 365 | if ((i.caller == this)) | |
361 | 366 | then true | |
362 | 367 | else pd | |
363 | 368 | case _ => | |
364 | 369 | throw("Match error") | |
365 | 370 | } | |
366 | 371 | } | |
367 | 372 | ||
368 | 373 | ||
369 | 374 | @Callable(i) | |
370 | 375 | func constructor (idoStart,idoDuration,claimStart,claimDuration,price,priceAssetId58,minInvestAmount) = { | |
371 | 376 | let priceMult = ((100 * 1000) * 1000) | |
372 | 377 | let idoEnd = (idoStart + idoDuration) | |
373 | 378 | if (isDefined(getString(keyConfig()))) | |
374 | 379 | then throw("already initialized") | |
375 | 380 | else if (("3PMEHLx1j6zerarZTYfsGqDeeZqQoMpxq5S" != toString(i.caller))) | |
376 | 381 | then throw("not authorized") | |
377 | 382 | else if ((size(i.payments) != 1)) | |
378 | 383 | then throw("exactly 1 payment must be attached") | |
379 | 384 | else if ((idoEnd >= claimStart)) | |
380 | 385 | then throw("claimStart must be greater than idoEnd") | |
381 | 386 | else { | |
382 | 387 | let pmt = value(i.payments[0]) | |
383 | 388 | let idoAssetId = value(pmt.assetId) | |
384 | 389 | let idoAssetInfo = valueOrErrorMessage(assetInfo(idoAssetId), "fail to load ido asset info") | |
385 | 390 | let idoAssetId58 = toBase58String(idoAssetId) | |
386 | 391 | let idoAssetMult = pow(10, 0, idoAssetInfo.decimals, 0, 0, DOWN) | |
387 | 392 | let priceAssetId = fromBase58String(priceAssetId58) | |
388 | 393 | let priceAssetInfo = valueOrErrorMessage(assetInfo(priceAssetId), "fail to load price asset info") | |
389 | 394 | let priceAssetMult = pow(10, 0, priceAssetInfo.decimals, 0, 0, DOWN) | |
390 | 395 | let origTotalsArray = readTotalsArrayOrDefault() | |
391 | 396 | let totalsDiff = [0, 0, 0, 0] | |
392 | 397 | [StringEntry(keyConfig(), fromatConfig(idoStart, idoDuration, claimStart, claimDuration, price, priceMult, idoAssetId58, idoAssetMult, priceAssetId58, priceAssetMult, minInvestAmount, pmt.amount)), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart, 0)] | |
393 | 398 | } | |
394 | 399 | } | |
395 | 400 | ||
396 | 401 | ||
397 | 402 | ||
398 | 403 | @Callable(i) | |
399 | 404 | func invest () = { | |
400 | 405 | let cfgArray = readConfigArray() | |
401 | 406 | let idoStart = parseIntValue(cfgArray[IdxCfgIdoStart]) | |
402 | 407 | let idoDuration = parseIntValue(cfgArray[IdxCfgIdoDuration]) | |
403 | 408 | let idoEnd = (idoStart + idoDuration) | |
404 | 409 | let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart]) | |
405 | 410 | let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration]) | |
406 | 411 | let price = parseIntValue(cfgArray[IdxCfgPrice]) | |
407 | 412 | let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult]) | |
408 | 413 | let idoAssetId58 = cfgArray[IdxCfgIdoAssetId] | |
409 | 414 | let idoAssetId = fromBase58String(idoAssetId58) | |
410 | 415 | let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult]) | |
411 | 416 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
412 | 417 | let priceAssetId = fromBase58String(priceAssetId58) | |
413 | 418 | let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult]) | |
414 | 419 | let minIvestAmount = parseIntValue(cfgArray[IdxCfgMinInvestAmount]) | |
415 | 420 | let userAddress = toString(i.caller) | |
416 | 421 | if ((idoStart > height)) | |
417 | 422 | then throw("ido has not been started yet") | |
418 | 423 | else if ((height > idoEnd)) | |
419 | 424 | then throw("ido has been already ended") | |
420 | 425 | else if ((size(i.payments) != 1)) | |
421 | 426 | then throw("exactly 1 payment is expected") | |
422 | 427 | else { | |
423 | 428 | let pmt = value(i.payments[0]) | |
424 | 429 | let pmtAssetId = value(pmt.assetId) | |
425 | 430 | let pmtAmount = pmt.amount | |
426 | 431 | if ((pmtAssetId != priceAssetId)) | |
427 | 432 | then throw((("invalid payment asset id: " + toBase58String(pmtAssetId)) + " is expected")) | |
428 | 433 | else { | |
429 | 434 | let origInvestorArray = readInvestorArrayOrDefault(userAddress) | |
430 | 435 | let origTotalsArray = readTotalsArrayOrDefault() | |
431 | 436 | let newPriceTotalAmount = (parseIntValue(origTotalsArray[IdxInvTotalAmount]) + pmtAmount) | |
432 | 437 | let requiredIdoAssetAmount = (newPriceTotalAmount * 100) | |
433 | 438 | if ((requiredIdoAssetAmount > assetBalance(this, idoAssetId))) | |
434 | 439 | then throw("IDO asset has been - sold consider to use smaller payment") | |
435 | 440 | else { | |
436 | 441 | let totalsDiff = [pmtAmount, pmtAmount, 0, 0] | |
437 | 442 | [TotalsEntry(keyInvestor(userAddress), origInvestorArray, totalsDiff, claimStart, 0), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart, 0), InvestOperationHistoryEntry(userAddress, pmtAmount, 0, i.transactionId)] | |
438 | 443 | } | |
439 | 444 | } | |
440 | 445 | } | |
441 | 446 | } | |
442 | 447 | ||
443 | 448 | ||
444 | 449 | ||
445 | 450 | @Callable(i) | |
446 | 451 | func claim (claimedAssetId58,userAddress58) = { | |
447 | 452 | let callerAddress58 = toString(i.caller) | |
448 | 453 | if ((userAddress58 != callerAddress58)) | |
449 | 454 | then throw("not authorized") | |
450 | 455 | else { | |
451 | 456 | let cfgArray = readConfigArray() | |
452 | 457 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
453 | 458 | let claimResultTuple = internalClaim(claimedAssetId58, i.caller, i.transactionId) | |
454 | 459 | let totalsDiff = claimResultTuple._1 | |
455 | 460 | let outAmount = claimResultTuple._2 | |
456 | 461 | let outAssetId = claimResultTuple._3 | |
457 | 462 | let origInvestArray = claimResultTuple._4 | |
458 | 463 | let newClaimPeriodHeight = claimResultTuple._5 | |
459 | 464 | let claimedPriceAmountFromDiff = totalsDiff[IdxDiffClaimedPriceAmountIncrement] | |
460 | 465 | let claimedIdoAssetAmountFromDiff = totalsDiff[IdxDiffClaimedIdoAssetAmountIncrement] | |
461 | 466 | let priceAssetBalance = valueOrElse(getInteger(keyPriceAssetBalance(userAddress58)), 0) | |
462 | 467 | let priceAssetDecimals = value(assetInfo(fromBase58String(priceAssetId58))).decimals | |
463 | 468 | let entries = if ((claimedAssetId58 == priceAssetId58)) | |
464 | 469 | then { | |
465 | - | let $ | |
466 | - | let periodMinAvailableToClaim = $ | |
467 | - | let periodTotalAvailableToClaim = $ | |
468 | - | let periodUserAvailableToClaim = $ | |
469 | - | let totalUserAvailableToClaim = $ | |
470 | - | let usdtPriceAssetAllowableRatio = $ | |
471 | - | let currentUsdtPriceAssetRatio = $ | |
472 | - | let endPeriodBlocksLeft = $ | |
473 | - | let updatedCurrentPeriod = $ | |
474 | - | let periodStart = $ | |
475 | - | let periodEnd = $ | |
470 | + | let $t02213822582 = internalClaimV2(priceAssetId58, userAddress58, outAmount, totalsDiff[IdxDiffClaimedPriceAmountIncrement]) | |
471 | + | let periodMinAvailableToClaim = $t02213822582._1 | |
472 | + | let periodTotalAvailableToClaim = $t02213822582._2 | |
473 | + | let periodUserAvailableToClaim = $t02213822582._3 | |
474 | + | let totalUserAvailableToClaim = $t02213822582._4 | |
475 | + | let usdtPriceAssetAllowableRatio = $t02213822582._5 | |
476 | + | let currentUsdtPriceAssetRatio = $t02213822582._6 | |
477 | + | let endPeriodBlocksLeft = $t02213822582._7 | |
478 | + | let updatedCurrentPeriod = $t02213822582._8 | |
479 | + | let periodStart = $t02213822582._9 | |
480 | + | let periodEnd = $t02213822582._10 | |
476 | 481 | let checks = [if ((periodUserAvailableToClaim > 0)) | |
477 | 482 | then true | |
478 | 483 | else throwErr("unavailable to claim because user period allowance reached"), if ((periodTotalAvailableToClaim > 0)) | |
479 | 484 | then true | |
480 | 485 | else throwErr("unavailable to claim because total period allowance reached"), if ((periodMinAvailableToClaim > 0)) | |
481 | 486 | then true | |
482 | 487 | else throwErr("nothing to claim"), if ((usdtPriceAssetAllowableRatio > currentUsdtPriceAssetRatio)) | |
483 | 488 | then true | |
484 | 489 | else throwErr("unavailable to claim because usdn price lower than usdtPriceAssetAllowableRatio")] | |
485 | 490 | if ((checks == checks)) | |
486 | 491 | then { | |
487 | 492 | let updatedPeriodTotalAvailableToClaim = (periodTotalAvailableToClaim - periodMinAvailableToClaim) | |
488 | 493 | let updatedPeriodUserAvailableToClaim = (periodUserAvailableToClaim - periodMinAvailableToClaim) | |
489 | 494 | let entries = if ((priceAssetBalance > periodMinAvailableToClaim)) | |
490 | 495 | then [ScriptTransfer(i.caller, periodMinAvailableToClaim, outAssetId), IntegerEntry(keyPriceAssetBalance(userAddress58), (priceAssetBalance - periodMinAvailableToClaim))] | |
491 | 496 | else { | |
492 | 497 | let evaluateResult = split(asString(invoke(this, "claimREADONLY", [priceAssetId58, userAddress58], nil)), SEP) | |
493 | 498 | if ((evaluateResult == evaluateResult)) | |
494 | 499 | then { | |
495 | 500 | let availablePriceAmountToClaim = parseIntValue(evaluateResult[3]) | |
496 | 501 | let lastClaimEntries = if ((availablePriceAmountToClaim == periodMinAvailableToClaim)) | |
497 | 502 | then { | |
498 | 503 | let investorTotalAmount = parseIntValue(origInvestArray[IdxInvTotalAmount]) | |
499 | 504 | let investorRemainingAmount = parseIntValue(origInvestArray[IdxInvRemainingAmount]) | |
500 | 505 | let investorPriceAssetBalance = parseIntValue(origInvestArray[IdxInvClaimedPriceAssetAmount]) | |
501 | 506 | let investorIdoAssetBalance = parseIntValue(origInvestArray[IdxInvClaimedIdoAssetAmount]) | |
502 | 507 | let investorLastClaimedHeight = parseIntValue(origInvestArray[IdxInvLastClaimedHeight]) | |
503 | 508 | let newInvestArray = [toString(investorTotalAmount), "0", toString(investorPriceAssetBalance), toString(investorIdoAssetBalance), toString(investorLastClaimedHeight)] | |
504 | 509 | let totals = readTotalsArrayOrDefault() | |
505 | 510 | let totalsTotalAmount = parseIntValue(totals[IdxInvTotalAmount]) | |
506 | 511 | let totalsRemainingAmount = parseIntValue(totals[IdxInvRemainingAmount]) | |
507 | 512 | let totalsClaimedPriceAssetAmount = parseIntValue(totals[IdxInvClaimedPriceAssetAmount]) | |
508 | 513 | let totalsClaimedIdoAssetAmount = parseIntValue(totals[IdxInvClaimedIdoAssetAmount]) | |
509 | 514 | let totalsLastClaimedHeight = parseIntValue(totals[IdxInvLastClaimedHeight]) | |
510 | 515 | let newTotalsRemainingAmount = (totalsRemainingAmount - investorRemainingAmount) | |
511 | 516 | let newTotalArray = [toString(totalsTotalAmount), toString(newTotalsRemainingAmount), toString(totalsClaimedPriceAssetAmount), toString(totalsClaimedIdoAssetAmount), toString(totalsLastClaimedHeight)] | |
512 | 517 | let newTotalRemainingAmount = (valueOrElse(getInteger(keyTotalRemainingAmount()), 0) + investorRemainingAmount) | |
513 | 518 | [StringEntry(keyInvestorRemainingAmount(userAddress58), toString(investorRemainingAmount)), StringEntry(keyTotalRemainingAmount(), toString(newTotalRemainingAmount)), TotalsEntry(keyInvestor(userAddress58), newInvestArray, totalsDiff, newClaimPeriodHeight, 0), TotalsEntry(keyTotals(), newTotalArray, totalsDiff, newClaimPeriodHeight, 0)] | |
514 | 519 | } | |
515 | 520 | else [TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight, 0), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight, 0)] | |
516 | 521 | let updatedPriceAssetBalance = ((priceAssetBalance + outAmount) - periodMinAvailableToClaim) | |
517 | 522 | ([ScriptTransfer(i.caller, periodMinAvailableToClaim, outAssetId), IntegerEntry(keyPriceAssetBalance(userAddress58), updatedPriceAssetBalance)] ++ lastClaimEntries) | |
518 | 523 | } | |
519 | 524 | else throw("Strict value is not equal to itself.") | |
520 | 525 | } | |
521 | 526 | $Tuple2(([IntegerEntry(keyCurrentPeriod(), updatedCurrentPeriod), IntegerEntry(keyPeriodStartHeight(updatedCurrentPeriod), periodStart), IntegerEntry(keyPeriodEndHeight(updatedCurrentPeriod), periodEnd), IntegerEntry(keyPeriodTotalAvailableToClaim(priceAssetId58, updatedCurrentPeriod), updatedPeriodTotalAvailableToClaim), IntegerEntry(keyPeriodUserAvailableToClaim(priceAssetId58, updatedCurrentPeriod, userAddress58), updatedPeriodUserAvailableToClaim), ClaimOperationHistoryEntry(userAddress58, periodMinAvailableToClaim, claimedIdoAssetAmountFromDiff, i.transactionId)] ++ entries), unit) | |
522 | 527 | } | |
523 | 528 | else throw("Strict value is not equal to itself.") | |
524 | 529 | } | |
525 | 530 | else { | |
526 | 531 | let priceAssetBalanceIdoDecimals = fraction(priceAssetBalance, scale8, pow(10, 0, priceAssetDecimals, 0, 0, DOWN)) | |
527 | 532 | $Tuple2([ScriptTransfer(i.caller, (outAmount + priceAssetBalanceIdoDecimals), outAssetId), IntegerEntry(keyPriceAssetBalance(userAddress58), 0), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight, priceAssetBalance), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight, priceAssetBalance), ClaimOperationHistoryEntry(userAddress58, claimedPriceAmountFromDiff, (claimedIdoAssetAmountFromDiff + priceAssetBalanceIdoDecimals), i.transactionId)], unit) | |
528 | 533 | } | |
529 | 534 | entries | |
530 | 535 | } | |
531 | 536 | } | |
532 | 537 | ||
533 | 538 | ||
534 | 539 | ||
535 | 540 | @Callable(i) | |
536 | 541 | func cleanRemaingAmount (userAddress58) = { | |
537 | 542 | let priceAssetId58 = readConfigArray()[IdxCfgPriceAssetId] | |
538 | 543 | let evaluateResult = split(asString(invoke(this, "claimREADONLY", [priceAssetId58, userAddress58], nil)), SEP) | |
539 | 544 | if ((evaluateResult == evaluateResult)) | |
540 | 545 | then { | |
541 | 546 | let availablePriceAmountToClaim = parseIntValue(evaluateResult[2]) | |
542 | 547 | let checkUnclaimedAssets = if ((availablePriceAmountToClaim == 0)) | |
543 | 548 | then true | |
544 | 549 | else throwErr("user have unclaimed assets") | |
545 | 550 | if ((checkUnclaimedAssets == checkUnclaimedAssets)) | |
546 | 551 | then { | |
547 | 552 | let investor = split(value(getString(keyInvestor(userAddress58))), SEP) | |
548 | 553 | let investorTotalAmount = parseIntValue(investor[IdxInvTotalAmount]) | |
549 | 554 | let investorRemainingAmount = parseIntValue(investor[IdxInvRemainingAmount]) | |
550 | 555 | let investorPriceAssetBalance = parseIntValue(investor[IdxInvClaimedPriceAssetAmount]) | |
551 | 556 | let investorIdoAssetBalance = parseIntValue(investor[IdxInvClaimedIdoAssetAmount]) | |
552 | 557 | let investorLastClaimedHeight = parseIntValue(investor[IdxInvLastClaimedHeight]) | |
553 | 558 | let investorRemainingAmountCheck = if ((investorRemainingAmount != 0)) | |
554 | 559 | then true | |
555 | 560 | else throwErr("investorRemainingAmount already zero") | |
556 | 561 | if ((investorRemainingAmountCheck == investorRemainingAmountCheck)) | |
557 | 562 | then { | |
558 | 563 | let newInvestor = makeString(["%d%d%d%d%d", toString(investorTotalAmount), "0", toString(investorPriceAssetBalance), toString(investorIdoAssetBalance), toString(investorLastClaimedHeight)], SEP) | |
559 | 564 | let totals = split(value(getString(keyTotals())), SEP) | |
560 | 565 | let totalsTotalAmount = parseIntValue(totals[IdxInvTotalAmount]) | |
561 | 566 | let totalsRemainingAmount = parseIntValue(totals[IdxInvRemainingAmount]) | |
562 | 567 | let totalsClaimedPriceAssetAmount = parseIntValue(totals[IdxInvClaimedPriceAssetAmount]) | |
563 | 568 | let totalsClaimedIdoAssetAmount = parseIntValue(totals[IdxInvClaimedIdoAssetAmount]) | |
564 | 569 | let totalsLastClaimedHeight = parseIntValue(totals[IdxInvLastClaimedHeight]) | |
565 | 570 | let newTotals = makeString(["%d%d%d%d%d", toString(totalsTotalAmount), toString((totalsRemainingAmount - investorRemainingAmount)), toString(totalsClaimedPriceAssetAmount), toString(totalsClaimedIdoAssetAmount), toString(totalsLastClaimedHeight)], SEP) | |
566 | 571 | let newTotalRemainingAmount = (valueOrElse(getInteger(keyTotalRemainingAmount()), 0) + investorRemainingAmount) | |
567 | 572 | [StringEntry(keyInvestorRemainingAmount(userAddress58), toString(investorRemainingAmount)), StringEntry(keyTotalRemainingAmount(), toString(newTotalRemainingAmount)), StringEntry(keyInvestor(userAddress58), newInvestor), StringEntry(keyTotals(), newTotals)] | |
568 | 573 | } | |
569 | 574 | else throw("Strict value is not equal to itself.") | |
570 | 575 | } | |
571 | 576 | else throw("Strict value is not equal to itself.") | |
572 | 577 | } | |
573 | 578 | else throw("Strict value is not equal to itself.") | |
574 | 579 | } | |
575 | 580 | ||
576 | 581 | ||
577 | 582 | ||
578 | 583 | @Callable(i) | |
579 | 584 | func claimREADONLY (claimedAssetId58,userAddress58) = { | |
580 | 585 | let claimResultTuple = internalClaim(claimedAssetId58, addressFromStringValue(userAddress58), fromBase58String("")) | |
581 | 586 | let totalsDiff = claimResultTuple._1 | |
582 | 587 | let outAmount = claimResultTuple._2 | |
583 | 588 | let outAssetId = claimResultTuple._3 | |
584 | 589 | let origInvestArray = claimResultTuple._4 | |
585 | 590 | let newClaimPeriodHeight = claimResultTuple._5 | |
586 | 591 | let availableToClaimArray = claimResultTuple._6 | |
587 | 592 | let availablePriceAmountToClaim = availableToClaimArray[0] | |
588 | 593 | let availableIdoAmountToClaim = availableToClaimArray[1] | |
589 | 594 | $Tuple2(nil, makeString(["%s%d%d", userAddress58, toString(availablePriceAmountToClaim), toString(availableIdoAmountToClaim)], SEP)) | |
590 | 595 | } | |
591 | 596 | ||
592 | 597 | ||
593 | 598 | ||
594 | 599 | @Callable(i) | |
595 | 600 | func claimV2READONLY (claimedAssetId58,userAddress58) = { | |
596 | 601 | let claimResultTuple = internalClaim(claimedAssetId58, addressFromStringValue(userAddress58), fromBase58String("")) | |
597 | 602 | let totalsDiff = claimResultTuple._1 | |
598 | 603 | let outAmount = claimResultTuple._2 | |
599 | 604 | let outAssetId = claimResultTuple._3 | |
600 | 605 | let origInvestArray = claimResultTuple._4 | |
601 | 606 | let newClaimPeriodHeight = claimResultTuple._5 | |
602 | 607 | let availableToClaimArray = claimResultTuple._6 | |
603 | 608 | let availablePriceAmountToClaim = availableToClaimArray[0] | |
604 | 609 | let availableIdoAmountToClaim = availableToClaimArray[1] | |
605 | 610 | let cfgArray = readConfigArray() | |
606 | 611 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
607 | 612 | let priceAssetBalance = valueOrElse(getInteger(keyPriceAssetBalance(userAddress58)), 0) | |
608 | 613 | let priceAssetBalanceIdoDecimals = (priceAssetBalance * 100) | |
609 | 614 | let availableIdoAmountToClaimWithPriceAssetBalance = (availableIdoAmountToClaim + priceAssetBalanceIdoDecimals) | |
610 | - | let $ | |
611 | - | let periodMinAvailableToClaim = $ | |
612 | - | let periodTotalAvailableToClaim = $ | |
613 | - | let periodUserAvailableToClaim = $ | |
614 | - | let totalUserAvailableToClaim = $ | |
615 | - | let usdtPriceAssetAllowableRatio = $ | |
616 | - | let currentUsdtPriceAssetRatio = $ | |
617 | - | let endPeriodBlocksLeft = $ | |
618 | - | let updatedCurrentPeriod = $ | |
619 | - | let periodStart = $ | |
620 | - | let periodEnd = $ | |
615 | + | let $t03383334245 = internalClaimV2(priceAssetId58, userAddress58, outAmount, totalsDiff[IdxDiffClaimedPriceAmountIncrement]) | |
616 | + | let periodMinAvailableToClaim = $t03383334245._1 | |
617 | + | let periodTotalAvailableToClaim = $t03383334245._2 | |
618 | + | let periodUserAvailableToClaim = $t03383334245._3 | |
619 | + | let totalUserAvailableToClaim = $t03383334245._4 | |
620 | + | let usdtPriceAssetAllowableRatio = $t03383334245._5 | |
621 | + | let currentUsdtPriceAssetRatio = $t03383334245._6 | |
622 | + | let endPeriodBlocksLeft = $t03383334245._7 | |
623 | + | let updatedCurrentPeriod = $t03383334245._8 | |
624 | + | let periodStart = $t03383334245._9 | |
625 | + | let periodEnd = $t03383334245._10 | |
621 | 626 | let currentPeriodEndHeight = valueOrElse(getInteger(keyPeriodEndHeight(updatedCurrentPeriod)), 0) | |
622 | 627 | let userTotalPriceAssetClaimed = (parseIntValue(readInvestorArrayOrFail(userAddress58)[IdxInvClaimedPriceAssetAmount]) - priceAssetBalance) | |
623 | 628 | let resultString = if ((height > currentPeriodEndHeight)) | |
624 | 629 | then { | |
625 | 630 | let periodLenght = value(getInteger(keyPeriodLength())) | |
626 | 631 | let userPeriodAllowance = value(getInteger(keyUserPeriodAllowance(priceAssetId58))) | |
627 | 632 | let totalPeriodAllowance = value(getInteger(keyTotalPeriodAllowance(priceAssetId58))) | |
628 | 633 | makeString(["%d%d%d%d%d%d", toString(availableIdoAmountToClaimWithPriceAssetBalance), toString(userPeriodAllowance), toString(totalPeriodAllowance), toString(usdtPriceAssetAllowableRatio), toString(currentUsdtPriceAssetRatio), toString(periodLenght), toString(userTotalPriceAssetClaimed)], SEP) | |
629 | 634 | } | |
630 | 635 | else makeString(["%d%d%d%d%d%d", toString(availableIdoAmountToClaimWithPriceAssetBalance), toString(periodMinAvailableToClaim), toString(periodTotalAvailableToClaim), toString(usdtPriceAssetAllowableRatio), toString(currentUsdtPriceAssetRatio), toString(endPeriodBlocksLeft), toString(userTotalPriceAssetClaimed)], SEP) | |
631 | 636 | $Tuple2(nil, resultString) | |
632 | 637 | } | |
633 | 638 | ||
634 | 639 | ||
635 | 640 | @Verifier(tx) | |
636 | 641 | func verify () = { | |
637 | 642 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
638 | 643 | case pk: ByteVector => | |
639 | 644 | pk | |
640 | 645 | case _: Unit => | |
641 | 646 | tx.senderPublicKey | |
642 | 647 | case _ => | |
643 | 648 | throw("Match error") | |
644 | 649 | } | |
645 | 650 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
646 | 651 | } | |
647 | 652 |
github/deemru/w8io/169f3d6 102.61 ms ◑