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