tx · 323EnozLCPpZvFjr36yYGRNmqhJFwZPD8TsDfZ3ZZnsd 3MvZpvvbmovEt3pvdDZKvhKRjjQxdbUD6Tv: -0.02400000 Waves 2022.11.02 16:24 [2299547] smart account 3MvZpvvbmovEt3pvdDZKvhKRjjQxdbUD6Tv > SELF 0.00000000 Waves
{ "type": 13, "id": "323EnozLCPpZvFjr36yYGRNmqhJFwZPD8TsDfZ3ZZnsd", "fee": 2400000, "feeAssetId": null, "timestamp": 1667395536630, "version": 1, "sender": "3MvZpvvbmovEt3pvdDZKvhKRjjQxdbUD6Tv", "senderPublicKey": "39YkRD2qWXTcdNBr4CbDnm8g8SAB2FKVaDeGYahcFHHx", "proofs": [ "fp6crBNUuagA4dXphMqLUEBkpD4BjrykRK9Du8rGBWs948kMRpwCRdM7GdEHVT7e5KR8ArKPgFzyhBEe5WQYjn1" ], "script": "base64:AAIFAAAAAAAADasIAhIJCgcBAQEBAQgBEgASBAoCCAgSBAoCCAgSBAoCCAgSAwoBCBIAIg9nZXRTdHJpbmdPckZhaWwiA2tleSIDU0VQIghCVUZTQ0FMRSIGc2NhbGU4Igh0aHJvd0VyciIDbXNnIh1jb252ZXJ0UHJpY2VBc3NldEludG9JZG9Bc3NldCIQcHJpY2VBc3NldEFtb3VudCIOcHJpY2VBc3NldE1VTFQiBXByaWNlIglwcmljZU1VTFQiDGlkb0Fzc2V0TVVMVCIPYlByaWNlQXNzZXRNVUxUIg1iSWRvQXNzZXRNVUxUIg5iUHJpY2VBc3NldEJVRiIPYkFtb3VudEFzc2V0QlVGIg5JZHhDZmdJZG9TdGFydCIRSWR4Q2ZnSWRvRHVyYXRpb24iEElkeENmZ0NsYWltU3RhcnQiE0lkeENmZ0NsYWltRHVyYXRpb24iC0lkeENmZ1ByaWNlIg9JZHhDZmdQcmljZU11bHQiEElkeENmZ0lkb0Fzc2V0SWQiEklkeENmZ0lkb0Fzc2V0TXVsdCISSWR4Q2ZnUHJpY2VBc3NldElkIhRJZHhDZmdQcmljZUF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TAQAAAA5jb25maXJtTWFuYWdlcgAAAAAEAAAAAmNCCQEAAAACYlEAAAAABAAAAAJjQwMJAQAAAAlpc0RlZmluZWQAAAABBQAAAAJjQgYJAAACAAAAAQIAAAASTm8gcGVuZGluZyBtYW5hZ2VyAwkAAAAAAAACBQAAAAJjQwUAAAACY0MEAAAAAmNEAwkAAAAAAAACCAUAAAACYlMAAAAPY2FsbGVyUHVibGljS2V5CQEAAAAFdmFsdWUAAAABBQAAAAJjQgYJAAACAAAAAQIAAAAbWW91IGFyZSBub3QgcGVuZGluZyBtYW5hZ2VyAwkAAAAAAAACBQAAAAJjRAUAAAACY0QJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAAAmF6AAAAAAkAAlgAAAABCQEAAAAFdmFsdWUAAAABBQAAAAJjQgkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAACYUEAAAAABQAAAANuaWwJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAACY0UBAAAAAmNGAAAAAAQAAAACY0cEAAAAAmJvCQEAAAACYk8AAAAAAwkAAAEAAAACBQAAAAJibwIAAAAKQnl0ZVZlY3RvcgQAAAACYlUFAAAAAmJvBQAAAAJiVQMJAAABAAAAAgUAAAACYm8CAAAABFVuaXQIBQAAAAJjRQAAAA9zZW5kZXJQdWJsaWNLZXkJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IJAAH0AAAAAwgFAAAAAmNFAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACY0UAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAAJjR81CuNU=", "chainId": 84, "height": 2299547, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3ZQ1FzYhuRtanVvCLvTZDi35rzHSoJHjvUjeH9Ruzexd Next: 2KFoyBoEN1QSqmexi7Z4j6PbkReDnfCcEBApjJYiFoHF 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 keyCurrentPeriod () = 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 periodLength = value(getInteger(keyPeriodLength())) | |
226 | + | let currentPeriod = valueOrElse(getInteger(keyCurrentPeriod()), 0) | |
227 | + | let $t01110111522 = if ((currentPeriod > 0)) | |
228 | + | then $Tuple2(value(getInteger(keyPeriodStartHeight((currentPeriod - 1)))), valueOrElse(getInteger(keyPeriodEndHeight((currentPeriod - 1))), (height + periodLength))) | |
229 | + | else $Tuple2(valueOrElse(getInteger(keyPeriodStartHeight(currentPeriod)), height), valueOrElse(getInteger(keyPeriodEndHeight(currentPeriod)), (height + periodLength))) | |
230 | + | let periodStart = $t01110111522._1 | |
231 | + | let periodEnd = $t01110111522._2 | |
232 | + | let periodTotalAvailableToClaim = valueOrElse(getInteger(keyPeriodTotalAvailableToClaim(priceAssetId58, currentPeriod)), totalPeriodPriceAssetAllowance) | |
233 | + | let periodUserAvailableToClaim = valueOrElse(getInteger(keyPeriodUserAvailableToClaim(priceAssetId58, currentPeriod, userAddress58)), userPeriodPriceAssetAllowance) | |
234 | + | let availableClaimingPriceAssetAmount = min([totalUserAvailableToClaim, periodTotalAvailableToClaim, periodUserAvailableToClaim]) | |
235 | + | let usdtPriceAssetAllowableRatio = value(getInteger(keyUsdtPriceAssetAllowableRatio())) | |
236 | + | let putOneTknV2PriceAssetAmount = scale8 | |
237 | + | let $t01217612427 = { | |
238 | + | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "putOneTknV2WithoutTakeFeeREADONLY", [putOneTknV2PriceAssetAmount, priceAssetId], nil) | |
239 | + | if ($isInstanceOf(@, "(Int, Int, Int)")) | |
240 | + | then @ | |
241 | + | else throw("Couldn't cast Any to (Int, Int, Int)") | |
242 | + | } | |
243 | + | if (($t01217612427 == $t01217612427)) | |
244 | + | then { | |
245 | + | let bonus = $t01217612427._3 | |
246 | + | let feeAmount = $t01217612427._2 | |
247 | + | let lpAmount = $t01217612427._1 | |
248 | + | let usdtAssetId = value(fromBase58String(value(getString(keyUsdtAssetId())))) | |
249 | + | let $t01251612734 = { | |
250 | + | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "getOneTknV2READONLY", [usdtAssetId, lpAmount], nil) | |
251 | + | if ($isInstanceOf(@, "(Int, Int)")) | |
252 | + | then @ | |
253 | + | else throw("Couldn't cast Any to (Int, Int)") | |
254 | + | } | |
255 | + | if (($t01251612734 == $t01251612734)) | |
256 | + | then { | |
257 | + | let getOneTknV2FeeAmount = $t01251612734._2 | |
258 | + | let usdtAmount = $t01251612734._1 | |
259 | + | let currentUsdtPriceAssetRatio = fraction(usdtAmount, putOneTknV2PriceAssetAmount, scale8) | |
260 | + | let endPeriodBlocksLeft = (periodEnd - height) | |
261 | + | if ((claimedAssetId58 == priceAssetId58)) | |
262 | + | then $Tuple6([0, -(availableClaimingPriceAssetAmount), availableClaimingPriceAssetAmount, 0], availableClaimingPriceAssetAmount, priceAssetId, origInvestArray, newClaimPeriodHeight, [currentPeriod, periodStart, periodEnd, totalUserAvailableToClaim, claimingIdoAssetAmount, availableClaimingPriceAssetAmount, periodTotalAvailableToClaim, usdtPriceAssetAllowableRatio, currentUsdtPriceAssetRatio, endPeriodBlocksLeft]) | |
263 | + | else if ((claimedAssetId58 == idoAssetId58)) | |
264 | + | then $Tuple6([0, -(availableClaimingPriceAssetAmount), 0, availableClaimingPriceAssetAmount], claimingIdoAssetAmount, idoAssetId, origInvestArray, newClaimPeriodHeight, [currentPeriod, periodStart, periodEnd, totalUserAvailableToClaim, claimingIdoAssetAmount, availableClaimingPriceAssetAmount, periodTotalAvailableToClaim, usdtPriceAssetAllowableRatio, currentUsdtPriceAssetRatio, endPeriodBlocksLeft]) | |
265 | + | else throwErr(makeString(["unsupported assetId:", claimedAssetId58], " ")) | |
266 | + | } | |
267 | + | else throw("Strict value is not equal to itself.") | |
268 | + | } | |
269 | + | else throw("Strict value is not equal to itself.") | |
270 | + | } | |
189 | 271 | else throw("Strict value is not equal to itself.") | |
190 | 272 | } | |
191 | 273 | ||
233 | 315 | let idoEnd = (idoStart + idoDuration) | |
234 | 316 | if (isDefined(getString(keyConfig()))) | |
235 | 317 | then throw("already initialized") | |
236 | - | else if ((" | |
318 | + | else if (("3PMEHLx1j6zerarZTYfsGqDeeZqQoMpxq5S" != toString(i.caller))) | |
237 | 319 | then throw("not authorized") | |
238 | 320 | else if ((size(i.payments) != 1)) | |
239 | 321 | then throw("exactly 1 payment must be attached") | |
307 | 389 | func claim (claimedAssetId58,userAddress58) = { | |
308 | 390 | let callerAddress58 = toString(i.caller) | |
309 | 391 | if ((userAddress58 != callerAddress58)) | |
310 | - | then | |
392 | + | then throwErr("not authorized") | |
311 | 393 | else { | |
394 | + | let priceAssetId = readConfigArray()[IdxCfgPriceAssetId] | |
312 | 395 | let claimResultTuple = internalClaim(claimedAssetId58, i.caller, i.transactionId) | |
313 | 396 | let totalsDiff = claimResultTuple._1 | |
314 | 397 | let outAmount = claimResultTuple._2 | |
315 | 398 | let outAssetId = claimResultTuple._3 | |
316 | 399 | let origInvestArray = claimResultTuple._4 | |
317 | 400 | 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) | |
401 | + | let availableToClaimArray = claimResultTuple._6 | |
402 | + | let currentPeriod = availableToClaimArray[0] | |
403 | + | let periodStart = availableToClaimArray[1] | |
404 | + | let periodEnd = availableToClaimArray[2] | |
405 | + | let totalUserAvailableToClaim = availableToClaimArray[3] | |
406 | + | let periodAvailableIdoAmountToClaim = availableToClaimArray[4] | |
407 | + | let periodAvailableUserPriceAmountToClaim = availableToClaimArray[5] | |
408 | + | let periodAvailableTotalPriceAmountToClaim = availableToClaimArray[6] | |
409 | + | let usdtPriceAssetAllowableRatio = availableToClaimArray[7] | |
410 | + | let currentPriceAssetRatio = availableToClaimArray[8] | |
411 | + | let endPriodBlocksLeft = availableToClaimArray[9] | |
412 | + | let checks = [if (if ((totalUserAvailableToClaim > 0)) | |
413 | + | then true | |
414 | + | else (periodAvailableIdoAmountToClaim > 0)) | |
415 | + | then true | |
416 | + | else throwErr("nothing to claim"), if ((periodAvailableUserPriceAmountToClaim > 0)) | |
417 | + | then true | |
418 | + | else throwErr("unavailable to claim because user period allowance reached"), if ((periodAvailableTotalPriceAmountToClaim > 0)) | |
419 | + | then true | |
420 | + | else throwErr("unavailable to claim because total period allowance reached")] | |
421 | + | if ((checks == checks)) | |
422 | + | then { | |
423 | + | let claimedPriceAmountFromDiff = totalsDiff[IdxDiffClaimedPriceAmountIncrement] | |
424 | + | let claimedIdoAssetAmountFromDiff = totalsDiff[IdxDiffClaimedIdoAssetAmountIncrement] | |
425 | + | let updatedPeriodTotalAvailableToClaim = (periodAvailableTotalPriceAmountToClaim - claimedPriceAmountFromDiff) | |
426 | + | let updatedPeriodUserAvailableToClaim = (periodAvailableUserPriceAmountToClaim - claimedPriceAmountFromDiff) | |
427 | + | $Tuple2([ScriptTransfer(i.caller, outAmount, outAssetId), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight), IntegerEntry(keyCurrentPeriod(), currentPeriod), IntegerEntry(keyPeriodStartHeight(currentPeriod), periodStart), IntegerEntry(keyPeriodEndHeight(currentPeriod), periodEnd), IntegerEntry(keyPeriodTotalAvailableToClaim(priceAssetId, currentPeriod), updatedPeriodTotalAvailableToClaim), IntegerEntry(keyPeriodUserAvailableToClaim(priceAssetId, currentPeriod, userAddress58), updatedPeriodUserAvailableToClaim), ClaimOperationHistoryEntry(userAddress58, claimedPriceAmountFromDiff, claimedIdoAssetAmountFromDiff, i.transactionId)], unit) | |
428 | + | } | |
429 | + | else throw("Strict value is not equal to itself.") | |
321 | 430 | } | |
322 | 431 | } | |
323 | 432 | ||
332 | 441 | let origInvestArray = claimResultTuple._4 | |
333 | 442 | let newClaimPeriodHeight = claimResultTuple._5 | |
334 | 443 | let availableToClaimArray = claimResultTuple._6 | |
335 | - | let | |
336 | - | let | |
444 | + | let availableIdoAmountToClaim = availableToClaimArray[4] | |
445 | + | let availablePriceAmountToClaim = availableToClaimArray[5] | |
337 | 446 | $Tuple2(nil, makeString(["%s%d%d", userAddress58, toString(availablePriceAmountToClaim), toString(availableIdoAmountToClaim)], SEP)) | |
447 | + | } | |
448 | + | ||
449 | + | ||
450 | + | ||
451 | + | @Callable(i) | |
452 | + | func claimV2READONLY (claimedAssetId58,userAddress58) = { | |
453 | + | let claimResultTuple = internalClaim(claimedAssetId58, addressFromStringValue(userAddress58), fromBase58String("")) | |
454 | + | let totalsDiff = claimResultTuple._1 | |
455 | + | let outAmount = claimResultTuple._2 | |
456 | + | let outAssetId = claimResultTuple._3 | |
457 | + | let origInvestArray = claimResultTuple._4 | |
458 | + | let newClaimPeriodHeight = claimResultTuple._5 | |
459 | + | let availableToClaimArray = claimResultTuple._6 | |
460 | + | let currentPeriod = availableToClaimArray[0] | |
461 | + | let periodStart = availableToClaimArray[1] | |
462 | + | let periodEnd = availableToClaimArray[2] | |
463 | + | let totalUserAvailableToClaim = availableToClaimArray[3] | |
464 | + | let periodAvailableIdoAmountToClaim = availableToClaimArray[4] | |
465 | + | let periodAvailableUserPriceAmountToClaim = availableToClaimArray[5] | |
466 | + | let periodAvailableTotalPriceAmountToClaim = availableToClaimArray[6] | |
467 | + | let usdtPriceAssetAllowableRatio = availableToClaimArray[7] | |
468 | + | let currentPriceAssetRatio = availableToClaimArray[8] | |
469 | + | let endPriodBlocksLeft = availableToClaimArray[9] | |
470 | + | 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) | |
471 | + | $Tuple2(nil, resultString) | |
338 | 472 | } | |
339 | 473 | ||
340 | 474 |
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 keyCurrentPeriod () = 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 periodLength = value(getInteger(keyPeriodLength())) | |
226 | + | let currentPeriod = valueOrElse(getInteger(keyCurrentPeriod()), 0) | |
227 | + | let $t01110111522 = if ((currentPeriod > 0)) | |
228 | + | then $Tuple2(value(getInteger(keyPeriodStartHeight((currentPeriod - 1)))), valueOrElse(getInteger(keyPeriodEndHeight((currentPeriod - 1))), (height + periodLength))) | |
229 | + | else $Tuple2(valueOrElse(getInteger(keyPeriodStartHeight(currentPeriod)), height), valueOrElse(getInteger(keyPeriodEndHeight(currentPeriod)), (height + periodLength))) | |
230 | + | let periodStart = $t01110111522._1 | |
231 | + | let periodEnd = $t01110111522._2 | |
232 | + | let periodTotalAvailableToClaim = valueOrElse(getInteger(keyPeriodTotalAvailableToClaim(priceAssetId58, currentPeriod)), totalPeriodPriceAssetAllowance) | |
233 | + | let periodUserAvailableToClaim = valueOrElse(getInteger(keyPeriodUserAvailableToClaim(priceAssetId58, currentPeriod, userAddress58)), userPeriodPriceAssetAllowance) | |
234 | + | let availableClaimingPriceAssetAmount = min([totalUserAvailableToClaim, periodTotalAvailableToClaim, periodUserAvailableToClaim]) | |
235 | + | let usdtPriceAssetAllowableRatio = value(getInteger(keyUsdtPriceAssetAllowableRatio())) | |
236 | + | let putOneTknV2PriceAssetAmount = scale8 | |
237 | + | let $t01217612427 = { | |
238 | + | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "putOneTknV2WithoutTakeFeeREADONLY", [putOneTknV2PriceAssetAmount, priceAssetId], nil) | |
239 | + | if ($isInstanceOf(@, "(Int, Int, Int)")) | |
240 | + | then @ | |
241 | + | else throw("Couldn't cast Any to (Int, Int, Int)") | |
242 | + | } | |
243 | + | if (($t01217612427 == $t01217612427)) | |
244 | + | then { | |
245 | + | let bonus = $t01217612427._3 | |
246 | + | let feeAmount = $t01217612427._2 | |
247 | + | let lpAmount = $t01217612427._1 | |
248 | + | let usdtAssetId = value(fromBase58String(value(getString(keyUsdtAssetId())))) | |
249 | + | let $t01251612734 = { | |
250 | + | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "getOneTknV2READONLY", [usdtAssetId, lpAmount], nil) | |
251 | + | if ($isInstanceOf(@, "(Int, Int)")) | |
252 | + | then @ | |
253 | + | else throw("Couldn't cast Any to (Int, Int)") | |
254 | + | } | |
255 | + | if (($t01251612734 == $t01251612734)) | |
256 | + | then { | |
257 | + | let getOneTknV2FeeAmount = $t01251612734._2 | |
258 | + | let usdtAmount = $t01251612734._1 | |
259 | + | let currentUsdtPriceAssetRatio = fraction(usdtAmount, putOneTknV2PriceAssetAmount, scale8) | |
260 | + | let endPeriodBlocksLeft = (periodEnd - height) | |
261 | + | if ((claimedAssetId58 == priceAssetId58)) | |
262 | + | then $Tuple6([0, -(availableClaimingPriceAssetAmount), availableClaimingPriceAssetAmount, 0], availableClaimingPriceAssetAmount, priceAssetId, origInvestArray, newClaimPeriodHeight, [currentPeriod, periodStart, periodEnd, totalUserAvailableToClaim, claimingIdoAssetAmount, availableClaimingPriceAssetAmount, periodTotalAvailableToClaim, usdtPriceAssetAllowableRatio, currentUsdtPriceAssetRatio, endPeriodBlocksLeft]) | |
263 | + | else if ((claimedAssetId58 == idoAssetId58)) | |
264 | + | then $Tuple6([0, -(availableClaimingPriceAssetAmount), 0, availableClaimingPriceAssetAmount], claimingIdoAssetAmount, idoAssetId, origInvestArray, newClaimPeriodHeight, [currentPeriod, periodStart, periodEnd, totalUserAvailableToClaim, claimingIdoAssetAmount, availableClaimingPriceAssetAmount, periodTotalAvailableToClaim, usdtPriceAssetAllowableRatio, currentUsdtPriceAssetRatio, endPeriodBlocksLeft]) | |
265 | + | else throwErr(makeString(["unsupported assetId:", claimedAssetId58], " ")) | |
266 | + | } | |
267 | + | else throw("Strict value is not equal to itself.") | |
268 | + | } | |
269 | + | else throw("Strict value is not equal to itself.") | |
270 | + | } | |
189 | 271 | else throw("Strict value is not equal to itself.") | |
190 | 272 | } | |
191 | 273 | ||
192 | 274 | ||
193 | 275 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
194 | 276 | case s: String => | |
195 | 277 | fromBase58String(s) | |
196 | 278 | case _: Unit => | |
197 | 279 | unit | |
198 | 280 | case _ => | |
199 | 281 | throw("Match error") | |
200 | 282 | } | |
201 | 283 | ||
202 | 284 | ||
203 | 285 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
204 | 286 | case s: String => | |
205 | 287 | fromBase58String(s) | |
206 | 288 | case _: Unit => | |
207 | 289 | unit | |
208 | 290 | case _ => | |
209 | 291 | throw("Match error") | |
210 | 292 | } | |
211 | 293 | ||
212 | 294 | ||
213 | 295 | func mustManager (i) = { | |
214 | 296 | let pd = throw("Permission denied") | |
215 | 297 | match managerPublicKeyOrUnit() { | |
216 | 298 | case pk: ByteVector => | |
217 | 299 | if ((i.callerPublicKey == pk)) | |
218 | 300 | then true | |
219 | 301 | else pd | |
220 | 302 | case _: Unit => | |
221 | 303 | if ((i.caller == this)) | |
222 | 304 | then true | |
223 | 305 | else pd | |
224 | 306 | case _ => | |
225 | 307 | throw("Match error") | |
226 | 308 | } | |
227 | 309 | } | |
228 | 310 | ||
229 | 311 | ||
230 | 312 | @Callable(i) | |
231 | 313 | func constructor (idoStart,idoDuration,claimStart,claimDuration,price,priceAssetId58,minInvestAmount) = { | |
232 | 314 | let priceMult = ((100 * 1000) * 1000) | |
233 | 315 | let idoEnd = (idoStart + idoDuration) | |
234 | 316 | if (isDefined(getString(keyConfig()))) | |
235 | 317 | then throw("already initialized") | |
236 | - | else if ((" | |
318 | + | else if (("3PMEHLx1j6zerarZTYfsGqDeeZqQoMpxq5S" != toString(i.caller))) | |
237 | 319 | then throw("not authorized") | |
238 | 320 | else if ((size(i.payments) != 1)) | |
239 | 321 | then throw("exactly 1 payment must be attached") | |
240 | 322 | else if ((idoEnd >= claimStart)) | |
241 | 323 | then throw("claimStart must be greater than idoEnd") | |
242 | 324 | else { | |
243 | 325 | let pmt = value(i.payments[0]) | |
244 | 326 | let idoAssetId = value(pmt.assetId) | |
245 | 327 | let idoAssetInfo = valueOrErrorMessage(assetInfo(idoAssetId), "fail to load ido asset info") | |
246 | 328 | let idoAssetId58 = toBase58String(idoAssetId) | |
247 | 329 | let idoAssetMult = pow(10, 0, idoAssetInfo.decimals, 0, 0, DOWN) | |
248 | 330 | let priceAssetId = fromBase58String(priceAssetId58) | |
249 | 331 | let priceAssetInfo = valueOrErrorMessage(assetInfo(priceAssetId), "fail to load price asset info") | |
250 | 332 | let priceAssetMult = pow(10, 0, priceAssetInfo.decimals, 0, 0, DOWN) | |
251 | 333 | let origTotalsArray = readTotalsArrayOrDefault() | |
252 | 334 | let totalsDiff = [0, 0, 0, 0] | |
253 | 335 | [StringEntry(keyConfig(), fromatConfig(idoStart, idoDuration, claimStart, claimDuration, price, priceMult, idoAssetId58, idoAssetMult, priceAssetId58, priceAssetMult, minInvestAmount, pmt.amount)), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart)] | |
254 | 336 | } | |
255 | 337 | } | |
256 | 338 | ||
257 | 339 | ||
258 | 340 | ||
259 | 341 | @Callable(i) | |
260 | 342 | func invest () = { | |
261 | 343 | let cfgArray = readConfigArray() | |
262 | 344 | let idoStart = parseIntValue(cfgArray[IdxCfgIdoStart]) | |
263 | 345 | let idoDuration = parseIntValue(cfgArray[IdxCfgIdoDuration]) | |
264 | 346 | let idoEnd = (idoStart + idoDuration) | |
265 | 347 | let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart]) | |
266 | 348 | let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration]) | |
267 | 349 | let price = parseIntValue(cfgArray[IdxCfgPrice]) | |
268 | 350 | let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult]) | |
269 | 351 | let idoAssetId58 = cfgArray[IdxCfgIdoAssetId] | |
270 | 352 | let idoAssetId = fromBase58String(idoAssetId58) | |
271 | 353 | let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult]) | |
272 | 354 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
273 | 355 | let priceAssetId = fromBase58String(priceAssetId58) | |
274 | 356 | let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult]) | |
275 | 357 | let minIvestAmount = parseIntValue(cfgArray[IdxCfgMinInvestAmount]) | |
276 | 358 | let userAddress = toString(i.caller) | |
277 | 359 | if ((idoStart > height)) | |
278 | 360 | then throw("ido has not been started yet") | |
279 | 361 | else if ((height > idoEnd)) | |
280 | 362 | then throw("ido has been already ended") | |
281 | 363 | else if ((size(i.payments) != 1)) | |
282 | 364 | then throw("exactly 1 payment is expected") | |
283 | 365 | else { | |
284 | 366 | let pmt = value(i.payments[0]) | |
285 | 367 | let pmtAssetId = value(pmt.assetId) | |
286 | 368 | let pmtAmount = pmt.amount | |
287 | 369 | if ((pmtAssetId != priceAssetId)) | |
288 | 370 | then throw((("invalid payment asset id: " + toBase58String(pmtAssetId)) + " is expected")) | |
289 | 371 | else { | |
290 | 372 | let origInvestorArray = readInvestorArrayOrDefault(userAddress) | |
291 | 373 | let origTotalsArray = readTotalsArrayOrDefault() | |
292 | 374 | let newPriceTotalAmount = (parseIntValue(origTotalsArray[IdxInvTotalAmount]) + pmtAmount) | |
293 | 375 | let requiredIdoAssetAmount = (newPriceTotalAmount * 100) | |
294 | 376 | if ((requiredIdoAssetAmount > assetBalance(this, idoAssetId))) | |
295 | 377 | then throw("IDO asset has been - sold consider to use smaller payment") | |
296 | 378 | else { | |
297 | 379 | let totalsDiff = [pmtAmount, pmtAmount, 0, 0] | |
298 | 380 | [TotalsEntry(keyInvestor(userAddress), origInvestorArray, totalsDiff, claimStart), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart), InvestOperationHistoryEntry(userAddress, pmtAmount, 0, i.transactionId)] | |
299 | 381 | } | |
300 | 382 | } | |
301 | 383 | } | |
302 | 384 | } | |
303 | 385 | ||
304 | 386 | ||
305 | 387 | ||
306 | 388 | @Callable(i) | |
307 | 389 | func claim (claimedAssetId58,userAddress58) = { | |
308 | 390 | let callerAddress58 = toString(i.caller) | |
309 | 391 | if ((userAddress58 != callerAddress58)) | |
310 | - | then | |
392 | + | then throwErr("not authorized") | |
311 | 393 | else { | |
394 | + | let priceAssetId = readConfigArray()[IdxCfgPriceAssetId] | |
312 | 395 | let claimResultTuple = internalClaim(claimedAssetId58, i.caller, i.transactionId) | |
313 | 396 | let totalsDiff = claimResultTuple._1 | |
314 | 397 | let outAmount = claimResultTuple._2 | |
315 | 398 | let outAssetId = claimResultTuple._3 | |
316 | 399 | let origInvestArray = claimResultTuple._4 | |
317 | 400 | 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) | |
401 | + | let availableToClaimArray = claimResultTuple._6 | |
402 | + | let currentPeriod = availableToClaimArray[0] | |
403 | + | let periodStart = availableToClaimArray[1] | |
404 | + | let periodEnd = availableToClaimArray[2] | |
405 | + | let totalUserAvailableToClaim = availableToClaimArray[3] | |
406 | + | let periodAvailableIdoAmountToClaim = availableToClaimArray[4] | |
407 | + | let periodAvailableUserPriceAmountToClaim = availableToClaimArray[5] | |
408 | + | let periodAvailableTotalPriceAmountToClaim = availableToClaimArray[6] | |
409 | + | let usdtPriceAssetAllowableRatio = availableToClaimArray[7] | |
410 | + | let currentPriceAssetRatio = availableToClaimArray[8] | |
411 | + | let endPriodBlocksLeft = availableToClaimArray[9] | |
412 | + | let checks = [if (if ((totalUserAvailableToClaim > 0)) | |
413 | + | then true | |
414 | + | else (periodAvailableIdoAmountToClaim > 0)) | |
415 | + | then true | |
416 | + | else throwErr("nothing to claim"), if ((periodAvailableUserPriceAmountToClaim > 0)) | |
417 | + | then true | |
418 | + | else throwErr("unavailable to claim because user period allowance reached"), if ((periodAvailableTotalPriceAmountToClaim > 0)) | |
419 | + | then true | |
420 | + | else throwErr("unavailable to claim because total period allowance reached")] | |
421 | + | if ((checks == checks)) | |
422 | + | then { | |
423 | + | let claimedPriceAmountFromDiff = totalsDiff[IdxDiffClaimedPriceAmountIncrement] | |
424 | + | let claimedIdoAssetAmountFromDiff = totalsDiff[IdxDiffClaimedIdoAssetAmountIncrement] | |
425 | + | let updatedPeriodTotalAvailableToClaim = (periodAvailableTotalPriceAmountToClaim - claimedPriceAmountFromDiff) | |
426 | + | let updatedPeriodUserAvailableToClaim = (periodAvailableUserPriceAmountToClaim - claimedPriceAmountFromDiff) | |
427 | + | $Tuple2([ScriptTransfer(i.caller, outAmount, outAssetId), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight), IntegerEntry(keyCurrentPeriod(), currentPeriod), IntegerEntry(keyPeriodStartHeight(currentPeriod), periodStart), IntegerEntry(keyPeriodEndHeight(currentPeriod), periodEnd), IntegerEntry(keyPeriodTotalAvailableToClaim(priceAssetId, currentPeriod), updatedPeriodTotalAvailableToClaim), IntegerEntry(keyPeriodUserAvailableToClaim(priceAssetId, currentPeriod, userAddress58), updatedPeriodUserAvailableToClaim), ClaimOperationHistoryEntry(userAddress58, claimedPriceAmountFromDiff, claimedIdoAssetAmountFromDiff, i.transactionId)], unit) | |
428 | + | } | |
429 | + | else throw("Strict value is not equal to itself.") | |
321 | 430 | } | |
322 | 431 | } | |
323 | 432 | ||
324 | 433 | ||
325 | 434 | ||
326 | 435 | @Callable(i) | |
327 | 436 | func claimREADONLY (claimedAssetId58,userAddress58) = { | |
328 | 437 | let claimResultTuple = internalClaim(claimedAssetId58, addressFromStringValue(userAddress58), fromBase58String("")) | |
329 | 438 | let totalsDiff = claimResultTuple._1 | |
330 | 439 | let outAmount = claimResultTuple._2 | |
331 | 440 | let outAssetId = claimResultTuple._3 | |
332 | 441 | let origInvestArray = claimResultTuple._4 | |
333 | 442 | let newClaimPeriodHeight = claimResultTuple._5 | |
334 | 443 | let availableToClaimArray = claimResultTuple._6 | |
335 | - | let | |
336 | - | let | |
444 | + | let availableIdoAmountToClaim = availableToClaimArray[4] | |
445 | + | let availablePriceAmountToClaim = availableToClaimArray[5] | |
337 | 446 | $Tuple2(nil, makeString(["%s%d%d", userAddress58, toString(availablePriceAmountToClaim), toString(availableIdoAmountToClaim)], SEP)) | |
447 | + | } | |
448 | + | ||
449 | + | ||
450 | + | ||
451 | + | @Callable(i) | |
452 | + | func claimV2READONLY (claimedAssetId58,userAddress58) = { | |
453 | + | let claimResultTuple = internalClaim(claimedAssetId58, addressFromStringValue(userAddress58), fromBase58String("")) | |
454 | + | let totalsDiff = claimResultTuple._1 | |
455 | + | let outAmount = claimResultTuple._2 | |
456 | + | let outAssetId = claimResultTuple._3 | |
457 | + | let origInvestArray = claimResultTuple._4 | |
458 | + | let newClaimPeriodHeight = claimResultTuple._5 | |
459 | + | let availableToClaimArray = claimResultTuple._6 | |
460 | + | let currentPeriod = availableToClaimArray[0] | |
461 | + | let periodStart = availableToClaimArray[1] | |
462 | + | let periodEnd = availableToClaimArray[2] | |
463 | + | let totalUserAvailableToClaim = availableToClaimArray[3] | |
464 | + | let periodAvailableIdoAmountToClaim = availableToClaimArray[4] | |
465 | + | let periodAvailableUserPriceAmountToClaim = availableToClaimArray[5] | |
466 | + | let periodAvailableTotalPriceAmountToClaim = availableToClaimArray[6] | |
467 | + | let usdtPriceAssetAllowableRatio = availableToClaimArray[7] | |
468 | + | let currentPriceAssetRatio = availableToClaimArray[8] | |
469 | + | let endPriodBlocksLeft = availableToClaimArray[9] | |
470 | + | 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) | |
471 | + | $Tuple2(nil, resultString) | |
338 | 472 | } | |
339 | 473 | ||
340 | 474 | ||
341 | 475 | ||
342 | 476 | @Callable(i) | |
343 | 477 | func setManager (pendingManagerPublicKey) = { | |
344 | 478 | let checkCaller = mustManager(i) | |
345 | 479 | if ((checkCaller == checkCaller)) | |
346 | 480 | then { | |
347 | 481 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
348 | 482 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
349 | 483 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
350 | 484 | else throw("Strict value is not equal to itself.") | |
351 | 485 | } | |
352 | 486 | else throw("Strict value is not equal to itself.") | |
353 | 487 | } | |
354 | 488 | ||
355 | 489 | ||
356 | 490 | ||
357 | 491 | @Callable(i) | |
358 | 492 | func confirmManager () = { | |
359 | 493 | let pm = pendingManagerPublicKeyOrUnit() | |
360 | 494 | let hasPM = if (isDefined(pm)) | |
361 | 495 | then true | |
362 | 496 | else throw("No pending manager") | |
363 | 497 | if ((hasPM == hasPM)) | |
364 | 498 | then { | |
365 | 499 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
366 | 500 | then true | |
367 | 501 | else throw("You are not pending manager") | |
368 | 502 | if ((checkPM == checkPM)) | |
369 | 503 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
370 | 504 | else throw("Strict value is not equal to itself.") | |
371 | 505 | } | |
372 | 506 | else throw("Strict value is not equal to itself.") | |
373 | 507 | } | |
374 | 508 | ||
375 | 509 | ||
376 | 510 | @Verifier(tx) | |
377 | 511 | func verify () = { | |
378 | 512 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
379 | 513 | case pk: ByteVector => | |
380 | 514 | pk | |
381 | 515 | case _: Unit => | |
382 | 516 | tx.senderPublicKey | |
383 | 517 | case _ => | |
384 | 518 | throw("Match error") | |
385 | 519 | } | |
386 | 520 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
387 | 521 | } | |
388 | 522 |
github/deemru/w8io/026f985 52.07 ms ◑