tx · 7gHMLYbhBDXWsBx1p7fyP3bo9ytWYAeUxnFAT4MLdzym 3Mynj79w9PikhwUwMwFPk2vifkm8zkDt2Zt: -0.02200000 Waves 2022.11.02 09:30 [2299123] smart account 3Mynj79w9PikhwUwMwFPk2vifkm8zkDt2Zt > SELF 0.00000000 Waves
{ "type": 13, "id": "7gHMLYbhBDXWsBx1p7fyP3bo9ytWYAeUxnFAT4MLdzym", "fee": 2200000, "feeAssetId": null, "timestamp": 1667370654481, "version": 1, "sender": "3Mynj79w9PikhwUwMwFPk2vifkm8zkDt2Zt", "senderPublicKey": "5195SwZ4ifX6bBstZ6tN31kEQFVHaKpFYLc1GCa3Myrh", "proofs": [ "3S1LSMrWxNMVofuoEoNkbxsyPX5KzVhDWsmyF7gjVtBi9Eww1jiCEhJXAw2AL93mjHeEoVPZW491YtmNNwuokCwg" ], "script": "base64:AAIFAAAAAAAADTAIAhIJCgcBAQEBAQgBEgASBAoCCAgSBAoCCAgSBAoCCAgSAwoBCBIAIg9nZXRTdHJpbmdPckZhaWwiA2tleSIDU0VQIghCVUZTQ0FMRSIGc2NhbGU4Igh0aHJvd0VyciIDbXNnIh1jb252ZXJ0UHJpY2VBc3NldEludG9JZG9Bc3NldCIQcHJpY2VBc3NldEFtb3VudCIOcHJpY2VBc3NldE1VTFQiBXByaWNlIglwcmljZU1VTFQiDGlkb0Fzc2V0TVVMVCIPYlByaWNlQXNzZXRNVUxUIg1iSWRvQXNzZXRNVUxUIg5iUHJpY2VBc3NldEJVRiIPYkFtb3VudEFzc2V0QlVGIg5JZHhDZmdJZG9TdGFydCIRSWR4Q2ZnSWRvRHVyYXRpb24iEElkeENmZ0NsYWltU3RhcnQiE0lkeENmZ0NsYWltRHVyYXRpb24iC0lkeENmZ1ByaWNlIg9JZHhDZmdQcmljZU11bHQiEElkeENmZ0lkb0Fzc2V0SWQiEklkeENmZ0lkb0Fzc2V0TXVsdCISSWR4Q2ZnUHJpY2VBc3NldElkIhRJZHhDZmdQcmljZUFz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90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAmN5AQAAAAJjegAAAAAEAAAAAmNBBAAAAAJibwkBAAAAAmJLAAAAAAMJAAABAAAAAgUAAAACYm8CAAAACkJ5dGVWZWN0b3IEAAAAAmJRBQAAAAJibwUAAAACYlEDCQAAAQAAAAIFAAAAAmJvAgAAAARVbml0CAUAAAACY3kAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJjeQAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAmN5AAAABnByb29mcwAAAAAAAAAAAAUAAAACY0EKzAbR", "chainId": 84, "height": 2299123, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8voyBbNK7N3SXNsZfMDzyc3ZT5iv2anF3FjWUotpeGYU Next: none Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | let SEP = "__" | |
8 | 8 | ||
9 | 9 | let BUFSCALE = toBigInt(1000000000000000000) | |
10 | + | ||
11 | + | let scale8 = 100000000 | |
12 | + | ||
13 | + | func throwErr (msg) = throw(makeString(["ido.ride:", msg], " ")) | |
14 | + | ||
10 | 15 | ||
11 | 16 | func convertPriceAssetIntoIdoAsset (priceAssetAmount,priceAssetMULT,price,priceMULT,idoAssetMULT) = { | |
12 | 17 | let bPriceAssetMULT = toBigInt(priceAssetMULT) | |
80 | 85 | ||
81 | 86 | ||
82 | 87 | func keyUSDNClaimEndHeight () = "%s__usdnClaimEndHeight" | |
88 | + | ||
89 | + | ||
90 | + | func keyPeriodLength () = makeString(["%s", "periodLength"], SEP) | |
91 | + | ||
92 | + | ||
93 | + | func keyCurrnetPeriod () = makeString(["%s", "currentPeriod"], SEP) | |
94 | + | ||
95 | + | ||
96 | + | func keyPeriodStartHeight (periodNum) = makeString(["%s%s", "periodStartHeight", toString(periodNum)], SEP) | |
97 | + | ||
98 | + | ||
99 | + | func keyPeriodEndHeight (periodNum) = makeString(["%s%s", "periodEndHeight", toString(periodNum)], SEP) | |
100 | + | ||
101 | + | ||
102 | + | func keyUsdtPriceAssetAllowableRatio () = makeString(["%s", "usdtPriceAssetAllowableRatio"], SEP) | |
103 | + | ||
104 | + | ||
105 | + | func keyTotalPeriodAllowance (assetId) = makeString(["%s%s", "totalPeriodAllowance", assetId], SEP) | |
106 | + | ||
107 | + | ||
108 | + | func keyUserPeriodAllowance (assetId) = makeString(["%s%s", "userPeriodAllowance", assetId], SEP) | |
109 | + | ||
110 | + | ||
111 | + | func keyPeriodTotalAvailableToClaim (assetId,periodNum) = makeString(["%s%s%s", "periodTotalAvailableToClaim", assetId, toString(periodNum)], SEP) | |
112 | + | ||
113 | + | ||
114 | + | func keyPeriodUserAvailableToClaim (assetId,periodNum,userAddress) = makeString(["%s%s%s%s", "periodUserAvailableToClaim", assetId, toString(periodNum), userAddress], SEP) | |
115 | + | ||
116 | + | ||
117 | + | func keyUsdtPriceAssetStablePool () = makeString(["%s", "usdtPriceAssetStablePool"], SEP) | |
118 | + | ||
119 | + | ||
120 | + | func keyUsdtAssetId () = makeString(["%s", "usdtAssetId"], SEP) | |
83 | 121 | ||
84 | 122 | ||
85 | 123 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
159 | 197 | then claimStart | |
160 | 198 | else height | |
161 | 199 | let claimingBlocks = (newClaimPeriodHeight - investLastClaimedHeight) | |
162 | - | let | |
163 | - | let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset( | |
200 | + | let totalUserAvailableToClaim = fraction(investTotalAmount, claimingBlocks, claimDuration) | |
201 | + | let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset(totalUserAvailableToClaim, priceAssetMult, price, priceMult, idoAssetMult) | |
164 | 202 | let isUSDN = (claimedAssetId58 == priceAssetId58) | |
165 | 203 | let isUSDNClaimDisabled = valueOrElse(getBoolean(keyUSDNClaimDisabled()), false) | |
166 | 204 | let isUSDNClaimEnded = match getInteger(keyUSDNClaimEndHeight()) { | |
175 | 213 | then isUSDNClaimDisabled | |
176 | 214 | else false)) | |
177 | 215 | then true | |
178 | - | else | |
216 | + | else throwErr("USDN claim is disabled"), if (!(if (isUSDN) | |
179 | 217 | then isUSDNClaimEnded | |
180 | 218 | else false)) | |
181 | 219 | then true | |
182 | - | else | |
220 | + | else throwErr("USDN claim is ended")] | |
183 | 221 | if ((checks == checks)) | |
184 | - | then if ((claimedAssetId58 == priceAssetId58)) | |
185 | - | then $Tuple6([0, -(claimingPriceAssetAmount), claimingPriceAssetAmount, 0], claimingPriceAssetAmount, priceAssetId, origInvestArray, newClaimPeriodHeight, [claimingPriceAssetAmount, claimingIdoAssetAmount]) | |
186 | - | else if ((claimedAssetId58 == idoAssetId58)) | |
187 | - | then $Tuple6([0, -(claimingPriceAssetAmount), 0, claimingIdoAssetAmount], claimingIdoAssetAmount, idoAssetId, origInvestArray, newClaimPeriodHeight, [claimingPriceAssetAmount, claimingIdoAssetAmount]) | |
188 | - | else throw(("unsupported assetId: " + claimedAssetId58)) | |
222 | + | then { | |
223 | + | let totalPeriodPriceAssetAllowance = value(getInteger(keyTotalPeriodAllowance(priceAssetId58))) | |
224 | + | let userPeriodPriceAssetAllowance = value(getInteger(keyUserPeriodAllowance(priceAssetId58))) | |
225 | + | let currentPeriod = valueOrElse(getInteger(keyCurrnetPeriod()), 0) | |
226 | + | let periodTotalAvailableToClaim = valueOrElse(getInteger(keyPeriodTotalAvailableToClaim(priceAssetId58, currentPeriod)), totalPeriodPriceAssetAllowance) | |
227 | + | let periodUserAvailableToClaim = valueOrElse(getInteger(keyPeriodUserAvailableToClaim(priceAssetId58, currentPeriod, userAddress58)), userPeriodPriceAssetAllowance) | |
228 | + | let availableClaimingPriceAssetAmount = min([totalUserAvailableToClaim, periodTotalAvailableToClaim, periodUserAvailableToClaim]) | |
229 | + | let usdtPriceAssetAllowableRatio = value(getInteger(keyUsdtPriceAssetAllowableRatio())) | |
230 | + | let putOneTknV2PriceAssestAmount = scale8 | |
231 | + | let $t01169311945 = { | |
232 | + | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "putOneTknV2WithoutTakeFeeREADONLY", [putOneTknV2PriceAssestAmount, priceAssetId], nil) | |
233 | + | if ($isInstanceOf(@, "(Int, Int, Int)")) | |
234 | + | then @ | |
235 | + | else throw("Couldn't cast Any to (Int, Int, Int)") | |
236 | + | } | |
237 | + | if (($t01169311945 == $t01169311945)) | |
238 | + | then { | |
239 | + | let bonus = $t01169311945._3 | |
240 | + | let feeAmount = $t01169311945._2 | |
241 | + | let lpAmount = $t01169311945._1 | |
242 | + | let usdtAssetId = value(fromBase58String(value(getString(keyUsdtAssetId())))) | |
243 | + | let $t01203412252 = { | |
244 | + | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "getOneTknV2READONLY", [usdtAssetId, lpAmount], nil) | |
245 | + | if ($isInstanceOf(@, "(Int, Int)")) | |
246 | + | then @ | |
247 | + | else throw("Couldn't cast Any to (Int, Int)") | |
248 | + | } | |
249 | + | if (($t01203412252 == $t01203412252)) | |
250 | + | then { | |
251 | + | let getOneTknV2FeeAmount = $t01203412252._2 | |
252 | + | let usdtAmount = $t01203412252._1 | |
253 | + | let currentUsdtPriceAssetRatio = fraction(usdtAmount, putOneTknV2PriceAssestAmount, scale8) | |
254 | + | let endPeriodBlocksLeft = (valueOrElse(getInteger(keyPeriodEndHeight(currentPeriod)), claimEnd) - height) | |
255 | + | if ((claimedAssetId58 == priceAssetId58)) | |
256 | + | then $Tuple6([0, -(availableClaimingPriceAssetAmount), availableClaimingPriceAssetAmount, 0], availableClaimingPriceAssetAmount, priceAssetId, origInvestArray, newClaimPeriodHeight, [totalUserAvailableToClaim, claimingIdoAssetAmount, availableClaimingPriceAssetAmount, periodTotalAvailableToClaim, usdtPriceAssetAllowableRatio, currentUsdtPriceAssetRatio, endPeriodBlocksLeft]) | |
257 | + | else if ((claimedAssetId58 == idoAssetId58)) | |
258 | + | then $Tuple6([0, -(availableClaimingPriceAssetAmount), 0, availableClaimingPriceAssetAmount], claimingIdoAssetAmount, idoAssetId, origInvestArray, newClaimPeriodHeight, [totalUserAvailableToClaim, claimingIdoAssetAmount, availableClaimingPriceAssetAmount, periodTotalAvailableToClaim, currentUsdtPriceAssetRatio, usdtPriceAssetAllowableRatio]) | |
259 | + | else throwErr(makeString(["unsupported assetId:", claimedAssetId58], " ")) | |
260 | + | } | |
261 | + | else throw("Strict value is not equal to itself.") | |
262 | + | } | |
263 | + | else throw("Strict value is not equal to itself.") | |
264 | + | } | |
189 | 265 | else throw("Strict value is not equal to itself.") | |
190 | 266 | } | |
191 | 267 | ||
307 | 383 | func claim (claimedAssetId58,userAddress58) = { | |
308 | 384 | let callerAddress58 = toString(i.caller) | |
309 | 385 | if ((userAddress58 != callerAddress58)) | |
310 | - | then | |
386 | + | then throwErr("not authorized") | |
311 | 387 | else { | |
312 | 388 | let claimResultTuple = internalClaim(claimedAssetId58, i.caller, i.transactionId) | |
313 | 389 | let totalsDiff = claimResultTuple._1 | |
315 | 391 | let outAssetId = claimResultTuple._3 | |
316 | 392 | let origInvestArray = claimResultTuple._4 | |
317 | 393 | let newClaimPeriodHeight = claimResultTuple._5 | |
318 | - | let claimedPriceAmountFromDiff = totalsDiff[IdxDiffClaimedPriceAmountIncrement] | |
319 | - | let claimedIdoAssetAmountFromDiff = totalsDiff[IdxDiffClaimedIdoAssetAmountIncrement] | |
320 | - | $Tuple2([ScriptTransfer(i.caller, outAmount, outAssetId), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight), ClaimOperationHistoryEntry(userAddress58, claimedPriceAmountFromDiff, claimedIdoAssetAmountFromDiff, i.transactionId)], unit) | |
394 | + | let availableToClaimArray = claimResultTuple._6 | |
395 | + | let totalUserAvailableToClaim = availableToClaimArray[0] | |
396 | + | let periodAvailableIdoAmountToClaim = availableToClaimArray[1] | |
397 | + | let periodAvailableUserPriceAmountToClaim = availableToClaimArray[2] | |
398 | + | let periodAvailableTotalPriceAmountToClaim = availableToClaimArray[3] | |
399 | + | let checks = [if (if ((totalUserAvailableToClaim > 0)) | |
400 | + | then true | |
401 | + | else (periodAvailableIdoAmountToClaim > 0)) | |
402 | + | then true | |
403 | + | else throwErr("nothing to claim"), if ((periodAvailableUserPriceAmountToClaim > 0)) | |
404 | + | then true | |
405 | + | else throwErr("unavailable to claim because user period allowance reached"), if ((periodAvailableTotalPriceAmountToClaim > 0)) | |
406 | + | then true | |
407 | + | else throwErr("unavailable to claim because total period allowance reached")] | |
408 | + | if ((checks == checks)) | |
409 | + | then { | |
410 | + | let claimedPriceAmountFromDiff = totalsDiff[IdxDiffClaimedPriceAmountIncrement] | |
411 | + | let claimedIdoAssetAmountFromDiff = totalsDiff[IdxDiffClaimedIdoAssetAmountIncrement] | |
412 | + | $Tuple2([ScriptTransfer(i.caller, outAmount, outAssetId), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight), ClaimOperationHistoryEntry(userAddress58, claimedPriceAmountFromDiff, claimedIdoAssetAmountFromDiff, i.transactionId)], unit) | |
413 | + | } | |
414 | + | else throw("Strict value is not equal to itself.") | |
321 | 415 | } | |
322 | 416 | } | |
323 | 417 | ||
332 | 426 | let origInvestArray = claimResultTuple._4 | |
333 | 427 | let newClaimPeriodHeight = claimResultTuple._5 | |
334 | 428 | let availableToClaimArray = claimResultTuple._6 | |
335 | - | let availablePriceAmountToClaim = availableToClaimArray[ | |
336 | - | let availableIdoAmountToClaim = availableToClaimArray[ | |
429 | + | let availablePriceAmountToClaim = availableToClaimArray[1] | |
430 | + | let availableIdoAmountToClaim = availableToClaimArray[2] | |
337 | 431 | $Tuple2(nil, makeString(["%s%d%d", userAddress58, toString(availablePriceAmountToClaim), toString(availableIdoAmountToClaim)], SEP)) | |
432 | + | } | |
433 | + | ||
434 | + | ||
435 | + | ||
436 | + | @Callable(i) | |
437 | + | func claimV2READONLY (claimedAssetId58,userAddress58) = { | |
438 | + | let claimResultTuple = internalClaim(claimedAssetId58, addressFromStringValue(userAddress58), fromBase58String("")) | |
439 | + | let totalsDiff = claimResultTuple._1 | |
440 | + | let outAmount = claimResultTuple._2 | |
441 | + | let outAssetId = claimResultTuple._3 | |
442 | + | let origInvestArray = claimResultTuple._4 | |
443 | + | let newClaimPeriodHeight = claimResultTuple._5 | |
444 | + | let availableToClaimArray = claimResultTuple._6 | |
445 | + | let totalUserAvailableToClaim = availableToClaimArray[0] | |
446 | + | let periodAvailableIdoAmountToClaim = availableToClaimArray[1] | |
447 | + | let periodAvailableUserPriceAmountToClaim = availableToClaimArray[2] | |
448 | + | let periodAvailableTotalPriceAmountToClaim = availableToClaimArray[3] | |
449 | + | let usdtPriceAssetAllowableRatio = availableToClaimArray[4] | |
450 | + | let currentPriceAssetRatio = availableToClaimArray[5] | |
451 | + | let endPriodBlocksLeft = availableToClaimArray[6] | |
452 | + | let resultString = makeString(["%d%d%d%d%d%d%d", toString(totalUserAvailableToClaim), toString(periodAvailableIdoAmountToClaim), toString(periodAvailableUserPriceAmountToClaim), toString(periodAvailableTotalPriceAmountToClaim), toString(usdtPriceAssetAllowableRatio), toString(currentPriceAssetRatio), toString(endPriodBlocksLeft)], SEP) | |
453 | + | $Tuple2(nil, resultString) | |
338 | 454 | } | |
339 | 455 | ||
340 | 456 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
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 | + | ||
11 | + | let scale8 = 100000000 | |
12 | + | ||
13 | + | func throwErr (msg) = throw(makeString(["ido.ride:", msg], " ")) | |
14 | + | ||
10 | 15 | ||
11 | 16 | func convertPriceAssetIntoIdoAsset (priceAssetAmount,priceAssetMULT,price,priceMULT,idoAssetMULT) = { | |
12 | 17 | let bPriceAssetMULT = toBigInt(priceAssetMULT) | |
13 | 18 | let bIdoAssetMULT = toBigInt(idoAssetMULT) | |
14 | 19 | let bPriceAssetBUF = fraction(toBigInt(priceAssetAmount), BUFSCALE, bPriceAssetMULT) | |
15 | 20 | let bAmountAssetBUF = fraction(bPriceAssetBUF, toBigInt(priceMULT), toBigInt(price)) | |
16 | 21 | toInt(fraction(bAmountAssetBUF, toBigInt(idoAssetMULT), BUFSCALE)) | |
17 | 22 | } | |
18 | 23 | ||
19 | 24 | ||
20 | 25 | let IdxCfgIdoStart = 1 | |
21 | 26 | ||
22 | 27 | let IdxCfgIdoDuration = 2 | |
23 | 28 | ||
24 | 29 | let IdxCfgClaimStart = 3 | |
25 | 30 | ||
26 | 31 | let IdxCfgClaimDuration = 4 | |
27 | 32 | ||
28 | 33 | let IdxCfgPrice = 5 | |
29 | 34 | ||
30 | 35 | let IdxCfgPriceMult = 6 | |
31 | 36 | ||
32 | 37 | let IdxCfgIdoAssetId = 7 | |
33 | 38 | ||
34 | 39 | let IdxCfgIdoAssetMult = 8 | |
35 | 40 | ||
36 | 41 | let IdxCfgPriceAssetId = 9 | |
37 | 42 | ||
38 | 43 | let IdxCfgPriceAssetMult = 10 | |
39 | 44 | ||
40 | 45 | let IdxCfgMinInvestAmount = 11 | |
41 | 46 | ||
42 | 47 | 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) | |
43 | 48 | ||
44 | 49 | ||
45 | 50 | 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)) | |
46 | 51 | ||
47 | 52 | ||
48 | 53 | let IdxInvTotalAmount = 1 | |
49 | 54 | ||
50 | 55 | let IdxInvRemainingAmount = 2 | |
51 | 56 | ||
52 | 57 | let IdxInvClaimedPriceAssetAmount = 3 | |
53 | 58 | ||
54 | 59 | let IdxInvClaimedIdoAssetAmount = 4 | |
55 | 60 | ||
56 | 61 | let IdxInvLastClaimedHeight = 5 | |
57 | 62 | ||
58 | 63 | func formatInvestorS (totalAmount,remainingAmount,claimedPriceAssetAmount,claimedIdoAssetAmount,lastClaimedHeight) = makeString(["%d%d%d%d%d", totalAmount, remainingAmount, claimedPriceAssetAmount, claimedIdoAssetAmount, lastClaimedHeight], SEP) | |
59 | 64 | ||
60 | 65 | ||
61 | 66 | func formatInvestor (totalAmount,remainingAmount,claimedPriceAssetAmount,claimedIdoAssetAmount,lastClaimedHeight) = formatInvestorS(toString(totalAmount), toString(remainingAmount), toString(claimedPriceAssetAmount), toString(claimedIdoAssetAmount), toString(lastClaimedHeight)) | |
62 | 67 | ||
63 | 68 | ||
64 | 69 | func formatHistoryRecord (priceAssetAmount,idoAssetAmount) = makeString(["%d%d%d%d", toString(height), toString(lastBlock.timestamp), toString(priceAssetAmount), toString(idoAssetAmount)], SEP) | |
65 | 70 | ||
66 | 71 | ||
67 | 72 | func keyConfig () = "%s__config" | |
68 | 73 | ||
69 | 74 | ||
70 | 75 | func keyInvestor (userAddress) = ("%s__" + userAddress) | |
71 | 76 | ||
72 | 77 | ||
73 | 78 | func keyTotals () = "%s__totals" | |
74 | 79 | ||
75 | 80 | ||
76 | 81 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
77 | 82 | ||
78 | 83 | ||
79 | 84 | func keyUSDNClaimDisabled () = "%s__usdnClaimDisabled" | |
80 | 85 | ||
81 | 86 | ||
82 | 87 | func keyUSDNClaimEndHeight () = "%s__usdnClaimEndHeight" | |
88 | + | ||
89 | + | ||
90 | + | func keyPeriodLength () = makeString(["%s", "periodLength"], SEP) | |
91 | + | ||
92 | + | ||
93 | + | func keyCurrnetPeriod () = makeString(["%s", "currentPeriod"], SEP) | |
94 | + | ||
95 | + | ||
96 | + | func keyPeriodStartHeight (periodNum) = makeString(["%s%s", "periodStartHeight", toString(periodNum)], SEP) | |
97 | + | ||
98 | + | ||
99 | + | func keyPeriodEndHeight (periodNum) = makeString(["%s%s", "periodEndHeight", toString(periodNum)], SEP) | |
100 | + | ||
101 | + | ||
102 | + | func keyUsdtPriceAssetAllowableRatio () = makeString(["%s", "usdtPriceAssetAllowableRatio"], SEP) | |
103 | + | ||
104 | + | ||
105 | + | func keyTotalPeriodAllowance (assetId) = makeString(["%s%s", "totalPeriodAllowance", assetId], SEP) | |
106 | + | ||
107 | + | ||
108 | + | func keyUserPeriodAllowance (assetId) = makeString(["%s%s", "userPeriodAllowance", assetId], SEP) | |
109 | + | ||
110 | + | ||
111 | + | func keyPeriodTotalAvailableToClaim (assetId,periodNum) = makeString(["%s%s%s", "periodTotalAvailableToClaim", assetId, toString(periodNum)], SEP) | |
112 | + | ||
113 | + | ||
114 | + | func keyPeriodUserAvailableToClaim (assetId,periodNum,userAddress) = makeString(["%s%s%s%s", "periodUserAvailableToClaim", assetId, toString(periodNum), userAddress], SEP) | |
115 | + | ||
116 | + | ||
117 | + | func keyUsdtPriceAssetStablePool () = makeString(["%s", "usdtPriceAssetStablePool"], SEP) | |
118 | + | ||
119 | + | ||
120 | + | func keyUsdtAssetId () = makeString(["%s", "usdtAssetId"], SEP) | |
83 | 121 | ||
84 | 122 | ||
85 | 123 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
86 | 124 | ||
87 | 125 | ||
88 | 126 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
89 | 127 | ||
90 | 128 | ||
91 | 129 | func readConfigArray () = split(getStringOrFail(keyConfig()), SEP) | |
92 | 130 | ||
93 | 131 | ||
94 | 132 | func readTotalsArrayOrDefaultByCustomKey (customKey) = split(valueOrElse(getString(customKey), formatInvestorS("0", "0", "0", "0", "0")), SEP) | |
95 | 133 | ||
96 | 134 | ||
97 | 135 | func readTotalsArrayOrDefault () = readTotalsArrayOrDefaultByCustomKey(keyTotals()) | |
98 | 136 | ||
99 | 137 | ||
100 | 138 | func readInvestorArrayOrDefault (userAddress) = readTotalsArrayOrDefaultByCustomKey(keyInvestor(userAddress)) | |
101 | 139 | ||
102 | 140 | ||
103 | 141 | func readInvestorArrayOrFail (userAddress) = split(getStringOrFail(keyInvestor(userAddress)), SEP) | |
104 | 142 | ||
105 | 143 | ||
106 | 144 | let IdxDiffTotalIncrement = 0 | |
107 | 145 | ||
108 | 146 | let IdxDiffRemainingPriceAmountIncrement = 1 | |
109 | 147 | ||
110 | 148 | let IdxDiffClaimedPriceAmountIncrement = 2 | |
111 | 149 | ||
112 | 150 | let IdxDiffClaimedIdoAssetAmountIncrement = 3 | |
113 | 151 | ||
114 | 152 | func TotalsEntry (key,origArray,incrementDiff,newLastClaimedHeight) = { | |
115 | 153 | let totalAmount = parseIntValue(origArray[IdxInvTotalAmount]) | |
116 | 154 | let remainingAmount = parseIntValue(origArray[IdxInvRemainingAmount]) | |
117 | 155 | let claimedPriceAssetAmount = parseIntValue(origArray[IdxInvClaimedPriceAssetAmount]) | |
118 | 156 | let claimedIdoAssetAmount = parseIntValue(origArray[IdxInvClaimedIdoAssetAmount]) | |
119 | 157 | let lastClaimedHeight = parseIntValue(origArray[IdxInvLastClaimedHeight]) | |
120 | 158 | let newTotalAmount = (totalAmount + incrementDiff[IdxDiffTotalIncrement]) | |
121 | 159 | let newRemainingAmount = (remainingAmount + incrementDiff[IdxDiffRemainingPriceAmountIncrement]) | |
122 | 160 | let newClaimedPriceAssetAmount = (claimedPriceAssetAmount + incrementDiff[IdxDiffClaimedPriceAmountIncrement]) | |
123 | 161 | let newClaimedIdoAssetAmount = (claimedIdoAssetAmount + incrementDiff[IdxDiffClaimedIdoAssetAmountIncrement]) | |
124 | 162 | if ((0 > newRemainingAmount)) | |
125 | 163 | then throw("invalid math") | |
126 | 164 | else StringEntry(key, formatInvestor(newTotalAmount, newRemainingAmount, newClaimedPriceAssetAmount, newClaimedIdoAssetAmount, newLastClaimedHeight)) | |
127 | 165 | } | |
128 | 166 | ||
129 | 167 | ||
130 | 168 | func InvestOperationHistoryEntry (userAddress,priceAssetAmount,idoAssetAmount,txId) = StringEntry(keyOperationHistoryRecord("invest", userAddress, toBase58String(txId)), formatHistoryRecord(priceAssetAmount, idoAssetAmount)) | |
131 | 169 | ||
132 | 170 | ||
133 | 171 | func ClaimOperationHistoryEntry (userAddress,priceAssetAmount,idoAssetAmount,txId) = StringEntry(keyOperationHistoryRecord("claim", userAddress, toBase58String(txId)), formatHistoryRecord(priceAssetAmount, idoAssetAmount)) | |
134 | 172 | ||
135 | 173 | ||
136 | 174 | func internalClaim (claimedAssetId58,userAddress,txId) = { | |
137 | 175 | let cfgArray = readConfigArray() | |
138 | 176 | let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart]) | |
139 | 177 | let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration]) | |
140 | 178 | let claimEnd = (claimStart + claimDuration) | |
141 | 179 | let price = parseIntValue(cfgArray[IdxCfgPrice]) | |
142 | 180 | let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult]) | |
143 | 181 | let idoAssetId58 = cfgArray[IdxCfgIdoAssetId] | |
144 | 182 | let idoAssetId = fromBase58String(idoAssetId58) | |
145 | 183 | let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult]) | |
146 | 184 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
147 | 185 | let priceAssetId = fromBase58String(priceAssetId58) | |
148 | 186 | let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult]) | |
149 | 187 | let userAddress58 = toString(userAddress) | |
150 | 188 | let origInvestArray = readInvestorArrayOrFail(userAddress58) | |
151 | 189 | let investTotalAmount = parseIntValue(origInvestArray[IdxInvTotalAmount]) | |
152 | 190 | let investLastClaimedHeightTMP = parseIntValue(origInvestArray[IdxInvLastClaimedHeight]) | |
153 | 191 | let investLastClaimedHeight = if ((claimStart >= investLastClaimedHeightTMP)) | |
154 | 192 | then claimStart | |
155 | 193 | else investLastClaimedHeightTMP | |
156 | 194 | let newClaimPeriodHeight = if ((height > claimEnd)) | |
157 | 195 | then claimEnd | |
158 | 196 | else if ((claimStart > height)) | |
159 | 197 | then claimStart | |
160 | 198 | else height | |
161 | 199 | let claimingBlocks = (newClaimPeriodHeight - investLastClaimedHeight) | |
162 | - | let | |
163 | - | let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset( | |
200 | + | let totalUserAvailableToClaim = fraction(investTotalAmount, claimingBlocks, claimDuration) | |
201 | + | let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset(totalUserAvailableToClaim, priceAssetMult, price, priceMult, idoAssetMult) | |
164 | 202 | let isUSDN = (claimedAssetId58 == priceAssetId58) | |
165 | 203 | let isUSDNClaimDisabled = valueOrElse(getBoolean(keyUSDNClaimDisabled()), false) | |
166 | 204 | let isUSDNClaimEnded = match getInteger(keyUSDNClaimEndHeight()) { | |
167 | 205 | case end: Int => | |
168 | 206 | (height > end) | |
169 | 207 | case _: Unit => | |
170 | 208 | false | |
171 | 209 | case _ => | |
172 | 210 | throw("Match error") | |
173 | 211 | } | |
174 | 212 | let checks = [if (!(if (isUSDN) | |
175 | 213 | then isUSDNClaimDisabled | |
176 | 214 | else false)) | |
177 | 215 | then true | |
178 | - | else | |
216 | + | else throwErr("USDN claim is disabled"), if (!(if (isUSDN) | |
179 | 217 | then isUSDNClaimEnded | |
180 | 218 | else false)) | |
181 | 219 | then true | |
182 | - | else | |
220 | + | else throwErr("USDN claim is ended")] | |
183 | 221 | if ((checks == checks)) | |
184 | - | then if ((claimedAssetId58 == priceAssetId58)) | |
185 | - | then $Tuple6([0, -(claimingPriceAssetAmount), claimingPriceAssetAmount, 0], claimingPriceAssetAmount, priceAssetId, origInvestArray, newClaimPeriodHeight, [claimingPriceAssetAmount, claimingIdoAssetAmount]) | |
186 | - | else if ((claimedAssetId58 == idoAssetId58)) | |
187 | - | then $Tuple6([0, -(claimingPriceAssetAmount), 0, claimingIdoAssetAmount], claimingIdoAssetAmount, idoAssetId, origInvestArray, newClaimPeriodHeight, [claimingPriceAssetAmount, claimingIdoAssetAmount]) | |
188 | - | else throw(("unsupported assetId: " + claimedAssetId58)) | |
222 | + | then { | |
223 | + | let totalPeriodPriceAssetAllowance = value(getInteger(keyTotalPeriodAllowance(priceAssetId58))) | |
224 | + | let userPeriodPriceAssetAllowance = value(getInteger(keyUserPeriodAllowance(priceAssetId58))) | |
225 | + | let currentPeriod = valueOrElse(getInteger(keyCurrnetPeriod()), 0) | |
226 | + | let periodTotalAvailableToClaim = valueOrElse(getInteger(keyPeriodTotalAvailableToClaim(priceAssetId58, currentPeriod)), totalPeriodPriceAssetAllowance) | |
227 | + | let periodUserAvailableToClaim = valueOrElse(getInteger(keyPeriodUserAvailableToClaim(priceAssetId58, currentPeriod, userAddress58)), userPeriodPriceAssetAllowance) | |
228 | + | let availableClaimingPriceAssetAmount = min([totalUserAvailableToClaim, periodTotalAvailableToClaim, periodUserAvailableToClaim]) | |
229 | + | let usdtPriceAssetAllowableRatio = value(getInteger(keyUsdtPriceAssetAllowableRatio())) | |
230 | + | let putOneTknV2PriceAssestAmount = scale8 | |
231 | + | let $t01169311945 = { | |
232 | + | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "putOneTknV2WithoutTakeFeeREADONLY", [putOneTknV2PriceAssestAmount, priceAssetId], nil) | |
233 | + | if ($isInstanceOf(@, "(Int, Int, Int)")) | |
234 | + | then @ | |
235 | + | else throw("Couldn't cast Any to (Int, Int, Int)") | |
236 | + | } | |
237 | + | if (($t01169311945 == $t01169311945)) | |
238 | + | then { | |
239 | + | let bonus = $t01169311945._3 | |
240 | + | let feeAmount = $t01169311945._2 | |
241 | + | let lpAmount = $t01169311945._1 | |
242 | + | let usdtAssetId = value(fromBase58String(value(getString(keyUsdtAssetId())))) | |
243 | + | let $t01203412252 = { | |
244 | + | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "getOneTknV2READONLY", [usdtAssetId, lpAmount], nil) | |
245 | + | if ($isInstanceOf(@, "(Int, Int)")) | |
246 | + | then @ | |
247 | + | else throw("Couldn't cast Any to (Int, Int)") | |
248 | + | } | |
249 | + | if (($t01203412252 == $t01203412252)) | |
250 | + | then { | |
251 | + | let getOneTknV2FeeAmount = $t01203412252._2 | |
252 | + | let usdtAmount = $t01203412252._1 | |
253 | + | let currentUsdtPriceAssetRatio = fraction(usdtAmount, putOneTknV2PriceAssestAmount, scale8) | |
254 | + | let endPeriodBlocksLeft = (valueOrElse(getInteger(keyPeriodEndHeight(currentPeriod)), claimEnd) - height) | |
255 | + | if ((claimedAssetId58 == priceAssetId58)) | |
256 | + | then $Tuple6([0, -(availableClaimingPriceAssetAmount), availableClaimingPriceAssetAmount, 0], availableClaimingPriceAssetAmount, priceAssetId, origInvestArray, newClaimPeriodHeight, [totalUserAvailableToClaim, claimingIdoAssetAmount, availableClaimingPriceAssetAmount, periodTotalAvailableToClaim, usdtPriceAssetAllowableRatio, currentUsdtPriceAssetRatio, endPeriodBlocksLeft]) | |
257 | + | else if ((claimedAssetId58 == idoAssetId58)) | |
258 | + | then $Tuple6([0, -(availableClaimingPriceAssetAmount), 0, availableClaimingPriceAssetAmount], claimingIdoAssetAmount, idoAssetId, origInvestArray, newClaimPeriodHeight, [totalUserAvailableToClaim, claimingIdoAssetAmount, availableClaimingPriceAssetAmount, periodTotalAvailableToClaim, currentUsdtPriceAssetRatio, usdtPriceAssetAllowableRatio]) | |
259 | + | else throwErr(makeString(["unsupported assetId:", claimedAssetId58], " ")) | |
260 | + | } | |
261 | + | else throw("Strict value is not equal to itself.") | |
262 | + | } | |
263 | + | else throw("Strict value is not equal to itself.") | |
264 | + | } | |
189 | 265 | else throw("Strict value is not equal to itself.") | |
190 | 266 | } | |
191 | 267 | ||
192 | 268 | ||
193 | 269 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
194 | 270 | case s: String => | |
195 | 271 | fromBase58String(s) | |
196 | 272 | case _: Unit => | |
197 | 273 | unit | |
198 | 274 | case _ => | |
199 | 275 | throw("Match error") | |
200 | 276 | } | |
201 | 277 | ||
202 | 278 | ||
203 | 279 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
204 | 280 | case s: String => | |
205 | 281 | fromBase58String(s) | |
206 | 282 | case _: Unit => | |
207 | 283 | unit | |
208 | 284 | case _ => | |
209 | 285 | throw("Match error") | |
210 | 286 | } | |
211 | 287 | ||
212 | 288 | ||
213 | 289 | func mustManager (i) = { | |
214 | 290 | let pd = throw("Permission denied") | |
215 | 291 | match managerPublicKeyOrUnit() { | |
216 | 292 | case pk: ByteVector => | |
217 | 293 | if ((i.callerPublicKey == pk)) | |
218 | 294 | then true | |
219 | 295 | else pd | |
220 | 296 | case _: Unit => | |
221 | 297 | if ((i.caller == this)) | |
222 | 298 | then true | |
223 | 299 | else pd | |
224 | 300 | case _ => | |
225 | 301 | throw("Match error") | |
226 | 302 | } | |
227 | 303 | } | |
228 | 304 | ||
229 | 305 | ||
230 | 306 | @Callable(i) | |
231 | 307 | func constructor (idoStart,idoDuration,claimStart,claimDuration,price,priceAssetId58,minInvestAmount) = { | |
232 | 308 | let priceMult = ((100 * 1000) * 1000) | |
233 | 309 | let idoEnd = (idoStart + idoDuration) | |
234 | 310 | if (isDefined(getString(keyConfig()))) | |
235 | 311 | then throw("already initialized") | |
236 | 312 | else if (("3PMEHLx1j6zerarZTYfsGqDeeZqQoMpxq5S" != toString(i.caller))) | |
237 | 313 | then throw("not authorized") | |
238 | 314 | else if ((size(i.payments) != 1)) | |
239 | 315 | then throw("exactly 1 payment must be attached") | |
240 | 316 | else if ((idoEnd >= claimStart)) | |
241 | 317 | then throw("claimStart must be greater than idoEnd") | |
242 | 318 | else { | |
243 | 319 | let pmt = value(i.payments[0]) | |
244 | 320 | let idoAssetId = value(pmt.assetId) | |
245 | 321 | let idoAssetInfo = valueOrErrorMessage(assetInfo(idoAssetId), "fail to load ido asset info") | |
246 | 322 | let idoAssetId58 = toBase58String(idoAssetId) | |
247 | 323 | let idoAssetMult = pow(10, 0, idoAssetInfo.decimals, 0, 0, DOWN) | |
248 | 324 | let priceAssetId = fromBase58String(priceAssetId58) | |
249 | 325 | let priceAssetInfo = valueOrErrorMessage(assetInfo(priceAssetId), "fail to load price asset info") | |
250 | 326 | let priceAssetMult = pow(10, 0, priceAssetInfo.decimals, 0, 0, DOWN) | |
251 | 327 | let origTotalsArray = readTotalsArrayOrDefault() | |
252 | 328 | let totalsDiff = [0, 0, 0, 0] | |
253 | 329 | [StringEntry(keyConfig(), fromatConfig(idoStart, idoDuration, claimStart, claimDuration, price, priceMult, idoAssetId58, idoAssetMult, priceAssetId58, priceAssetMult, minInvestAmount, pmt.amount)), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart)] | |
254 | 330 | } | |
255 | 331 | } | |
256 | 332 | ||
257 | 333 | ||
258 | 334 | ||
259 | 335 | @Callable(i) | |
260 | 336 | func invest () = { | |
261 | 337 | let cfgArray = readConfigArray() | |
262 | 338 | let idoStart = parseIntValue(cfgArray[IdxCfgIdoStart]) | |
263 | 339 | let idoDuration = parseIntValue(cfgArray[IdxCfgIdoDuration]) | |
264 | 340 | let idoEnd = (idoStart + idoDuration) | |
265 | 341 | let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart]) | |
266 | 342 | let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration]) | |
267 | 343 | let price = parseIntValue(cfgArray[IdxCfgPrice]) | |
268 | 344 | let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult]) | |
269 | 345 | let idoAssetId58 = cfgArray[IdxCfgIdoAssetId] | |
270 | 346 | let idoAssetId = fromBase58String(idoAssetId58) | |
271 | 347 | let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult]) | |
272 | 348 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
273 | 349 | let priceAssetId = fromBase58String(priceAssetId58) | |
274 | 350 | let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult]) | |
275 | 351 | let minIvestAmount = parseIntValue(cfgArray[IdxCfgMinInvestAmount]) | |
276 | 352 | let userAddress = toString(i.caller) | |
277 | 353 | if ((idoStart > height)) | |
278 | 354 | then throw("ido has not been started yet") | |
279 | 355 | else if ((height > idoEnd)) | |
280 | 356 | then throw("ido has been already ended") | |
281 | 357 | else if ((size(i.payments) != 1)) | |
282 | 358 | then throw("exactly 1 payment is expected") | |
283 | 359 | else { | |
284 | 360 | let pmt = value(i.payments[0]) | |
285 | 361 | let pmtAssetId = value(pmt.assetId) | |
286 | 362 | let pmtAmount = pmt.amount | |
287 | 363 | if ((pmtAssetId != priceAssetId)) | |
288 | 364 | then throw((("invalid payment asset id: " + toBase58String(pmtAssetId)) + " is expected")) | |
289 | 365 | else { | |
290 | 366 | let origInvestorArray = readInvestorArrayOrDefault(userAddress) | |
291 | 367 | let origTotalsArray = readTotalsArrayOrDefault() | |
292 | 368 | let newPriceTotalAmount = (parseIntValue(origTotalsArray[IdxInvTotalAmount]) + pmtAmount) | |
293 | 369 | let requiredIdoAssetAmount = (newPriceTotalAmount * 100) | |
294 | 370 | if ((requiredIdoAssetAmount > assetBalance(this, idoAssetId))) | |
295 | 371 | then throw("IDO asset has been - sold consider to use smaller payment") | |
296 | 372 | else { | |
297 | 373 | let totalsDiff = [pmtAmount, pmtAmount, 0, 0] | |
298 | 374 | [TotalsEntry(keyInvestor(userAddress), origInvestorArray, totalsDiff, claimStart), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart), InvestOperationHistoryEntry(userAddress, pmtAmount, 0, i.transactionId)] | |
299 | 375 | } | |
300 | 376 | } | |
301 | 377 | } | |
302 | 378 | } | |
303 | 379 | ||
304 | 380 | ||
305 | 381 | ||
306 | 382 | @Callable(i) | |
307 | 383 | func claim (claimedAssetId58,userAddress58) = { | |
308 | 384 | let callerAddress58 = toString(i.caller) | |
309 | 385 | if ((userAddress58 != callerAddress58)) | |
310 | - | then | |
386 | + | then throwErr("not authorized") | |
311 | 387 | else { | |
312 | 388 | let claimResultTuple = internalClaim(claimedAssetId58, i.caller, i.transactionId) | |
313 | 389 | let totalsDiff = claimResultTuple._1 | |
314 | 390 | let outAmount = claimResultTuple._2 | |
315 | 391 | let outAssetId = claimResultTuple._3 | |
316 | 392 | let origInvestArray = claimResultTuple._4 | |
317 | 393 | let newClaimPeriodHeight = claimResultTuple._5 | |
318 | - | let claimedPriceAmountFromDiff = totalsDiff[IdxDiffClaimedPriceAmountIncrement] | |
319 | - | let claimedIdoAssetAmountFromDiff = totalsDiff[IdxDiffClaimedIdoAssetAmountIncrement] | |
320 | - | $Tuple2([ScriptTransfer(i.caller, outAmount, outAssetId), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight), ClaimOperationHistoryEntry(userAddress58, claimedPriceAmountFromDiff, claimedIdoAssetAmountFromDiff, i.transactionId)], unit) | |
394 | + | let availableToClaimArray = claimResultTuple._6 | |
395 | + | let totalUserAvailableToClaim = availableToClaimArray[0] | |
396 | + | let periodAvailableIdoAmountToClaim = availableToClaimArray[1] | |
397 | + | let periodAvailableUserPriceAmountToClaim = availableToClaimArray[2] | |
398 | + | let periodAvailableTotalPriceAmountToClaim = availableToClaimArray[3] | |
399 | + | let checks = [if (if ((totalUserAvailableToClaim > 0)) | |
400 | + | then true | |
401 | + | else (periodAvailableIdoAmountToClaim > 0)) | |
402 | + | then true | |
403 | + | else throwErr("nothing to claim"), if ((periodAvailableUserPriceAmountToClaim > 0)) | |
404 | + | then true | |
405 | + | else throwErr("unavailable to claim because user period allowance reached"), if ((periodAvailableTotalPriceAmountToClaim > 0)) | |
406 | + | then true | |
407 | + | else throwErr("unavailable to claim because total period allowance reached")] | |
408 | + | if ((checks == checks)) | |
409 | + | then { | |
410 | + | let claimedPriceAmountFromDiff = totalsDiff[IdxDiffClaimedPriceAmountIncrement] | |
411 | + | let claimedIdoAssetAmountFromDiff = totalsDiff[IdxDiffClaimedIdoAssetAmountIncrement] | |
412 | + | $Tuple2([ScriptTransfer(i.caller, outAmount, outAssetId), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight), ClaimOperationHistoryEntry(userAddress58, claimedPriceAmountFromDiff, claimedIdoAssetAmountFromDiff, i.transactionId)], unit) | |
413 | + | } | |
414 | + | else throw("Strict value is not equal to itself.") | |
321 | 415 | } | |
322 | 416 | } | |
323 | 417 | ||
324 | 418 | ||
325 | 419 | ||
326 | 420 | @Callable(i) | |
327 | 421 | func claimREADONLY (claimedAssetId58,userAddress58) = { | |
328 | 422 | let claimResultTuple = internalClaim(claimedAssetId58, addressFromStringValue(userAddress58), fromBase58String("")) | |
329 | 423 | let totalsDiff = claimResultTuple._1 | |
330 | 424 | let outAmount = claimResultTuple._2 | |
331 | 425 | let outAssetId = claimResultTuple._3 | |
332 | 426 | let origInvestArray = claimResultTuple._4 | |
333 | 427 | let newClaimPeriodHeight = claimResultTuple._5 | |
334 | 428 | let availableToClaimArray = claimResultTuple._6 | |
335 | - | let availablePriceAmountToClaim = availableToClaimArray[ | |
336 | - | let availableIdoAmountToClaim = availableToClaimArray[ | |
429 | + | let availablePriceAmountToClaim = availableToClaimArray[1] | |
430 | + | let availableIdoAmountToClaim = availableToClaimArray[2] | |
337 | 431 | $Tuple2(nil, makeString(["%s%d%d", userAddress58, toString(availablePriceAmountToClaim), toString(availableIdoAmountToClaim)], SEP)) | |
432 | + | } | |
433 | + | ||
434 | + | ||
435 | + | ||
436 | + | @Callable(i) | |
437 | + | func claimV2READONLY (claimedAssetId58,userAddress58) = { | |
438 | + | let claimResultTuple = internalClaim(claimedAssetId58, addressFromStringValue(userAddress58), fromBase58String("")) | |
439 | + | let totalsDiff = claimResultTuple._1 | |
440 | + | let outAmount = claimResultTuple._2 | |
441 | + | let outAssetId = claimResultTuple._3 | |
442 | + | let origInvestArray = claimResultTuple._4 | |
443 | + | let newClaimPeriodHeight = claimResultTuple._5 | |
444 | + | let availableToClaimArray = claimResultTuple._6 | |
445 | + | let totalUserAvailableToClaim = availableToClaimArray[0] | |
446 | + | let periodAvailableIdoAmountToClaim = availableToClaimArray[1] | |
447 | + | let periodAvailableUserPriceAmountToClaim = availableToClaimArray[2] | |
448 | + | let periodAvailableTotalPriceAmountToClaim = availableToClaimArray[3] | |
449 | + | let usdtPriceAssetAllowableRatio = availableToClaimArray[4] | |
450 | + | let currentPriceAssetRatio = availableToClaimArray[5] | |
451 | + | let endPriodBlocksLeft = availableToClaimArray[6] | |
452 | + | let resultString = makeString(["%d%d%d%d%d%d%d", toString(totalUserAvailableToClaim), toString(periodAvailableIdoAmountToClaim), toString(periodAvailableUserPriceAmountToClaim), toString(periodAvailableTotalPriceAmountToClaim), toString(usdtPriceAssetAllowableRatio), toString(currentPriceAssetRatio), toString(endPriodBlocksLeft)], SEP) | |
453 | + | $Tuple2(nil, resultString) | |
338 | 454 | } | |
339 | 455 | ||
340 | 456 | ||
341 | 457 | ||
342 | 458 | @Callable(i) | |
343 | 459 | func setManager (pendingManagerPublicKey) = { | |
344 | 460 | let checkCaller = mustManager(i) | |
345 | 461 | if ((checkCaller == checkCaller)) | |
346 | 462 | then { | |
347 | 463 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
348 | 464 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
349 | 465 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
350 | 466 | else throw("Strict value is not equal to itself.") | |
351 | 467 | } | |
352 | 468 | else throw("Strict value is not equal to itself.") | |
353 | 469 | } | |
354 | 470 | ||
355 | 471 | ||
356 | 472 | ||
357 | 473 | @Callable(i) | |
358 | 474 | func confirmManager () = { | |
359 | 475 | let pm = pendingManagerPublicKeyOrUnit() | |
360 | 476 | let hasPM = if (isDefined(pm)) | |
361 | 477 | then true | |
362 | 478 | else throw("No pending manager") | |
363 | 479 | if ((hasPM == hasPM)) | |
364 | 480 | then { | |
365 | 481 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
366 | 482 | then true | |
367 | 483 | else throw("You are not pending manager") | |
368 | 484 | if ((checkPM == checkPM)) | |
369 | 485 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
370 | 486 | else throw("Strict value is not equal to itself.") | |
371 | 487 | } | |
372 | 488 | else throw("Strict value is not equal to itself.") | |
373 | 489 | } | |
374 | 490 | ||
375 | 491 | ||
376 | 492 | @Verifier(tx) | |
377 | 493 | func verify () = { | |
378 | 494 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
379 | 495 | case pk: ByteVector => | |
380 | 496 | pk | |
381 | 497 | case _: Unit => | |
382 | 498 | tx.senderPublicKey | |
383 | 499 | case _ => | |
384 | 500 | throw("Match error") | |
385 | 501 | } | |
386 | 502 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
387 | 503 | } | |
388 | 504 |
github/deemru/w8io/026f985 66.60 ms ◑