tx · Y16vkZYdV4YVV8hFgBXjdD9WmbemtsjUHVYuDMBAKqH 3NBnH6Dmj3qoU6dc3kTRJ73mpPeuLg3f1WV: -0.00900000 Waves 2022.08.17 19:39 [2188732] smart account 3NBnH6Dmj3qoU6dc3kTRJ73mpPeuLg3f1WV > SELF 0.00000000 Waves
{ "type": 13, "id": "Y16vkZYdV4YVV8hFgBXjdD9WmbemtsjUHVYuDMBAKqH", "fee": 900000, "feeAssetId": null, "timestamp": 1660754304812, "version": 2, "chainId": 84, "sender": "3NBnH6Dmj3qoU6dc3kTRJ73mpPeuLg3f1WV", "senderPublicKey": "E14HJsuErSNo18PaiCmFuGo8hj7ptMN6BvmGxztpHHcV", "proofs": [ "5CgKpi3jc4wkJKvHfq62cBUyNPC8kLxhsKEN5g5YSTPgsqgYP95X7731phs3LQBrzF8j2jAeWnJtoC1xpTbdhqqo" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAACgAAAAAJbWF4U3VwcGx5AAAAAAAAAAPoAAAAAAV3YXZlcwAAAAAABfXhAAEAAAAMZ2V0UHVua0lES2V5AAAAAQAAAAJpZAkAASwAAAACAgAAAAVwdW5rXwUAAAACaWQBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAADHRyeUdldFN0cmluZwAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWICAAAAAAUAAAADdmFsAQAAAAZnZXRVUkwAAAABAAAAAmlkAwkBAAAAD2NvbnRhaW5zRWxlbWVudAAAAAIJ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AGYAAAACBQAAAAlzdGFydE1pbnQIBQAAAAlsYXN0QmxvY2sAAAAJdGltZXN0YW1wCQAAAgAAAAECAAAAFU1pbnQgaGFzbmB0IHlldCBiZWd1bgMFAAAAEGZpcnN0UGF5bWVudEJvb2wJAAACAAAAAQIAAAAkUGF5bWVudCBtdXN0IGJlIGluIFdhdmVzIHRva2VucyBvbmx5AwkAAGYAAAACBQAAAAt3YXZlc05lZWRlZAgFAAAADGZpcnN0UGF5bWVudAAAAAZhbW91bnQJAAACAAAAAQIAAAASSW5zdWZmaWNpZW50IGZ1bmRzCQEAAAAFX21pbnQAAAADBQAAAAFpBQAAABB0b3RhbFB1bmtzU3VwcGx5BQAAAA5hdmFpbGFibGVQdW5rcwAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5LYqRyw==", "height": 2188732, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: iYm12vQPzSsog2wTf7qtMe7tYgETaRnpvcTRDcfnLTd Next: BHgjGV7iYXqYQvSKG81S2ork7LMukMVBT2NNRch7My1g Diff:
Old | New | Differences | |
---|---|---|---|
70 | 70 | let meta = tryGetString("collection_description") | |
71 | 71 | let asset = Issue(name, meta, 1, 0, false, unit, height) | |
72 | 72 | let assetId = calculateAssetId(asset) | |
73 | - | let tx = [IntegerEntry("punks_supply", (totalPunksSupply + 1)), StringEntry("available_punks", makeString(removeByIndex(listAvailablePunks, rand), ",")), asset, StringEntry(getPunkIDKey(punkId), toBase58String(assetId | |
73 | + | let tx = [IntegerEntry("punks_supply", (totalPunksSupply + 1)), StringEntry("available_punks", makeString(removeByIndex(listAvailablePunks, rand), ",")), asset, StringEntry(getPunkIDKey(punkId), toBase58String(assetId)), StringEntry((toBase58String(assetId) + "_type"), getTypePunk(punkId)), StringEntry((toBase58String(assetId) + "_url"), getURL(punkId)), StringEntry((toBase58String(assetId) + "_fraction"), tryGetString("fraction")), ScriptTransfer(i.caller, 1, assetId)] | |
74 | 74 | tx | |
75 | 75 | } | |
76 | 76 |
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 = 100000000 | |
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 getURL (id) = if (containsElement(split(tryGetString("gif_punk"), ","), id)) | |
34 | 34 | then (("https://mypunks.wavespunks.com/mad/m" + id) + ".gif") | |
35 | 35 | else (("https://mypunks.wavespunks.com/mad/m" + id) + ".png") | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func getTypePunk (id) = { | |
39 | 39 | let idINT = match parseInt(id) { | |
40 | 40 | case i: Int => | |
41 | 41 | i | |
42 | 42 | case i: Unit => | |
43 | 43 | 0 | |
44 | 44 | case _ => | |
45 | 45 | throw("Match error") | |
46 | 46 | } | |
47 | 47 | if (containsElement(split(tryGetString("gif_punk"), ","), toString(idINT))) | |
48 | 48 | then "ultra-rare" | |
49 | 49 | else if ((29 >= idINT)) | |
50 | 50 | then "rare" | |
51 | 51 | else "unique" | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func getRandomNumber (variants,txId,heightBlock,offset) = { | |
56 | 56 | let randomSeedBlock = value(blockInfoByHeight((heightBlock - 1))) | |
57 | 57 | let randomHash = sha256_16Kb((txId + value(randomSeedBlock.vrf))) | |
58 | 58 | (toInt(randomHash, offset) % variants) | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func calcWavesNeeded () = (waves * 6) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func _mint (i,totalPunksSupply,availablePunks) = { | |
66 | 66 | let listAvailablePunks = split(availablePunks, ",") | |
67 | 67 | let rand = getRandomNumber((maxSupply - totalPunksSupply), i.transactionId, height, 0) | |
68 | 68 | let punkId = listAvailablePunks[rand] | |
69 | 69 | let name = ("MadPunk #" + punkId) | |
70 | 70 | let meta = tryGetString("collection_description") | |
71 | 71 | let asset = Issue(name, meta, 1, 0, false, unit, height) | |
72 | 72 | let assetId = calculateAssetId(asset) | |
73 | - | let tx = [IntegerEntry("punks_supply", (totalPunksSupply + 1)), StringEntry("available_punks", makeString(removeByIndex(listAvailablePunks, rand), ",")), asset, StringEntry(getPunkIDKey(punkId), toBase58String(assetId | |
73 | + | let tx = [IntegerEntry("punks_supply", (totalPunksSupply + 1)), StringEntry("available_punks", makeString(removeByIndex(listAvailablePunks, rand), ",")), asset, StringEntry(getPunkIDKey(punkId), toBase58String(assetId)), StringEntry((toBase58String(assetId) + "_type"), getTypePunk(punkId)), StringEntry((toBase58String(assetId) + "_url"), getURL(punkId)), StringEntry((toBase58String(assetId) + "_fraction"), tryGetString("fraction")), ScriptTransfer(i.caller, 1, assetId)] | |
74 | 74 | tx | |
75 | 75 | } | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | @Callable(i) | |
79 | 79 | func mint () = { | |
80 | 80 | let totalPunksSupply = tryGetInteger("punks_supply") | |
81 | 81 | let availablePunks = tryGetString("available_punks") | |
82 | 82 | let preMintAddress = split(tryGetString("premint_address"), ",") | |
83 | 83 | let startMint = tryGetInteger("start_mint") | |
84 | 84 | let wavesNeeded = calcWavesNeeded() | |
85 | 85 | let firstPayment = value(i.payments[0]) | |
86 | 86 | let firstPaymentBool = match firstPayment.assetId { | |
87 | 87 | case t: ByteVector => | |
88 | 88 | true | |
89 | 89 | case w: Unit => | |
90 | 90 | false | |
91 | 91 | case _ => | |
92 | 92 | throw("Match error") | |
93 | 93 | } | |
94 | 94 | if ((totalPunksSupply == maxSupply)) | |
95 | 95 | then throw("All punks are minted") | |
96 | 96 | else if ((availablePunks == "")) | |
97 | 97 | then throw("No punks available") | |
98 | 98 | else if (containsElement(preMintAddress, toString(i.caller))) | |
99 | 99 | then { | |
100 | 100 | let index = match indexOf(preMintAddress, toString(i.caller)) { | |
101 | 101 | case b: Int => | |
102 | 102 | b | |
103 | 103 | case b: Unit => | |
104 | 104 | 0 | |
105 | 105 | case _ => | |
106 | 106 | throw("Match error") | |
107 | 107 | } | |
108 | 108 | let temp = (_mint(i, totalPunksSupply, availablePunks) ++ [StringEntry("premint_address", makeString(removeByIndex(preMintAddress, index), ","))]) | |
109 | 109 | temp | |
110 | 110 | } | |
111 | 111 | else if ((startMint > lastBlock.timestamp)) | |
112 | 112 | then throw("Mint hasn`t yet begun") | |
113 | 113 | else if (firstPaymentBool) | |
114 | 114 | then throw("Payment must be in Waves tokens only") | |
115 | 115 | else if ((wavesNeeded > firstPayment.amount)) | |
116 | 116 | then throw("Insufficient funds") | |
117 | 117 | else _mint(i, totalPunksSupply, availablePunks) | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | @Verifier(tx) | |
122 | 122 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
123 | 123 |
github/deemru/w8io/026f985 29.99 ms ◑