tx · 4paTBxWxwpwajZrd6iCyaVxDk6kgYSyxf1n8wBYRoQYD

3MvZpvvbmovEt3pvdDZKvhKRjjQxdbUD6Tv:  -0.01700000 Waves

2022.11.02 14:00 [2299402] smart account 3MvZpvvbmovEt3pvdDZKvhKRjjQxdbUD6Tv > SELF 0.00000000 Waves

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

github/deemru/w8io/026f985 
25.60 ms