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