tx · AKGttLNzSenSUFncf6Fvw7QtGpfed3SZdZLNMWcCH6B3 3N2PjXqef29HexCE7PeGZa9eRjS2jVeaFe4: -0.01700000 Waves 2023.09.15 11:17 [2756265] smart account 3N2PjXqef29HexCE7PeGZa9eRjS2jVeaFe4 > SELF 0.00000000 Waves
{ "type": 13, "id": "AKGttLNzSenSUFncf6Fvw7QtGpfed3SZdZLNMWcCH6B3", "fee": 1700000, "feeAssetId": null, "timestamp": 1694765822273, "version": 2, "chainId": 84, "sender": "3N2PjXqef29HexCE7PeGZa9eRjS2jVeaFe4", "senderPublicKey": "DU1U4j8FqHUMRr9WgfF3yo67ULEFkjp7dtMWMpjBK1ar", "proofs": [ "3YpZWbmrhfLXRhbmQBHL1pbAwQisyVTBzXRn8TNMNFo724JTkb7ZRf5wimoeWu2wz23gNoRv1F1B9AwFirBCtkyg", "5EzjU9oa4Du2WxUTZqYNGbrAzaUKhW4mC7gzZgkCHu2BErNY8Heg8xidSYywZVVMe1hYAAEg8qjNmN5umhnkBjZ7" ], "script": "base64:BgI0CAISABIDCgEIEgMKAQgSBwoFCAgICAESABIDCgEBEgASABIDCgEIEgUKAwgICBIAEgASACMABlNDQUxFOACAwtcvAA1QRVJDRU5UX1NDQUxFAJBOAAlTRVBBUkFUT1ICAl9fAAlrSW50ZXJlc3QCCGludGVyZXN0AA1rVXNlckludGVyZXN0Ag1fdXNlckludGVyZXN0AA5rVXNlckF2YWlsYWJsZQITX3VzZXJBdmFpbGFibGVDbGFpbQAQa1VzZXJUb2tlblN0YWtlZAIQX3VzZXJUb2tlblN0YWtlZAARa1RvdGFsVG9rZW5TdGFrZWQCEHRvdGFsVG9rZW5TdGFrZWQADGtORlRJbnRlcmVzdAILTkZUSW50ZXJlc3QAEGtORlRVc2VySW50ZXJlc3QCEF9ORlRVc2VySW50ZXJlc3QAFmtORlRVc2VyQXZhaWxhYmxlQ2xhaW0CFl9ORlRVc2VyQXZhaWxhYmxlQ2xhaW0AD2tORlRUb3RhbFN0YW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TFTaWduZWQFEmFkbWluUHViS2V5MlNpZ25lZAUSYWRtaW5QdWJLZXkzU2lnbmVkAAIEByRtYXRjaDAFAnR4AwkAAQIFByRtYXRjaDACF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBANpbnYFByRtYXRjaDAEBmlzU2VsZgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQQKaXNSaWdodEZlZQMJAAACCAUDaW52A2ZlZQCg9zYJAAACCAUDaW52CmZlZUFzc2V0SWQFBHVuaXQHBAppc0luaXRDYWxsCQAAAggFA2ludghmdW5jdGlvbgIEaW5pdAQMaXNub1BheW1lbnRzCQAAAgkAkAMBCAUDaW52CHBheW1lbnRzAAADAwMDBQppc1JpZ2h0RmVlBQppc0luaXRDYWxsBwUGaXNTZWxmBwUMaXNub1BheW1lbnRzBwYFE211bHRpU2lnbmVkQnlBZG1pbnMFE211bHRpU2lnbmVkQnlBZG1pbnOfdnTp", "height": 2756265, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4ipPRY1tfDjXYHf3RgACkpV6xWnLcAF4ihmfxhQifYmQ Next: 5dSyRTeK8fmHAMxrT2jEyWX8uJW41UvbJExcpAsUZGU4 Diff:
Old | New | Differences | |
---|---|---|---|
114 | 114 | } | |
115 | 115 | ||
116 | 116 | ||
117 | + | func getUserStakedNFT (user) = { | |
118 | + | func forNft (uNFT,nftId) = if (isDefined(getBoolean(this, (((user + "_") + nftId) + kuserNFTStakedId)))) | |
119 | + | then (uNFT :+ nftId) | |
120 | + | else uNFT | |
121 | + | ||
122 | + | let nftsStr = valueOrElse(getString(this, kNFTCreatedList), "") | |
123 | + | let nftList = if ((nftsStr == "")) | |
124 | + | then nil | |
125 | + | else split(nftsStr, SEPARATOR) | |
126 | + | let userNfts = { | |
127 | + | let $l = nftList | |
128 | + | let $s = size($l) | |
129 | + | let $acc0 = nil | |
130 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
131 | + | then $a | |
132 | + | else forNft($a, $l[$i]) | |
133 | + | ||
134 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
135 | + | then $a | |
136 | + | else throw("List size exceeds 5") | |
137 | + | ||
138 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
139 | + | } | |
140 | + | makeString(userNfts, ",") | |
141 | + | } | |
142 | + | ||
143 | + | ||
117 | 144 | @Callable(i) | |
118 | 145 | func getStatsREADONLY () = { | |
119 | 146 | let apr = calcTokenApr() | |
126 | 153 | ||
127 | 154 | @Callable(i) | |
128 | 155 | func getStatsByUserREADONLY (user) = { | |
129 | - | let $t039804579 = if ((user == "")) | |
130 | - | then $Tuple4(0, 0, 0, 0) | |
131 | - | else { | |
132 | - | let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address") | |
133 | - | let $t042174313 = claimCalc(user) | |
134 | - | let userNewInterest = $t042174313._1 | |
135 | - | let claimAmountAvailable = $t042174313._2 | |
136 | - | let userTokenStaked = $t042174313._3 | |
137 | - | let totalTokenStaked = $t042174313._4 | |
138 | - | let $t043204421 = claimCalcNft(user) | |
139 | - | let userNewInterestNFT = $t043204421._1 | |
140 | - | let claimAmountAvailableNFT = $t043204421._2 | |
141 | - | let userNFTStaked = $t043204421._3 | |
142 | - | let totalNFTStaked = $t043204421._4 | |
143 | - | let userBalance = assetBalance(userAddr, fromBase58String(tokenId)) | |
144 | - | $Tuple4(userBalance, userTokenStaked, claimAmountAvailable, claimAmountAvailableNFT) | |
145 | - | } | |
146 | - | let userTokenBalance = $t039804579._1 | |
147 | - | let userTokenStaked = $t039804579._2 | |
148 | - | let claimAmountAvailable = $t039804579._3 | |
149 | - | let claimAmountAvailableNFT = $t039804579._4 | |
150 | - | $Tuple2(nil, makeString(["%d%d%d%d", toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable), toString(claimAmountAvailableNFT)], SEPARATOR)) | |
156 | + | let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address") | |
157 | + | let $t044944590 = claimCalc(user) | |
158 | + | let userNewInterest = $t044944590._1 | |
159 | + | let claimAmountAvailable = $t044944590._2 | |
160 | + | let userTokenStaked = $t044944590._3 | |
161 | + | let totalTokenStaked = $t044944590._4 | |
162 | + | let $t045934694 = claimCalcNft(user) | |
163 | + | let userNewInterestNFT = $t045934694._1 | |
164 | + | let claimAmountAvailableNFT = $t045934694._2 | |
165 | + | let userNFTStaked = $t045934694._3 | |
166 | + | let totalNFTStaked = $t045934694._4 | |
167 | + | let userTokenBalance = assetBalance(userAddr, fromBase58String(tokenId)) | |
168 | + | let userNfts = getUserStakedNFT(user) | |
169 | + | $Tuple2(nil, makeString(["%d%d%d%d%s", toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable), toString(claimAmountAvailableNFT), userNfts], SEPARATOR)) | |
151 | 170 | } | |
152 | 171 | ||
153 | 172 | ||
155 | 174 | @Callable(i) | |
156 | 175 | func getUserStatsREADONLY (user) = { | |
157 | 176 | let apr = calcTokenApr() | |
158 | - | let $ | |
177 | + | let $t051395738 = if ((user == "")) | |
159 | 178 | then $Tuple4(0, 0, 0, 0) | |
160 | 179 | else { | |
161 | 180 | let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address") | |
162 | - | let $ | |
163 | - | let userNewInterest = $ | |
164 | - | let claimAmountAvailable = $ | |
165 | - | let userTokenStaked = $ | |
166 | - | let totalTokenStaked = $ | |
167 | - | let $ | |
168 | - | let userNewInterestNFT = $ | |
169 | - | let claimAmountAvailableNFT = $ | |
170 | - | let userNFTStaked = $ | |
171 | - | let totalNFTStaked = $ | |
181 | + | let $t053765472 = claimCalc(user) | |
182 | + | let userNewInterest = $t053765472._1 | |
183 | + | let claimAmountAvailable = $t053765472._2 | |
184 | + | let userTokenStaked = $t053765472._3 | |
185 | + | let totalTokenStaked = $t053765472._4 | |
186 | + | let $t054795580 = claimCalcNft(user) | |
187 | + | let userNewInterestNFT = $t054795580._1 | |
188 | + | let claimAmountAvailableNFT = $t054795580._2 | |
189 | + | let userNFTStaked = $t054795580._3 | |
190 | + | let totalNFTStaked = $t054795580._4 | |
172 | 191 | let userBalance = assetBalance(userAddr, fromBase58String(tokenId)) | |
173 | 192 | $Tuple4(userBalance, userTokenStaked, claimAmountAvailable, claimAmountAvailableNFT) | |
174 | 193 | } | |
175 | - | let userTokenBalance = $ | |
176 | - | let userTokenStaked = $ | |
177 | - | let claimAmountAvailable = $ | |
178 | - | let claimAmountAvailableNFT = $ | |
194 | + | let userTokenBalance = $t051395738._1 | |
195 | + | let userTokenStaked = $t051395738._2 | |
196 | + | let claimAmountAvailable = $t051395738._3 | |
197 | + | let claimAmountAvailableNFT = $t051395738._4 | |
179 | 198 | $Tuple2(nil, makeString(["%d%d%d%d%d", toString(apr), toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable), toString(claimAmountAvailableNFT)], SEPARATOR)) | |
180 | 199 | } | |
181 | 200 | ||
200 | 219 | func stake () = valueOrElse(isActive(), if ((size(i.payments) != 1)) | |
201 | 220 | then throw("One payment expected") | |
202 | 221 | else { | |
203 | - | let $ | |
204 | - | let pmtAmount = $ | |
205 | - | let pmtAssetId = $ | |
222 | + | let $t069417016 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
223 | + | let pmtAmount = $t069417016._1 | |
224 | + | let pmtAssetId = $t069417016._2 | |
206 | 225 | if ((pmtAssetId != fromBase58String(tokenId))) | |
207 | 226 | then throw("Wrong payment asset") | |
208 | 227 | else { | |
209 | 228 | let user = toString(i.caller) | |
210 | - | let $ | |
211 | - | let userNewInterest = $ | |
212 | - | let claimAmountAvailable = $ | |
213 | - | let userTokenStaked = $ | |
214 | - | let totalTokenStaked = $ | |
229 | + | let $t071377233 = claimCalc(user) | |
230 | + | let userNewInterest = $t071377233._1 | |
231 | + | let claimAmountAvailable = $t071377233._2 | |
232 | + | let userTokenStaked = $t071377233._3 | |
233 | + | let totalTokenStaked = $t071377233._4 | |
215 | 234 | [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked + pmtAmount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked + pmtAmount))] | |
216 | 235 | } | |
217 | 236 | }) | |
224 | 243 | if ((0 >= amount)) | |
225 | 244 | then throw("Amount must be greater than 0") | |
226 | 245 | else { | |
227 | - | let $ | |
228 | - | let userNewInterest = $ | |
229 | - | let claimAmountAvailable = $ | |
230 | - | let userTokenStaked = $ | |
231 | - | let totalTokenStaked = $ | |
246 | + | let $t076717767 = claimCalc(user) | |
247 | + | let userNewInterest = $t076717767._1 | |
248 | + | let claimAmountAvailable = $t076717767._2 | |
249 | + | let userTokenStaked = $t076717767._3 | |
250 | + | let totalTokenStaked = $t076717767._4 | |
232 | 251 | if ((amount > userTokenStaked)) | |
233 | 252 | then throw("You can't unstake more than staked") | |
234 | 253 | else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked - amount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked - amount)), ScriptTransfer(i.caller, amount, fromBase58String(tokenId))] | |
240 | 259 | @Callable(i) | |
241 | 260 | func claim () = valueOrElse(isActive(), { | |
242 | 261 | let user = toString(i.caller) | |
243 | - | let $ | |
244 | - | let userNewInterest = $ | |
245 | - | let claimAmountAvailable = $ | |
246 | - | let userTokenStaked = $ | |
247 | - | let totalTokenStaked = $ | |
248 | - | let $ | |
249 | - | let userNewInterestNFT = $ | |
250 | - | let claimAmountAvailableNFT = $ | |
251 | - | let userNFTStaked = $ | |
252 | - | let totalNFTStaked = $ | |
262 | + | let $t082738369 = claimCalc(user) | |
263 | + | let userNewInterest = $t082738369._1 | |
264 | + | let claimAmountAvailable = $t082738369._2 | |
265 | + | let userTokenStaked = $t082738369._3 | |
266 | + | let totalTokenStaked = $t082738369._4 | |
267 | + | let $t083728473 = claimCalcNft(user) | |
268 | + | let userNewInterestNFT = $t083728473._1 | |
269 | + | let claimAmountAvailableNFT = $t083728473._2 | |
270 | + | let userNFTStaked = $t083728473._3 | |
271 | + | let totalNFTStaked = $t083728473._4 | |
253 | 272 | if (((claimAmountAvailable + claimAmountAvailableNFT) == 0)) | |
254 | 273 | then throw("Nothing to claim") | |
255 | 274 | else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), 0), IntegerEntry((user + kNFTUserInterest), userNewInterestNFT), IntegerEntry((user + kNFTUserAvailableClaim), 0), ScriptTransfer(i.caller, (claimAmountAvailable + claimAmountAvailableNFT), fromBase58String(tokenId))] | |
261 | 280 | func stakeNFT () = valueOrElse(isActive(), if ((size(i.payments) != 1)) | |
262 | 281 | then throw("One payment expected") | |
263 | 282 | else { | |
264 | - | let $ | |
265 | - | let pmtAmount = $ | |
266 | - | let pmtAssetId = $ | |
283 | + | let $t090299104 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
284 | + | let pmtAmount = $t090299104._1 | |
285 | + | let pmtAssetId = $t090299104._2 | |
267 | 286 | let pmtAssetIdStr = assetIdToStr(pmtAssetId) | |
268 | 287 | if (!(isDefined(getString(this, (pmtAssetIdStr + kNFTCreated))))) | |
269 | 288 | then throw("Wrong nft asset") | |
270 | 289 | else { | |
271 | 290 | let user = toString(i.caller) | |
272 | - | let $ | |
273 | - | let userNewInterest = $ | |
274 | - | let claimAmountAvailable = $ | |
275 | - | let userNFTStaked = $ | |
276 | - | let totalNFTStaked = $ | |
291 | + | let $t092859380 = claimCalcNft(user) | |
292 | + | let userNewInterest = $t092859380._1 | |
293 | + | let claimAmountAvailable = $t092859380._2 | |
294 | + | let userNFTStaked = $t092859380._3 | |
295 | + | let totalNFTStaked = $t092859380._4 | |
277 | 296 | [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked + 1)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked + 1)), BooleanEntry((((user + "_") + pmtAssetIdStr) + kuserNFTStakedId), true)] | |
278 | 297 | } | |
279 | 298 | }) | |
286 | 305 | if (isDefined(getBoolean(this, (((user + "_") + id) + kuserNFTStakedId)))) | |
287 | 306 | then throw("You didn't staked") | |
288 | 307 | else { | |
289 | - | let $ | |
290 | - | let userNewInterest = $ | |
291 | - | let claimAmountAvailable = $ | |
292 | - | let userNFTStaked = $ | |
293 | - | let totalNFTStaked = $ | |
308 | + | let $t0991710012 = claimCalcNft(user) | |
309 | + | let userNewInterest = $t0991710012._1 | |
310 | + | let claimAmountAvailable = $t0991710012._2 | |
311 | + | let userNFTStaked = $t0991710012._3 | |
312 | + | let totalNFTStaked = $t0991710012._4 | |
294 | 313 | [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked - 1)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked - 1)), DeleteEntry((((user + "_") + id) + kuserNFTStakedId)), ScriptTransfer(i.caller, 1, fromBase58String(id))] | |
295 | 314 | } | |
296 | 315 | }) | |
315 | 334 | func airdrop () = valueOrElse(isActive(), valueOrElse(isAdminCall(i), if ((size(i.payments) != 1)) | |
316 | 335 | then throw("One payment expected") | |
317 | 336 | else { | |
318 | - | let $ | |
319 | - | let pmtAmount = $ | |
320 | - | let pmtAssetId = $ | |
337 | + | let $t01118211257 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
338 | + | let pmtAmount = $t01118211257._1 | |
339 | + | let pmtAssetId = $t01118211257._2 | |
321 | 340 | if ((pmtAssetId != fromBase58String(tokenId))) | |
322 | 341 | then throw("Wrong payment asset") | |
323 | 342 | else { | |
326 | 345 | let totalNFTStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0) | |
327 | 346 | let curInterest = valueOrElse(getInteger(this, kInterest), 0) | |
328 | 347 | let curNFTInterest = valueOrElse(getInteger(this, kNFTInterest), 0) | |
329 | - | let $ | |
348 | + | let $t01168011884 = if ((totalNFTStaked == 0)) | |
330 | 349 | then $Tuple2(0, pmtAmount) | |
331 | 350 | else { | |
332 | 351 | let nftP = fraction(pmtAmount, min([percentForNFT, (totalNFTStaked * 10)]), 100) | |
333 | 352 | $Tuple2(nftP, (pmtAmount - nftP)) | |
334 | 353 | } | |
335 | - | let pmtNFT = $ | |
336 | - | let pmtToken = $ | |
354 | + | let pmtNFT = $t01168011884._1 | |
355 | + | let pmtToken = $t01168011884._2 | |
337 | 356 | let interestNew = if ((totalTokenStaked > 0)) | |
338 | 357 | then (curInterest + fraction(pmtToken, SCALE8, totalTokenStaked)) | |
339 | 358 | else curInterest |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 100000000 | |
5 | 5 | ||
6 | 6 | let PERCENT_SCALE = 10000 | |
7 | 7 | ||
8 | 8 | let SEPARATOR = "__" | |
9 | 9 | ||
10 | 10 | let kInterest = "interest" | |
11 | 11 | ||
12 | 12 | let kUserInterest = "_userInterest" | |
13 | 13 | ||
14 | 14 | let kUserAvailable = "_userAvailableClaim" | |
15 | 15 | ||
16 | 16 | let kUserTokenStaked = "_userTokenStaked" | |
17 | 17 | ||
18 | 18 | let kTotalTokenStaked = "totalTokenStaked" | |
19 | 19 | ||
20 | 20 | let kNFTInterest = "NFTInterest" | |
21 | 21 | ||
22 | 22 | let kNFTUserInterest = "_NFTUserInterest" | |
23 | 23 | ||
24 | 24 | let kNFTUserAvailableClaim = "_NFTUserAvailableClaim" | |
25 | 25 | ||
26 | 26 | let kNFTTotalStaked = "NFTTotalStaked" | |
27 | 27 | ||
28 | 28 | let kuserNFTStaked = "_userNFTStaked" | |
29 | 29 | ||
30 | 30 | let kuserNFTStakedId = "_userNFTStakedId" | |
31 | 31 | ||
32 | 32 | let kNFTCreated = "_NFTCreated" | |
33 | 33 | ||
34 | 34 | let kLastAirdrop = "_lastAirdrop" | |
35 | 35 | ||
36 | 36 | let kTokenid = "tokenId" | |
37 | 37 | ||
38 | 38 | let kPersentForNFT = "percentForNFT" | |
39 | 39 | ||
40 | 40 | let kNFTCreatedList = "nftCreatedList" | |
41 | 41 | ||
42 | 42 | let kActive = "active" | |
43 | 43 | ||
44 | 44 | let kAdmin1PK = "admin_pub_1" | |
45 | 45 | ||
46 | 46 | let kAdmin2PK = "admin_pub_2" | |
47 | 47 | ||
48 | 48 | let kAdmin3PK = "admin_pub_3" | |
49 | 49 | ||
50 | 50 | let admin1PK = fromBase58String(valueOrErrorMessage(getString(this, kAdmin1PK), "Can't get admin1PK")) | |
51 | 51 | ||
52 | 52 | let admin2PK = fromBase58String(valueOrErrorMessage(getString(this, kAdmin2PK), "Can't get admin2PK")) | |
53 | 53 | ||
54 | 54 | let admin3PK = fromBase58String(valueOrErrorMessage(getString(this, kAdmin3PK), "Can't get operatorPK")) | |
55 | 55 | ||
56 | 56 | let tokenId = valueOrErrorMessage(getString(this, kTokenid), "Can't get staking token") | |
57 | 57 | ||
58 | 58 | func isAdminCall (i) = if (containsElement([admin1PK, admin2PK, admin3PK], i.callerPublicKey)) | |
59 | 59 | then unit | |
60 | 60 | else throw("Only admin can call this function") | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func isSelfCall (i) = if ((i.caller == this)) | |
64 | 64 | then unit | |
65 | 65 | else throw("Only contract itself can call this function") | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func isActive () = if (valueOrElse(getBoolean(this, kActive), true)) | |
69 | 69 | then unit | |
70 | 70 | else throw("DApp is inactive at this moment") | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func assetIdToStr (assetId) = match assetId { | |
74 | 74 | case id: ByteVector => | |
75 | 75 | toBase58String(id) | |
76 | 76 | case waves: Unit => | |
77 | 77 | "WAVES" | |
78 | 78 | case _ => | |
79 | 79 | throw("Not Asset id") | |
80 | 80 | } | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func claimCalc (user) = { | |
84 | 84 | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
85 | 85 | let curInterest = valueOrElse(getInteger(this, kInterest), 0) | |
86 | 86 | let availableForClaim = valueOrElse(getInteger(this, (user + kUserAvailable)), 0) | |
87 | 87 | let userInterest = valueOrElse(getInteger(this, (user + kUserInterest)), curInterest) | |
88 | 88 | let userTokenStaked = valueOrElse(getInteger(this, (user + kUserTokenStaked)), 0) | |
89 | 89 | let claimAmount = fraction(userTokenStaked, (curInterest - userInterest), SCALE8) | |
90 | 90 | $Tuple4(curInterest, (claimAmount + availableForClaim), userTokenStaked, totalTokenStaked) | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func claimCalcNft (user) = { | |
95 | 95 | let totalNftStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0) | |
96 | 96 | let curInterest = valueOrElse(getInteger(this, kNFTInterest), 0) | |
97 | 97 | let availableForClaim = valueOrElse(getInteger(this, (user + kNFTUserAvailableClaim)), 0) | |
98 | 98 | let userInterest = valueOrElse(getInteger(this, (user + kNFTUserInterest)), curInterest) | |
99 | 99 | let userNftStaked = valueOrElse(getInteger(this, (user + kuserNFTStaked)), 0) | |
100 | 100 | let claimAmount = (userNftStaked * (curInterest - userInterest)) | |
101 | 101 | $Tuple4(curInterest, (claimAmount + availableForClaim), userNftStaked, totalNftStaked) | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func calcTokenApr () = { | |
106 | 106 | let lastAirdrop = valueOrElse(getInteger(this, kLastAirdrop), 0) | |
107 | 107 | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
108 | 108 | let totalNFTStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0) | |
109 | 109 | let percentForNFT = getIntegerValue(this, kPersentForNFT) | |
110 | 110 | let tokenAirdrop = if ((totalNFTStaked == 0)) | |
111 | 111 | then lastAirdrop | |
112 | 112 | else fraction(lastAirdrop, min([percentForNFT, (totalNFTStaked * 10)]), 100) | |
113 | 113 | (fraction(tokenAirdrop, PERCENT_SCALE, totalTokenStaked) * 52) | |
114 | 114 | } | |
115 | 115 | ||
116 | 116 | ||
117 | + | func getUserStakedNFT (user) = { | |
118 | + | func forNft (uNFT,nftId) = if (isDefined(getBoolean(this, (((user + "_") + nftId) + kuserNFTStakedId)))) | |
119 | + | then (uNFT :+ nftId) | |
120 | + | else uNFT | |
121 | + | ||
122 | + | let nftsStr = valueOrElse(getString(this, kNFTCreatedList), "") | |
123 | + | let nftList = if ((nftsStr == "")) | |
124 | + | then nil | |
125 | + | else split(nftsStr, SEPARATOR) | |
126 | + | let userNfts = { | |
127 | + | let $l = nftList | |
128 | + | let $s = size($l) | |
129 | + | let $acc0 = nil | |
130 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
131 | + | then $a | |
132 | + | else forNft($a, $l[$i]) | |
133 | + | ||
134 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
135 | + | then $a | |
136 | + | else throw("List size exceeds 5") | |
137 | + | ||
138 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
139 | + | } | |
140 | + | makeString(userNfts, ",") | |
141 | + | } | |
142 | + | ||
143 | + | ||
117 | 144 | @Callable(i) | |
118 | 145 | func getStatsREADONLY () = { | |
119 | 146 | let apr = calcTokenApr() | |
120 | 147 | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
121 | 148 | let totalNftStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0) | |
122 | 149 | $Tuple2(nil, makeString(["%d%d%d", toString(apr), toString(totalTokenStaked), toString(totalNftStaked)], SEPARATOR)) | |
123 | 150 | } | |
124 | 151 | ||
125 | 152 | ||
126 | 153 | ||
127 | 154 | @Callable(i) | |
128 | 155 | func getStatsByUserREADONLY (user) = { | |
129 | - | let $t039804579 = if ((user == "")) | |
130 | - | then $Tuple4(0, 0, 0, 0) | |
131 | - | else { | |
132 | - | let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address") | |
133 | - | let $t042174313 = claimCalc(user) | |
134 | - | let userNewInterest = $t042174313._1 | |
135 | - | let claimAmountAvailable = $t042174313._2 | |
136 | - | let userTokenStaked = $t042174313._3 | |
137 | - | let totalTokenStaked = $t042174313._4 | |
138 | - | let $t043204421 = claimCalcNft(user) | |
139 | - | let userNewInterestNFT = $t043204421._1 | |
140 | - | let claimAmountAvailableNFT = $t043204421._2 | |
141 | - | let userNFTStaked = $t043204421._3 | |
142 | - | let totalNFTStaked = $t043204421._4 | |
143 | - | let userBalance = assetBalance(userAddr, fromBase58String(tokenId)) | |
144 | - | $Tuple4(userBalance, userTokenStaked, claimAmountAvailable, claimAmountAvailableNFT) | |
145 | - | } | |
146 | - | let userTokenBalance = $t039804579._1 | |
147 | - | let userTokenStaked = $t039804579._2 | |
148 | - | let claimAmountAvailable = $t039804579._3 | |
149 | - | let claimAmountAvailableNFT = $t039804579._4 | |
150 | - | $Tuple2(nil, makeString(["%d%d%d%d", toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable), toString(claimAmountAvailableNFT)], SEPARATOR)) | |
156 | + | let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address") | |
157 | + | let $t044944590 = claimCalc(user) | |
158 | + | let userNewInterest = $t044944590._1 | |
159 | + | let claimAmountAvailable = $t044944590._2 | |
160 | + | let userTokenStaked = $t044944590._3 | |
161 | + | let totalTokenStaked = $t044944590._4 | |
162 | + | let $t045934694 = claimCalcNft(user) | |
163 | + | let userNewInterestNFT = $t045934694._1 | |
164 | + | let claimAmountAvailableNFT = $t045934694._2 | |
165 | + | let userNFTStaked = $t045934694._3 | |
166 | + | let totalNFTStaked = $t045934694._4 | |
167 | + | let userTokenBalance = assetBalance(userAddr, fromBase58String(tokenId)) | |
168 | + | let userNfts = getUserStakedNFT(user) | |
169 | + | $Tuple2(nil, makeString(["%d%d%d%d%s", toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable), toString(claimAmountAvailableNFT), userNfts], SEPARATOR)) | |
151 | 170 | } | |
152 | 171 | ||
153 | 172 | ||
154 | 173 | ||
155 | 174 | @Callable(i) | |
156 | 175 | func getUserStatsREADONLY (user) = { | |
157 | 176 | let apr = calcTokenApr() | |
158 | - | let $ | |
177 | + | let $t051395738 = if ((user == "")) | |
159 | 178 | then $Tuple4(0, 0, 0, 0) | |
160 | 179 | else { | |
161 | 180 | let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address") | |
162 | - | let $ | |
163 | - | let userNewInterest = $ | |
164 | - | let claimAmountAvailable = $ | |
165 | - | let userTokenStaked = $ | |
166 | - | let totalTokenStaked = $ | |
167 | - | let $ | |
168 | - | let userNewInterestNFT = $ | |
169 | - | let claimAmountAvailableNFT = $ | |
170 | - | let userNFTStaked = $ | |
171 | - | let totalNFTStaked = $ | |
181 | + | let $t053765472 = claimCalc(user) | |
182 | + | let userNewInterest = $t053765472._1 | |
183 | + | let claimAmountAvailable = $t053765472._2 | |
184 | + | let userTokenStaked = $t053765472._3 | |
185 | + | let totalTokenStaked = $t053765472._4 | |
186 | + | let $t054795580 = claimCalcNft(user) | |
187 | + | let userNewInterestNFT = $t054795580._1 | |
188 | + | let claimAmountAvailableNFT = $t054795580._2 | |
189 | + | let userNFTStaked = $t054795580._3 | |
190 | + | let totalNFTStaked = $t054795580._4 | |
172 | 191 | let userBalance = assetBalance(userAddr, fromBase58String(tokenId)) | |
173 | 192 | $Tuple4(userBalance, userTokenStaked, claimAmountAvailable, claimAmountAvailableNFT) | |
174 | 193 | } | |
175 | - | let userTokenBalance = $ | |
176 | - | let userTokenStaked = $ | |
177 | - | let claimAmountAvailable = $ | |
178 | - | let claimAmountAvailableNFT = $ | |
194 | + | let userTokenBalance = $t051395738._1 | |
195 | + | let userTokenStaked = $t051395738._2 | |
196 | + | let claimAmountAvailable = $t051395738._3 | |
197 | + | let claimAmountAvailableNFT = $t051395738._4 | |
179 | 198 | $Tuple2(nil, makeString(["%d%d%d%d%d", toString(apr), toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable), toString(claimAmountAvailableNFT)], SEPARATOR)) | |
180 | 199 | } | |
181 | 200 | ||
182 | 201 | ||
183 | 202 | ||
184 | 203 | @Callable(i) | |
185 | 204 | func init (tokenId,adm1Pub,adm2Pub,adm3Pub,toNFTPercent) = valueOrElse(isSelfCall(i), if (isDefined(getString(this, kTokenid))) | |
186 | 205 | then throw("DApp already inited") | |
187 | 206 | else if (!(isDefined(assetInfo(fromBase58String(tokenId))))) | |
188 | 207 | then throw("asset id is not correct asset id") | |
189 | 208 | else if ((size(fromBase58String(adm1Pub)) != 32)) | |
190 | 209 | then throw("group1Admin1PubKey is not correct") | |
191 | 210 | else if ((size(fromBase58String(adm2Pub)) != 32)) | |
192 | 211 | then throw("group1Admin1PubKey is not correct") | |
193 | 212 | else if ((size(fromBase58String(adm3Pub)) != 32)) | |
194 | 213 | then throw("group1Admin1PubKey is not correct") | |
195 | 214 | else [StringEntry(kTokenid, tokenId), StringEntry(kAdmin1PK, adm1Pub), StringEntry(kAdmin2PK, adm2Pub), StringEntry(kAdmin3PK, adm3Pub), IntegerEntry(kPersentForNFT, toNFTPercent)]) | |
196 | 215 | ||
197 | 216 | ||
198 | 217 | ||
199 | 218 | @Callable(i) | |
200 | 219 | func stake () = valueOrElse(isActive(), if ((size(i.payments) != 1)) | |
201 | 220 | then throw("One payment expected") | |
202 | 221 | else { | |
203 | - | let $ | |
204 | - | let pmtAmount = $ | |
205 | - | let pmtAssetId = $ | |
222 | + | let $t069417016 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
223 | + | let pmtAmount = $t069417016._1 | |
224 | + | let pmtAssetId = $t069417016._2 | |
206 | 225 | if ((pmtAssetId != fromBase58String(tokenId))) | |
207 | 226 | then throw("Wrong payment asset") | |
208 | 227 | else { | |
209 | 228 | let user = toString(i.caller) | |
210 | - | let $ | |
211 | - | let userNewInterest = $ | |
212 | - | let claimAmountAvailable = $ | |
213 | - | let userTokenStaked = $ | |
214 | - | let totalTokenStaked = $ | |
229 | + | let $t071377233 = claimCalc(user) | |
230 | + | let userNewInterest = $t071377233._1 | |
231 | + | let claimAmountAvailable = $t071377233._2 | |
232 | + | let userTokenStaked = $t071377233._3 | |
233 | + | let totalTokenStaked = $t071377233._4 | |
215 | 234 | [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked + pmtAmount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked + pmtAmount))] | |
216 | 235 | } | |
217 | 236 | }) | |
218 | 237 | ||
219 | 238 | ||
220 | 239 | ||
221 | 240 | @Callable(i) | |
222 | 241 | func unstake (amount) = valueOrElse(isActive(), { | |
223 | 242 | let user = toString(i.caller) | |
224 | 243 | if ((0 >= amount)) | |
225 | 244 | then throw("Amount must be greater than 0") | |
226 | 245 | else { | |
227 | - | let $ | |
228 | - | let userNewInterest = $ | |
229 | - | let claimAmountAvailable = $ | |
230 | - | let userTokenStaked = $ | |
231 | - | let totalTokenStaked = $ | |
246 | + | let $t076717767 = claimCalc(user) | |
247 | + | let userNewInterest = $t076717767._1 | |
248 | + | let claimAmountAvailable = $t076717767._2 | |
249 | + | let userTokenStaked = $t076717767._3 | |
250 | + | let totalTokenStaked = $t076717767._4 | |
232 | 251 | if ((amount > userTokenStaked)) | |
233 | 252 | then throw("You can't unstake more than staked") | |
234 | 253 | else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked - amount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked - amount)), ScriptTransfer(i.caller, amount, fromBase58String(tokenId))] | |
235 | 254 | } | |
236 | 255 | }) | |
237 | 256 | ||
238 | 257 | ||
239 | 258 | ||
240 | 259 | @Callable(i) | |
241 | 260 | func claim () = valueOrElse(isActive(), { | |
242 | 261 | let user = toString(i.caller) | |
243 | - | let $ | |
244 | - | let userNewInterest = $ | |
245 | - | let claimAmountAvailable = $ | |
246 | - | let userTokenStaked = $ | |
247 | - | let totalTokenStaked = $ | |
248 | - | let $ | |
249 | - | let userNewInterestNFT = $ | |
250 | - | let claimAmountAvailableNFT = $ | |
251 | - | let userNFTStaked = $ | |
252 | - | let totalNFTStaked = $ | |
262 | + | let $t082738369 = claimCalc(user) | |
263 | + | let userNewInterest = $t082738369._1 | |
264 | + | let claimAmountAvailable = $t082738369._2 | |
265 | + | let userTokenStaked = $t082738369._3 | |
266 | + | let totalTokenStaked = $t082738369._4 | |
267 | + | let $t083728473 = claimCalcNft(user) | |
268 | + | let userNewInterestNFT = $t083728473._1 | |
269 | + | let claimAmountAvailableNFT = $t083728473._2 | |
270 | + | let userNFTStaked = $t083728473._3 | |
271 | + | let totalNFTStaked = $t083728473._4 | |
253 | 272 | if (((claimAmountAvailable + claimAmountAvailableNFT) == 0)) | |
254 | 273 | then throw("Nothing to claim") | |
255 | 274 | else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), 0), IntegerEntry((user + kNFTUserInterest), userNewInterestNFT), IntegerEntry((user + kNFTUserAvailableClaim), 0), ScriptTransfer(i.caller, (claimAmountAvailable + claimAmountAvailableNFT), fromBase58String(tokenId))] | |
256 | 275 | }) | |
257 | 276 | ||
258 | 277 | ||
259 | 278 | ||
260 | 279 | @Callable(i) | |
261 | 280 | func stakeNFT () = valueOrElse(isActive(), if ((size(i.payments) != 1)) | |
262 | 281 | then throw("One payment expected") | |
263 | 282 | else { | |
264 | - | let $ | |
265 | - | let pmtAmount = $ | |
266 | - | let pmtAssetId = $ | |
283 | + | let $t090299104 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
284 | + | let pmtAmount = $t090299104._1 | |
285 | + | let pmtAssetId = $t090299104._2 | |
267 | 286 | let pmtAssetIdStr = assetIdToStr(pmtAssetId) | |
268 | 287 | if (!(isDefined(getString(this, (pmtAssetIdStr + kNFTCreated))))) | |
269 | 288 | then throw("Wrong nft asset") | |
270 | 289 | else { | |
271 | 290 | let user = toString(i.caller) | |
272 | - | let $ | |
273 | - | let userNewInterest = $ | |
274 | - | let claimAmountAvailable = $ | |
275 | - | let userNFTStaked = $ | |
276 | - | let totalNFTStaked = $ | |
291 | + | let $t092859380 = claimCalcNft(user) | |
292 | + | let userNewInterest = $t092859380._1 | |
293 | + | let claimAmountAvailable = $t092859380._2 | |
294 | + | let userNFTStaked = $t092859380._3 | |
295 | + | let totalNFTStaked = $t092859380._4 | |
277 | 296 | [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked + 1)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked + 1)), BooleanEntry((((user + "_") + pmtAssetIdStr) + kuserNFTStakedId), true)] | |
278 | 297 | } | |
279 | 298 | }) | |
280 | 299 | ||
281 | 300 | ||
282 | 301 | ||
283 | 302 | @Callable(i) | |
284 | 303 | func unstakeNFT (id) = valueOrElse(isActive(), { | |
285 | 304 | let user = toString(i.caller) | |
286 | 305 | if (isDefined(getBoolean(this, (((user + "_") + id) + kuserNFTStakedId)))) | |
287 | 306 | then throw("You didn't staked") | |
288 | 307 | else { | |
289 | - | let $ | |
290 | - | let userNewInterest = $ | |
291 | - | let claimAmountAvailable = $ | |
292 | - | let userNFTStaked = $ | |
293 | - | let totalNFTStaked = $ | |
308 | + | let $t0991710012 = claimCalcNft(user) | |
309 | + | let userNewInterest = $t0991710012._1 | |
310 | + | let claimAmountAvailable = $t0991710012._2 | |
311 | + | let userNFTStaked = $t0991710012._3 | |
312 | + | let totalNFTStaked = $t0991710012._4 | |
294 | 313 | [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked - 1)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked - 1)), DeleteEntry((((user + "_") + id) + kuserNFTStakedId)), ScriptTransfer(i.caller, 1, fromBase58String(id))] | |
295 | 314 | } | |
296 | 315 | }) | |
297 | 316 | ||
298 | 317 | ||
299 | 318 | ||
300 | 319 | @Callable(i) | |
301 | 320 | func issueNFT (userAddr,name,descr) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), { | |
302 | 321 | let uAddr = valueOrErrorMessage(addressFromString(userAddr), "Wrong user address") | |
303 | 322 | let issue = Issue(name, descr, 1, 0, false) | |
304 | 323 | let nftId = calculateAssetId(issue) | |
305 | 324 | let nftList = valueOrElse(getString(this, kNFTCreatedList), "") | |
306 | 325 | let newNftList = (nftList + (if ((nftList != "")) | |
307 | 326 | then (SEPARATOR + toBase58String(nftId)) | |
308 | 327 | else ("" + toBase58String(nftId)))) | |
309 | 328 | [issue, StringEntry((toBase58String(nftId) + kNFTCreated), userAddr), StringEntry(kNFTCreatedList, newNftList), ScriptTransfer(uAddr, 1, nftId)] | |
310 | 329 | })) | |
311 | 330 | ||
312 | 331 | ||
313 | 332 | ||
314 | 333 | @Callable(i) | |
315 | 334 | func airdrop () = valueOrElse(isActive(), valueOrElse(isAdminCall(i), if ((size(i.payments) != 1)) | |
316 | 335 | then throw("One payment expected") | |
317 | 336 | else { | |
318 | - | let $ | |
319 | - | let pmtAmount = $ | |
320 | - | let pmtAssetId = $ | |
337 | + | let $t01118211257 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
338 | + | let pmtAmount = $t01118211257._1 | |
339 | + | let pmtAssetId = $t01118211257._2 | |
321 | 340 | if ((pmtAssetId != fromBase58String(tokenId))) | |
322 | 341 | then throw("Wrong payment asset") | |
323 | 342 | else { | |
324 | 343 | let percentForNFT = getIntegerValue(this, kPersentForNFT) | |
325 | 344 | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
326 | 345 | let totalNFTStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0) | |
327 | 346 | let curInterest = valueOrElse(getInteger(this, kInterest), 0) | |
328 | 347 | let curNFTInterest = valueOrElse(getInteger(this, kNFTInterest), 0) | |
329 | - | let $ | |
348 | + | let $t01168011884 = if ((totalNFTStaked == 0)) | |
330 | 349 | then $Tuple2(0, pmtAmount) | |
331 | 350 | else { | |
332 | 351 | let nftP = fraction(pmtAmount, min([percentForNFT, (totalNFTStaked * 10)]), 100) | |
333 | 352 | $Tuple2(nftP, (pmtAmount - nftP)) | |
334 | 353 | } | |
335 | - | let pmtNFT = $ | |
336 | - | let pmtToken = $ | |
354 | + | let pmtNFT = $t01168011884._1 | |
355 | + | let pmtToken = $t01168011884._2 | |
337 | 356 | let interestNew = if ((totalTokenStaked > 0)) | |
338 | 357 | then (curInterest + fraction(pmtToken, SCALE8, totalTokenStaked)) | |
339 | 358 | else curInterest | |
340 | 359 | let interestNFTNew = if ((totalNFTStaked > 0)) | |
341 | 360 | then (curNFTInterest + (pmtNFT / totalNFTStaked)) | |
342 | 361 | else curNFTInterest | |
343 | 362 | [IntegerEntry(kInterest, interestNew), IntegerEntry(kNFTInterest, interestNFTNew), IntegerEntry(kLastAirdrop, pmtAmount)] | |
344 | 363 | } | |
345 | 364 | })) | |
346 | 365 | ||
347 | 366 | ||
348 | 367 | ||
349 | 368 | @Callable(i) | |
350 | 369 | func activate () = valueOrElse(isAdminCall(i), if (valueOrElse(getBoolean(this, kActive), true)) | |
351 | 370 | then throw("dApp already active") | |
352 | 371 | else [BooleanEntry(kActive, true)]) | |
353 | 372 | ||
354 | 373 | ||
355 | 374 | ||
356 | 375 | @Callable(i) | |
357 | 376 | func shutdown () = valueOrElse(isAdminCall(i), if (!(valueOrElse(getBoolean(this, kActive), true))) | |
358 | 377 | then throw("dApp already shutdown") | |
359 | 378 | else [BooleanEntry(kActive, false)]) | |
360 | 379 | ||
361 | 380 | ||
362 | 381 | @Verifier(tx) | |
363 | 382 | func verify () = { | |
364 | 383 | let multiSignedByAdmins = { | |
365 | 384 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin1PK)) | |
366 | 385 | then 1 | |
367 | 386 | else 0 | |
368 | 387 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], admin2PK)) | |
369 | 388 | then 1 | |
370 | 389 | else 0 | |
371 | 390 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], admin3PK)) | |
372 | 391 | then 1 | |
373 | 392 | else 0 | |
374 | 393 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
375 | 394 | } | |
376 | 395 | match tx { | |
377 | 396 | case inv: InvokeScriptTransaction => | |
378 | 397 | let isSelf = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
379 | 398 | let isRightFee = if ((inv.fee == 900000)) | |
380 | 399 | then (inv.feeAssetId == unit) | |
381 | 400 | else false | |
382 | 401 | let isInitCall = (inv.function == "init") | |
383 | 402 | let isnoPayments = (size(inv.payments) == 0) | |
384 | 403 | if (if (if (if (isRightFee) | |
385 | 404 | then isInitCall | |
386 | 405 | else false) | |
387 | 406 | then isSelf | |
388 | 407 | else false) | |
389 | 408 | then isnoPayments | |
390 | 409 | else false) | |
391 | 410 | then true | |
392 | 411 | else multiSignedByAdmins | |
393 | 412 | case _ => | |
394 | 413 | multiSignedByAdmins | |
395 | 414 | } | |
396 | 415 | } | |
397 | 416 |
github/deemru/w8io/026f985 67.19 ms ◑