tx · 4yKh41bfZY9LEjr5AyUphWkyfr6aBDLq9vStNrCcqp2g 3NCz3oCc3PNdauKDJEiPLzQwpBXXYEBc9p2: -0.00200000 Waves 2022.08.02 16:31 [2166927] smart account 3NCz3oCc3PNdauKDJEiPLzQwpBXXYEBc9p2 > SELF 0.00000000 Waves
{ "type": 13, "id": "4yKh41bfZY9LEjr5AyUphWkyfr6aBDLq9vStNrCcqp2g", "fee": 200000, "feeAssetId": null, "timestamp": 1659447121888, "version": 2, "chainId": 84, "sender": "3NCz3oCc3PNdauKDJEiPLzQwpBXXYEBc9p2", "senderPublicKey": "3rvQsNbK5fc274oTJXxit5LUfVpNUHyPrKiaJZbmJ7zx", "proofs": [ "jLAYBirSDainPanX6vJ2o7HR7SzJkPvX26BQjodALCsJQ5M5gFLVXqii2eW4BSZnEqM9YBiWrB7wR2CVY83XHXK" ], "script": "base64:BgIRCAISBgoECAgICBIDCgEIEgALAAdrQ29tbW9uAgZjb21tb24ABWtSYXJlAgRyYXJlAAprTGVnZW5kYXJ5AglsZWdlbmRhcnkABmtQcmljZQIKcHJpY2VMZXZlcgAJc2VwYXJhdG9yAgF8AAljb3VudFJhcmUJAGQCAAEJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwUFa1JhcmUAAAALY291bnRDb21tb24JAGQCAAEJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwUHa0NvbW1vbgAAAA5jb3VudExlZ2VuZGFyeQkAZAIAAQkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQprTGVnZW5kYXJ5AAABCXJhbmRvbWl6ZQIFYnl0ZXMFcmFuZ2UEBGhhc2gJAPcDAQUFYnl0ZXMEBWluZGV4CQCxCQEFBGhhc2gJAGoCBQVpbmRleAUFcmFuZ2UBCmV4dHJhQ291bnQBBHJhcmUDCQAAAgUEcmFyZQUHa0NvbW1vbgkBDEludGVnZXJFbnRyeQIFB2tDb21tb24FC2NvdW50Q29tbW9uAwkAAAIFBHJhcmU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ev: 4NvqBe7vFzRNwqz3w9Fwsc17AhS8bfdDutudKtaYHh8m Next: A7bCLTsaGz19v4jx9BLGonAUPP5cuSo53tFQHEz4SVje Diff:
Old | New | Differences | |
---|---|---|---|
11 | 11 | ||
12 | 12 | let separator = "|" | |
13 | 13 | ||
14 | - | let kActive = "active" | |
15 | - | ||
16 | - | let active = getBooleanValue(this, kActive) | |
17 | - | ||
18 | 14 | let countRare = (1 + valueOrElse(getInteger(this, kRare), 0)) | |
19 | 15 | ||
20 | 16 | let countCommon = (1 + valueOrElse(getInteger(this, kCommon), 0)) | |
21 | 17 | ||
22 | 18 | let countLegendary = (1 + valueOrElse(getInteger(this, kLegendary), 0)) | |
23 | - | ||
24 | - | func isActive () = if (active) | |
25 | - | then unit | |
26 | - | else throw("Store is active") | |
27 | - | ||
28 | 19 | ||
29 | 20 | func randomize (bytes,range) = { | |
30 | 21 | let hash = sha256(bytes) | |
72 | 63 | func pullTheLever () = { | |
73 | 64 | let rarity = calculationRarity(i.transactionId) | |
74 | 65 | let structRare = extraCount(rarity) | |
75 | - | [structRare, ScriptTransfer(i.caller, 1, fromBase58String(getStringValue(this, ((rarity + separator) + toString(getIntegerValue(this, rarity))))))] | |
66 | + | [structRare, ScriptTransfer(i.caller, 1, fromBase58String(getStringValue(this, ((rarity + separator) + toString(valueOrElse(getIntegerValue(this, rarity), 0))))))] | |
76 | 67 | } | |
77 | 68 | ||
78 | 69 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kCommon = "common" | |
5 | 5 | ||
6 | 6 | let kRare = "rare" | |
7 | 7 | ||
8 | 8 | let kLegendary = "legendary" | |
9 | 9 | ||
10 | 10 | let kPrice = "priceLever" | |
11 | 11 | ||
12 | 12 | let separator = "|" | |
13 | 13 | ||
14 | - | let kActive = "active" | |
15 | - | ||
16 | - | let active = getBooleanValue(this, kActive) | |
17 | - | ||
18 | 14 | let countRare = (1 + valueOrElse(getInteger(this, kRare), 0)) | |
19 | 15 | ||
20 | 16 | let countCommon = (1 + valueOrElse(getInteger(this, kCommon), 0)) | |
21 | 17 | ||
22 | 18 | let countLegendary = (1 + valueOrElse(getInteger(this, kLegendary), 0)) | |
23 | - | ||
24 | - | func isActive () = if (active) | |
25 | - | then unit | |
26 | - | else throw("Store is active") | |
27 | - | ||
28 | 19 | ||
29 | 20 | func randomize (bytes,range) = { | |
30 | 21 | let hash = sha256(bytes) | |
31 | 22 | let index = toInt(hash) | |
32 | 23 | (index % range) | |
33 | 24 | } | |
34 | 25 | ||
35 | 26 | ||
36 | 27 | func extraCount (rare) = if ((rare == kCommon)) | |
37 | 28 | then IntegerEntry(kCommon, countCommon) | |
38 | 29 | else if ((rare == kRare)) | |
39 | 30 | then IntegerEntry(kRare, countCommon) | |
40 | 31 | else IntegerEntry(kLegendary, countLegendary) | |
41 | 32 | ||
42 | 33 | ||
43 | 34 | func calculationRarity (transactionId) = { | |
44 | 35 | let tokenRare = randomize(transactionId, 100) | |
45 | 36 | if ((5 >= tokenRare)) | |
46 | 37 | then kLegendary | |
47 | 38 | else if ((tokenRare >= 80)) | |
48 | 39 | then kRare | |
49 | 40 | else kCommon | |
50 | 41 | } | |
51 | 42 | ||
52 | 43 | ||
53 | 44 | @Callable(i) | |
54 | 45 | func issueNft (name,desc,rarity,prefix) = if ((i.caller != this)) | |
55 | 46 | then throw("Only owner") | |
56 | 47 | else { | |
57 | 48 | let newToken = Issue(name, desc, 1, 0, false) | |
58 | 49 | let issueId = calculateAssetId(newToken) | |
59 | 50 | [newToken] | |
60 | 51 | } | |
61 | 52 | ||
62 | 53 | ||
63 | 54 | ||
64 | 55 | @Callable(i) | |
65 | 56 | func setPrice (price) = if ((i.caller != this)) | |
66 | 57 | then throw("Only owner") | |
67 | 58 | else [StringEntry(kPrice, price)] | |
68 | 59 | ||
69 | 60 | ||
70 | 61 | ||
71 | 62 | @Callable(i) | |
72 | 63 | func pullTheLever () = { | |
73 | 64 | let rarity = calculationRarity(i.transactionId) | |
74 | 65 | let structRare = extraCount(rarity) | |
75 | - | [structRare, ScriptTransfer(i.caller, 1, fromBase58String(getStringValue(this, ((rarity + separator) + toString(getIntegerValue(this, rarity))))))] | |
66 | + | [structRare, ScriptTransfer(i.caller, 1, fromBase58String(getStringValue(this, ((rarity + separator) + toString(valueOrElse(getIntegerValue(this, rarity), 0))))))] | |
76 | 67 | } | |
77 | 68 | ||
78 | 69 |
github/deemru/w8io/026f985 25.65 ms ◑