tx · 6UinNALyQ1Rw59C8HKiQfQjkp8eSEtj5aDE4p6PN91Rs

3MqySDQxn5jzBUc144oks9fQzAXCBvJ2B8Y:  -0.01000000 Waves

2021.08.24 12:56 [1672260] smart account 3MqySDQxn5jzBUc144oks9fQzAXCBvJ2B8Y > SELF 0.00000000 Waves

{ "type": 13, "id": "6UinNALyQ1Rw59C8HKiQfQjkp8eSEtj5aDE4p6PN91Rs", "fee": 1000000, "feeAssetId": null, "timestamp": 1629798974135, "version": 1, "sender": "3MqySDQxn5jzBUc144oks9fQzAXCBvJ2B8Y", "senderPublicKey": "3YcAqsm6P2UYnzeZng9DPfjNQbEcHithbYzPy3ZMzLMk", "proofs": [ "2aEKH7jp32B5tWCHGHbJz3PFUCsgbyMjSXtLgaVzAY4Bz2m85FeH1wLCcJ7Fx1bu4sFkEeNfT5XgSrpwqNQdb5QG" ], "script": "base64:AAIFAAAAAAAAABQIAhIJCgcBAQEBAQgBEgASAwoBCAAAACoBAAAAD2dldFN0cmluZ09yRmFpbAAAAAEAAAADa2V5CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQiAAAAAQUAAAADa2V5CQABLAAAAAIJAAEsAAAAAgIAAAAPbWFuZGF0b3J5IHRoaXMuBQAAAANrZXkCAAAADyBpcyBub3QgZGVmaW5lZAAAAAADU0VQAgAAAAJfXwAAAAAIQlVGU0NBTEUJAAE2AAAAAQAN4Lazp2QAAAEAAAAdY29udmVydFByaWNlQXNzZXRJbnRvSWRvQXNzZXQAAAAFAAAAEHByaWNlQXNzZXRBbW91bnQAAAAOcHJpY2VBc3NldE1VTFQAAAAFcHJpY2UAAAAJcHJpY2VNVUxUAAAADGlkb0Fzc2V0TVVMVAQAAAAKYlByaWNlTVVMVAkAATYAAAABBQAAAA5wcmljZUFzc2V0TVVMVAQAAAAOYlByaWNlQXNzZXRCVUYJAAE8AAAAAwkAATYAAAABBQAAABBwcmljZUFzc2V0QW1vdW50BQAAAAhCVUZTQ0FMRQUAAAAK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ZAkAAAIAAAABAgAAADlJRE8gYXNzZXQgaGFzIGJlZW4gLSBzb2xkIGNvbnNpZGVyIHRvIHVzZSBzbWFsbGVyIHBheW1lbnQEAAAACnRvdGFsc0RpZmYJAARMAAAAAgUAAAAJcG10QW1vdW50CQAETAAAAAIFAAAACXBtdEFtb3VudAkABEwAAAACAAAAAAAAAAAACQAETAAAAAIAAAAAAAAAAAAFAAAAA25pbAkABEwAAAACCQEAAAALVG90YWxzRW50cnkAAAAECQEAAAALa2V5SW52ZXN0b3IAAAABBQAAAAt1c2VyQWRkcmVzcwUAAAARb3JpZ0ludmVzdG9yQXJyYXkFAAAACnRvdGFsc0RpZmYFAAAACmNsYWltU3RhcnQJAARMAAAAAgkBAAAAC1RvdGFsc0VudHJ5AAAABAkBAAAACWtleVRvdGFscwAAAAAFAAAAD29yaWdUb3RhbHNBcnJheQUAAAAKdG90YWxzRGlmZgUAAAAKY2xhaW1TdGFydAkABEwAAAACCQEAAAAbSW52ZXN0T3BlcmF0aW9uSGlzdG9yeUVudHJ5AAAABAUAAAALdXNlckFkZHJlc3MFAAAACXBtdEFtb3VudAAAAAAAAAAAAAgFAAAAAWkAAAANdHJhbnNhY3Rpb25JZAUAAAADbmlsAAAAAWkBAAAABWNsYWltAAAAAQAAABBjbGFpbWVkQXNzZXRJZDU4BAAAAAt1c2VyQWRkcmVzcwgFAAAAAWkAAAAGY2FsbGVyCQEAAAAMcHJpdmF0ZUNsYWltAAAAAwUAAAAQY2xhaW1lZEFzc2V0SWQ1OAUAAAALdXNlckFkZHJlc3MIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQAAAAARRPf9g==", "chainId": 84, "height": 1672260, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 2mbnJCJCZRVyuBcQkXcEPnUrzaWAyTDPMsuYH1yH4ngX 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 bPriceMULT = toBigInt(priceAssetMULT)
13+ let bPriceAssetBUF = fraction(toBigInt(priceAssetAmount), BUFSCALE, bPriceMULT)
14+ let bAmountAssetBUF = fraction(bPriceAssetBUF, bPriceMULT, toBigInt(price))
15+ toInt(fraction(bAmountAssetBUF, toBigInt(idoAssetMULT), BUFSCALE))
16+ }
17+
18+
19+let IdxCfgIdoStart = 1
20+
21+let IdxCfgIdoDuration = 2
22+
23+let IdxCfgClaimStart = 3
24+
25+let IdxCfgClaimDuration = 4
26+
27+let IdxCfgPrice = 5
28+
29+let IdxCfgPriceMult = 6
30+
31+let IdxCfgIdoAssetId = 7
32+
33+let IdxCfgIdoAssetMult = 8
34+
35+let IdxCfgPriceAssetId = 9
36+
37+let IdxCfgPriceAssetMult = 10
38+
39+let IdxCfgMinInvestAmount = 11
40+
41+func fromatConfigS (idoStart,idoDuration,claimStart,claimDuration,price,priceMult,idoAssetId58,idoAssetMult,priceAssetId58,priceAssetMult,minInvestAmount) = makeString(["%d%d%d%d%d%d%s%d%s%d%d", idoStart, idoDuration, claimStart, claimDuration, price, priceMult, idoAssetId58, idoAssetMult, priceAssetId58, priceAssetMult, minInvestAmount], SEP)
42+
43+
44+func fromatConfig (idoStart,idoDuration,claimStart,claimDuration,price,priceMult,idoAssetId58,idoAssetMult,priceAssetId58,priceAssetMult,minInvestAmount) = fromatConfigS(toString(idoStart), toString(idoDuration), toString(claimStart), toString(claimDuration), toString(price), toString(priceMult), idoAssetId58, toString(idoAssetMult), priceAssetId58, toString(priceAssetMult), toString(minInvestAmount))
45+
46+
47+let IdxInvTotalAmount = 1
48+
49+let IdxInvRemainingAmount = 2
50+
51+let IdxInvClaimedPriceAssetAmount = 3
52+
53+let IdxInvClaimedIdoAssetAmount = 4
54+
55+let IdxInvLastClaimedHeight = 5
56+
57+func formatInvestorS (totalAmount,remainingAmount,claimedPriceAssetAmount,claimedIdoAssetAmount,lastClaimedHeight) = makeString(["%d%d%d%d%d", totalAmount, remainingAmount, claimedPriceAssetAmount, claimedIdoAssetAmount, lastClaimedHeight], SEP)
58+
59+
60+func formatInvestor (totalAmount,remainingAmount,claimedPriceAssetAmount,claimedIdoAssetAmount,lastClaimedHeight) = formatInvestorS(toString(totalAmount), toString(remainingAmount), toString(claimedPriceAssetAmount), toString(claimedIdoAssetAmount), toString(lastClaimedHeight))
61+
62+
63+func formatHistoryRecord (priceAssetAmount,idoAssetAmount) = makeString(["%d%d%d%d", toString(height), toString(lastBlock.timestamp), toString(priceAssetAmount), toString(idoAssetAmount)], SEP)
64+
65+
66+func keyConfig () = "%s__config"
67+
68+
69+func keyInvestor (userAddress) = ("%s__" + userAddress)
70+
71+
72+func keyTotals () = "%s__totals"
73+
74+
75+func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP)
76+
77+
78+func readConfigArray () = split(getStringOrFail(keyConfig()), SEP)
79+
80+
81+func readTotalsArrayOrDefaultByCustomKey (customKey) = split(valueOrElse(getString(customKey), formatInvestorS("0", "0", "0", "0", "0")), SEP)
82+
83+
84+func readTotalsArrayOrDefault () = readTotalsArrayOrDefaultByCustomKey(keyTotals())
85+
86+
87+func readInvestorArrayOrDefault (userAddress) = readTotalsArrayOrDefaultByCustomKey(keyInvestor(userAddress))
88+
89+
90+func readInvestorArrayOrFail (userAddress) = split(getStringOrFail(keyInvestor(userAddress)), SEP)
91+
92+
93+let IdxDiffTotalIncrement = 0
94+
95+let IdxDiffRemainingPriceAmountIncrement = 1
96+
97+let IdxDiffClaimedPriceAmountIncrement = 2
98+
99+let IdxDiffClaimedIdoAssetAmountIncrement = 3
100+
101+func TotalsEntry (key,origArray,incrementDiff,newLastClaimedHeight) = {
102+ let totalAmount = parseIntValue(origArray[IdxInvTotalAmount])
103+ let remainingAmount = parseIntValue(origArray[IdxInvRemainingAmount])
104+ let claimedPriceAssetAmount = parseIntValue(origArray[IdxInvClaimedPriceAssetAmount])
105+ let claimedIdoAssetAmount = parseIntValue(origArray[IdxInvClaimedIdoAssetAmount])
106+ let lastClaimedHeight = parseIntValue(origArray[IdxInvLastClaimedHeight])
107+ let newTotalAmount = (totalAmount + incrementDiff[IdxDiffTotalIncrement])
108+ let newRemainingAmount = (remainingAmount + incrementDiff[IdxDiffRemainingPriceAmountIncrement])
109+ let newClaimedPriceAssetAmount = (claimedPriceAssetAmount + incrementDiff[IdxDiffClaimedPriceAmountIncrement])
110+ let newClaimedIdoAssetAmount = (claimedIdoAssetAmount + incrementDiff[IdxDiffClaimedIdoAssetAmountIncrement])
111+ if ((0 > newRemainingAmount))
112+ then throw("invalid math")
113+ else StringEntry(key, formatInvestor(newTotalAmount, newRemainingAmount, newClaimedPriceAssetAmount, newClaimedIdoAssetAmount, newLastClaimedHeight))
114+ }
115+
116+
117+func InvestOperationHistoryEntry (userAddress,priceAssetAmount,idoAssetAmount,txId) = StringEntry(keyOperationHistoryRecord("invest", userAddress, toBase58String(txId)), formatHistoryRecord(priceAssetAmount, idoAssetAmount))
118+
119+
120+func ClaimOperationHistoryEntry (userAddress,priceAssetAmount,idoAssetAmount,txId) = StringEntry(keyOperationHistoryRecord("claim", userAddress, toBase58String(txId)), formatHistoryRecord(priceAssetAmount, idoAssetAmount))
121+
122+
123+func privateClaim (claimedAssetId58,userAddress,txId) = {
124+ let cfgArray = readConfigArray()
125+ let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart])
126+ let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration])
127+ let claimEnd = (claimStart + claimDuration)
128+ let price = parseIntValue(cfgArray[IdxCfgPrice])
129+ let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult])
130+ let idoAssetId58 = cfgArray[IdxCfgIdoAssetId]
131+ let idoAssetId = fromBase58String(idoAssetId58)
132+ let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult])
133+ let priceAssetId58 = cfgArray[IdxCfgPriceAssetId]
134+ let priceAssetId = fromBase58String(priceAssetId58)
135+ let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult])
136+ let userAddress58 = toString(userAddress)
137+ let origInvestArray = readInvestorArrayOrFail(userAddress58)
138+ let investTotalAmount = parseIntValue(origInvestArray[IdxInvTotalAmount])
139+ let investLastClaimedHeight = parseIntValue(origInvestArray[IdxInvLastClaimedHeight])
140+ let newClaimPeriodHeight = if ((height > claimEnd))
141+ then claimEnd
142+ else height
143+ let claimingBlocks = (investLastClaimedHeight - newClaimPeriodHeight)
144+ let claimingPriceAssetAmount = fraction(investTotalAmount, claimingBlocks, claimDuration)
145+ let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset(claimingPriceAssetAmount, priceAssetMult, price, priceMult, idoAssetMult)
146+ let claimResultTuple = if ((claimedAssetId58 == priceAssetId58))
147+ then $Tuple3([0, -(claimingPriceAssetAmount), claimingPriceAssetAmount, 0], claimingPriceAssetAmount, priceAssetId)
148+ else if ((claimedAssetId58 == idoAssetId58))
149+ then $Tuple3([0, -(claimingPriceAssetAmount), 0, claimingIdoAssetAmount], claimingIdoAssetAmount, idoAssetId)
150+ else throw(("unsupported assetId: " + claimedAssetId58))
151+ let totalsDiff = claimResultTuple._1
152+ let outAmount = claimResultTuple._2
153+ let outAssetId = claimResultTuple._3
154+ let claimedPriceAmountFromDiff = totalsDiff[IdxDiffClaimedPriceAmountIncrement]
155+ let claimedIdoAssetAmountFromDiff = totalsDiff[IdxDiffClaimedIdoAssetAmountIncrement]
156+[ScriptTransfer(userAddress, outAmount, outAssetId), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight), ClaimOperationHistoryEntry(userAddress58, claimedPriceAmountFromDiff, claimedIdoAssetAmountFromDiff, txId)]
157+ }
158+
159+
160+@Callable(i)
161+func constructor (idoStart,idoDuration,claimStart,claimDuration,price,priceAssetId58,minInvestAmount) = {
162+ let priceMult = ((100 * 1000) * 1000)
163+ let idoEnd = (idoStart + idoDuration)
164+ if (isDefined(getString(keyConfig())))
165+ then throw("already initialized")
166+ else if (("3N4Aib5iubWiGMzdTh6wWiVDVbo32oeVUmH" != toString(i.caller)))
167+ then throw("not authorized")
168+ else if ((size(i.payments) != 1))
169+ then throw("exactly 1 payment must be attached")
170+ else if ((idoEnd >= claimStart))
171+ then throw("claimStart must be greater than idoEnd")
172+ else {
173+ let pmt = value(i.payments[0])
174+ let idoAssetId = value(pmt.assetId)
175+ let idoAssetInfo = valueOrErrorMessage(assetInfo(idoAssetId), "fail to load ido asset info")
176+ let idoAssetId58 = toBase58String(idoAssetId)
177+ let idoAssetMult = pow(10, 0, idoAssetInfo.decimals, 0, 0, DOWN)
178+ let priceAssetId = fromBase58String(priceAssetId58)
179+ let priceAssetInfo = valueOrErrorMessage(assetInfo(priceAssetId), "fail to load price asset info")
180+ let priceAssetMult = pow(10, 0, priceAssetInfo.decimals, 0, 0, DOWN)
181+[StringEntry(keyConfig(), fromatConfig(idoStart, idoDuration, claimStart, claimDuration, price, priceMult, idoAssetId58, idoAssetMult, priceAssetId58, priceAssetMult, minInvestAmount))]
182+ }
183+ }
184+
185+
186+
187+@Callable(i)
188+func invest () = {
189+ let cfgArray = readConfigArray()
190+ let idoStart = parseIntValue(cfgArray[IdxCfgIdoStart])
191+ let idoDuration = parseIntValue(cfgArray[IdxCfgIdoDuration])
192+ let idoEnd = (idoStart + idoDuration)
193+ let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart])
194+ let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration])
195+ let price = parseIntValue(cfgArray[IdxCfgPrice])
196+ let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult])
197+ let idoAssetId58 = cfgArray[IdxCfgIdoAssetId]
198+ let idoAssetId = fromBase58String(idoAssetId58)
199+ let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult])
200+ let priceAssetId58 = cfgArray[IdxCfgPriceAssetId]
201+ let priceAssetId = fromBase58String(priceAssetId58)
202+ let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult])
203+ let minIvestAmount = parseIntValue(cfgArray[IdxCfgMinInvestAmount])
204+ let userAddress = toString(i.caller)
205+ if ((idoStart > height))
206+ then throw("ido has not been started yet")
207+ else if ((height > idoEnd))
208+ then throw("ido has been already ended")
209+ else if ((size(i.payments) != 1))
210+ then throw("exactly 1 payment is expected")
211+ else {
212+ let pmt = value(i.payments[0])
213+ let pmtAssetId = value(pmt.assetId)
214+ let pmtAmount = pmt.amount
215+ if ((pmtAssetId != priceAssetId))
216+ then throw((("invalid payment asset id: " + toBase58String(pmtAssetId)) + " is expected"))
217+ else if ((minIvestAmount > pmtAmount))
218+ then throw(((("payment amount is less then min allowed: pmtAmount=" + toString(pmtAmount)) + " minIvestAmount=") + toString(minIvestAmount)))
219+ else {
220+ let origInvestorArray = readInvestorArrayOrDefault(userAddress)
221+ let origTotalsArray = readTotalsArrayOrDefault()
222+ let newPriceTotalAmount = (parseIntValue(origTotalsArray[IdxInvTotalAmount]) + pmtAmount)
223+ let requiredIdoAssetAmount = convertPriceAssetIntoIdoAsset(newPriceTotalAmount, priceAssetMult, price, priceMult, idoAssetMult)
224+ if ((requiredIdoAssetAmount > assetBalance(this, idoAssetId)))
225+ then throw("IDO asset has been - sold consider to use smaller payment")
226+ else {
227+ let totalsDiff = [pmtAmount, pmtAmount, 0, 0]
228+[TotalsEntry(keyInvestor(userAddress), origInvestorArray, totalsDiff, claimStart), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart), InvestOperationHistoryEntry(userAddress, pmtAmount, 0, i.transactionId)]
229+ }
230+ }
231+ }
232+ }
233+
234+
235+
236+@Callable(i)
237+func claim (claimedAssetId58) = {
238+ let userAddress = i.caller
239+ privateClaim(claimedAssetId58, userAddress, i.transactionId)
240+ }
241+
242+

github/deemru/w8io/169f3d6 
20.69 ms