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