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