tx · 4tkabmMuPbXRwGxZceEPc2cPGyNNRAwHuuruvaQCQBMt 3Muey1cqNaBjjcxXfKHF8qqTZeyGPAsvCpP: -0.00800000 Waves 2022.08.18 20:14 [2190205] smart account 3Muey1cqNaBjjcxXfKHF8qqTZeyGPAsvCpP > SELF 0.00000000 Waves
{ "type": 13, "id": "4tkabmMuPbXRwGxZceEPc2cPGyNNRAwHuuruvaQCQBMt", "fee": 800000, "feeAssetId": null, "timestamp": 1660842850692, "version": 2, "chainId": 84, "sender": "3Muey1cqNaBjjcxXfKHF8qqTZeyGPAsvCpP", "senderPublicKey": "3bPATHM3GnqSGjJb8saHmYMvsaioqu2etEGkZDiuRCcn", "proofs": [ "4h1YzGLgtWS1gMHSk5hGK2hGTBb5LKHvSV6R7vbbQLtNEkCu5Lh5Sh7hisDsfQCbZ1FUbgEeY92XmsYdeSFx986x" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAACwAAAAAJbWF4U3VwcGx5AAAAAAAAAAPoAAAAAAV3YXZlcwAAAAAABfXhAAEAAAAMZ2V0UHVua0lES2V5AAAAAQAAAAJpZAkAASwAAAACAgAAAAVwdW5rXwUAAAACaWQBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAADXRyeUdldEJvb2xlYW4AAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGwAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAHQm9vbGVhbgQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgcFAAAAA3ZhbAEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAk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heW1lbnRCb29sCQAAAgAAAAECAAAAJFBheW1lbnQgbXVzdCBiZSBpbiBXYXZlcyB0b2tlbnMgb25seQMJAABmAAAAAgUAAAALd2F2ZXNOZWVkZWQIBQAAAAxmaXJzdFBheW1lbnQAAAAGYW1vdW50CQAAAgAAAAECAAAAEkluc3VmZmljaWVudCBmdW5kcwkBAAAABV9taW50AAAAAwUAAAABaQUAAAAQdG90YWxQdW5rc1N1cHBseQUAAAAOYXZhaWxhYmxlUHVua3MAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQEIFXw=", "height": 2190205, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4zErmhgTQAwzcg5BXwwQMWWVnkhKUX5vhBbU3fJKqCM5 Next: none Diff:
Old | New | Differences | |
---|---|---|---|
24 | 24 | ||
25 | 25 | func j (f) = { | |
26 | 26 | let g = { | |
27 | + | let h = getBoolean(this, f) | |
28 | + | if ($isInstanceOf(h, "Boolean")) | |
29 | + | then { | |
30 | + | let i = h | |
31 | + | i | |
32 | + | } | |
33 | + | else false | |
34 | + | } | |
35 | + | g | |
36 | + | } | |
37 | + | ||
38 | + | ||
39 | + | func k (f) = { | |
40 | + | let g = { | |
27 | 41 | let h = getString(this, f) | |
28 | 42 | if ($isInstanceOf(h, "String")) | |
29 | 43 | then { | |
36 | 50 | } | |
37 | 51 | ||
38 | 52 | ||
39 | - | func | |
53 | + | func l (d) = if (containsElement(split(k("gif_punk"), ","), d)) | |
40 | 54 | then (("https://mypunks.wavespunks.com/mad/m" + d) + ".gif") | |
41 | 55 | else (("https://mypunks.wavespunks.com/mad/m" + d) + ".png") | |
42 | 56 | ||
43 | 57 | ||
44 | - | func | |
45 | - | let | |
58 | + | func m (d) = { | |
59 | + | let n = { | |
46 | 60 | let h = parseInt(d) | |
47 | 61 | if ($isInstanceOf(h, "Int")) | |
48 | 62 | then { | |
49 | - | let | |
50 | - | | |
63 | + | let o = h | |
64 | + | o | |
51 | 65 | } | |
52 | 66 | else if ($isInstanceOf(h, "Unit")) | |
53 | 67 | then { | |
54 | - | let | |
68 | + | let o = h | |
55 | 69 | 0 | |
56 | 70 | } | |
57 | 71 | else throw("Match error") | |
58 | 72 | } | |
59 | - | if (containsElement(split( | |
73 | + | if (containsElement(split(k("gif_punk"), ","), toString(n))) | |
60 | 74 | then "ultra-rare" | |
61 | - | else if ((29 >= | |
75 | + | else if ((29 >= n)) | |
62 | 76 | then "rare" | |
63 | 77 | else "unique" | |
64 | 78 | } | |
65 | 79 | ||
66 | 80 | ||
67 | - | func | |
68 | - | let | |
69 | - | let | |
70 | - | (toInt( | |
81 | + | func p (q,r,s,t) = { | |
82 | + | let u = value(blockInfoByHeight((s - 1))) | |
83 | + | let v = sha256_16Kb((r + value(u.vrf))) | |
84 | + | (toInt(v, t) % q) | |
71 | 85 | } | |
72 | 86 | ||
73 | 87 | ||
74 | - | func | |
88 | + | func w () = (b * 6) | |
75 | 89 | ||
76 | 90 | ||
77 | - | func | |
78 | - | let | |
79 | - | let | |
80 | - | let | |
81 | - | let | |
82 | - | let | |
83 | - | let | |
84 | - | let | |
85 | - | let | |
86 | - | | |
91 | + | func x (o,y,z) = { | |
92 | + | let A = split(z, ",") | |
93 | + | let B = p((a - y), o.transactionId, height, 0) | |
94 | + | let C = A[B] | |
95 | + | let D = ("MadPunk #" + C) | |
96 | + | let E = k("collection_description") | |
97 | + | let F = Issue(D, E, 1, 0, false, unit, height) | |
98 | + | let G = calculateAssetId(F) | |
99 | + | let H = [IntegerEntry("punks_supply", (y + 1)), StringEntry("available_punks", makeString(removeByIndex(A, B), ",")), F, StringEntry(c(C), toBase58String(G)), StringEntry((toBase58String(G) + "_id"), c(C)), StringEntry((toBase58String(G) + "_type"), m(C)), StringEntry((toBase58String(G) + "_url"), l(C)), StringEntry((toBase58String(G) + "_fraction"), k("fraction")), ScriptTransfer(o.caller, 1, G)] | |
100 | + | H | |
87 | 101 | } | |
88 | 102 | ||
89 | 103 | ||
90 | - | @Callable( | |
104 | + | @Callable(o) | |
91 | 105 | func mint () = { | |
92 | - | let | |
93 | - | let | |
94 | - | let | |
95 | - | let | |
96 | - | let | |
97 | - | let | |
98 | - | let | |
99 | - | let h = | |
106 | + | let y = e("punks_supply") | |
107 | + | let z = k("available_punks") | |
108 | + | let I = split(k("premint_address"), ",") | |
109 | + | let J = e("start_mint") | |
110 | + | let K = w() | |
111 | + | let L = value(o.payments[0]) | |
112 | + | let M = { | |
113 | + | let h = L.assetId | |
100 | 114 | if ($isInstanceOf(h, "ByteVector")) | |
101 | 115 | then { | |
102 | - | let | |
116 | + | let N = h | |
103 | 117 | true | |
104 | 118 | } | |
105 | 119 | else if ($isInstanceOf(h, "Unit")) | |
106 | 120 | then { | |
107 | - | let | |
121 | + | let O = h | |
108 | 122 | false | |
109 | 123 | } | |
110 | 124 | else throw("Match error") | |
111 | 125 | } | |
112 | - | if (( | |
126 | + | if ((y == a)) | |
113 | 127 | then throw("All punks are minted") | |
114 | - | else if (( | |
128 | + | else if ((z == "")) | |
115 | 129 | then throw("No punks available") | |
116 | - | else if ( | |
130 | + | else if (j(toString(o.caller))) | |
117 | 131 | then { | |
118 | - | let O = { | |
119 | - | let h = indexOf(H, toString(n.caller)) | |
120 | - | if ($isInstanceOf(h, "Int")) | |
121 | - | then { | |
122 | - | let i = h | |
123 | - | i | |
124 | - | } | |
125 | - | else if ($isInstanceOf(h, "Unit")) | |
126 | - | then { | |
127 | - | let i = h | |
128 | - | 0 | |
129 | - | } | |
130 | - | else throw("Match error") | |
131 | - | } | |
132 | - | let P = (w(n, x, y) ++ [StringEntry("premint_address", makeString(removeByIndex(H, O), ","))]) | |
132 | + | let P = x(o, y, z) | |
133 | 133 | P | |
134 | 134 | } | |
135 | - | else if (( | |
135 | + | else if ((J > lastBlock.timestamp)) | |
136 | 136 | then throw("Mint hasn`t yet begun") | |
137 | - | else if ( | |
137 | + | else if (M) | |
138 | 138 | then throw("Payment must be in Waves tokens only") | |
139 | - | else if (( | |
139 | + | else if ((K > L.amount)) | |
140 | 140 | then throw("Insufficient funds") | |
141 | - | else | |
141 | + | else x(o, y, z) | |
142 | 142 | } | |
143 | 143 | ||
144 | 144 | ||
145 | - | @Verifier( | |
146 | - | func Q () = sigVerify( | |
145 | + | @Verifier(H) | |
146 | + | func Q () = sigVerify(H.bodyBytes, H.proofs[0], H.senderPublicKey) | |
147 | 147 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = 1000 | |
5 | 5 | ||
6 | 6 | let b = 100000000 | |
7 | 7 | ||
8 | 8 | func c (d) = ("punk_" + d) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func e (f) = { | |
12 | 12 | let g = { | |
13 | 13 | let h = getInteger(this, f) | |
14 | 14 | if ($isInstanceOf(h, "Int")) | |
15 | 15 | then { | |
16 | 16 | let i = h | |
17 | 17 | i | |
18 | 18 | } | |
19 | 19 | else 0 | |
20 | 20 | } | |
21 | 21 | g | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func j (f) = { | |
26 | 26 | let g = { | |
27 | + | let h = getBoolean(this, f) | |
28 | + | if ($isInstanceOf(h, "Boolean")) | |
29 | + | then { | |
30 | + | let i = h | |
31 | + | i | |
32 | + | } | |
33 | + | else false | |
34 | + | } | |
35 | + | g | |
36 | + | } | |
37 | + | ||
38 | + | ||
39 | + | func k (f) = { | |
40 | + | let g = { | |
27 | 41 | let h = getString(this, f) | |
28 | 42 | if ($isInstanceOf(h, "String")) | |
29 | 43 | then { | |
30 | 44 | let i = h | |
31 | 45 | i | |
32 | 46 | } | |
33 | 47 | else "" | |
34 | 48 | } | |
35 | 49 | g | |
36 | 50 | } | |
37 | 51 | ||
38 | 52 | ||
39 | - | func | |
53 | + | func l (d) = if (containsElement(split(k("gif_punk"), ","), d)) | |
40 | 54 | then (("https://mypunks.wavespunks.com/mad/m" + d) + ".gif") | |
41 | 55 | else (("https://mypunks.wavespunks.com/mad/m" + d) + ".png") | |
42 | 56 | ||
43 | 57 | ||
44 | - | func | |
45 | - | let | |
58 | + | func m (d) = { | |
59 | + | let n = { | |
46 | 60 | let h = parseInt(d) | |
47 | 61 | if ($isInstanceOf(h, "Int")) | |
48 | 62 | then { | |
49 | - | let | |
50 | - | | |
63 | + | let o = h | |
64 | + | o | |
51 | 65 | } | |
52 | 66 | else if ($isInstanceOf(h, "Unit")) | |
53 | 67 | then { | |
54 | - | let | |
68 | + | let o = h | |
55 | 69 | 0 | |
56 | 70 | } | |
57 | 71 | else throw("Match error") | |
58 | 72 | } | |
59 | - | if (containsElement(split( | |
73 | + | if (containsElement(split(k("gif_punk"), ","), toString(n))) | |
60 | 74 | then "ultra-rare" | |
61 | - | else if ((29 >= | |
75 | + | else if ((29 >= n)) | |
62 | 76 | then "rare" | |
63 | 77 | else "unique" | |
64 | 78 | } | |
65 | 79 | ||
66 | 80 | ||
67 | - | func | |
68 | - | let | |
69 | - | let | |
70 | - | (toInt( | |
81 | + | func p (q,r,s,t) = { | |
82 | + | let u = value(blockInfoByHeight((s - 1))) | |
83 | + | let v = sha256_16Kb((r + value(u.vrf))) | |
84 | + | (toInt(v, t) % q) | |
71 | 85 | } | |
72 | 86 | ||
73 | 87 | ||
74 | - | func | |
88 | + | func w () = (b * 6) | |
75 | 89 | ||
76 | 90 | ||
77 | - | func | |
78 | - | let | |
79 | - | let | |
80 | - | let | |
81 | - | let | |
82 | - | let | |
83 | - | let | |
84 | - | let | |
85 | - | let | |
86 | - | | |
91 | + | func x (o,y,z) = { | |
92 | + | let A = split(z, ",") | |
93 | + | let B = p((a - y), o.transactionId, height, 0) | |
94 | + | let C = A[B] | |
95 | + | let D = ("MadPunk #" + C) | |
96 | + | let E = k("collection_description") | |
97 | + | let F = Issue(D, E, 1, 0, false, unit, height) | |
98 | + | let G = calculateAssetId(F) | |
99 | + | let H = [IntegerEntry("punks_supply", (y + 1)), StringEntry("available_punks", makeString(removeByIndex(A, B), ",")), F, StringEntry(c(C), toBase58String(G)), StringEntry((toBase58String(G) + "_id"), c(C)), StringEntry((toBase58String(G) + "_type"), m(C)), StringEntry((toBase58String(G) + "_url"), l(C)), StringEntry((toBase58String(G) + "_fraction"), k("fraction")), ScriptTransfer(o.caller, 1, G)] | |
100 | + | H | |
87 | 101 | } | |
88 | 102 | ||
89 | 103 | ||
90 | - | @Callable( | |
104 | + | @Callable(o) | |
91 | 105 | func mint () = { | |
92 | - | let | |
93 | - | let | |
94 | - | let | |
95 | - | let | |
96 | - | let | |
97 | - | let | |
98 | - | let | |
99 | - | let h = | |
106 | + | let y = e("punks_supply") | |
107 | + | let z = k("available_punks") | |
108 | + | let I = split(k("premint_address"), ",") | |
109 | + | let J = e("start_mint") | |
110 | + | let K = w() | |
111 | + | let L = value(o.payments[0]) | |
112 | + | let M = { | |
113 | + | let h = L.assetId | |
100 | 114 | if ($isInstanceOf(h, "ByteVector")) | |
101 | 115 | then { | |
102 | - | let | |
116 | + | let N = h | |
103 | 117 | true | |
104 | 118 | } | |
105 | 119 | else if ($isInstanceOf(h, "Unit")) | |
106 | 120 | then { | |
107 | - | let | |
121 | + | let O = h | |
108 | 122 | false | |
109 | 123 | } | |
110 | 124 | else throw("Match error") | |
111 | 125 | } | |
112 | - | if (( | |
126 | + | if ((y == a)) | |
113 | 127 | then throw("All punks are minted") | |
114 | - | else if (( | |
128 | + | else if ((z == "")) | |
115 | 129 | then throw("No punks available") | |
116 | - | else if ( | |
130 | + | else if (j(toString(o.caller))) | |
117 | 131 | then { | |
118 | - | let O = { | |
119 | - | let h = indexOf(H, toString(n.caller)) | |
120 | - | if ($isInstanceOf(h, "Int")) | |
121 | - | then { | |
122 | - | let i = h | |
123 | - | i | |
124 | - | } | |
125 | - | else if ($isInstanceOf(h, "Unit")) | |
126 | - | then { | |
127 | - | let i = h | |
128 | - | 0 | |
129 | - | } | |
130 | - | else throw("Match error") | |
131 | - | } | |
132 | - | let P = (w(n, x, y) ++ [StringEntry("premint_address", makeString(removeByIndex(H, O), ","))]) | |
132 | + | let P = x(o, y, z) | |
133 | 133 | P | |
134 | 134 | } | |
135 | - | else if (( | |
135 | + | else if ((J > lastBlock.timestamp)) | |
136 | 136 | then throw("Mint hasn`t yet begun") | |
137 | - | else if ( | |
137 | + | else if (M) | |
138 | 138 | then throw("Payment must be in Waves tokens only") | |
139 | - | else if (( | |
139 | + | else if ((K > L.amount)) | |
140 | 140 | then throw("Insufficient funds") | |
141 | - | else | |
141 | + | else x(o, y, z) | |
142 | 142 | } | |
143 | 143 | ||
144 | 144 | ||
145 | - | @Verifier( | |
146 | - | func Q () = sigVerify( | |
145 | + | @Verifier(H) | |
146 | + | func Q () = sigVerify(H.bodyBytes, H.proofs[0], H.senderPublicKey) | |
147 | 147 |
github/deemru/w8io/169f3d6 49.59 ms ◑