tx · EsqMyviQQX6WtxBcyHbYTheSvcnr1d5rz4hdrCb4FuVy

3MqF7bUuSUBCyGSQ2qbFSu2VPirPBBr9hLy:  -0.01000000 Waves

2021.08.24 12:51 [1672255] smart account 3MqF7bUuSUBCyGSQ2qbFSu2VPirPBBr9hLy > SELF 0.00000000 Waves

{ "type": 13, "id": "EsqMyviQQX6WtxBcyHbYTheSvcnr1d5rz4hdrCb4FuVy", "fee": 1000000, "feeAssetId": null, "timestamp": 1629798711033, "version": 1, "sender": "3MqF7bUuSUBCyGSQ2qbFSu2VPirPBBr9hLy", "senderPublicKey": "HPGYDwopmhjk8nqTqEzkLcZdLG1VSy6iaAJEo8DqrifC", "proofs": [ "3XeRo3Jx7NT62q1ngA5peHgs6aQY2HDp4WJ4izU4RiGmciwxCbQqtDYywfaX9dZQaghjAbdB7XuXTqmRkDCDUZmt" ], "script": "base64:AAIFAAAAAAAAABQIAhIJCgcBAQEBAQgBEgASAwoBCAAAACkBAAAAD2dldFN0cmluZ09yRmFpbAAAAAEAAAADa2V5CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQiAAAAAQUAAAADa2V5CQABLAAAAAIJAAEsAAAAAgIAAAAPbWFuZGF0b3J5IHRoaXMuBQAAAANrZXkCAAAADyBpcyBub3QgZGVmaW5lZAAAAAADU0VQAgAAAAJfXwAAAAAIQlVGU0NBTEUJAAE2AAAAAQAN4Lazp2QAAAEAAAAdY29udmVydFByaWNlQXNzZXRJbnRvSWRvQXNzZXQAAAAFAAAAEHByaWNlQXNzZXRBbW91bnQAAAAOcHJpY2VBc3NldE1VTFQAAAAFcHJpY2UAAAAJcHJpY2VNVUxUAAAADGlkb0Fzc2V0TVVMVAQAAAAKYlByaWNlTVVMVAkAATYAAAABBQAAAA5wcmljZUFzc2V0TVVMVAQAAAAOYlByaWNlQXNzZXRCVUYJAAE8AAAAAwkAATYAAAABBQAAABBwcmljZUFzc2V0QW1vdW50BQAAAAhCVUZTQ0FMRQUAAAAKYl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Jlc3MFAAAACW91dEFtb3VudAUAAAAKb3V0QXNzZXRJZAkABEwAAAACCQEAAAALVG90YWxzRW50cnkAAAAECQEAAAALa2V5SW52ZXN0b3IAAAABBQAAAA11c2VyQWRkcmVzczU4BQAAAA9vcmlnSW52ZXN0QXJyYXkFAAAACnRvdGFsc0RpZmYFAAAAFG5ld0NsYWltUGVyaW9kSGVpZ2h0CQAETAAAAAIJAQAAAAtUb3RhbHNFbnRyeQAAAAQJAQAAAAlrZXlUb3RhbHMAAAAACQEAAAAYcmVhZFRvdGFsc0FycmF5T3JEZWZhdWx0AAAAAAUAAAAKdG90YWxzRGlmZgUAAAAUbmV3Q2xhaW1QZXJpb2RIZWlnaHQJAARMAAAAAgkBAAAAGkNsYWltT3BlcmF0aW9uSGlzdG9yeUVudHJ5AAAABAUAAAANdXNlckFkZHJlc3M1OAUAAAAaY2xhaW1lZFByaWNlQW1vdW50RnJvbURpZmYFAAAAHWNsYWltZWRJZG9Bc3NldEFtb3VudEZyb21EaWZmCAUAAAABaQAAAA10cmFuc2FjdGlvbklkBQAAAANuaWwAAAAAZviddg==", "chainId": 84, "height": 1672255, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none 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+@Callable(i)
124+func constructor (idoStart,idoDuration,claimStart,claimDuration,price,priceAssetId58,minInvestAmount) = {
125+ let priceMult = ((100 * 1000) * 1000)
126+ let idoEnd = (idoStart + idoDuration)
127+ if (isDefined(getString(keyConfig())))
128+ then throw("already initialized")
129+ else if ((this != i.caller))
130+ then throw("not authorized")
131+ else if ((size(i.payments) != 1))
132+ then throw("exactly 1 payment must be attached")
133+ else if ((idoEnd >= claimStart))
134+ then throw("claimStart must be greater than idoEnd")
135+ else {
136+ let pmt = value(i.payments[0])
137+ let idoAssetId = value(pmt.assetId)
138+ let idoAssetInfo = valueOrErrorMessage(assetInfo(idoAssetId), "fail to load ido asset info")
139+ let idoAssetId58 = toBase58String(idoAssetId)
140+ let idoAssetMult = pow(10, 0, idoAssetInfo.decimals, 0, 0, DOWN)
141+ let priceAssetId = fromBase58String(priceAssetId58)
142+ let priceAssetInfo = valueOrErrorMessage(assetInfo(priceAssetId), "fail to load price asset info")
143+ let priceAssetMult = pow(10, 0, priceAssetInfo.decimals, 0, 0, DOWN)
144+[StringEntry(keyConfig(), fromatConfig(idoStart, idoDuration, claimStart, claimDuration, price, priceMult, idoAssetId58, idoAssetMult, priceAssetId58, priceAssetMult, minInvestAmount))]
145+ }
146+ }
147+
148+
149+
150+@Callable(i)
151+func invest () = {
152+ let cfgArray = readConfigArray()
153+ let idoStart = parseIntValue(cfgArray[IdxCfgIdoStart])
154+ let idoDuration = parseIntValue(cfgArray[IdxCfgIdoDuration])
155+ let idoEnd = (idoStart + idoDuration)
156+ let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart])
157+ let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration])
158+ let price = parseIntValue(cfgArray[IdxCfgPrice])
159+ let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult])
160+ let idoAssetId58 = cfgArray[IdxCfgIdoAssetId]
161+ let idoAssetId = fromBase58String(idoAssetId58)
162+ let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult])
163+ let priceAssetId58 = cfgArray[IdxCfgPriceAssetId]
164+ let priceAssetId = fromBase58String(priceAssetId58)
165+ let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult])
166+ let minIvestAmount = parseIntValue(cfgArray[IdxCfgMinInvestAmount])
167+ let userAddress = toString(i.caller)
168+ if ((idoStart > height))
169+ then throw("ido has not been started yet")
170+ else if ((height > idoEnd))
171+ then throw("ido has been already ended")
172+ else if ((size(i.payments) != 1))
173+ then throw("exactly 1 payment is expected")
174+ else {
175+ let pmt = value(i.payments[0])
176+ let pmtAssetId = value(pmt.assetId)
177+ let pmtAmount = pmt.amount
178+ if ((pmtAssetId != priceAssetId))
179+ then throw((("invalid payment asset id: " + toBase58String(pmtAssetId)) + " is expected"))
180+ else if ((minIvestAmount > pmtAmount))
181+ then throw(((("payment amount is less then min allowed: pmtAmount=" + toString(pmtAmount)) + " minIvestAmount=") + toString(minIvestAmount)))
182+ else {
183+ let origInvestorArray = readInvestorArrayOrDefault(userAddress)
184+ let origTotalsArray = readTotalsArrayOrDefault()
185+ let newPriceTotalAmount = (parseIntValue(origTotalsArray[IdxInvTotalAmount]) + pmtAmount)
186+ let requiredIdoAssetAmount = convertPriceAssetIntoIdoAsset(newPriceTotalAmount, priceAssetMult, price, priceMult, idoAssetMult)
187+ if ((requiredIdoAssetAmount > assetBalance(this, idoAssetId)))
188+ then throw("IDO asset has been - sold consider to use smaller payment")
189+ else {
190+ let totalsDiff = [pmtAmount, pmtAmount, 0, 0]
191+[TotalsEntry(keyInvestor(userAddress), origInvestorArray, totalsDiff, claimStart), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart), InvestOperationHistoryEntry(userAddress, pmtAmount, 0, i.transactionId)]
192+ }
193+ }
194+ }
195+ }
196+
197+
198+
199+@Callable(i)
200+func claim (claimedAssetId58) = {
201+ let cfgArray = readConfigArray()
202+ let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart])
203+ let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration])
204+ let claimEnd = (claimStart + claimDuration)
205+ let price = parseIntValue(cfgArray[IdxCfgPrice])
206+ let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult])
207+ let idoAssetId58 = cfgArray[IdxCfgIdoAssetId]
208+ let idoAssetId = fromBase58String(idoAssetId58)
209+ let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult])
210+ let priceAssetId58 = cfgArray[IdxCfgPriceAssetId]
211+ let priceAssetId = fromBase58String(priceAssetId58)
212+ let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult])
213+ let userAddress = i.caller
214+ let userAddress58 = toString(userAddress)
215+ let origInvestArray = readInvestorArrayOrFail(userAddress58)
216+ let investTotalAmount = parseIntValue(origInvestArray[IdxInvTotalAmount])
217+ let investLastClaimedHeight = parseIntValue(origInvestArray[IdxInvLastClaimedHeight])
218+ let newClaimPeriodHeight = if ((height > claimEnd))
219+ then claimEnd
220+ else height
221+ let claimingBlocks = (investLastClaimedHeight - newClaimPeriodHeight)
222+ let claimingPriceAssetAmount = fraction(investTotalAmount, claimingBlocks, claimDuration)
223+ let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset(claimingPriceAssetAmount, priceAssetMult, price, priceMult, idoAssetMult)
224+ let claimResultTuple = if ((claimedAssetId58 == priceAssetId58))
225+ then $Tuple3([0, -(claimingPriceAssetAmount), claimingPriceAssetAmount, 0], claimingPriceAssetAmount, priceAssetId)
226+ else if ((claimedAssetId58 == idoAssetId58))
227+ then $Tuple3([0, -(claimingPriceAssetAmount), 0, claimingIdoAssetAmount], claimingIdoAssetAmount, idoAssetId)
228+ else throw(("unsupported assetId: " + claimedAssetId58))
229+ let totalsDiff = claimResultTuple._1
230+ let outAmount = claimResultTuple._2
231+ let outAssetId = claimResultTuple._3
232+ let claimedPriceAmountFromDiff = totalsDiff[IdxDiffClaimedPriceAmountIncrement]
233+ let claimedIdoAssetAmountFromDiff = totalsDiff[IdxDiffClaimedIdoAssetAmountIncrement]
234+[ScriptTransfer(userAddress, outAmount, outAssetId), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight), ClaimOperationHistoryEntry(userAddress58, claimedPriceAmountFromDiff, claimedIdoAssetAmountFromDiff, i.transactionId)]
235+ }
236+
237+

github/deemru/w8io/169f3d6 
36.33 ms