tx · H75AKw9JPm3MYhWkQoxHVis1GSMHM2FegkZpjQoxqu7i 3NCz3oCc3PNdauKDJEiPLzQwpBXXYEBc9p2: -0.00200000 Waves 2022.08.02 15:42 [2166882] smart account 3NCz3oCc3PNdauKDJEiPLzQwpBXXYEBc9p2 > SELF 0.00000000 Waves
{ "type": 13, "id": "H75AKw9JPm3MYhWkQoxHVis1GSMHM2FegkZpjQoxqu7i", "fee": 200000, "feeAssetId": null, "timestamp": 1659444136843, "version": 2, "chainId": 84, "sender": "3NCz3oCc3PNdauKDJEiPLzQwpBXXYEBc9p2", "senderPublicKey": "3rvQsNbK5fc274oTJXxit5LUfVpNUHyPrKiaJZbmJ7zx", "proofs": [ "2bBSPPcr2Sr9uS7Wmj9trw6c5PGDZUFxCZ2zMRsmdFK8u6XkNv4D4dRBhxyLJrERnMFg1yYGes2BWXqcysaeSBnM" ], "script": "base64:BgIRCAISBgoECAgICBIDCgEIEgAHAAZrUHJpY2UCCnByaWNlTGV2ZXIACXNlcGFyYXRvcgIBfAAHa0FjdGl2ZQIGYWN0aXZlAAZhY3RpdmUJARFAZXh0ck5hdGl2ZSgxMDUxKQIFBHRoaXMFB2tBY3RpdmUBCGlzQWN0aXZlAAMFBmFjdGl2ZQUEdW5pdAkAAgECD1N0b3JlIGlzIGFjdGl2ZQEJcmFuZG9taXplAgVieXRlcwVyYW5nZQQEaGFzaAkA9wMBBQVieXRlcwQFaW5kZXgJALEJAQUEaGFzaAkAagIFBWluZGV4BQVyYW5nZQERY2FsY3VsYXRpb25SYXJpdHkBDXRyYW5zYWN0aW9uSWQECXRva2VuUmFyZQkBCXJhbmRvbWl6ZQIFDXRyYW5zYWN0aW9uSWQAZAQLbnVtYmVyVG9rZW4JAQlyYW5kb21pemUCBQ10cmFuc2FjdGlvbklkAAMEBmNvbW1vbgIGY29tbW9uBARyYXJlAgRyYXJlBAlsZWdlbmRhcnkCCWxlZ2VuZGFyeQMJAGcCAAUFCXRva2VuUmFyZQkArAICCQCsAgIFCWxlZ2VuZGFyeQUJc2VwYXJhdG9yCQCkAwEFC251bWJlclRva2VuAwkAZwIFCXRva2VuUmFyZQBQCQCsAgIJAKwCAgUEcmFyZQUJc2VwYXJhdG9yCQCkAwEFC251bWJlclRva2VuCQCsAgIJAKwCAgUGY29tbW9uBQlzZXBhcmF0b3IJAKQDAQULbnVtYmVyVG9rZW4DAWkBCGlzc3VlTmZ0BARuYW1lBGRlc2MGcmFyaXR5BnByZWZpeAMJAQIhPQIIBQFpBmNhbGxlcgUEdGhpcwkAAgECCk9ubHkgb3duZXIECG5ld1Rva2VuCQDCCAUFBG5hbWUFBGRlc2MAAQAABwQHaXNzdWVJZAkAuAgBBQhuZXdUb2tlbgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgUGcmFyaXR5BQlzZXBhcmF0b3IFBnByZWZpeAkA2AQBBQdpc3N1ZUlkCQDMCAIFCG5ld1Rva2VuBQNuaWwBaQEIc2V0UHJpY2UBBXByaWNlAwkBAiE9AggFAWkGY2FsbGVyBQR0aGlzCQACAQIKT25seSBvd25lcgkAzAgCCQELU3RyaW5nRW50cnkCBQZrUHJpY2UFBXByaWNlBQNuaWwBaQEMcHVsbFRoZUxldmVyAAMJAQEhAQUGYWN0aXZlCQACAQINTm90IGFjdGl2YXRlZAQGcmFyaXR5CQERY2FsY3VsYXRpb25SYXJpdHkBCAUBaQ10cmFuc2FjdGlvbklkCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgABCQDZBAEJARFAZXh0ck5hdGl2ZSgxMDUzKQIFBHRoaXMFBnJhcml0eQUDbmlsAJZ85UI=", "height": 2166882, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 676bakyFA99q3eahNLFUsBr24aKyg4e6C1PCtzGj86h2 Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let kPrice = "priceLever" | |
5 | + | ||
6 | + | let separator = "|" | |
7 | + | ||
8 | + | let kActive = "active" | |
9 | + | ||
10 | + | let active = getBooleanValue(this, kActive) | |
11 | + | ||
12 | + | func isActive () = if (active) | |
13 | + | then unit | |
14 | + | else throw("Store is active") | |
15 | + | ||
16 | + | ||
17 | + | func randomize (bytes,range) = { | |
18 | + | let hash = sha256(bytes) | |
19 | + | let index = toInt(hash) | |
20 | + | (index % range) | |
21 | + | } | |
22 | + | ||
23 | + | ||
24 | + | func calculationRarity (transactionId) = { | |
25 | + | let tokenRare = randomize(transactionId, 100) | |
26 | + | let numberToken = randomize(transactionId, 3) | |
27 | + | let common = "common" | |
28 | + | let rare = "rare" | |
29 | + | let legendary = "legendary" | |
30 | + | if ((5 >= tokenRare)) | |
31 | + | then ((legendary + separator) + toString(numberToken)) | |
32 | + | else if ((tokenRare >= 80)) | |
33 | + | then ((rare + separator) + toString(numberToken)) | |
34 | + | else ((common + separator) + toString(numberToken)) | |
35 | + | } | |
36 | + | ||
37 | + | ||
38 | + | @Callable(i) | |
39 | + | func issueNft (name,desc,rarity,prefix) = if ((i.caller != this)) | |
40 | + | then throw("Only owner") | |
41 | + | else { | |
42 | + | let newToken = Issue(name, desc, 1, 0, false) | |
43 | + | let issueId = calculateAssetId(newToken) | |
44 | + | [StringEntry(((rarity + separator) + prefix), toBase58String(issueId)), newToken] | |
45 | + | } | |
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | @Callable(i) | |
50 | + | func setPrice (price) = if ((i.caller != this)) | |
51 | + | then throw("Only owner") | |
52 | + | else [StringEntry(kPrice, price)] | |
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | @Callable(i) | |
57 | + | func pullTheLever () = if (!(active)) | |
58 | + | then throw("Not activated") | |
59 | + | else { | |
60 | + | let rarity = calculationRarity(i.transactionId) | |
61 | + | [ScriptTransfer(i.caller, 1, fromBase58String(getStringValue(this, rarity)))] | |
62 | + | } | |
63 | + | ||
64 | + |
github/deemru/w8io/026f985 15.93 ms ◑