tx · HEYUNyhNxe4BQhy8t9eWrpxxQUkPwPvUfitybtLeZLUs 3MydZBLyjvR1dzf6nzucCbpCDZgaL4zWPwg: -0.01400000 Waves 2022.01.25 12:33 [1894261] smart account 3MydZBLyjvR1dzf6nzucCbpCDZgaL4zWPwg > SELF 0.00000000 Waves
{ "type": 13, "id": "HEYUNyhNxe4BQhy8t9eWrpxxQUkPwPvUfitybtLeZLUs", "fee": 1400000, "feeAssetId": null, "timestamp": 1643103246447, "version": 2, "chainId": 84, "sender": "3MydZBLyjvR1dzf6nzucCbpCDZgaL4zWPwg", "senderPublicKey": "2STNTL69cCYwATq85AKghuBwWjSiZGJcmmmLYVW5wQbx", "proofs": [ "4hxnMMjNenDjPMZcm9mm8WGTrzETnBAB2ihc9q5E3D2hAz2XYAmSQP9ZYRZ5UwYxuWEAXd2DwP3e6iAkLCSFTG5w" ], "script": "base64:AAIFAAAAAAAAAoQIAhIDCgEIGggKAUESA3JlZhoTCgFCEg5hdmFpbGFibGVQdW5rcxoQCgFDEgt3YXZlc05lZWRlZBoRCgFEEgxmaXJzdFBheW1lbnQaFQoBRRIQZmlyc3RQYXltZW50Qm9vbBoGCgFGEgF0GgYKAUcSAXcaFwoBSBISbGlzdEF2YWlsYWJsZVB1bmtzGgkKAUkSBHJhbmQaCwoBShIGcHVua0lkGgkKAUsSBG5hbWUaCQoBTBIEbWV0YRoKCgFNEgVhc3NldBoMCgFOEgdhc3NldElkGhMKAU8SDnJlZmVyYWxBZGRyZXNzGgcKAVASAnR4GgsKAVESBnZlcmlmeRoOCgFhEgltYXhTdXBwbHkaCgoBYhIFd2F2ZXMaEQoBYxIMZ2V0UHVua0lES2V5GgcKAWQSAmlkGhIKAWUSDXRyeUdldEludGVnZXIaCAoBZhIDa2V5GggKAWcSA3ZhbBoMCgFoEgckbWF0Y2gwGgYKAWkSAWIaEQoBahIMdHJ5R2V0U3RyaW5nGhIKAWsSDXRyeUdldEFkZHJlc3MaCQoBbBIEYWRkchoGCgFtEgFhG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naHQEAAAAAU4JAAQ4AAAAAQUAAAABTQQAAAABTwkBAAAAAWsAAAABBQAAAAFBCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAAxwdW5rc19zdXBwbHkJAABkAAAAAgUAAAABegAAAAAAAAAAAQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAA9hdmFpbGFibGVfcHVua3MJAAS5AAAAAgkABFEAAAACBQAAAAFIBQAAAAFJAgAAAAEsCQAETAAAAAIFAAAAAU0JAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAAAWMAAAABBQAAAAFKCQACWAAAAAEFAAAAAU4JAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAAlgAAAABBQAAAAFOCQEAAAABYwAAAAEFAAAAAUoJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAXAAAAAGY2FsbGVyAAAAAAAAAAABBQAAAAFOCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAAU8JAABpAAAAAggFAAAAAUQAAAAGYW1vdW50AAAAAAAAAAAKBQAAAAR1bml0BQAAAANuaWwAAAABAAAAAVABAAAAAVEAAAAACQAB9AAAAAMIBQAAAAFQAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAABUAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAFQAAAAD3NlbmRlclB1YmxpY0tleR4ZqJ0=", "height": 1894261, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: J62cjciWVHfYVMB4CwL8CgUXQ5dxEJKiB4spDToivn7n Next: 9DYQvaMj2UsCahB8Yz7uv1NmxVLHxS4oGAwVVagbpXeM Diff:
Old | New | Differences | |
---|---|---|---|
113 | 113 | let listAvailablePunks = split(availablePunks, ",") | |
114 | 114 | let rand = getRandomNumber((maxSupply - totalPunksSupply), i.transactionId, height, 0) | |
115 | 115 | let punkId = listAvailablePunks[rand] | |
116 | - | let name = (" | |
116 | + | let name = ("ZombiePunk #" + punkId) | |
117 | 117 | let meta = (((((("{\"id\": " + punkId) + ", \"type\": \"") + getTypePunk(punkId)) + "\", \"url\": \"") + getURL(punkId)) + "\"}") | |
118 | 118 | let asset = Issue(name, meta, 1, 0, false, unit, height) | |
119 | 119 | let assetId = calculateAssetId(asset) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let maxSupply = 1000 | |
5 | 5 | ||
6 | 6 | let waves = 300000000 | |
7 | 7 | ||
8 | 8 | func getPunkIDKey (id) = ("punk_" + id) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func tryGetInteger (key) = { | |
12 | 12 | let val = match getInteger(this, key) { | |
13 | 13 | case b: Int => | |
14 | 14 | b | |
15 | 15 | case _ => | |
16 | 16 | 0 | |
17 | 17 | } | |
18 | 18 | val | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func tryGetString (key) = { | |
23 | 23 | let val = match getString(this, key) { | |
24 | 24 | case b: String => | |
25 | 25 | b | |
26 | 26 | case _ => | |
27 | 27 | "" | |
28 | 28 | } | |
29 | 29 | val | |
30 | 30 | } | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func tryGetAddress (addr) = { | |
34 | 34 | let val = match addressFromString(addr) { | |
35 | 35 | case a: Address => | |
36 | 36 | a | |
37 | 37 | case a: Unit => | |
38 | 38 | Address(base58'3Msrw9Kxa6RgHYQ63sSib9uESmaBU9gH6Gy') | |
39 | 39 | case _ => | |
40 | 40 | throw("Match error") | |
41 | 41 | } | |
42 | 42 | val | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getTypePunk (id) = { | |
47 | 47 | let idINT = match parseInt(id) { | |
48 | 48 | case i: Int => | |
49 | 49 | i | |
50 | 50 | case i: Unit => | |
51 | 51 | 0 | |
52 | 52 | case _ => | |
53 | 53 | throw("Match error") | |
54 | 54 | } | |
55 | 55 | if ((idINT == 0)) | |
56 | 56 | then "ultra-rare" | |
57 | 57 | else if ((40 >= idINT)) | |
58 | 58 | then "rare" | |
59 | 59 | else "unique" | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func getURL (id) = { | |
64 | 64 | let idINT = match parseInt(id) { | |
65 | 65 | case i: Int => | |
66 | 66 | i | |
67 | 67 | case i: Unit => | |
68 | 68 | 0 | |
69 | 69 | case _ => | |
70 | 70 | throw("Match error") | |
71 | 71 | } | |
72 | 72 | if ((idINT == 0)) | |
73 | 73 | then (("https://wavespunks.com/zombie/z" + id) + ".gif") | |
74 | 74 | else (("https://wavespunks.com/zombie/z" + id) + ".png") | |
75 | 75 | } | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func getRandomNumber (variants,txId,heightBlock,offset) = { | |
79 | 79 | let randomSeedBlock = value(blockInfoByHeight((heightBlock - 1))) | |
80 | 80 | let randomHash = sha256_16Kb((txId + value(randomSeedBlock.vrf))) | |
81 | 81 | (toInt(randomHash, offset) % variants) | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func calcWavesNeeded (totalPunksSupply) = if ((totalPunksSupply == 0)) | |
86 | 86 | then waves | |
87 | 87 | else (((totalPunksSupply / 200) + 1) * waves) | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | @Callable(i) | |
91 | 91 | func mint (ref) = { | |
92 | 92 | let totalPunksSupply = tryGetInteger("punks_supply") | |
93 | 93 | let availablePunks = tryGetString("available_punks") | |
94 | 94 | let wavesNeeded = calcWavesNeeded(totalPunksSupply) | |
95 | 95 | let firstPayment = value(i.payments[0]) | |
96 | 96 | let firstPaymentBool = match firstPayment.assetId { | |
97 | 97 | case t: ByteVector => | |
98 | 98 | true | |
99 | 99 | case w: Unit => | |
100 | 100 | false | |
101 | 101 | case _ => | |
102 | 102 | throw("Match error") | |
103 | 103 | } | |
104 | 104 | if ((totalPunksSupply == maxSupply)) | |
105 | 105 | then throw("All punks are minted") | |
106 | 106 | else if ((availablePunks == "")) | |
107 | 107 | then throw("No punks available") | |
108 | 108 | else if (firstPaymentBool) | |
109 | 109 | then throw("Payment must be in Waves tokens only") | |
110 | 110 | else if ((wavesNeeded > firstPayment.amount)) | |
111 | 111 | then throw("Insufficient funds") | |
112 | 112 | else { | |
113 | 113 | let listAvailablePunks = split(availablePunks, ",") | |
114 | 114 | let rand = getRandomNumber((maxSupply - totalPunksSupply), i.transactionId, height, 0) | |
115 | 115 | let punkId = listAvailablePunks[rand] | |
116 | - | let name = (" | |
116 | + | let name = ("ZombiePunk #" + punkId) | |
117 | 117 | let meta = (((((("{\"id\": " + punkId) + ", \"type\": \"") + getTypePunk(punkId)) + "\", \"url\": \"") + getURL(punkId)) + "\"}") | |
118 | 118 | let asset = Issue(name, meta, 1, 0, false, unit, height) | |
119 | 119 | let assetId = calculateAssetId(asset) | |
120 | 120 | let referalAddress = tryGetAddress(ref) | |
121 | 121 | [IntegerEntry("punks_supply", (totalPunksSupply + 1)), StringEntry("available_punks", makeString(removeByIndex(listAvailablePunks, rand), ",")), asset, StringEntry(getPunkIDKey(punkId), toBase58String(assetId)), StringEntry(toBase58String(assetId), getPunkIDKey(punkId)), ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(referalAddress, (firstPayment.amount / 10), unit)] | |
122 | 122 | } | |
123 | 123 | } | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | @Verifier(tx) | |
127 | 127 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
128 | 128 |
github/deemru/w8io/026f985 26.58 ms ◑