tx · 6WfveioZGVFp9LTnGpAqsk6fXCC8y2nRSxH6EZqzE17o 3Mymo7ZEbRb9vk7gyvGf2YxuZefPifDkLU2: -0.00200000 Waves 2022.08.02 17:01 [2166961] smart account 3Mymo7ZEbRb9vk7gyvGf2YxuZefPifDkLU2 > SELF 0.00000000 Waves
{ "type": 13, "id": "6WfveioZGVFp9LTnGpAqsk6fXCC8y2nRSxH6EZqzE17o", "fee": 200000, "feeAssetId": null, "timestamp": 1659448890731, "version": 2, "chainId": 84, "sender": "3Mymo7ZEbRb9vk7gyvGf2YxuZefPifDkLU2", "senderPublicKey": "EjcAjdt1eYjgEGmawvybTReyRWZSdAuYk8MqZvJE5ydJ", "proofs": [ "27JfR9dnLvTXQtGnKGqKAjcz2vy6U2kJRqE4HbKo76HQ5EFB9Kgr9hrkHgNgcGhpdiRbXRegDjF1m3HtpGScByLu" ], "script": "base64:BgIRCAISBgoECAgICBIDCgEIEgALAAdrQ29tbW9uAgZjb21tb24ABWtSYXJlAgRyYXJlAAprTGVnZW5kYXJ5AglsZWdlbmRhcnkABmtQcmljZQIKcHJpY2VMZXZlcgAJc2VwYXJhdG9yAgF8AAljb3VudFJhcmUJAGQCAAEJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwUFa1JhcmUAAAALY291bnRDb21tb24JAGQCAAEJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwUHa0NvbW1vbgAAAA5jb3VudExlZ2VuZGFyeQkAZAIAAQkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQprTGVnZW5kYXJ5AAABCXJhbmRvbWl6ZQIFYnl0ZXMFcmFuZ2UEBGhhc2gJAPcDAQUFYnl0ZXMEBWluZGV4CQCxCQEFBGhhc2gJAGoCBQVpbmRleAUFcmFuZ2UBCmV4dHJhQ291bnQBBHJhcmUDCQAAAgUEcmFyZQUHa0NvbW1vbgkBDEludGVnZXJFbnRyeQIFB2tDb21tb24FC2NvdW50Q29tbW9uAwkAAAIFBH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XRpb25SYXJpdHkBCAUBaQ10cmFuc2FjdGlvbklkBApzdHJ1Y3RSYXJlCQEKZXh0cmFDb3VudAEFBnJhcml0eQkAzAgCBQpzdHJ1Y3RSYXJlCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgABCQDZBAEJAQt2YWx1ZU9yRWxzZQIJAJ0IAgUEdGhpcwkArAICCQCsAgIFBnJhcml0eQUJc2VwYXJhdG9yCQCkAwEJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwUGcmFyaXR5AAACDlN0b3JlIGlzIGVtcHR5BQNuaWwAsxUViA==", "height": 2166961, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let kCommon = "common" | |
5 | + | ||
6 | + | let kRare = "rare" | |
7 | + | ||
8 | + | let kLegendary = "legendary" | |
9 | + | ||
10 | + | let kPrice = "priceLever" | |
11 | + | ||
12 | + | let separator = "|" | |
13 | + | ||
14 | + | let countRare = (1 + valueOrElse(getInteger(this, kRare), 0)) | |
15 | + | ||
16 | + | let countCommon = (1 + valueOrElse(getInteger(this, kCommon), 0)) | |
17 | + | ||
18 | + | let countLegendary = (1 + valueOrElse(getInteger(this, kLegendary), 0)) | |
19 | + | ||
20 | + | func randomize (bytes,range) = { | |
21 | + | let hash = sha256(bytes) | |
22 | + | let index = toInt(hash) | |
23 | + | (index % range) | |
24 | + | } | |
25 | + | ||
26 | + | ||
27 | + | func extraCount (rare) = if ((rare == kCommon)) | |
28 | + | then IntegerEntry(kCommon, countCommon) | |
29 | + | else if ((rare == kRare)) | |
30 | + | then IntegerEntry(kRare, countCommon) | |
31 | + | else IntegerEntry(kLegendary, countLegendary) | |
32 | + | ||
33 | + | ||
34 | + | func calculationRarity (transactionId) = { | |
35 | + | let tokenRare = randomize(transactionId, 100) | |
36 | + | if ((5 >= tokenRare)) | |
37 | + | then kLegendary | |
38 | + | else if ((tokenRare >= 80)) | |
39 | + | then kRare | |
40 | + | else kCommon | |
41 | + | } | |
42 | + | ||
43 | + | ||
44 | + | @Callable(i) | |
45 | + | func issueNft (name,desc,rarity,prefix) = if ((i.caller != this)) | |
46 | + | then throw("Only owner") | |
47 | + | else { | |
48 | + | let newToken = Issue(name, desc, 1, 0, false) | |
49 | + | let issueId = calculateAssetId(newToken) | |
50 | + | [newToken, StringEntry(((rarity + separator) + prefix), toBase58String(issueId))] | |
51 | + | } | |
52 | + | ||
53 | + | ||
54 | + | ||
55 | + | @Callable(i) | |
56 | + | func setPrice (price) = if ((i.caller != this)) | |
57 | + | then throw("Only owner") | |
58 | + | else [StringEntry(kPrice, price)] | |
59 | + | ||
60 | + | ||
61 | + | ||
62 | + | @Callable(i) | |
63 | + | func pullTheLever () = { | |
64 | + | let amount = value(i.payments[0].amount) | |
65 | + | if ((i.payments[0].assetId != unit)) | |
66 | + | then throw("Pay in waves") | |
67 | + | else { | |
68 | + | let correctPrice = getIntegerValue(this, kPrice) | |
69 | + | if ((correctPrice > amount)) | |
70 | + | then throw("Payment amount < price") | |
71 | + | else { | |
72 | + | let rarity = calculationRarity(i.transactionId) | |
73 | + | let structRare = extraCount(rarity) | |
74 | + | [structRare, ScriptTransfer(i.caller, 1, fromBase58String(valueOrElse(getString(this, ((rarity + separator) + toString(valueOrElse(getInteger(this, rarity), 0)))), "Store is empty")))] | |
75 | + | } | |
76 | + | } | |
77 | + | } | |
78 | + | ||
79 | + |
github/deemru/w8io/169f3d6 22.76 ms ◑