tx · 3ZQ1FzYhuRtanVvCLvTZDi35rzHSoJHjvUjeH9Ruzexd

3MvZpvvbmovEt3pvdDZKvhKRjjQxdbUD6Tv:  -0.01700000 Waves

2022.11.02 16:18 [2299542] smart account 3MvZpvvbmovEt3pvdDZKvhKRjjQxdbUD6Tv > SELF 0.00000000 Waves

{ "type": 13, "id": "3ZQ1FzYhuRtanVvCLvTZDi35rzHSoJHjvUjeH9Ruzexd", "fee": 1700000, "feeAssetId": null, "timestamp": 1667395089105, "version": 1, "sender": "3MvZpvvbmovEt3pvdDZKvhKRjjQxdbUD6Tv", "senderPublicKey": "39YkRD2qWXTcdNBr4CbDnm8g8SAB2FKVaDeGYahcFHHx", "proofs": [ "3gX6mitpNXTAQ5ZJ86NWAuCRFr5fAgVgfCXJUFu4NjXehJLJih5qCdkWf1QwM7JvJK6usAPbgbhGubc26zAynPgn" ], "script": "base64:AAIFAAAAAAAACcYIAhIJCgcBAQEBAQgBEgASBAoCCAgSBAoCCAgSAwoBCBIAIg9nZXRTdHJpbmdPckZhaWwiA2tleSIDU0VQIghCVUZTQ0FMRSIdY29udmVydFByaWNlQXNzZXRJbnRvSWRvQXNzZXQiEHByaWNlQXNzZXRBbW91bnQiDnByaWNlQXNzZXRNVUxUIgVwcmljZSIJcHJpY2VNVUxUIgxpZG9Bc3NldE1VTFQiD2JQcmljZUFzc2V0TVVMVCINYklkb0Fzc2V0TVVMVCIOYlByaWNlQXNzZXRCVUYiD2JBbW91bnRBc3NldEJVRiIOSWR4Q2ZnSWRvU3RhcnQiEUlkeENmZ0lkb0R1cmF0aW9uIhBJZHhDZmdDbGFpbVN0YXJ0IhNJZHhDZmdDbGFpbUR1cmF0aW9uIgtJZHhDZmdQcmljZSIPSWR4Q2ZnUHJpY2VNdWx0IhBJZHhDZmdJZG9Bc3NldElkIhJJZHhDZmdJZG9Bc3NldE11bHQiEklkeENmZ1ByaWNlQXNzZXRJZCIUSWR4Q2ZnUHJpY2VBc3NldE11bHQiFUlkeENmZ01p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i4JAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAQAAAAJiSgEAAAACYksAAAAABAAAAAJiTAQAAAACYVkJAQAAAAJiYgAAAAADCQAAAQAAAAIFAAAAAmFZAgAAAApCeXRlVmVjdG9yBAAAAAJiaAUAAAACYVkFAAAAAmJoAwkAAAEAAAACBQAAAAJhWQIAAAAEVW5pdAgFAAAAAmJKAAAAD3NlbmRlclB1YmxpY0tleQkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgkAAfQAAAADCAUAAAACYkoAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJiSgAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAAmJMYS4tIw==", "chainId": 84, "height": 2299542, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7npvjwSRh6LG5mXgESqSSetbVn28p92CmpgdhvJHSmFM Next: 323EnozLCPpZvFjr36yYGRNmqhJFwZPD8TsDfZ3ZZnsd Diff:
OldNewDifferences
77 let SEP = "__"
88
99 let BUFSCALE = toBigInt(1000000000000000000)
10-
11-let scale8 = 100000000
12-
13-func throwErr (msg) = throw(makeString(["ido.ride:", msg], " "))
14-
1510
1611 func convertPriceAssetIntoIdoAsset (priceAssetAmount,priceAssetMULT,price,priceMULT,idoAssetMULT) = {
1712 let bPriceAssetMULT = toBigInt(priceAssetMULT)
8580
8681
8782 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)
12183
12284
12385 func keyManagerPublicKey () = "%s__managerPublicKey"
197159 then claimStart
198160 else height
199161 let claimingBlocks = (newClaimPeriodHeight - investLastClaimedHeight)
200- let totalUserAvailableToClaim = fraction(investTotalAmount, claimingBlocks, claimDuration)
201- let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset(totalUserAvailableToClaim, priceAssetMult, price, priceMult, idoAssetMult)
162+ let claimingPriceAssetAmount = fraction(investTotalAmount, claimingBlocks, claimDuration)
163+ let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset(claimingPriceAssetAmount, priceAssetMult, price, priceMult, idoAssetMult)
202164 let isUSDN = (claimedAssetId58 == priceAssetId58)
203165 let isUSDNClaimDisabled = valueOrElse(getBoolean(keyUSDNClaimDisabled()), false)
204166 let isUSDNClaimEnded = match getInteger(keyUSDNClaimEndHeight()) {
213175 then isUSDNClaimDisabled
214176 else false))
215177 then true
216- else throwErr("USDN claim is disabled"), if (!(if (isUSDN)
178+ else throw("USDN claim is disabled"), if (!(if (isUSDN)
217179 then isUSDNClaimEnded
218180 else false))
219181 then true
220- else throwErr("USDN claim is ended")]
182+ else throw("USDN claim is ended")]
221183 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- }
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))
287189 else throw("Strict value is not equal to itself.")
288190 }
289191
331233 let idoEnd = (idoStart + idoDuration)
332234 if (isDefined(getString(keyConfig())))
333235 then throw("already initialized")
334- else if (("3PMEHLx1j6zerarZTYfsGqDeeZqQoMpxq5S" != toString(i.caller)))
236+ else if (("3N4nTJ5sSp5X5ChS2bBBmwNMn1eeRzT1FoP" != toString(i.caller)))
335237 then throw("not authorized")
336238 else if ((size(i.payments) != 1))
337239 then throw("exactly 1 payment must be attached")
405307 func claim (claimedAssetId58,userAddress58) = {
406308 let callerAddress58 = toString(i.caller)
407309 if ((userAddress58 != callerAddress58))
408- then throwErr("not authorized")
310+ then throw("not authorized")
409311 else {
410- let priceAssetId = readConfigArray()[IdxCfgPriceAssetId]
411312 let claimResultTuple = internalClaim(claimedAssetId58, i.caller, i.transactionId)
412313 let totalsDiff = claimResultTuple._1
413314 let outAmount = claimResultTuple._2
414315 let outAssetId = claimResultTuple._3
415316 let origInvestArray = claimResultTuple._4
416317 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))
438- 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)
444- }
445- else throw("Strict value is not equal to itself.")
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)
446321 }
447322 }
448323
457332 let origInvestArray = claimResultTuple._4
458333 let newClaimPeriodHeight = claimResultTuple._5
459334 let availableToClaimArray = claimResultTuple._6
460- let availableIdoAmountToClaim = availableToClaimArray[4]
461- let availablePriceAmountToClaim = availableToClaimArray[5]
335+ let availablePriceAmountToClaim = availableToClaimArray[0]
336+ let availableIdoAmountToClaim = availableToClaimArray[1]
462337 $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)
488338 }
489339
490340
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined"))
55
66
77 let SEP = "__"
88
99 let BUFSCALE = toBigInt(1000000000000000000)
10-
11-let scale8 = 100000000
12-
13-func throwErr (msg) = throw(makeString(["ido.ride:", msg], " "))
14-
1510
1611 func convertPriceAssetIntoIdoAsset (priceAssetAmount,priceAssetMULT,price,priceMULT,idoAssetMULT) = {
1712 let bPriceAssetMULT = toBigInt(priceAssetMULT)
1813 let bIdoAssetMULT = toBigInt(idoAssetMULT)
1914 let bPriceAssetBUF = fraction(toBigInt(priceAssetAmount), BUFSCALE, bPriceAssetMULT)
2015 let bAmountAssetBUF = fraction(bPriceAssetBUF, toBigInt(priceMULT), toBigInt(price))
2116 toInt(fraction(bAmountAssetBUF, toBigInt(idoAssetMULT), BUFSCALE))
2217 }
2318
2419
2520 let IdxCfgIdoStart = 1
2621
2722 let IdxCfgIdoDuration = 2
2823
2924 let IdxCfgClaimStart = 3
3025
3126 let IdxCfgClaimDuration = 4
3227
3328 let IdxCfgPrice = 5
3429
3530 let IdxCfgPriceMult = 6
3631
3732 let IdxCfgIdoAssetId = 7
3833
3934 let IdxCfgIdoAssetMult = 8
4035
4136 let IdxCfgPriceAssetId = 9
4237
4338 let IdxCfgPriceAssetMult = 10
4439
4540 let IdxCfgMinInvestAmount = 11
4641
4742 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)
4843
4944
5045 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))
5146
5247
5348 let IdxInvTotalAmount = 1
5449
5550 let IdxInvRemainingAmount = 2
5651
5752 let IdxInvClaimedPriceAssetAmount = 3
5853
5954 let IdxInvClaimedIdoAssetAmount = 4
6055
6156 let IdxInvLastClaimedHeight = 5
6257
6358 func formatInvestorS (totalAmount,remainingAmount,claimedPriceAssetAmount,claimedIdoAssetAmount,lastClaimedHeight) = makeString(["%d%d%d%d%d", totalAmount, remainingAmount, claimedPriceAssetAmount, claimedIdoAssetAmount, lastClaimedHeight], SEP)
6459
6560
6661 func formatInvestor (totalAmount,remainingAmount,claimedPriceAssetAmount,claimedIdoAssetAmount,lastClaimedHeight) = formatInvestorS(toString(totalAmount), toString(remainingAmount), toString(claimedPriceAssetAmount), toString(claimedIdoAssetAmount), toString(lastClaimedHeight))
6762
6863
6964 func formatHistoryRecord (priceAssetAmount,idoAssetAmount) = makeString(["%d%d%d%d", toString(height), toString(lastBlock.timestamp), toString(priceAssetAmount), toString(idoAssetAmount)], SEP)
7065
7166
7267 func keyConfig () = "%s__config"
7368
7469
7570 func keyInvestor (userAddress) = ("%s__" + userAddress)
7671
7772
7873 func keyTotals () = "%s__totals"
7974
8075
8176 func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP)
8277
8378
8479 func keyUSDNClaimDisabled () = "%s__usdnClaimDisabled"
8580
8681
8782 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)
12183
12284
12385 func keyManagerPublicKey () = "%s__managerPublicKey"
12486
12587
12688 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
12789
12890
12991 func readConfigArray () = split(getStringOrFail(keyConfig()), SEP)
13092
13193
13294 func readTotalsArrayOrDefaultByCustomKey (customKey) = split(valueOrElse(getString(customKey), formatInvestorS("0", "0", "0", "0", "0")), SEP)
13395
13496
13597 func readTotalsArrayOrDefault () = readTotalsArrayOrDefaultByCustomKey(keyTotals())
13698
13799
138100 func readInvestorArrayOrDefault (userAddress) = readTotalsArrayOrDefaultByCustomKey(keyInvestor(userAddress))
139101
140102
141103 func readInvestorArrayOrFail (userAddress) = split(getStringOrFail(keyInvestor(userAddress)), SEP)
142104
143105
144106 let IdxDiffTotalIncrement = 0
145107
146108 let IdxDiffRemainingPriceAmountIncrement = 1
147109
148110 let IdxDiffClaimedPriceAmountIncrement = 2
149111
150112 let IdxDiffClaimedIdoAssetAmountIncrement = 3
151113
152114 func TotalsEntry (key,origArray,incrementDiff,newLastClaimedHeight) = {
153115 let totalAmount = parseIntValue(origArray[IdxInvTotalAmount])
154116 let remainingAmount = parseIntValue(origArray[IdxInvRemainingAmount])
155117 let claimedPriceAssetAmount = parseIntValue(origArray[IdxInvClaimedPriceAssetAmount])
156118 let claimedIdoAssetAmount = parseIntValue(origArray[IdxInvClaimedIdoAssetAmount])
157119 let lastClaimedHeight = parseIntValue(origArray[IdxInvLastClaimedHeight])
158120 let newTotalAmount = (totalAmount + incrementDiff[IdxDiffTotalIncrement])
159121 let newRemainingAmount = (remainingAmount + incrementDiff[IdxDiffRemainingPriceAmountIncrement])
160122 let newClaimedPriceAssetAmount = (claimedPriceAssetAmount + incrementDiff[IdxDiffClaimedPriceAmountIncrement])
161123 let newClaimedIdoAssetAmount = (claimedIdoAssetAmount + incrementDiff[IdxDiffClaimedIdoAssetAmountIncrement])
162124 if ((0 > newRemainingAmount))
163125 then throw("invalid math")
164126 else StringEntry(key, formatInvestor(newTotalAmount, newRemainingAmount, newClaimedPriceAssetAmount, newClaimedIdoAssetAmount, newLastClaimedHeight))
165127 }
166128
167129
168130 func InvestOperationHistoryEntry (userAddress,priceAssetAmount,idoAssetAmount,txId) = StringEntry(keyOperationHistoryRecord("invest", userAddress, toBase58String(txId)), formatHistoryRecord(priceAssetAmount, idoAssetAmount))
169131
170132
171133 func ClaimOperationHistoryEntry (userAddress,priceAssetAmount,idoAssetAmount,txId) = StringEntry(keyOperationHistoryRecord("claim", userAddress, toBase58String(txId)), formatHistoryRecord(priceAssetAmount, idoAssetAmount))
172134
173135
174136 func internalClaim (claimedAssetId58,userAddress,txId) = {
175137 let cfgArray = readConfigArray()
176138 let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart])
177139 let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration])
178140 let claimEnd = (claimStart + claimDuration)
179141 let price = parseIntValue(cfgArray[IdxCfgPrice])
180142 let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult])
181143 let idoAssetId58 = cfgArray[IdxCfgIdoAssetId]
182144 let idoAssetId = fromBase58String(idoAssetId58)
183145 let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult])
184146 let priceAssetId58 = cfgArray[IdxCfgPriceAssetId]
185147 let priceAssetId = fromBase58String(priceAssetId58)
186148 let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult])
187149 let userAddress58 = toString(userAddress)
188150 let origInvestArray = readInvestorArrayOrFail(userAddress58)
189151 let investTotalAmount = parseIntValue(origInvestArray[IdxInvTotalAmount])
190152 let investLastClaimedHeightTMP = parseIntValue(origInvestArray[IdxInvLastClaimedHeight])
191153 let investLastClaimedHeight = if ((claimStart >= investLastClaimedHeightTMP))
192154 then claimStart
193155 else investLastClaimedHeightTMP
194156 let newClaimPeriodHeight = if ((height > claimEnd))
195157 then claimEnd
196158 else if ((claimStart > height))
197159 then claimStart
198160 else height
199161 let claimingBlocks = (newClaimPeriodHeight - investLastClaimedHeight)
200- let totalUserAvailableToClaim = fraction(investTotalAmount, claimingBlocks, claimDuration)
201- let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset(totalUserAvailableToClaim, priceAssetMult, price, priceMult, idoAssetMult)
162+ let claimingPriceAssetAmount = fraction(investTotalAmount, claimingBlocks, claimDuration)
163+ let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset(claimingPriceAssetAmount, priceAssetMult, price, priceMult, idoAssetMult)
202164 let isUSDN = (claimedAssetId58 == priceAssetId58)
203165 let isUSDNClaimDisabled = valueOrElse(getBoolean(keyUSDNClaimDisabled()), false)
204166 let isUSDNClaimEnded = match getInteger(keyUSDNClaimEndHeight()) {
205167 case end: Int =>
206168 (height > end)
207169 case _: Unit =>
208170 false
209171 case _ =>
210172 throw("Match error")
211173 }
212174 let checks = [if (!(if (isUSDN)
213175 then isUSDNClaimDisabled
214176 else false))
215177 then true
216- else throwErr("USDN claim is disabled"), if (!(if (isUSDN)
178+ else throw("USDN claim is disabled"), if (!(if (isUSDN)
217179 then isUSDNClaimEnded
218180 else false))
219181 then true
220- else throwErr("USDN claim is ended")]
182+ else throw("USDN claim is ended")]
221183 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- }
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))
287189 else throw("Strict value is not equal to itself.")
288190 }
289191
290192
291193 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
292194 case s: String =>
293195 fromBase58String(s)
294196 case _: Unit =>
295197 unit
296198 case _ =>
297199 throw("Match error")
298200 }
299201
300202
301203 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
302204 case s: String =>
303205 fromBase58String(s)
304206 case _: Unit =>
305207 unit
306208 case _ =>
307209 throw("Match error")
308210 }
309211
310212
311213 func mustManager (i) = {
312214 let pd = throw("Permission denied")
313215 match managerPublicKeyOrUnit() {
314216 case pk: ByteVector =>
315217 if ((i.callerPublicKey == pk))
316218 then true
317219 else pd
318220 case _: Unit =>
319221 if ((i.caller == this))
320222 then true
321223 else pd
322224 case _ =>
323225 throw("Match error")
324226 }
325227 }
326228
327229
328230 @Callable(i)
329231 func constructor (idoStart,idoDuration,claimStart,claimDuration,price,priceAssetId58,minInvestAmount) = {
330232 let priceMult = ((100 * 1000) * 1000)
331233 let idoEnd = (idoStart + idoDuration)
332234 if (isDefined(getString(keyConfig())))
333235 then throw("already initialized")
334- else if (("3PMEHLx1j6zerarZTYfsGqDeeZqQoMpxq5S" != toString(i.caller)))
236+ else if (("3N4nTJ5sSp5X5ChS2bBBmwNMn1eeRzT1FoP" != toString(i.caller)))
335237 then throw("not authorized")
336238 else if ((size(i.payments) != 1))
337239 then throw("exactly 1 payment must be attached")
338240 else if ((idoEnd >= claimStart))
339241 then throw("claimStart must be greater than idoEnd")
340242 else {
341243 let pmt = value(i.payments[0])
342244 let idoAssetId = value(pmt.assetId)
343245 let idoAssetInfo = valueOrErrorMessage(assetInfo(idoAssetId), "fail to load ido asset info")
344246 let idoAssetId58 = toBase58String(idoAssetId)
345247 let idoAssetMult = pow(10, 0, idoAssetInfo.decimals, 0, 0, DOWN)
346248 let priceAssetId = fromBase58String(priceAssetId58)
347249 let priceAssetInfo = valueOrErrorMessage(assetInfo(priceAssetId), "fail to load price asset info")
348250 let priceAssetMult = pow(10, 0, priceAssetInfo.decimals, 0, 0, DOWN)
349251 let origTotalsArray = readTotalsArrayOrDefault()
350252 let totalsDiff = [0, 0, 0, 0]
351253 [StringEntry(keyConfig(), fromatConfig(idoStart, idoDuration, claimStart, claimDuration, price, priceMult, idoAssetId58, idoAssetMult, priceAssetId58, priceAssetMult, minInvestAmount, pmt.amount)), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart)]
352254 }
353255 }
354256
355257
356258
357259 @Callable(i)
358260 func invest () = {
359261 let cfgArray = readConfigArray()
360262 let idoStart = parseIntValue(cfgArray[IdxCfgIdoStart])
361263 let idoDuration = parseIntValue(cfgArray[IdxCfgIdoDuration])
362264 let idoEnd = (idoStart + idoDuration)
363265 let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart])
364266 let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration])
365267 let price = parseIntValue(cfgArray[IdxCfgPrice])
366268 let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult])
367269 let idoAssetId58 = cfgArray[IdxCfgIdoAssetId]
368270 let idoAssetId = fromBase58String(idoAssetId58)
369271 let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult])
370272 let priceAssetId58 = cfgArray[IdxCfgPriceAssetId]
371273 let priceAssetId = fromBase58String(priceAssetId58)
372274 let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult])
373275 let minIvestAmount = parseIntValue(cfgArray[IdxCfgMinInvestAmount])
374276 let userAddress = toString(i.caller)
375277 if ((idoStart > height))
376278 then throw("ido has not been started yet")
377279 else if ((height > idoEnd))
378280 then throw("ido has been already ended")
379281 else if ((size(i.payments) != 1))
380282 then throw("exactly 1 payment is expected")
381283 else {
382284 let pmt = value(i.payments[0])
383285 let pmtAssetId = value(pmt.assetId)
384286 let pmtAmount = pmt.amount
385287 if ((pmtAssetId != priceAssetId))
386288 then throw((("invalid payment asset id: " + toBase58String(pmtAssetId)) + " is expected"))
387289 else {
388290 let origInvestorArray = readInvestorArrayOrDefault(userAddress)
389291 let origTotalsArray = readTotalsArrayOrDefault()
390292 let newPriceTotalAmount = (parseIntValue(origTotalsArray[IdxInvTotalAmount]) + pmtAmount)
391293 let requiredIdoAssetAmount = (newPriceTotalAmount * 100)
392294 if ((requiredIdoAssetAmount > assetBalance(this, idoAssetId)))
393295 then throw("IDO asset has been - sold consider to use smaller payment")
394296 else {
395297 let totalsDiff = [pmtAmount, pmtAmount, 0, 0]
396298 [TotalsEntry(keyInvestor(userAddress), origInvestorArray, totalsDiff, claimStart), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart), InvestOperationHistoryEntry(userAddress, pmtAmount, 0, i.transactionId)]
397299 }
398300 }
399301 }
400302 }
401303
402304
403305
404306 @Callable(i)
405307 func claim (claimedAssetId58,userAddress58) = {
406308 let callerAddress58 = toString(i.caller)
407309 if ((userAddress58 != callerAddress58))
408- then throwErr("not authorized")
310+ then throw("not authorized")
409311 else {
410- let priceAssetId = readConfigArray()[IdxCfgPriceAssetId]
411312 let claimResultTuple = internalClaim(claimedAssetId58, i.caller, i.transactionId)
412313 let totalsDiff = claimResultTuple._1
413314 let outAmount = claimResultTuple._2
414315 let outAssetId = claimResultTuple._3
415316 let origInvestArray = claimResultTuple._4
416317 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))
438- 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)
444- }
445- else throw("Strict value is not equal to itself.")
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)
446321 }
447322 }
448323
449324
450325
451326 @Callable(i)
452327 func claimREADONLY (claimedAssetId58,userAddress58) = {
453328 let claimResultTuple = internalClaim(claimedAssetId58, addressFromStringValue(userAddress58), fromBase58String(""))
454329 let totalsDiff = claimResultTuple._1
455330 let outAmount = claimResultTuple._2
456331 let outAssetId = claimResultTuple._3
457332 let origInvestArray = claimResultTuple._4
458333 let newClaimPeriodHeight = claimResultTuple._5
459334 let availableToClaimArray = claimResultTuple._6
460- let availableIdoAmountToClaim = availableToClaimArray[4]
461- let availablePriceAmountToClaim = availableToClaimArray[5]
335+ let availablePriceAmountToClaim = availableToClaimArray[0]
336+ let availableIdoAmountToClaim = availableToClaimArray[1]
462337 $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)
488338 }
489339
490340
491341
492342 @Callable(i)
493343 func setManager (pendingManagerPublicKey) = {
494344 let checkCaller = mustManager(i)
495345 if ((checkCaller == checkCaller))
496346 then {
497347 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
498348 if ((checkManagerPublicKey == checkManagerPublicKey))
499349 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
500350 else throw("Strict value is not equal to itself.")
501351 }
502352 else throw("Strict value is not equal to itself.")
503353 }
504354
505355
506356
507357 @Callable(i)
508358 func confirmManager () = {
509359 let pm = pendingManagerPublicKeyOrUnit()
510360 let hasPM = if (isDefined(pm))
511361 then true
512362 else throw("No pending manager")
513363 if ((hasPM == hasPM))
514364 then {
515365 let checkPM = if ((i.callerPublicKey == value(pm)))
516366 then true
517367 else throw("You are not pending manager")
518368 if ((checkPM == checkPM))
519369 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
520370 else throw("Strict value is not equal to itself.")
521371 }
522372 else throw("Strict value is not equal to itself.")
523373 }
524374
525375
526376 @Verifier(tx)
527377 func verify () = {
528378 let targetPublicKey = match managerPublicKeyOrUnit() {
529379 case pk: ByteVector =>
530380 pk
531381 case _: Unit =>
532382 tx.senderPublicKey
533383 case _ =>
534384 throw("Match error")
535385 }
536386 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
537387 }
538388

github/deemru/w8io/026f985 
57.38 ms