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